diff options
-rw-r--r-- | drivers/i2c/busses/i2c-ali1535.c | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index dd364171f9c5..b6807db7b36f 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c | |||
@@ -1,23 +1,23 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (c) 2000 Frodo Looijaard <frodol@dds.nl>, | 2 | * Copyright (c) 2000 Frodo Looijaard <frodol@dds.nl>, |
3 | Philip Edelbrock <phil@netroedge.com>, | 3 | * Philip Edelbrock <phil@netroedge.com>, |
4 | Mark D. Studebaker <mdsxyz123@yahoo.com>, | 4 | * Mark D. Studebaker <mdsxyz123@yahoo.com>, |
5 | Dan Eaton <dan.eaton@rocketlogix.com> and | 5 | * Dan Eaton <dan.eaton@rocketlogix.com> and |
6 | Stephen Rousset<stephen.rousset@rocketlogix.com> | 6 | * Stephen Rousset <stephen.rousset@rocketlogix.com> |
7 | 7 | * | |
8 | This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or | 10 | * the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. | 11 | * (at your option) any later version. |
12 | 12 | * | |
13 | This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | 17 | * | |
18 | You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | /* | 23 | /* |
@@ -254,8 +254,8 @@ static int ali1535_transaction(struct i2c_adapter *adap) | |||
254 | if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) { | 254 | if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) { |
255 | /* do a clear-on-write */ | 255 | /* do a clear-on-write */ |
256 | outb_p(0xFF, SMBHSTSTS); | 256 | outb_p(0xFF, SMBHSTSTS); |
257 | if ((temp = inb_p(SMBHSTSTS)) & | 257 | temp = inb_p(SMBHSTSTS); |
258 | (ALI1535_STS_ERR | ALI1535_STS_BUSY)) { | 258 | if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) { |
259 | /* This is probably going to be correctable only by a | 259 | /* This is probably going to be correctable only by a |
260 | * power reset as one of the bits now appears to be | 260 | * power reset as one of the bits now appears to be |
261 | * stuck */ | 261 | * stuck */ |
@@ -267,9 +267,8 @@ static int ali1535_transaction(struct i2c_adapter *adap) | |||
267 | } | 267 | } |
268 | } else { | 268 | } else { |
269 | /* check and clear done bit */ | 269 | /* check and clear done bit */ |
270 | if (temp & ALI1535_STS_DONE) { | 270 | if (temp & ALI1535_STS_DONE) |
271 | outb_p(temp, SMBHSTSTS); | 271 | outb_p(temp, SMBHSTSTS); |
272 | } | ||
273 | } | 272 | } |
274 | 273 | ||
275 | /* start the transaction by writing anything to the start register */ | 274 | /* start the transaction by writing anything to the start register */ |
@@ -278,7 +277,7 @@ static int ali1535_transaction(struct i2c_adapter *adap) | |||
278 | /* We will always wait for a fraction of a second! */ | 277 | /* We will always wait for a fraction of a second! */ |
279 | timeout = 0; | 278 | timeout = 0; |
280 | do { | 279 | do { |
281 | msleep(1); | 280 | usleep_range(1000, 2000); |
282 | temp = inb_p(SMBHSTSTS); | 281 | temp = inb_p(SMBHSTSTS); |
283 | } while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE)) | 282 | } while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE)) |
284 | && (timeout++ < MAX_TIMEOUT)); | 283 | && (timeout++ < MAX_TIMEOUT)); |
@@ -325,12 +324,12 @@ static int ali1535_transaction(struct i2c_adapter *adap) | |||
325 | /* take consequent actions for error conditions */ | 324 | /* take consequent actions for error conditions */ |
326 | if (!(temp & ALI1535_STS_DONE)) { | 325 | if (!(temp & ALI1535_STS_DONE)) { |
327 | /* issue "kill" to reset host controller */ | 326 | /* issue "kill" to reset host controller */ |
328 | outb_p(ALI1535_KILL,SMBHSTTYP); | 327 | outb_p(ALI1535_KILL, SMBHSTTYP); |
329 | outb_p(0xFF,SMBHSTSTS); | 328 | outb_p(0xFF, SMBHSTSTS); |
330 | } else if (temp & ALI1535_STS_ERR) { | 329 | } else if (temp & ALI1535_STS_ERR) { |
331 | /* issue "timeout" to reset all devices on bus */ | 330 | /* issue "timeout" to reset all devices on bus */ |
332 | outb_p(ALI1535_T_OUT,SMBHSTTYP); | 331 | outb_p(ALI1535_T_OUT, SMBHSTTYP); |
333 | outb_p(0xFF,SMBHSTSTS); | 332 | outb_p(0xFF, SMBHSTSTS); |
334 | } | 333 | } |
335 | 334 | ||
336 | return result; | 335 | return result; |
@@ -351,7 +350,7 @@ static s32 ali1535_access(struct i2c_adapter *adap, u16 addr, | |||
351 | for (timeout = 0; | 350 | for (timeout = 0; |
352 | (timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE); | 351 | (timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE); |
353 | timeout++) { | 352 | timeout++) { |
354 | msleep(1); | 353 | usleep_range(1000, 2000); |
355 | temp = inb_p(SMBHSTSTS); | 354 | temp = inb_p(SMBHSTSTS); |
356 | } | 355 | } |
357 | if (timeout >= MAX_TIMEOUT) | 356 | if (timeout >= MAX_TIMEOUT) |
@@ -480,12 +479,12 @@ static struct i2c_adapter ali1535_adapter = { | |||
480 | .algo = &smbus_algorithm, | 479 | .algo = &smbus_algorithm, |
481 | }; | 480 | }; |
482 | 481 | ||
483 | static const struct pci_device_id ali1535_ids[] = { | 482 | static DEFINE_PCI_DEVICE_TABLE(ali1535_ids) = { |
484 | { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) }, | 483 | { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) }, |
485 | { }, | 484 | { }, |
486 | }; | 485 | }; |
487 | 486 | ||
488 | MODULE_DEVICE_TABLE (pci, ali1535_ids); | 487 | MODULE_DEVICE_TABLE(pci, ali1535_ids); |
489 | 488 | ||
490 | static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) | 489 | static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) |
491 | { | 490 | { |