Skip to content

Commit 0d9cf23

Browse files
mszyprowwsakernel
authored andcommitted
i2c: s3c24xx: fix read transfers in polling mode
To properly handle read transfers in polling mode, no waiting for the ACK state is needed as it will never come. Just wait a bit to ensure start state is on the bus and continue processing next bytes. Fixes: 117053f ("i2c: s3c2410: Add polling mode support") Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Chanho Park <chanho61.park@samsung.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent d0520eb commit 0d9cf23

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

drivers/i2c/busses/i2c-s3c2410.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,17 @@ static bool is_ack(struct s3c24xx_i2c *i2c)
216216
int tries;
217217

218218
for (tries = 50; tries; --tries) {
219-
if (readl(i2c->regs + S3C2410_IICCON)
220-
& S3C2410_IICCON_IRQPEND) {
219+
unsigned long tmp = readl(i2c->regs + S3C2410_IICCON);
220+
221+
if (!(tmp & S3C2410_IICCON_ACKEN)) {
222+
/*
223+
* Wait a bit for the bus to stabilize,
224+
* delay estimated experimentally.
225+
*/
226+
usleep_range(100, 200);
227+
return true;
228+
}
229+
if (tmp & S3C2410_IICCON_IRQPEND) {
221230
if (!(readl(i2c->regs + S3C2410_IICSTAT)
222231
& S3C2410_IICSTAT_LASTBIT))
223232
return true;

0 commit comments

Comments
 (0)