linux-mips
[Top] [All Lists]

[patch 2/8] au1xxx: I2C fixes

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [patch 2/8] au1xxx: I2C fixes
From: Domen Puncer <domen.puncer@ultra.si>
Date: Fri, 23 Jun 2006 11:58:58 +0200
Cc: linux-mips@linux-mips.org
In-reply-to: <20060623095703.GA30980@domen.ultra.si>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20060623095703.GA30980@domen.ultra.si>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.11+cvs20060126
- I2C fixes from Jordan Crusoe
- add SMBUS functionality flags

Signed-off-by: Domen Puncer <domen.puncer@ultra.si>

Index: linux-mailed/drivers/i2c/busses/i2c-au1550.c
===================================================================
--- linux-mailed.orig/drivers/i2c/busses/i2c-au1550.c
+++ linux-mailed/drivers/i2c/busses/i2c-au1550.c
@@ -35,7 +35,7 @@
 #include <linux/i2c.h>
 
 #include <asm/mach-au1x00/au1000.h>
-#include <asm/mach-pb1x00/pb1550.h>
+#include <asm/mach-au1x00/au1xxx.h>
 #include <asm/mach-au1x00/au1xxx_psc.h>
 
 #include "i2c-au1550.h"
@@ -118,13 +118,19 @@ do_address(struct i2c_au1550_data *adap,
 
        /* Reset the FIFOs, clear events.
        */
-       sp->psc_smbpcr = PSC_SMBPCR_DC;
+       stat = sp->psc_smbstat;
        sp->psc_smbevnt = PSC_SMBEVNT_ALLCLR;
        au_sync();
-       do {
-               stat = sp->psc_smbpcr;
+
+       if (!(stat & PSC_SMBSTAT_TE) || !(stat & PSC_SMBSTAT_RE)) {
+               sp->psc_smbpcr = PSC_SMBPCR_DC;
                au_sync();
-       } while ((stat & PSC_SMBPCR_DC) != 0);
+               do {
+                       stat = sp->psc_smbpcr;
+                       au_sync();
+               } while ((stat & PSC_SMBPCR_DC) != 0);
+               udelay(50);
+       }
 
        /* Write out the i2c chip address and specify operation
        */
@@ -279,7 +285,7 @@ au1550_xfer(struct i2c_adapter *i2c_adap
 static u32
 au1550_func(struct i2c_adapter *adap)
 {
-       return I2C_FUNC_I2C;
+       return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
 }
 
 static struct i2c_algorithm au1550_algo = {

<Prev in Thread] Current Thread [Next in Thread>