Skip to content

Commit 7fc9f68

Browse files
Wolfram Sanggregkh
authored andcommitted
i2c: rcar: slave: only send STOP event when we have been addressed
[ Upstream commit 314139f ] 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: de20d18 ("i2c: rcar: add slave support") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a504083 commit 7fc9f68

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/i2c/busses/i2c-rcar.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,13 +587,14 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
587587
rcar_i2c_write(priv, ICSIER, SDR | SSR | SAR);
588588
}
589589

590-
rcar_i2c_write(priv, ICSSR, ~SAR & 0xff);
590+
/* Clear SSR, too, because of old STOPs to other clients than us */
591+
rcar_i2c_write(priv, ICSSR, ~(SAR | SSR) & 0xff);
591592
}
592593

593594
/* master sent stop */
594595
if (ssr_filtered & SSR) {
595596
i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value);
596-
rcar_i2c_write(priv, ICSIER, SAR | SSR);
597+
rcar_i2c_write(priv, ICSIER, SAR);
597598
rcar_i2c_write(priv, ICSSR, ~SSR & 0xff);
598599
}
599600

@@ -848,7 +849,7 @@ static int rcar_reg_slave(struct i2c_client *slave)
848849
priv->slave = slave;
849850
rcar_i2c_write(priv, ICSAR, slave->addr);
850851
rcar_i2c_write(priv, ICSSR, 0);
851-
rcar_i2c_write(priv, ICSIER, SAR | SSR);
852+
rcar_i2c_write(priv, ICSIER, SAR);
852853
rcar_i2c_write(priv, ICSCR, SIE | SDBS);
853854

854855
return 0;

0 commit comments

Comments
 (0)