[PATCH 2/4] i2c: rockchip: ignore i2c transfers when another transfer is running
Gerald Loacker
gerald.loacker at wolfvision.net
Fri Sep 8 03:16:47 PDT 2023
It may happen that an i2c transfer is requested by a callback although
there is an other i2c transfer running. In this case do not interrupt the
transfer and return with an error.
Signed-off-by: Gerald Loacker <gerald.loacker at wolfvision.net>
---
drivers/i2c/busses/i2c-rockchip.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-rockchip.c b/drivers/i2c/busses/i2c-rockchip.c
index 1bca3e9913..a869b9d0b7 100644
--- a/drivers/i2c/busses/i2c-rockchip.c
+++ b/drivers/i2c/busses/i2c-rockchip.c
@@ -369,7 +369,19 @@ static int rockchip_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
{
struct rk_i2c *i2c = to_rk_i2c(adapter);
struct device *dev = &adapter->dev;
- int i, ret = 0;
+ struct i2c_regs *regs = i2c->regs;
+ int i, ret = 0, val;
+
+ val = readl(®s->con);
+ if (val & I2C_CON_EN) {
+ val = readl(®s->con);
+ if (val & I2C_IPD_ALL_CLEAN) {
+ dev_dbg(dev,
+ "i2c_xfer: %d messages dropped due to pending interrupts\n",
+ nmsgs);
+ return -EAGAIN;
+ }
+ }
dev_dbg(dev, "i2c_xfer: %d messages\n", nmsgs);
for (i = 0; i < nmsgs; i++) {
--
2.37.2
More information about the barebox
mailing list