summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Ciocaltea <cristian.ciocaltea@gmail.com>2020-10-09 00:44:39 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-14 10:31:23 +0200
commit250a51b772dbb5938f506d3385d8a0909ddf94b7 (patch)
tree597e64000de5d34ad7b7c7d5e52ee75f4df975f1
parentf1a66d5b7683464bf8f2104f830ebf87da10535e (diff)
downloadlinux-stable-250a51b772dbb5938f506d3385d8a0909ddf94b7.tar.gz
linux-stable-250a51b772dbb5938f506d3385d8a0909ddf94b7.tar.bz2
linux-stable-250a51b772dbb5938f506d3385d8a0909ddf94b7.zip
i2c: owl: Clear NACK and BUS error bits
commit f5b3f433641c543ebe5171285a42aa6adcdb2d22 upstream. When the NACK and BUS error bits are set by the hardware, the driver is responsible for clearing them by writing "1" into the corresponding status registers. Hence perform the necessary operations in owl_i2c_interrupt(). Fixes: d211e62af466 ("i2c: Add Actions Semiconductor Owl family S900 I2C driver") Reported-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com> Signed-off-by: Wolfram Sang <wsa@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/i2c/busses/i2c-owl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-owl.c b/drivers/i2c/busses/i2c-owl.c
index 96b4572e6d9c..cf3fcf35fe3d 100644
--- a/drivers/i2c/busses/i2c-owl.c
+++ b/drivers/i2c/busses/i2c-owl.c
@@ -179,6 +179,9 @@ static irqreturn_t owl_i2c_interrupt(int irq, void *_dev)
fifostat = readl(i2c_dev->base + OWL_I2C_REG_FIFOSTAT);
if (fifostat & OWL_I2C_FIFOSTAT_RNB) {
i2c_dev->err = -ENXIO;
+ /* Clear NACK error bit by writing "1" */
+ owl_i2c_update_reg(i2c_dev->base + OWL_I2C_REG_FIFOSTAT,
+ OWL_I2C_FIFOSTAT_RNB, true);
goto stop;
}
@@ -186,6 +189,9 @@ static irqreturn_t owl_i2c_interrupt(int irq, void *_dev)
stat = readl(i2c_dev->base + OWL_I2C_REG_STAT);
if (stat & OWL_I2C_STAT_BEB) {
i2c_dev->err = -EIO;
+ /* Clear BUS error bit by writing "1" */
+ owl_i2c_update_reg(i2c_dev->base + OWL_I2C_REG_STAT,
+ OWL_I2C_STAT_BEB, true);
goto stop;
}