summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2015-06-05 07:26:03 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2015-06-05 07:26:03 (GMT)
commita476a373bce39ddc8f6c7d52ae6a8cec8ca7024c (patch)
treeccc7d45c4fa1c93920d1632deff5b83f1f0924b3
parentba8554071f4b571b2ce3c84f8485eef0889544cd (diff)
downloadbspam335x-a476a373bce39ddc8f6c7d52ae6a8cec8ca7024c.zip
bspam335x-a476a373bce39ddc8f6c7d52ae6a8cec8ca7024c.tar.gz
bspam335x-a476a373bce39ddc8f6c7d52ae6a8cec8ca7024c.tar.bz2
Fixed I2C driver bug.
-rw-r--r--SylixOS/driver/i2c/am335x_i2c.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/SylixOS/driver/i2c/am335x_i2c.c b/SylixOS/driver/i2c/am335x_i2c.c
index 6432f72..d979089 100644
--- a/SylixOS/driver/i2c/am335x_i2c.c
+++ b/SylixOS/driver/i2c/am335x_i2c.c
@@ -203,24 +203,13 @@ static INT __am335xI2cTransferMsg (__PAM335X_I2C_CHANNEL pI2cChannel,
/* Generate Start Condition over I2C bus */
I2CMasterStart(pI2cChannel->I2CCHAN_ulVirtAddrBase);
- /*
- * Wait for the START to be reflected on the bus.
- * This can be checked by waiting for BUS BUSY condition set.
- */
- while (I2CMasterBusBusy(pI2cChannel->I2CCHAN_ulVirtAddrBase) == 0) {
- API_TimeSleep(LW_OPTION_WAIT_A_TICK);
- }
-
if (ERROR_NONE != API_SemaphoreBPend(pI2cChannel->I2CCHAN_hSignal, 3 * LW_OPTION_WAIT_A_SECOND)) {
printk(KERN_ERR "__am335xI2cTransferMsg(): TIMEOUT\n");
return (PX_ERROR);
}
- if (bIsLastMsg) {
- I2CMasterStop(pI2cChannel->I2CCHAN_ulVirtAddrBase);
- while (I2CMasterBusBusy(pI2cChannel->I2CCHAN_ulVirtAddrBase)) {
- API_TimeSleep(LW_OPTION_WAIT_A_TICK);
- }
+ I2CMasterStop(pI2cChannel->I2CCHAN_ulVirtAddrBase);
+ while (I2CMasterBusBusy(pI2cChannel->I2CCHAN_ulVirtAddrBase)) {
}
lib_memcpy(pI2cMsg->I2CMSG_pucBuffer, pI2cChannel->I2CCHAN_pucBuffer, pI2cMsg->I2CMSG_usLen);
@@ -270,24 +259,13 @@ static INT __am335xI2cTransferMsg (__PAM335X_I2C_CHANNEL pI2cChannel,
/* Generate Start Condition over I2C bus */
I2CMasterStart(pI2cChannel->I2CCHAN_ulVirtAddrBase);
- /*
- * Wait for the START to be reflected on the bus.
- * This can be checked by waiting for BUS BUSY condition set.
- */
- while (I2CMasterBusBusy(pI2cChannel->I2CCHAN_ulVirtAddrBase) == 0) {
- API_TimeSleep(LW_OPTION_WAIT_A_TICK);
- }
-
if (ERROR_NONE != API_SemaphoreBPend(pI2cChannel->I2CCHAN_hSignal, 3 * LW_OPTION_WAIT_A_SECOND)) {
printk(KERN_ERR "__am335xI2cTransferMsg(): TIMEOUT\n");
return (PX_ERROR);
}
- if (bIsLastMsg) {
- I2CMasterStop(pI2cChannel->I2CCHAN_ulVirtAddrBase);
- while (I2CMasterBusBusy(pI2cChannel->I2CCHAN_ulVirtAddrBase)) {
- API_TimeSleep(LW_OPTION_WAIT_A_TICK);
- }
+ I2CMasterStop(pI2cChannel->I2CCHAN_ulVirtAddrBase);
+ while (I2CMasterBusBusy(pI2cChannel->I2CCHAN_ulVirtAddrBase)) {
}
}