Commit bce989ca authored by Wolfram Sang's avatar Wolfram Sang Committed by Kelsey Skunberg

i2c: rcar: slave: only send STOP event when we have been addressed

BugLink: https://bugs.launchpad.net/bugs/1892822

[ Upstream commit 314139f9 ]

When the SSR interrupt is activated, it will detect every STOP condition
on the bus, not only the ones after we have been addressed. So, enable
this interrupt only after we have been addressed, and disable it
otherwise.

Fixes: de20d185 ("i2c: rcar: add slave support")
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKelsey Skunberg <kelsey.skunberg@canonical.com>
parent 9620b60c
...@@ -386,13 +386,14 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv) ...@@ -386,13 +386,14 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
rcar_i2c_write(priv, ICSIER, SDR | SSR | SAR); rcar_i2c_write(priv, ICSIER, SDR | SSR | SAR);
} }
rcar_i2c_write(priv, ICSSR, ~SAR & 0xff); /* Clear SSR, too, because of old STOPs to other clients than us */
rcar_i2c_write(priv, ICSSR, ~(SAR | SSR) & 0xff);
} }
/* master sent stop */ /* master sent stop */
if (ssr_filtered & SSR) { if (ssr_filtered & SSR) {
i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value); i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value);
rcar_i2c_write(priv, ICSIER, SAR | SSR); rcar_i2c_write(priv, ICSIER, SAR);
rcar_i2c_write(priv, ICSSR, ~SSR & 0xff); rcar_i2c_write(priv, ICSSR, ~SSR & 0xff);
} }
...@@ -541,7 +542,7 @@ static int rcar_reg_slave(struct i2c_client *slave) ...@@ -541,7 +542,7 @@ static int rcar_reg_slave(struct i2c_client *slave)
priv->slave = slave; priv->slave = slave;
rcar_i2c_write(priv, ICSAR, slave->addr); rcar_i2c_write(priv, ICSAR, slave->addr);
rcar_i2c_write(priv, ICSSR, 0); rcar_i2c_write(priv, ICSSR, 0);
rcar_i2c_write(priv, ICSIER, SAR | SSR); rcar_i2c_write(priv, ICSIER, SAR);
rcar_i2c_write(priv, ICSCR, SIE | SDBS); rcar_i2c_write(priv, ICSCR, SIE | SDBS);
return 0; return 0;
......
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