aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorOlivier Sobrie <olivier@sobrie.be>2012-03-26 15:47:18 -0400
committerJean Delvare <khali@endymion.delvare>2012-03-26 15:47:18 -0400
commitb3240e68c05deef2df28db9fc0eea4c277f76494 (patch)
treefabf238a44c7d49c4a4c16d83cb8e14181c9dd31 /drivers/i2c
parentc54c35572a30da2fa028c1dc045facac4ee5640a (diff)
i2c-isch: Decrease delay in command completion check loop
Generally it is not needed to wait for 1 msec, the SMBus get often ready in less than 200 usecs. msleep(1) can wait up to 20 msecs... It has a significant impact when there is a burst of transactions on the bus. Signed-off-by: Olivier Sobrie <olivier@sobrie.be> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-isch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
index 6561d275b8cf..f90a6057508d 100644
--- a/drivers/i2c/busses/i2c-isch.c
+++ b/drivers/i2c/busses/i2c-isch.c
@@ -47,7 +47,7 @@
47#define SMBBLKDAT (0x20 + sch_smba) 47#define SMBBLKDAT (0x20 + sch_smba)
48 48
49/* Other settings */ 49/* Other settings */
50#define MAX_TIMEOUT 500 50#define MAX_RETRIES 5000
51 51
52/* I2C constants */ 52/* I2C constants */
53#define SCH_QUICK 0x00 53#define SCH_QUICK 0x00
@@ -68,7 +68,7 @@ static int sch_transaction(void)
68{ 68{
69 int temp; 69 int temp;
70 int result = 0; 70 int result = 0;
71 int timeout = 0; 71 int retries = 0;
72 72
73 dev_dbg(&sch_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, " 73 dev_dbg(&sch_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
74 "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb(SMBHSTCNT), 74 "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb(SMBHSTCNT),
@@ -100,12 +100,12 @@ static int sch_transaction(void)
100 outb(inb(SMBHSTCNT) | 0x10, SMBHSTCNT); 100 outb(inb(SMBHSTCNT) | 0x10, SMBHSTCNT);
101 101
102 do { 102 do {
103 msleep(1); 103 usleep_range(100, 200);
104 temp = inb(SMBHSTSTS) & 0x0f; 104 temp = inb(SMBHSTSTS) & 0x0f;
105 } while ((temp & 0x08) && (timeout++ < MAX_TIMEOUT)); 105 } while ((temp & 0x08) && (retries++ < MAX_RETRIES));
106 106
107 /* If the SMBus is still busy, we give up */ 107 /* If the SMBus is still busy, we give up */
108 if (timeout > MAX_TIMEOUT) { 108 if (retries > MAX_RETRIES) {
109 dev_err(&sch_adapter.dev, "SMBus Timeout!\n"); 109 dev_err(&sch_adapter.dev, "SMBus Timeout!\n");
110 result = -ETIMEDOUT; 110 result = -ETIMEDOUT;
111 } 111 }