aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorAlexander Sverdlin <alexander.sverdlin@nokia.com>2015-06-09 07:10:10 -0400
committerWolfram Sang <wsa@the-dreams.de>2015-06-10 09:11:51 -0400
commit41c8d4520461b5134260f3fb9bb56c8455bad610 (patch)
treeaa03498179a2a63183908fc63833cde6dda28220 /drivers/i2c
parent72a956c556b68aa2a9c2c64f5a7b9e50f7bf67e1 (diff)
i2c: davinci: Avoid sending to own address
Sending a message to own address locks the controller up in very bizarre state, it behaves as slave even if MDR register clearly states master. The controller remains in this state until reset. To avoid unnecessary timeouts simply avoid sending to own address. The controller cannot do this any way. Also, do not enable AAS IRQ, as the slave mode is not supported by the driver and the only possibility to trigger this IRQ is to send to own address. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-davinci.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index ab341aad9038..3d3ae52b6916 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -41,8 +41,8 @@
41 41
42#define DAVINCI_I2C_TIMEOUT (1*HZ) 42#define DAVINCI_I2C_TIMEOUT (1*HZ)
43#define DAVINCI_I2C_MAX_TRIES 2 43#define DAVINCI_I2C_MAX_TRIES 2
44#define I2C_DAVINCI_INTR_ALL (DAVINCI_I2C_IMR_AAS | \ 44#define DAVINCI_I2C_OWN_ADDRESS 0x08
45 DAVINCI_I2C_IMR_SCD | \ 45#define I2C_DAVINCI_INTR_ALL (DAVINCI_I2C_IMR_SCD | \
46 DAVINCI_I2C_IMR_ARDY | \ 46 DAVINCI_I2C_IMR_ARDY | \
47 DAVINCI_I2C_IMR_NACK | \ 47 DAVINCI_I2C_IMR_NACK | \
48 DAVINCI_I2C_IMR_AL) 48 DAVINCI_I2C_IMR_AL)
@@ -233,7 +233,7 @@ static int i2c_davinci_init(struct davinci_i2c_dev *dev)
233 /* Respond at reserved "SMBus Host" slave address" (and zero); 233 /* Respond at reserved "SMBus Host" slave address" (and zero);
234 * we seem to have no option to not respond... 234 * we seem to have no option to not respond...
235 */ 235 */
236 davinci_i2c_write_reg(dev, DAVINCI_I2C_OAR_REG, 0x08); 236 davinci_i2c_write_reg(dev, DAVINCI_I2C_OAR_REG, DAVINCI_I2C_OWN_ADDRESS);
237 237
238 dev_dbg(dev->dev, "PSC = %d\n", 238 dev_dbg(dev->dev, "PSC = %d\n",
239 davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG)); 239 davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG));
@@ -386,6 +386,11 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
386 u16 w; 386 u16 w;
387 unsigned long time_left; 387 unsigned long time_left;
388 388
389 if (msg->addr == DAVINCI_I2C_OWN_ADDRESS) {
390 dev_warn(dev->dev, "transfer to own address aborted\n");
391 return -EADDRNOTAVAIL;
392 }
393
389 /* Introduce a delay, required for some boards (e.g Davinci EVM) */ 394 /* Introduce a delay, required for some boards (e.g Davinci EVM) */
390 if (pdata->bus_delay) 395 if (pdata->bus_delay)
391 udelay(pdata->bus_delay); 396 udelay(pdata->bus_delay);