Commit 41c8d452 authored by Alexander Sverdlin's avatar Alexander Sverdlin Committed by Wolfram Sang

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: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 72a956c5
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
#define DAVINCI_I2C_TIMEOUT (1*HZ) #define DAVINCI_I2C_TIMEOUT (1*HZ)
#define DAVINCI_I2C_MAX_TRIES 2 #define DAVINCI_I2C_MAX_TRIES 2
#define I2C_DAVINCI_INTR_ALL (DAVINCI_I2C_IMR_AAS | \ #define DAVINCI_I2C_OWN_ADDRESS 0x08
DAVINCI_I2C_IMR_SCD | \ #define I2C_DAVINCI_INTR_ALL (DAVINCI_I2C_IMR_SCD | \
DAVINCI_I2C_IMR_ARDY | \ DAVINCI_I2C_IMR_ARDY | \
DAVINCI_I2C_IMR_NACK | \ DAVINCI_I2C_IMR_NACK | \
DAVINCI_I2C_IMR_AL) DAVINCI_I2C_IMR_AL)
...@@ -233,7 +233,7 @@ static int i2c_davinci_init(struct davinci_i2c_dev *dev) ...@@ -233,7 +233,7 @@ static int i2c_davinci_init(struct davinci_i2c_dev *dev)
/* Respond at reserved "SMBus Host" slave address" (and zero); /* Respond at reserved "SMBus Host" slave address" (and zero);
* we seem to have no option to not respond... * we seem to have no option to not respond...
*/ */
davinci_i2c_write_reg(dev, DAVINCI_I2C_OAR_REG, 0x08); davinci_i2c_write_reg(dev, DAVINCI_I2C_OAR_REG, DAVINCI_I2C_OWN_ADDRESS);
dev_dbg(dev->dev, "PSC = %d\n", dev_dbg(dev->dev, "PSC = %d\n",
davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG)); 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,6 +386,11 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
u16 w; u16 w;
unsigned long time_left; unsigned long time_left;
if (msg->addr == DAVINCI_I2C_OWN_ADDRESS) {
dev_warn(dev->dev, "transfer to own address aborted\n");
return -EADDRNOTAVAIL;
}
/* Introduce a delay, required for some boards (e.g Davinci EVM) */ /* Introduce a delay, required for some boards (e.g Davinci EVM) */
if (pdata->bus_delay) if (pdata->bus_delay)
udelay(pdata->bus_delay); udelay(pdata->bus_delay);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment