Skip to content

Commit

Permalink
i2c: piix4: Use usleep_range()
Browse files Browse the repository at this point in the history
The piix4 i2c driver is extremely slow. Replacing msleep()
with usleep_range() increases its speed substantially.
Use sleep ranges similar to those used in the i2c-801 driver
to keep things simple.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
Guenter Roeck authored and Wolfram Sang committed Mar 2, 2018
1 parent be5b928 commit 0e89b2f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/i2c/busses/i2c-piix4.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,13 @@ static int piix4_transaction(struct i2c_adapter *piix4_adapter)

/* We will always wait for a fraction of a second! (See PIIX4 docs errata) */
if (srvrworks_csb5_delay) /* Extra delay for SERVERWORKS_CSB5 */
msleep(2);
usleep_range(2000, 2100);
else
msleep(1);
usleep_range(250, 500);

while ((++timeout < MAX_TIMEOUT) &&
((temp = inb_p(SMBHSTSTS)) & 0x01))
msleep(1);
usleep_range(250, 500);

/* If the SMBus is still busy, we give up */
if (timeout == MAX_TIMEOUT) {
Expand Down

0 comments on commit 0e89b2f

Please sign in to comment.