Skip to contentSkip to conversation

2.6 Patch for AMD MIPS Alchemy au1550 I2C interface I2C

PATCH Chris David 1 participant 1 message Oct 2, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

Please CC me on replies.

Here is a trivial patch to fix a "mis-used register" problem on the AMD MIPS Alchemy au1550 I2C interface.

In summary, The programmable serial controller seem to hang the kernel when I sent a single an 'address' byte on the I2C bus. The patch essentially uses the PSC_SMBSTAT register's TE (transmit FIFO empty) bit to check when the transmit FIFO is empty, instead of using the PSC_SMBEVNT register's TU (transmit underflow) bit. Using the TE bit fixed the hang problem.

I tested this on kernel 2.6.16, and confirmed the patch updates the 2.6.22 kernel correctly. If someone else can test this, that would be great. And I think it should be included in the kernel.

Again, please CC me on replies.

Thanks,

-Chris

---

drivers/i2c/busses/i2c-au1550.c 2007-09-26 08:43:43.000000000 -0700 renamed from drivers/i2c/busses/i2c-au1550.c 2007-09-26 08:38:45.000000000 -0700 +4 -7
diff -Naur linux-2.6.16-orig/drivers/i2c/busses/i2c-au1550.c linux-2.6.16/drivers/i2c/busses/i2c-au1550.c
@@ -61,17 +61,14 @@
 
        sp = (volatile psc_smb_t *)(adap->psc_base);
 
-       /* Wait for Tx FIFO Underflow.
+       /* Wait for Tx Buffer Empty
        */
        for (i = 0; i < adap->xfer_timeout; i++) {
-               stat = sp->psc_smbevnt;
+               stat = sp->psc_smbstat;
                au_sync();
-               if ((stat & PSC_SMBEVNT_TU) != 0) {
-                       /* Clear it.  */
-                       sp->psc_smbevnt = PSC_SMBEVNT_TU;
-                       au_sync();
+               if ((stat & PSC_SMBSTAT_TE) != 0)
                        return 0;
-               }
+
                udelay(1);
        }