diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-06 14:26:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-06 14:26:01 -0500 |
commit | 15bd1e5cb36306a015328aa1c2b6470a25153171 (patch) | |
tree | 0be8953bd75522e6d0aca7ef332cc23a179b1f04 | |
parent | beb5af4033cbeae2d50b4a6d770ab8901fd34d7a (diff) | |
parent | 681d15a0f527af7ab3a783e1037de86fbcb136ac (diff) |
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang:
"Here are two more driver bugfixes for I2C which would be good to have"
* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: cadence: Set the hardware time-out register to maximum value
i2c: davinci: generate STP always when NACK is received
-rw-r--r-- | drivers/i2c/busses/i2c-cadence.c | 11 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-davinci.c | 8 |
2 files changed, 14 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index 63f3f03ecc9b..c604f4c3ac0d 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c | |||
@@ -111,6 +111,8 @@ | |||
111 | #define CDNS_I2C_DIVA_MAX 4 | 111 | #define CDNS_I2C_DIVA_MAX 4 |
112 | #define CDNS_I2C_DIVB_MAX 64 | 112 | #define CDNS_I2C_DIVB_MAX 64 |
113 | 113 | ||
114 | #define CDNS_I2C_TIMEOUT_MAX 0xFF | ||
115 | |||
114 | #define cdns_i2c_readreg(offset) readl_relaxed(id->membase + offset) | 116 | #define cdns_i2c_readreg(offset) readl_relaxed(id->membase + offset) |
115 | #define cdns_i2c_writereg(val, offset) writel_relaxed(val, id->membase + offset) | 117 | #define cdns_i2c_writereg(val, offset) writel_relaxed(val, id->membase + offset) |
116 | 118 | ||
@@ -852,6 +854,15 @@ static int cdns_i2c_probe(struct platform_device *pdev) | |||
852 | goto err_clk_dis; | 854 | goto err_clk_dis; |
853 | } | 855 | } |
854 | 856 | ||
857 | /* | ||
858 | * Cadence I2C controller has a bug wherein it generates | ||
859 | * invalid read transaction after HW timeout in master receiver mode. | ||
860 | * HW timeout is not used by this driver and the interrupt is disabled. | ||
861 | * But the feature itself cannot be disabled. Hence maximum value | ||
862 | * is written to this register to reduce the chances of error. | ||
863 | */ | ||
864 | cdns_i2c_writereg(CDNS_I2C_TIMEOUT_MAX, CDNS_I2C_TIME_OUT_OFFSET); | ||
865 | |||
855 | dev_info(&pdev->dev, "%u kHz mmio %08lx irq %d\n", | 866 | dev_info(&pdev->dev, "%u kHz mmio %08lx irq %d\n", |
856 | id->i2c_clk / 1000, (unsigned long)r_mem->start, id->irq); | 867 | id->i2c_clk / 1000, (unsigned long)r_mem->start, id->irq); |
857 | 868 | ||
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index d15b7c9b9219..01f0cd87a4a5 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -407,11 +407,9 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) | |||
407 | if (dev->cmd_err & DAVINCI_I2C_STR_NACK) { | 407 | if (dev->cmd_err & DAVINCI_I2C_STR_NACK) { |
408 | if (msg->flags & I2C_M_IGNORE_NAK) | 408 | if (msg->flags & I2C_M_IGNORE_NAK) |
409 | return msg->len; | 409 | return msg->len; |
410 | if (stop) { | 410 | w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG); |
411 | w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG); | 411 | w |= DAVINCI_I2C_MDR_STP; |
412 | w |= DAVINCI_I2C_MDR_STP; | 412 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w); |
413 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w); | ||
414 | } | ||
415 | return -EREMOTEIO; | 413 | return -EREMOTEIO; |
416 | } | 414 | } |
417 | return -EIO; | 415 | return -EIO; |