Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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: de20d1857dd6 ("i2c: rcar: add slave support")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

authored by

Wolfram Sang and committed by
Wolfram Sang
314139f9 0c2a3493

+4 -3
+4 -3
drivers/i2c/busses/i2c-rcar.c
··· 583 583 rcar_i2c_write(priv, ICSIER, SDR | SSR | SAR); 584 584 } 585 585 586 - rcar_i2c_write(priv, ICSSR, ~SAR & 0xff); 586 + /* Clear SSR, too, because of old STOPs to other clients than us */ 587 + rcar_i2c_write(priv, ICSSR, ~(SAR | SSR) & 0xff); 587 588 } 588 589 589 590 /* master sent stop */ 590 591 if (ssr_filtered & SSR) { 591 592 i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value); 592 - rcar_i2c_write(priv, ICSIER, SAR | SSR); 593 + rcar_i2c_write(priv, ICSIER, SAR); 593 594 rcar_i2c_write(priv, ICSSR, ~SSR & 0xff); 594 595 } 595 596 ··· 854 853 priv->slave = slave; 855 854 rcar_i2c_write(priv, ICSAR, slave->addr); 856 855 rcar_i2c_write(priv, ICSSR, 0); 857 - rcar_i2c_write(priv, ICSIER, SAR | SSR); 856 + rcar_i2c_write(priv, ICSIER, SAR); 858 857 rcar_i2c_write(priv, ICSCR, SIE | SDBS); 859 858 860 859 return 0;