linux-mips
[Top] [All Lists]

[PATCH 1/2] i2c-au1550: prevent unwanted writes

To: i2c@lm-sensors.org, linux-mips@linux-mips.org
Subject: [PATCH 1/2] i2c-au1550: prevent unwanted writes
From: Manuel Lauss <mano@roarinelk.homelinux.net>
Date: Tue, 15 May 2007 20:07:12 +0200
Cc: khali@linux-fr.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.11
When the au1550 i2c driver addresses a nonexistant slave or does smbus
quick detection it returns to the upper layers without sending a proper
i2c stop condition.  This resulted in the minute register of the RTC on
my board to be overwritten with a random value on a following transfer.

Fix the driver to send a stop over the i2c bus after receiving a NACK and
probing for slaves.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>

--- a/drivers/i2c/busses/i2c-au1550.c   2007-04-26 05:08:32.000000000 +0200
+++ b/drivers/i2c/busses/i2c-au1550.c   2007-05-15 18:49:30.000000000 +0200
@@ -260,14 +260,18 @@ static int
 au1550_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num)
 {
        struct i2c_au1550_data *adap = i2c_adap->algo_data;
+       volatile psc_smb_t *sp = (volatile psc_smb_t *)(adap->psc_base);
        struct i2c_msg *p;
        int i, err = 0;
 
        for (i = 0; !err && i < num; i++) {
                p = &msgs[i];
                err = do_address(adap, p->addr, p->flags & I2C_M_RD);
-               if (err || !p->len)
+               if (err || !p->len) {
+                       sp->psc_smbtxrx = PSC_SMBTXRX_STP;
+                       wait_master_done(adap);
                        continue;
+               }
                if (p->flags & I2C_M_RD)
                        err = i2c_read(adap, p->buf, p->len);
                else

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 1/2] i2c-au1550: prevent unwanted writes, Manuel Lauss <=