1 From khali@linux-fr.org Mon Nov 19 09:45:02 2007
2 From: Jean Delvare <khali@linux-fr.org>
3 Date: Fri, 16 Nov 2007 10:24:36 +0100
4 Subject: i2c-pasemi: Fix NACK detection
6 Cc: Olof Johansson <olof@lixom.net>
7 Message-ID: <20071116102436.036f8727@hyperion.delvare>
9 From: Jean Delvare <khali@linux-fr.org>
11 patch be8a1f7cd4501c3b4b32543577a33aee6d2193ac in mainline.
13 Turns out we don't actually check the status to see if there was a
14 device out there to talk to, just if we had a timeout when doing so.
16 Add the proper check, so we don't falsly think there are devices
17 on the bus that are not there, etc.
19 Signed-off-by: Olof Johansson <olof@lixom.net>
20 Signed-off-by: Jean Delvare <khali@linux-fr.org>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
24 drivers/i2c/busses/i2c-pasemi.c | 5 +++++
25 1 file changed, 5 insertions(+)
27 --- a/drivers/i2c/busses/i2c-pasemi.c
28 +++ b/drivers/i2c/busses/i2c-pasemi.c
29 @@ -51,6 +51,7 @@ struct pasemi_smbus {
30 #define MRXFIFO_DATA_M 0x000000ff
32 #define SMSTA_XEN 0x08000000
33 +#define SMSTA_MTN 0x00200000
35 #define CTL_MRR 0x00000400
36 #define CTL_MTR 0x00000200
37 @@ -98,6 +99,10 @@ static unsigned int pasemi_smb_waitready
38 status = reg_read(smbus, REG_SMSTA);
42 + if (status & SMSTA_MTN)
46 dev_warn(&smbus->dev->dev, "Timeout, status 0x%08x\n", status);
47 reg_write(smbus, REG_SMSTA, status);