Commit 681d15a0 authored by Vishnu Motghare's avatar Vishnu Motghare Committed by Wolfram Sang

i2c: cadence: Set the hardware time-out register to maximum value

Cadence I2C controller has bug wherein it generates invalid read transactions
after timeout in master receiver mode. This driver does not use the HW
timeout and this interrupt is disabled but the feature itself cannot be
disabled. Hence, this patch writes the maximum value (0xFF) to this register.
This is one of the workarounds to this bug and it will not avoid the issue
completely but reduces the chances of error.
Signed-off-by: default avatarVishnu Motghare <vishnum@xilinx.com>
Signed-off-by: default avatarHarini Katakam <harinik@xilinx.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
parent 9ea359f7
...@@ -111,6 +111,8 @@ ...@@ -111,6 +111,8 @@
#define CDNS_I2C_DIVA_MAX 4 #define CDNS_I2C_DIVA_MAX 4
#define CDNS_I2C_DIVB_MAX 64 #define CDNS_I2C_DIVB_MAX 64
#define CDNS_I2C_TIMEOUT_MAX 0xFF
#define cdns_i2c_readreg(offset) readl_relaxed(id->membase + offset) #define cdns_i2c_readreg(offset) readl_relaxed(id->membase + offset)
#define cdns_i2c_writereg(val, offset) writel_relaxed(val, id->membase + offset) #define cdns_i2c_writereg(val, offset) writel_relaxed(val, id->membase + offset)
...@@ -852,6 +854,15 @@ static int cdns_i2c_probe(struct platform_device *pdev) ...@@ -852,6 +854,15 @@ static int cdns_i2c_probe(struct platform_device *pdev)
goto err_clk_dis; goto err_clk_dis;
} }
/*
* Cadence I2C controller has a bug wherein it generates
* invalid read transaction after HW timeout in master receiver mode.
* HW timeout is not used by this driver and the interrupt is disabled.
* But the feature itself cannot be disabled. Hence maximum value
* is written to this register to reduce the chances of error.
*/
cdns_i2c_writereg(CDNS_I2C_TIMEOUT_MAX, CDNS_I2C_TIME_OUT_OFFSET);
dev_info(&pdev->dev, "%u kHz mmio %08lx irq %d\n", dev_info(&pdev->dev, "%u kHz mmio %08lx irq %d\n",
id->i2c_clk / 1000, (unsigned long)r_mem->start, id->irq); id->i2c_clk / 1000, (unsigned long)r_mem->start, id->irq);
......
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