aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-05-05 11:27:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-05-05 11:27:14 -0400
commitf328ddc154605be11c4ca38fee6ace8adb140087 (patch)
tree53589963a1b6af22d0a26db7ab1e03dfeedb2b89 /drivers
parent80445de57764b45fc26315c19fe7dc9fc57c2c65 (diff)
parent2196d1cf4afab93fb64c2e5b417096e49b661612 (diff)
Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6: i2c-algo-pca: Let PCA9564 recover from unacked data byte (state 0x30) i2c-algo-bit: Fix timeout test i2c: Timeouts off by 1
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c2
-rw-r--r--drivers/i2c/algos/i2c-algo-pca.c11
-rw-r--r--drivers/i2c/busses/i2c-ali1535.c2
-rw-r--r--drivers/i2c/busses/i2c-ali15x3.c2
-rw-r--r--drivers/i2c/busses/i2c-amd756.c4
-rw-r--r--drivers/i2c/busses/i2c-i801.c8
-rw-r--r--drivers/i2c/busses/i2c-isch.c2
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c2
-rw-r--r--drivers/i2c/busses/i2c-sis5595.c2
-rw-r--r--drivers/i2c/busses/i2c-sis630.c2
-rw-r--r--drivers/i2c/busses/i2c-sis96x.c2
11 files changed, 25 insertions, 14 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index d420cc5f5633..e25e13980af3 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)
104 * chips may hold it low ("clock stretching") while they 104 * chips may hold it low ("clock stretching") while they
105 * are processing data internally. 105 * are processing data internally.
106 */ 106 */
107 if (time_after_eq(jiffies, start + adap->timeout)) 107 if (time_after(jiffies, start + adap->timeout))
108 return -ETIMEDOUT; 108 return -ETIMEDOUT;
109 cond_resched(); 109 cond_resched();
110 } 110 }
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
index 6318f7ddc1d4..78d42aae0089 100644
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -287,10 +287,21 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
287 287
288 case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received */ 288 case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received */
289 DEB2("NOT ACK received after data byte\n"); 289 DEB2("NOT ACK received after data byte\n");
290 pca_stop(adap);
290 goto out; 291 goto out;
291 292
292 case 0x38: /* Arbitration lost during SLA+W, SLA+R or data bytes */ 293 case 0x38: /* Arbitration lost during SLA+W, SLA+R or data bytes */
293 DEB2("Arbitration lost\n"); 294 DEB2("Arbitration lost\n");
295 /*
296 * The PCA9564 data sheet (2006-09-01) says "A
297 * START condition will be transmitted when the
298 * bus becomes free (STOP or SCL and SDA high)"
299 * when the STA bit is set (p. 11).
300 *
301 * In case this won't work, try pca_reset()
302 * instead.
303 */
304 pca_start(adap);
294 goto out; 305 goto out;
295 306
296 case 0x58: /* Data byte has been received; NOT ACK has been returned */ 307 case 0x58: /* Data byte has been received; NOT ACK has been returned */
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
index 981e080b32ae..d108450df064 100644
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -284,7 +284,7 @@ static int ali1535_transaction(struct i2c_adapter *adap)
284 && (timeout++ < MAX_TIMEOUT)); 284 && (timeout++ < MAX_TIMEOUT));
285 285
286 /* If the SMBus is still busy, we give up */ 286 /* If the SMBus is still busy, we give up */
287 if (timeout >= MAX_TIMEOUT) { 287 if (timeout > MAX_TIMEOUT) {
288 result = -ETIMEDOUT; 288 result = -ETIMEDOUT;
289 dev_err(&adap->dev, "SMBus Timeout!\n"); 289 dev_err(&adap->dev, "SMBus Timeout!\n");
290 } 290 }
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index 39066dee46e3..d627fceb790b 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -306,7 +306,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
306 && (timeout++ < MAX_TIMEOUT)); 306 && (timeout++ < MAX_TIMEOUT));
307 307
308 /* If the SMBus is still busy, we give up */ 308 /* If the SMBus is still busy, we give up */
309 if (timeout >= MAX_TIMEOUT) { 309 if (timeout > MAX_TIMEOUT) {
310 result = -ETIMEDOUT; 310 result = -ETIMEDOUT;
311 dev_err(&adap->dev, "SMBus Timeout!\n"); 311 dev_err(&adap->dev, "SMBus Timeout!\n");
312 } 312 }
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index 220f4a1eee1d..f7d6fe9c49ba 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -126,7 +126,7 @@ static int amd756_transaction(struct i2c_adapter *adap)
126 } while ((temp & (GS_HST_STS | GS_SMB_STS)) && 126 } while ((temp & (GS_HST_STS | GS_SMB_STS)) &&
127 (timeout++ < MAX_TIMEOUT)); 127 (timeout++ < MAX_TIMEOUT));
128 /* If the SMBus is still busy, we give up */ 128 /* If the SMBus is still busy, we give up */
129 if (timeout >= MAX_TIMEOUT) { 129 if (timeout > MAX_TIMEOUT) {
130 dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp); 130 dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp);
131 goto abort; 131 goto abort;
132 } 132 }
@@ -143,7 +143,7 @@ static int amd756_transaction(struct i2c_adapter *adap)
143 } while ((temp & GS_HST_STS) && (timeout++ < MAX_TIMEOUT)); 143 } while ((temp & GS_HST_STS) && (timeout++ < MAX_TIMEOUT));
144 144
145 /* If the SMBus is still busy, we give up */ 145 /* If the SMBus is still busy, we give up */
146 if (timeout >= MAX_TIMEOUT) { 146 if (timeout > MAX_TIMEOUT) {
147 dev_dbg(&adap->dev, "Completion timeout!\n"); 147 dev_dbg(&adap->dev, "Completion timeout!\n");
148 goto abort; 148 goto abort;
149 } 149 }
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 10411848fd70..9d2c5adf5d4f 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -237,7 +237,7 @@ static int i801_transaction(int xact)
237 status = inb_p(SMBHSTSTS); 237 status = inb_p(SMBHSTSTS);
238 } while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT)); 238 } while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT));
239 239
240 result = i801_check_post(status, timeout >= MAX_TIMEOUT); 240 result = i801_check_post(status, timeout > MAX_TIMEOUT);
241 if (result < 0) 241 if (result < 0)
242 return result; 242 return result;
243 243
@@ -257,9 +257,9 @@ static void i801_wait_hwpec(void)
257 } while ((!(status & SMBHSTSTS_INTR)) 257 } while ((!(status & SMBHSTSTS_INTR))
258 && (timeout++ < MAX_TIMEOUT)); 258 && (timeout++ < MAX_TIMEOUT));
259 259
260 if (timeout >= MAX_TIMEOUT) { 260 if (timeout > MAX_TIMEOUT)
261 dev_dbg(&I801_dev->dev, "PEC Timeout!\n"); 261 dev_dbg(&I801_dev->dev, "PEC Timeout!\n");
262 } 262
263 outb_p(status, SMBHSTSTS); 263 outb_p(status, SMBHSTSTS);
264} 264}
265 265
@@ -344,7 +344,7 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
344 while ((!(status & SMBHSTSTS_BYTE_DONE)) 344 while ((!(status & SMBHSTSTS_BYTE_DONE))
345 && (timeout++ < MAX_TIMEOUT)); 345 && (timeout++ < MAX_TIMEOUT));
346 346
347 result = i801_check_post(status, timeout >= MAX_TIMEOUT); 347 result = i801_check_post(status, timeout > MAX_TIMEOUT);
348 if (result < 0) 348 if (result < 0)
349 return result; 349 return result;
350 350
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
index b9c01aa90036..9f6b8e0f8632 100644
--- a/drivers/i2c/busses/i2c-isch.c
+++ b/drivers/i2c/busses/i2c-isch.c
@@ -112,7 +112,7 @@ static int sch_transaction(void)
112 } while ((temp & 0x08) && (timeout++ < MAX_TIMEOUT)); 112 } while ((temp & 0x08) && (timeout++ < MAX_TIMEOUT));
113 113
114 /* If the SMBus is still busy, we give up */ 114 /* If the SMBus is still busy, we give up */
115 if (timeout >= MAX_TIMEOUT) { 115 if (timeout > MAX_TIMEOUT) {
116 dev_err(&sch_adapter.dev, "SMBus Timeout!\n"); 116 dev_err(&sch_adapter.dev, "SMBus Timeout!\n");
117 result = -ETIMEDOUT; 117 result = -ETIMEDOUT;
118 } 118 }
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 2ff4683703a8..ec11d1c4e77b 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -173,7 +173,7 @@ static int nforce2_check_status(struct i2c_adapter *adap)
173 temp = inb_p(NVIDIA_SMB_STS); 173 temp = inb_p(NVIDIA_SMB_STS);
174 } while ((!temp) && (timeout++ < MAX_TIMEOUT)); 174 } while ((!temp) && (timeout++ < MAX_TIMEOUT));
175 175
176 if (timeout >= MAX_TIMEOUT) { 176 if (timeout > MAX_TIMEOUT) {
177 dev_dbg(&adap->dev, "SMBus Timeout!\n"); 177 dev_dbg(&adap->dev, "SMBus Timeout!\n");
178 if (smbus->can_abort) 178 if (smbus->can_abort)
179 nforce2_abort(adap); 179 nforce2_abort(adap);
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
index f320ab27da46..139f0c7f12a4 100644
--- a/drivers/i2c/busses/i2c-sis5595.c
+++ b/drivers/i2c/busses/i2c-sis5595.c
@@ -256,7 +256,7 @@ static int sis5595_transaction(struct i2c_adapter *adap)
256 } while (!(temp & 0x40) && (timeout++ < MAX_TIMEOUT)); 256 } while (!(temp & 0x40) && (timeout++ < MAX_TIMEOUT));
257 257
258 /* If the SMBus is still busy, we give up */ 258 /* If the SMBus is still busy, we give up */
259 if (timeout >= MAX_TIMEOUT) { 259 if (timeout > MAX_TIMEOUT) {
260 dev_dbg(&adap->dev, "SMBus Timeout!\n"); 260 dev_dbg(&adap->dev, "SMBus Timeout!\n");
261 result = -ETIMEDOUT; 261 result = -ETIMEDOUT;
262 } 262 }
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
index 50c3610e6028..70ca41e90e58 100644
--- a/drivers/i2c/busses/i2c-sis630.c
+++ b/drivers/i2c/busses/i2c-sis630.c
@@ -173,7 +173,7 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size)
173 } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT)); 173 } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT));
174 174
175 /* If the SMBus is still busy, we give up */ 175 /* If the SMBus is still busy, we give up */
176 if (timeout >= MAX_TIMEOUT) { 176 if (timeout > MAX_TIMEOUT) {
177 dev_dbg(&adap->dev, "SMBus Timeout!\n"); 177 dev_dbg(&adap->dev, "SMBus Timeout!\n");
178 result = -ETIMEDOUT; 178 result = -ETIMEDOUT;
179 } 179 }
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 7e1594b40579..8295885b2fdb 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -132,7 +132,7 @@ static int sis96x_transaction(int size)
132 } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT)); 132 } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT));
133 133
134 /* If the SMBus is still busy, we give up */ 134 /* If the SMBus is still busy, we give up */
135 if (timeout >= MAX_TIMEOUT) { 135 if (timeout > MAX_TIMEOUT) {
136 dev_dbg(&sis96x_adapter.dev, "SMBus Timeout! (0x%02x)\n", temp); 136 dev_dbg(&sis96x_adapter.dev, "SMBus Timeout! (0x%02x)\n", temp);
137 result = -ETIMEDOUT; 137 result = -ETIMEDOUT;
138 } 138 }