Thread (5 messages) 5 messages, 3 authors, 2012-09-14

Re: [PATCH] i2c-mpc: Wait for STOP to hit the bus

flat view

From: Tabi Timur-B04825 <hidden>
Date: 2012-09-02 02:48:10
Also in: linux-i2c

On Thu, Aug 30, 2012 at 5:40 AM, Joakim Tjernlund
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
-       mpc_i2c_stop(i2c);
+       mpc_i2c_stop(i2c); /* Initiate STOP */
+       orig_jiffies =3D jiffies;
+       /* Wait until STOP is seen, allow up to 1 s */
+       while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) {
+               if (time_after(jiffies, orig_jiffies + HZ)) {
+                       u8 status =3D readb(i2c->base + MPC_I2C_SR);
+
+                       dev_dbg(i2c->dev, "timeout\n");
+                       if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) !=
=3D 0) {
quoted hunk ↗ jump to hunk
+                               writeb(status & ~CSR_MAL,
+                                      i2c->base + MPC_I2C_SR);
+                               mpc_i2c_fixup(i2c);
+                       }
+                       return -EIO;
+               }
+               cond_resched();
+       }
Shouldn't the while-loop be inside mpc_i2c_stop() itself?

--=20
Timur Tabi
Linux kernel developer at Freescale=
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help