diff options
-rw-r--r-- | Documentation/i2c/busses/i2c-viapro | 12 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-viapro.c | 76 |
2 files changed, 43 insertions, 45 deletions
diff --git a/Documentation/i2c/busses/i2c-viapro b/Documentation/i2c/busses/i2c-viapro index 702f5ac68c09..ef0f1e94e726 100644 --- a/Documentation/i2c/busses/i2c-viapro +++ b/Documentation/i2c/busses/i2c-viapro | |||
@@ -4,17 +4,17 @@ Supported adapters: | |||
4 | * VIA Technologies, Inc. VT82C596A/B | 4 | * VIA Technologies, Inc. VT82C596A/B |
5 | Datasheet: Sometimes available at the VIA website | 5 | Datasheet: Sometimes available at the VIA website |
6 | 6 | ||
7 | * VIA Technologies, Inc. VT82C686A/B | 7 | * VIA Technologies, Inc. VT82C686A/B |
8 | Datasheet: Sometimes available at the VIA website | 8 | Datasheet: Sometimes available at the VIA website |
9 | 9 | ||
10 | * VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237 | 10 | * VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237 |
11 | Datasheet: available on request from Via | 11 | Datasheet: available on request from Via |
12 | 12 | ||
13 | Authors: | 13 | Authors: |
14 | Frodo Looijaard <frodol@dds.nl>, | 14 | Frodo Looijaard <frodol@dds.nl>, |
15 | Philip Edelbrock <phil@netroedge.com>, | 15 | Philip Edelbrock <phil@netroedge.com>, |
16 | Kyösti Mälkki <kmalkki@cc.hut.fi>, | 16 | Kyösti Mälkki <kmalkki@cc.hut.fi>, |
17 | Mark D. Studebaker <mdsxyz123@yahoo.com> | 17 | Mark D. Studebaker <mdsxyz123@yahoo.com> |
18 | 18 | ||
19 | Module Parameters | 19 | Module Parameters |
20 | ----------------- | 20 | ----------------- |
@@ -43,5 +43,3 @@ Your lspci -n listing must show one of these : | |||
43 | 43 | ||
44 | If none of these show up, you should look in the BIOS for settings like | 44 | If none of these show up, you should look in the BIOS for settings like |
45 | enable ACPI / SMBus or even USB. | 45 | enable ACPI / SMBus or even USB. |
46 | |||
47 | |||
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index 99d209e0485a..262755e1ae02 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware |
3 | monitoring | 3 | monitoring |
4 | Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, | 4 | Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, |
5 | Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>, | 5 | Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>, |
6 | Mark D. Studebaker <mdsxyz123@yahoo.com> | 6 | Mark D. Studebaker <mdsxyz123@yahoo.com> |
7 | 7 | ||
@@ -46,9 +46,9 @@ | |||
46 | 46 | ||
47 | static struct pci_dev *vt596_pdev; | 47 | static struct pci_dev *vt596_pdev; |
48 | 48 | ||
49 | #define SMBBA1 0x90 | 49 | #define SMBBA1 0x90 |
50 | #define SMBBA2 0x80 | 50 | #define SMBBA2 0x80 |
51 | #define SMBBA3 0xD0 | 51 | #define SMBBA3 0xD0 |
52 | 52 | ||
53 | /* SMBus address offsets */ | 53 | /* SMBus address offsets */ |
54 | static unsigned short vt596_smba; | 54 | static unsigned short vt596_smba; |
@@ -68,26 +68,26 @@ static unsigned short vt596_smba; | |||
68 | /* PCI Address Constants */ | 68 | /* PCI Address Constants */ |
69 | 69 | ||
70 | /* SMBus data in configuration space can be found in two places, | 70 | /* SMBus data in configuration space can be found in two places, |
71 | We try to select the better one*/ | 71 | We try to select the better one */ |
72 | 72 | ||
73 | static unsigned short smb_cf_hstcfg = 0xD2; | 73 | static unsigned short smb_cf_hstcfg = 0xD2; |
74 | 74 | ||
75 | #define SMBHSTCFG (smb_cf_hstcfg) | 75 | #define SMBHSTCFG (smb_cf_hstcfg) |
76 | #define SMBSLVC (smb_cf_hstcfg + 1) | 76 | #define SMBSLVC (smb_cf_hstcfg + 1) |
77 | #define SMBSHDW1 (smb_cf_hstcfg + 2) | 77 | #define SMBSHDW1 (smb_cf_hstcfg + 2) |
78 | #define SMBSHDW2 (smb_cf_hstcfg + 3) | 78 | #define SMBSHDW2 (smb_cf_hstcfg + 3) |
79 | #define SMBREV (smb_cf_hstcfg + 4) | 79 | #define SMBREV (smb_cf_hstcfg + 4) |
80 | 80 | ||
81 | /* Other settings */ | 81 | /* Other settings */ |
82 | #define MAX_TIMEOUT 500 | 82 | #define MAX_TIMEOUT 500 |
83 | #define ENABLE_INT9 0 | 83 | #define ENABLE_INT9 0 |
84 | 84 | ||
85 | /* VT82C596 constants */ | 85 | /* VT82C596 constants */ |
86 | #define VT596_QUICK 0x00 | 86 | #define VT596_QUICK 0x00 |
87 | #define VT596_BYTE 0x04 | 87 | #define VT596_BYTE 0x04 |
88 | #define VT596_BYTE_DATA 0x08 | 88 | #define VT596_BYTE_DATA 0x08 |
89 | #define VT596_WORD_DATA 0x0C | 89 | #define VT596_WORD_DATA 0x0C |
90 | #define VT596_BLOCK_DATA 0x14 | 90 | #define VT596_BLOCK_DATA 0x14 |
91 | 91 | ||
92 | 92 | ||
93 | /* If force is set to anything different from 0, we forcibly enable the | 93 | /* If force is set to anything different from 0, we forcibly enable the |
@@ -115,19 +115,19 @@ static int vt596_transaction(void) | |||
115 | int timeout = 0; | 115 | int timeout = 0; |
116 | 116 | ||
117 | dev_dbg(&vt596_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, " | 117 | dev_dbg(&vt596_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, " |
118 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), | 118 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), |
119 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), | 119 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), |
120 | inb_p(SMBHSTDAT1)); | 120 | inb_p(SMBHSTDAT1)); |
121 | 121 | ||
122 | /* Make sure the SMBus host is ready to start transmitting */ | 122 | /* Make sure the SMBus host is ready to start transmitting */ |
123 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { | 123 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { |
124 | dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). " | 124 | dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). " |
125 | "Resetting...\n", temp); | 125 | "Resetting...\n", temp); |
126 | 126 | ||
127 | outb_p(temp, SMBHSTSTS); | 127 | outb_p(temp, SMBHSTSTS); |
128 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { | 128 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { |
129 | dev_dbg(&vt596_adapter.dev, "Failed! (0x%02x)\n", temp); | 129 | dev_dbg(&vt596_adapter.dev, "Failed! (0x%02x)\n", temp); |
130 | 130 | ||
131 | return -1; | 131 | return -1; |
132 | } else { | 132 | } else { |
133 | dev_dbg(&vt596_adapter.dev, "Successfull!\n"); | 133 | dev_dbg(&vt596_adapter.dev, "Successfull!\n"); |
@@ -137,7 +137,7 @@ static int vt596_transaction(void) | |||
137 | /* start the transaction by setting bit 6 */ | 137 | /* start the transaction by setting bit 6 */ |
138 | outb_p(inb(SMBHSTCNT) | 0x040, SMBHSTCNT); | 138 | outb_p(inb(SMBHSTCNT) | 0x040, SMBHSTCNT); |
139 | 139 | ||
140 | /* We will always wait for a fraction of a second! | 140 | /* We will always wait for a fraction of a second! |
141 | I don't know if VIA needs this, Intel did */ | 141 | I don't know if VIA needs this, Intel did */ |
142 | do { | 142 | do { |
143 | msleep(1); | 143 | msleep(1); |
@@ -177,16 +177,16 @@ static int vt596_transaction(void) | |||
177 | 177 | ||
178 | dev_dbg(&vt596_adapter.dev, "Transaction (post): CNT=%02x, CMD=%02x, " | 178 | dev_dbg(&vt596_adapter.dev, "Transaction (post): CNT=%02x, CMD=%02x, " |
179 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), | 179 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), |
180 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), | 180 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), |
181 | inb_p(SMBHSTDAT1)); | 181 | inb_p(SMBHSTDAT1)); |
182 | 182 | ||
183 | return result; | 183 | return result; |
184 | } | 184 | } |
185 | 185 | ||
186 | /* Return -1 on error. */ | 186 | /* Return -1 on error. */ |
187 | static s32 vt596_access(struct i2c_adapter *adap, u16 addr, | 187 | static s32 vt596_access(struct i2c_adapter *adap, u16 addr, |
188 | unsigned short flags, char read_write, u8 command, | 188 | unsigned short flags, char read_write, u8 command, |
189 | int size, union i2c_smbus_data *data) | 189 | int size, union i2c_smbus_data *data) |
190 | { | 190 | { |
191 | int i, len; | 191 | int i, len; |
192 | 192 | ||
@@ -256,7 +256,7 @@ static s32 vt596_access(struct i2c_adapter *adap, u16 addr, | |||
256 | case VT596_BYTE: | 256 | case VT596_BYTE: |
257 | /* Where is the result put? I assume here it is in | 257 | /* Where is the result put? I assume here it is in |
258 | * SMBHSTDAT0 but it might just as well be in the | 258 | * SMBHSTDAT0 but it might just as well be in the |
259 | * SMBHSTCMD. No clue in the docs | 259 | * SMBHSTCMD. No clue in the docs |
260 | */ | 260 | */ |
261 | data->byte = inb_p(SMBHSTDAT0); | 261 | data->byte = inb_p(SMBHSTDAT0); |
262 | break; | 262 | break; |
@@ -302,7 +302,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
302 | { | 302 | { |
303 | unsigned char temp; | 303 | unsigned char temp; |
304 | int error = -ENODEV; | 304 | int error = -ENODEV; |
305 | 305 | ||
306 | /* Determine the address of the SMBus areas */ | 306 | /* Determine the address of the SMBus areas */ |
307 | if (force_addr) { | 307 | if (force_addr) { |
308 | vt596_smba = force_addr & 0xfff0; | 308 | vt596_smba = force_addr & 0xfff0; |
@@ -333,10 +333,10 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
333 | return -ENODEV; | 333 | return -ENODEV; |
334 | } | 334 | } |
335 | 335 | ||
336 | found: | 336 | found: |
337 | if (!request_region(vt596_smba, 8, "viapro-smbus")) { | 337 | if (!request_region(vt596_smba, 8, "viapro-smbus")) { |
338 | dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n", | 338 | dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n", |
339 | vt596_smba); | 339 | vt596_smba); |
340 | return -ENODEV; | 340 | return -ENODEV; |
341 | } | 341 | } |
342 | 342 | ||
@@ -348,13 +348,13 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
348 | pci_write_config_word(pdev, id->driver_data, vt596_smba); | 348 | pci_write_config_word(pdev, id->driver_data, vt596_smba); |
349 | pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01); | 349 | pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01); |
350 | dev_warn(&pdev->dev, "WARNING: SMBus interface set to new " | 350 | dev_warn(&pdev->dev, "WARNING: SMBus interface set to new " |
351 | "address 0x%04x!\n", vt596_smba); | 351 | "address 0x%04x!\n", vt596_smba); |
352 | } else if ((temp & 1) == 0) { | 352 | } else if ((temp & 1) == 0) { |
353 | if (force) { | 353 | if (force) { |
354 | /* NOTE: This assumes I/O space and other allocations | 354 | /* NOTE: This assumes I/O space and other allocations |
355 | * WERE done by the Bios! Don't complain if your | 355 | * WERE done by the Bios! Don't complain if your |
356 | * hardware does weird things after enabling this. | 356 | * hardware does weird things after enabling this. |
357 | * :') Check for Bios updates before resorting to | 357 | * :') Check for Bios updates before resorting to |
358 | * this. | 358 | * this. |
359 | */ | 359 | */ |
360 | pci_write_config_byte(pdev, SMBHSTCFG, temp | 1); | 360 | pci_write_config_byte(pdev, SMBHSTCFG, temp | 1); |
@@ -381,8 +381,8 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
381 | 381 | ||
382 | vt596_adapter.dev.parent = &pdev->dev; | 382 | vt596_adapter.dev.parent = &pdev->dev; |
383 | snprintf(vt596_adapter.name, I2C_NAME_SIZE, | 383 | snprintf(vt596_adapter.name, I2C_NAME_SIZE, |
384 | "SMBus Via Pro adapter at %04x", vt596_smba); | 384 | "SMBus Via Pro adapter at %04x", vt596_smba); |
385 | 385 | ||
386 | vt596_pdev = pci_dev_get(pdev); | 386 | vt596_pdev = pci_dev_get(pdev); |
387 | if (i2c_add_adapter(&vt596_adapter)) { | 387 | if (i2c_add_adapter(&vt596_adapter)) { |
388 | pci_dev_put(vt596_pdev); | 388 | pci_dev_put(vt596_pdev); |
@@ -395,7 +395,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
395 | */ | 395 | */ |
396 | return -ENODEV; | 396 | return -ENODEV; |
397 | 397 | ||
398 | release_region: | 398 | release_region: |
399 | release_region(vt596_smba, 8); | 399 | release_region(vt596_smba, 8); |
400 | return error; | 400 | return error; |
401 | } | 401 | } |
@@ -420,7 +420,7 @@ static struct pci_device_id vt596_ids[] = { | |||
420 | { 0, } | 420 | { 0, } |
421 | }; | 421 | }; |
422 | 422 | ||
423 | MODULE_DEVICE_TABLE (pci, vt596_ids); | 423 | MODULE_DEVICE_TABLE(pci, vt596_ids); |
424 | 424 | ||
425 | static struct pci_driver vt596_driver = { | 425 | static struct pci_driver vt596_driver = { |
426 | .name = "vt596_smbus", | 426 | .name = "vt596_smbus", |