diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-02-14 01:02:32 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-02-14 01:02:32 -0500 |
commit | ac98695d6c1508b724f246f38ce57fb4e3cec356 (patch) | |
tree | 189969a3689b9b83eaf39314a7942cc781ff836b /drivers/i2c/busses | |
parent | d9bc125caf592b7d081021f32ce5b717efdf70c8 (diff) | |
parent | 93bbad8fe13a25dcf7f3bc628a71d1a7642ae61b (diff) |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Diffstat (limited to 'drivers/i2c/busses')
27 files changed, 554 insertions, 66 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 9367c4cfe936..4d44a2db29dd 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -183,6 +183,7 @@ config I2C_PIIX4 | |||
183 | ATI IXP200 | 183 | ATI IXP200 |
184 | ATI IXP300 | 184 | ATI IXP300 |
185 | ATI IXP400 | 185 | ATI IXP400 |
186 | ATI SB600 | ||
186 | Serverworks OSB4 | 187 | Serverworks OSB4 |
187 | Serverworks CSB5 | 188 | Serverworks CSB5 |
188 | Serverworks CSB6 | 189 | Serverworks CSB6 |
@@ -341,6 +342,13 @@ config I2C_PARPORT_LIGHT | |||
341 | This support is also available as a module. If so, the module | 342 | This support is also available as a module. If so, the module |
342 | will be called i2c-parport-light. | 343 | will be called i2c-parport-light. |
343 | 344 | ||
345 | config I2C_PASEMI | ||
346 | tristate "PA Semi SMBus interface" | ||
347 | # depends on PPC_PASEMI && I2C && PCI | ||
348 | depends on I2C && PCI | ||
349 | help | ||
350 | Supports the PA Semi PWRficient on-chip SMBus interfaces. | ||
351 | |||
344 | config I2C_PROSAVAGE | 352 | config I2C_PROSAVAGE |
345 | tristate "S3/VIA (Pro)Savage" | 353 | tristate "S3/VIA (Pro)Savage" |
346 | depends on I2C && PCI | 354 | depends on I2C && PCI |
@@ -499,11 +507,11 @@ config I2C_VIA | |||
499 | will be called i2c-via. | 507 | will be called i2c-via. |
500 | 508 | ||
501 | config I2C_VIAPRO | 509 | config I2C_VIAPRO |
502 | tristate "VIA 82C596/82C686/82xx" | 510 | tristate "VIA VT82C596/82C686/82xx and CX700" |
503 | depends on I2C && PCI | 511 | depends on I2C && PCI |
504 | help | 512 | help |
505 | If you say yes to this option, support will be included for the VIA | 513 | If you say yes to this option, support will be included for the VIA |
506 | 82C596/82C686/82xx I2C interfaces. Specifically, the following | 514 | VT82C596 and later SMBus interface. Specifically, the following |
507 | chipsets are supported: | 515 | chipsets are supported: |
508 | VT82C596A/B | 516 | VT82C596A/B |
509 | VT82C686A/B | 517 | VT82C686A/B |
@@ -512,6 +520,7 @@ config I2C_VIAPRO | |||
512 | VT8235 | 520 | VT8235 |
513 | VT8237R/A | 521 | VT8237R/A |
514 | VT8251 | 522 | VT8251 |
523 | CX700 | ||
515 | 524 | ||
516 | This driver can also be built as a module. If so, the module | 525 | This driver can also be built as a module. If so, the module |
517 | will be called i2c-viapro. | 526 | will be called i2c-viapro. |
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 37196c1d0794..03505aa44bbf 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -27,6 +27,7 @@ obj-$(CONFIG_I2C_OCORES) += i2c-ocores.o | |||
27 | obj-$(CONFIG_I2C_OMAP) += i2c-omap.o | 27 | obj-$(CONFIG_I2C_OMAP) += i2c-omap.o |
28 | obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o | 28 | obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o |
29 | obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o | 29 | obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o |
30 | obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi.o | ||
30 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o | 31 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o |
31 | obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o | 32 | obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o |
32 | obj-$(CONFIG_I2C_PNX) += i2c-pnx.o | 33 | obj-$(CONFIG_I2C_PNX) += i2c-pnx.o |
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index e75d339a3481..0b0a87b8d107 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c | |||
@@ -475,6 +475,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
475 | 475 | ||
476 | static struct i2c_adapter ali1535_adapter = { | 476 | static struct i2c_adapter ali1535_adapter = { |
477 | .owner = THIS_MODULE, | 477 | .owner = THIS_MODULE, |
478 | .id = I2C_HW_SMBUS_ALI1535, | ||
478 | .class = I2C_CLASS_HWMON, | 479 | .class = I2C_CLASS_HWMON, |
479 | .algo = &smbus_algorithm, | 480 | .algo = &smbus_algorithm, |
480 | }; | 481 | }; |
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c index 8e1e3f8e40a4..6b68074e518a 100644 --- a/drivers/i2c/busses/i2c-ali1563.c +++ b/drivers/i2c/busses/i2c-ali1563.c | |||
@@ -314,35 +314,11 @@ static u32 ali1563_func(struct i2c_adapter * a) | |||
314 | } | 314 | } |
315 | 315 | ||
316 | 316 | ||
317 | static void ali1563_enable(struct pci_dev * dev) | ||
318 | { | ||
319 | u16 ctrl; | ||
320 | |||
321 | pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); | ||
322 | ctrl |= 0x7; | ||
323 | pci_write_config_word(dev,ALI1563_SMBBA,ctrl); | ||
324 | } | ||
325 | |||
326 | static int __devinit ali1563_setup(struct pci_dev * dev) | 317 | static int __devinit ali1563_setup(struct pci_dev * dev) |
327 | { | 318 | { |
328 | u16 ctrl; | 319 | u16 ctrl; |
329 | 320 | ||
330 | pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); | 321 | pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); |
331 | printk("ali1563: SMBus control = %04x\n",ctrl); | ||
332 | |||
333 | /* Check if device is even enabled first */ | ||
334 | if (!(ctrl & ALI1563_SMB_IOEN)) { | ||
335 | dev_warn(&dev->dev,"I/O space not enabled, trying manually\n"); | ||
336 | ali1563_enable(dev); | ||
337 | } | ||
338 | if (!(ctrl & ALI1563_SMB_IOEN)) { | ||
339 | dev_warn(&dev->dev,"I/O space still not enabled, giving up\n"); | ||
340 | goto Err; | ||
341 | } | ||
342 | if (!(ctrl & ALI1563_SMB_HOSTEN)) { | ||
343 | dev_warn(&dev->dev,"Host Controller not enabled\n"); | ||
344 | goto Err; | ||
345 | } | ||
346 | 322 | ||
347 | /* SMB I/O Base in high 12 bits and must be aligned with the | 323 | /* SMB I/O Base in high 12 bits and must be aligned with the |
348 | * size of the I/O space. */ | 324 | * size of the I/O space. */ |
@@ -351,11 +327,31 @@ static int __devinit ali1563_setup(struct pci_dev * dev) | |||
351 | dev_warn(&dev->dev,"ali1563_smba Uninitialized\n"); | 327 | dev_warn(&dev->dev,"ali1563_smba Uninitialized\n"); |
352 | goto Err; | 328 | goto Err; |
353 | } | 329 | } |
330 | |||
331 | /* Check if device is enabled */ | ||
332 | if (!(ctrl & ALI1563_SMB_HOSTEN)) { | ||
333 | dev_warn(&dev->dev, "Host Controller not enabled\n"); | ||
334 | goto Err; | ||
335 | } | ||
336 | if (!(ctrl & ALI1563_SMB_IOEN)) { | ||
337 | dev_warn(&dev->dev, "I/O space not enabled, trying manually\n"); | ||
338 | pci_write_config_word(dev, ALI1563_SMBBA, | ||
339 | ctrl | ALI1563_SMB_IOEN); | ||
340 | pci_read_config_word(dev, ALI1563_SMBBA, &ctrl); | ||
341 | if (!(ctrl & ALI1563_SMB_IOEN)) { | ||
342 | dev_err(&dev->dev, "I/O space still not enabled, " | ||
343 | "giving up\n"); | ||
344 | goto Err; | ||
345 | } | ||
346 | } | ||
347 | |||
354 | if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE, | 348 | if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE, |
355 | ali1563_pci_driver.name)) { | 349 | ali1563_pci_driver.name)) { |
356 | dev_warn(&dev->dev,"Could not allocate I/O space"); | 350 | dev_err(&dev->dev, "Could not allocate I/O space at 0x%04x\n", |
351 | ali1563_smba); | ||
357 | goto Err; | 352 | goto Err; |
358 | } | 353 | } |
354 | dev_info(&dev->dev, "Found ALi1563 SMBus at 0x%04x\n", ali1563_smba); | ||
359 | 355 | ||
360 | return 0; | 356 | return 0; |
361 | Err: | 357 | Err: |
@@ -374,6 +370,7 @@ static const struct i2c_algorithm ali1563_algorithm = { | |||
374 | 370 | ||
375 | static struct i2c_adapter ali1563_adapter = { | 371 | static struct i2c_adapter ali1563_adapter = { |
376 | .owner = THIS_MODULE, | 372 | .owner = THIS_MODULE, |
373 | .id = I2C_HW_SMBUS_ALI1563, | ||
377 | .class = I2C_CLASS_HWMON, | 374 | .class = I2C_CLASS_HWMON, |
378 | .algo = &ali1563_algorithm, | 375 | .algo = &ali1563_algorithm, |
379 | }; | 376 | }; |
@@ -384,13 +381,18 @@ static int __devinit ali1563_probe(struct pci_dev * dev, | |||
384 | int error; | 381 | int error; |
385 | 382 | ||
386 | if ((error = ali1563_setup(dev))) | 383 | if ((error = ali1563_setup(dev))) |
387 | return error; | 384 | goto exit; |
388 | ali1563_adapter.dev.parent = &dev->dev; | 385 | ali1563_adapter.dev.parent = &dev->dev; |
389 | sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x", | 386 | sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x", |
390 | ali1563_smba); | 387 | ali1563_smba); |
391 | if ((error = i2c_add_adapter(&ali1563_adapter))) | 388 | if ((error = i2c_add_adapter(&ali1563_adapter))) |
392 | ali1563_shutdown(dev); | 389 | goto exit_shutdown; |
393 | printk("%s: Returning %d\n",__FUNCTION__,error); | 390 | return 0; |
391 | |||
392 | exit_shutdown: | ||
393 | ali1563_shutdown(dev); | ||
394 | exit: | ||
395 | dev_warn(&dev->dev, "ALi1563 SMBus probe failed (%d)\n", error); | ||
394 | return error; | 396 | return error; |
395 | } | 397 | } |
396 | 398 | ||
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index 3f11b6e1a341..c537441ac038 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c | |||
@@ -470,6 +470,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
470 | 470 | ||
471 | static struct i2c_adapter ali15x3_adapter = { | 471 | static struct i2c_adapter ali15x3_adapter = { |
472 | .owner = THIS_MODULE, | 472 | .owner = THIS_MODULE, |
473 | .id = I2C_HW_SMBUS_ALI15X3, | ||
473 | .class = I2C_CLASS_HWMON, | 474 | .class = I2C_CLASS_HWMON, |
474 | .algo = &smbus_algorithm, | 475 | .algo = &smbus_algorithm, |
475 | }; | 476 | }; |
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c index 08e915730caf..e5e96c817566 100644 --- a/drivers/i2c/busses/i2c-amd756-s4882.c +++ b/drivers/i2c/busses/i2c-amd756-s4882.c | |||
@@ -184,12 +184,14 @@ static int __init amd756_s4882_init(void) | |||
184 | s4882_algo[0].smbus_xfer = amd756_access_virt0; | 184 | s4882_algo[0].smbus_xfer = amd756_access_virt0; |
185 | s4882_adapter[0] = amd756_smbus; | 185 | s4882_adapter[0] = amd756_smbus; |
186 | s4882_adapter[0].algo = s4882_algo; | 186 | s4882_adapter[0].algo = s4882_algo; |
187 | s4882_adapter[0].dev.parent = amd756_smbus.dev.parent; | ||
187 | for (i = 1; i < 5; i++) { | 188 | for (i = 1; i < 5; i++) { |
188 | s4882_algo[i] = *(amd756_smbus.algo); | 189 | s4882_algo[i] = *(amd756_smbus.algo); |
189 | s4882_adapter[i] = amd756_smbus; | 190 | s4882_adapter[i] = amd756_smbus; |
190 | sprintf(s4882_adapter[i].name, | 191 | sprintf(s4882_adapter[i].name, |
191 | "SMBus 8111 adapter (CPU%d)", i-1); | 192 | "SMBus 8111 adapter (CPU%d)", i-1); |
192 | s4882_adapter[i].algo = s4882_algo+i; | 193 | s4882_adapter[i].algo = s4882_algo+i; |
194 | s4882_adapter[i].dev.parent = amd756_smbus.dev.parent; | ||
193 | } | 195 | } |
194 | s4882_algo[1].smbus_xfer = amd756_access_virt1; | 196 | s4882_algo[1].smbus_xfer = amd756_access_virt1; |
195 | s4882_algo[2].smbus_xfer = amd756_access_virt2; | 197 | s4882_algo[2].smbus_xfer = amd756_access_virt2; |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 2d21afdc5b1c..91fbc0ee439c 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -301,6 +301,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
301 | 301 | ||
302 | struct i2c_adapter amd756_smbus = { | 302 | struct i2c_adapter amd756_smbus = { |
303 | .owner = THIS_MODULE, | 303 | .owner = THIS_MODULE, |
304 | .id = I2C_HW_SMBUS_AMD756, | ||
304 | .class = I2C_CLASS_HWMON, | 305 | .class = I2C_CLASS_HWMON, |
305 | .algo = &smbus_algorithm, | 306 | .algo = &smbus_algorithm, |
306 | }; | 307 | }; |
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index 0fbc7186c91a..14ad9912f204 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c | |||
@@ -76,7 +76,8 @@ static unsigned int amd_ec_wait_write(struct amd_smbus *smbus) | |||
76 | udelay(1); | 76 | udelay(1); |
77 | 77 | ||
78 | if (!timeout) { | 78 | if (!timeout) { |
79 | dev_warn(&smbus->dev->dev, "Timeout while waiting for IBF to clear\n"); | 79 | dev_warn(&smbus->dev->dev, |
80 | "Timeout while waiting for IBF to clear\n"); | ||
80 | return -1; | 81 | return -1; |
81 | } | 82 | } |
82 | 83 | ||
@@ -91,14 +92,16 @@ static unsigned int amd_ec_wait_read(struct amd_smbus *smbus) | |||
91 | udelay(1); | 92 | udelay(1); |
92 | 93 | ||
93 | if (!timeout) { | 94 | if (!timeout) { |
94 | dev_warn(&smbus->dev->dev, "Timeout while waiting for OBF to set\n"); | 95 | dev_warn(&smbus->dev->dev, |
96 | "Timeout while waiting for OBF to set\n"); | ||
95 | return -1; | 97 | return -1; |
96 | } | 98 | } |
97 | 99 | ||
98 | return 0; | 100 | return 0; |
99 | } | 101 | } |
100 | 102 | ||
101 | static unsigned int amd_ec_read(struct amd_smbus *smbus, unsigned char address, unsigned char *data) | 103 | static unsigned int amd_ec_read(struct amd_smbus *smbus, unsigned char address, |
104 | unsigned char *data) | ||
102 | { | 105 | { |
103 | if (amd_ec_wait_write(smbus)) | 106 | if (amd_ec_wait_write(smbus)) |
104 | return -1; | 107 | return -1; |
@@ -115,7 +118,8 @@ static unsigned int amd_ec_read(struct amd_smbus *smbus, unsigned char address, | |||
115 | return 0; | 118 | return 0; |
116 | } | 119 | } |
117 | 120 | ||
118 | static unsigned int amd_ec_write(struct amd_smbus *smbus, unsigned char address, unsigned char data) | 121 | static unsigned int amd_ec_write(struct amd_smbus *smbus, unsigned char address, |
122 | unsigned char data) | ||
119 | { | 123 | { |
120 | if (amd_ec_wait_write(smbus)) | 124 | if (amd_ec_wait_write(smbus)) |
121 | return -1; | 125 | return -1; |
@@ -175,18 +179,19 @@ static unsigned int amd_ec_write(struct amd_smbus *smbus, unsigned char address, | |||
175 | #define AMD_SMB_PRTCL_PEC 0x80 | 179 | #define AMD_SMB_PRTCL_PEC 0x80 |
176 | 180 | ||
177 | 181 | ||
178 | static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, | 182 | static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, |
179 | char read_write, u8 command, int size, union i2c_smbus_data * data) | 183 | unsigned short flags, char read_write, u8 command, int size, |
184 | union i2c_smbus_data * data) | ||
180 | { | 185 | { |
181 | struct amd_smbus *smbus = adap->algo_data; | 186 | struct amd_smbus *smbus = adap->algo_data; |
182 | unsigned char protocol, len, pec, temp[2]; | 187 | unsigned char protocol, len, pec, temp[2]; |
183 | int i; | 188 | int i; |
184 | 189 | ||
185 | protocol = (read_write == I2C_SMBUS_READ) ? AMD_SMB_PRTCL_READ : AMD_SMB_PRTCL_WRITE; | 190 | protocol = (read_write == I2C_SMBUS_READ) ? AMD_SMB_PRTCL_READ |
191 | : AMD_SMB_PRTCL_WRITE; | ||
186 | pec = (flags & I2C_CLIENT_PEC) ? AMD_SMB_PRTCL_PEC : 0; | 192 | pec = (flags & I2C_CLIENT_PEC) ? AMD_SMB_PRTCL_PEC : 0; |
187 | 193 | ||
188 | switch (size) { | 194 | switch (size) { |
189 | |||
190 | case I2C_SMBUS_QUICK: | 195 | case I2C_SMBUS_QUICK: |
191 | protocol |= AMD_SMB_PRTCL_QUICK; | 196 | protocol |= AMD_SMB_PRTCL_QUICK; |
192 | read_write = I2C_SMBUS_WRITE; | 197 | read_write = I2C_SMBUS_WRITE; |
@@ -208,8 +213,10 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
208 | case I2C_SMBUS_WORD_DATA: | 213 | case I2C_SMBUS_WORD_DATA: |
209 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 214 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
210 | if (read_write == I2C_SMBUS_WRITE) { | 215 | if (read_write == I2C_SMBUS_WRITE) { |
211 | amd_ec_write(smbus, AMD_SMB_DATA, data->word); | 216 | amd_ec_write(smbus, AMD_SMB_DATA, |
212 | amd_ec_write(smbus, AMD_SMB_DATA + 1, data->word >> 8); | 217 | data->word & 0xff); |
218 | amd_ec_write(smbus, AMD_SMB_DATA + 1, | ||
219 | data->word >> 8); | ||
213 | } | 220 | } |
214 | protocol |= AMD_SMB_PRTCL_WORD_DATA | pec; | 221 | protocol |= AMD_SMB_PRTCL_WORD_DATA | pec; |
215 | break; | 222 | break; |
@@ -217,27 +224,31 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
217 | case I2C_SMBUS_BLOCK_DATA: | 224 | case I2C_SMBUS_BLOCK_DATA: |
218 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 225 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
219 | if (read_write == I2C_SMBUS_WRITE) { | 226 | if (read_write == I2C_SMBUS_WRITE) { |
220 | len = min_t(u8, data->block[0], 32); | 227 | len = min_t(u8, data->block[0], |
228 | I2C_SMBUS_BLOCK_MAX); | ||
221 | amd_ec_write(smbus, AMD_SMB_BCNT, len); | 229 | amd_ec_write(smbus, AMD_SMB_BCNT, len); |
222 | for (i = 0; i < len; i++) | 230 | for (i = 0; i < len; i++) |
223 | amd_ec_write(smbus, AMD_SMB_DATA + i, data->block[i + 1]); | 231 | amd_ec_write(smbus, AMD_SMB_DATA + i, |
232 | data->block[i + 1]); | ||
224 | } | 233 | } |
225 | protocol |= AMD_SMB_PRTCL_BLOCK_DATA | pec; | 234 | protocol |= AMD_SMB_PRTCL_BLOCK_DATA | pec; |
226 | break; | 235 | break; |
227 | 236 | ||
228 | case I2C_SMBUS_I2C_BLOCK_DATA: | 237 | case I2C_SMBUS_I2C_BLOCK_DATA: |
229 | len = min_t(u8, data->block[0], 32); | 238 | len = min_t(u8, data->block[0], |
239 | I2C_SMBUS_BLOCK_MAX); | ||
230 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 240 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
231 | amd_ec_write(smbus, AMD_SMB_BCNT, len); | 241 | amd_ec_write(smbus, AMD_SMB_BCNT, len); |
232 | if (read_write == I2C_SMBUS_WRITE) | 242 | if (read_write == I2C_SMBUS_WRITE) |
233 | for (i = 0; i < len; i++) | 243 | for (i = 0; i < len; i++) |
234 | amd_ec_write(smbus, AMD_SMB_DATA + i, data->block[i + 1]); | 244 | amd_ec_write(smbus, AMD_SMB_DATA + i, |
245 | data->block[i + 1]); | ||
235 | protocol |= AMD_SMB_PRTCL_I2C_BLOCK_DATA; | 246 | protocol |= AMD_SMB_PRTCL_I2C_BLOCK_DATA; |
236 | break; | 247 | break; |
237 | 248 | ||
238 | case I2C_SMBUS_PROC_CALL: | 249 | case I2C_SMBUS_PROC_CALL: |
239 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 250 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
240 | amd_ec_write(smbus, AMD_SMB_DATA, data->word); | 251 | amd_ec_write(smbus, AMD_SMB_DATA, data->word & 0xff); |
241 | amd_ec_write(smbus, AMD_SMB_DATA + 1, data->word >> 8); | 252 | amd_ec_write(smbus, AMD_SMB_DATA + 1, data->word >> 8); |
242 | protocol = AMD_SMB_PRTCL_PROC_CALL | pec; | 253 | protocol = AMD_SMB_PRTCL_PROC_CALL | pec; |
243 | read_write = I2C_SMBUS_READ; | 254 | read_write = I2C_SMBUS_READ; |
@@ -248,7 +259,8 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
248 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 259 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
249 | amd_ec_write(smbus, AMD_SMB_BCNT, len); | 260 | amd_ec_write(smbus, AMD_SMB_BCNT, len); |
250 | for (i = 0; i < len; i++) | 261 | for (i = 0; i < len; i++) |
251 | amd_ec_write(smbus, AMD_SMB_DATA + i, data->block[i + 1]); | 262 | amd_ec_write(smbus, AMD_SMB_DATA + i, |
263 | data->block[i + 1]); | ||
252 | protocol = AMD_SMB_PRTCL_BLOCK_PROC_CALL | pec; | 264 | protocol = AMD_SMB_PRTCL_BLOCK_PROC_CALL | pec; |
253 | read_write = I2C_SMBUS_READ; | 265 | read_write = I2C_SMBUS_READ; |
254 | break; | 266 | break; |
@@ -280,7 +292,6 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
280 | return 0; | 292 | return 0; |
281 | 293 | ||
282 | switch (size) { | 294 | switch (size) { |
283 | |||
284 | case I2C_SMBUS_BYTE: | 295 | case I2C_SMBUS_BYTE: |
285 | case I2C_SMBUS_BYTE_DATA: | 296 | case I2C_SMBUS_BYTE_DATA: |
286 | amd_ec_read(smbus, AMD_SMB_DATA, &data->byte); | 297 | amd_ec_read(smbus, AMD_SMB_DATA, &data->byte); |
@@ -296,10 +307,11 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
296 | case I2C_SMBUS_BLOCK_DATA: | 307 | case I2C_SMBUS_BLOCK_DATA: |
297 | case I2C_SMBUS_BLOCK_PROC_CALL: | 308 | case I2C_SMBUS_BLOCK_PROC_CALL: |
298 | amd_ec_read(smbus, AMD_SMB_BCNT, &len); | 309 | amd_ec_read(smbus, AMD_SMB_BCNT, &len); |
299 | len = min_t(u8, len, 32); | 310 | len = min_t(u8, len, I2C_SMBUS_BLOCK_MAX); |
300 | case I2C_SMBUS_I2C_BLOCK_DATA: | 311 | case I2C_SMBUS_I2C_BLOCK_DATA: |
301 | for (i = 0; i < len; i++) | 312 | for (i = 0; i < len; i++) |
302 | amd_ec_read(smbus, AMD_SMB_DATA + i, data->block + i + 1); | 313 | amd_ec_read(smbus, AMD_SMB_DATA + i, |
314 | data->block + i + 1); | ||
303 | data->block[0] = len; | 315 | data->block[0] = len; |
304 | break; | 316 | break; |
305 | } | 317 | } |
@@ -310,7 +322,8 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
310 | 322 | ||
311 | static u32 amd8111_func(struct i2c_adapter *adapter) | 323 | static u32 amd8111_func(struct i2c_adapter *adapter) |
312 | { | 324 | { |
313 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA | | 325 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
326 | I2C_FUNC_SMBUS_BYTE_DATA | | ||
314 | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA | | 327 | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA | |
315 | I2C_FUNC_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_BLOCK_PROC_CALL | | 328 | I2C_FUNC_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_BLOCK_PROC_CALL | |
316 | I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_HWPEC_CALC; | 329 | I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_HWPEC_CALC; |
@@ -329,12 +342,13 @@ static struct pci_device_id amd8111_ids[] = { | |||
329 | 342 | ||
330 | MODULE_DEVICE_TABLE (pci, amd8111_ids); | 343 | MODULE_DEVICE_TABLE (pci, amd8111_ids); |
331 | 344 | ||
332 | static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id) | 345 | static int __devinit amd8111_probe(struct pci_dev *dev, |
346 | const struct pci_device_id *id) | ||
333 | { | 347 | { |
334 | struct amd_smbus *smbus; | 348 | struct amd_smbus *smbus; |
335 | int error = -ENODEV; | 349 | int error; |
336 | 350 | ||
337 | if (~pci_resource_flags(dev, 0) & IORESOURCE_IO) | 351 | if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO)) |
338 | return -ENODEV; | 352 | return -ENODEV; |
339 | 353 | ||
340 | smbus = kzalloc(sizeof(struct amd_smbus), GFP_KERNEL); | 354 | smbus = kzalloc(sizeof(struct amd_smbus), GFP_KERNEL); |
@@ -345,12 +359,15 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ | |||
345 | smbus->base = pci_resource_start(dev, 0); | 359 | smbus->base = pci_resource_start(dev, 0); |
346 | smbus->size = pci_resource_len(dev, 0); | 360 | smbus->size = pci_resource_len(dev, 0); |
347 | 361 | ||
348 | if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) | 362 | if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) { |
363 | error = -EBUSY; | ||
349 | goto out_kfree; | 364 | goto out_kfree; |
365 | } | ||
350 | 366 | ||
351 | smbus->adapter.owner = THIS_MODULE; | 367 | smbus->adapter.owner = THIS_MODULE; |
352 | snprintf(smbus->adapter.name, I2C_NAME_SIZE, | 368 | snprintf(smbus->adapter.name, I2C_NAME_SIZE, |
353 | "SMBus2 AMD8111 adapter at %04x", smbus->base); | 369 | "SMBus2 AMD8111 adapter at %04x", smbus->base); |
370 | smbus->adapter.id = I2C_HW_SMBUS_AMD8111; | ||
354 | smbus->adapter.class = I2C_CLASS_HWMON; | 371 | smbus->adapter.class = I2C_CLASS_HWMON; |
355 | smbus->adapter.algo = &smbus_algorithm; | 372 | smbus->adapter.algo = &smbus_algorithm; |
356 | smbus->adapter.algo_data = smbus; | 373 | smbus->adapter.algo_data = smbus; |
@@ -358,11 +375,11 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ | |||
358 | /* set up the driverfs linkage to our parent device */ | 375 | /* set up the driverfs linkage to our parent device */ |
359 | smbus->adapter.dev.parent = &dev->dev; | 376 | smbus->adapter.dev.parent = &dev->dev; |
360 | 377 | ||
378 | pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0); | ||
361 | error = i2c_add_adapter(&smbus->adapter); | 379 | error = i2c_add_adapter(&smbus->adapter); |
362 | if (error) | 380 | if (error) |
363 | goto out_release_region; | 381 | goto out_release_region; |
364 | 382 | ||
365 | pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0); | ||
366 | pci_set_drvdata(dev, smbus); | 383 | pci_set_drvdata(dev, smbus); |
367 | return 0; | 384 | return 0; |
368 | 385 | ||
@@ -370,10 +387,9 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ | |||
370 | release_region(smbus->base, smbus->size); | 387 | release_region(smbus->base, smbus->size); |
371 | out_kfree: | 388 | out_kfree: |
372 | kfree(smbus); | 389 | kfree(smbus); |
373 | return -1; | 390 | return error; |
374 | } | 391 | } |
375 | 392 | ||
376 | |||
377 | static void __devexit amd8111_remove(struct pci_dev *dev) | 393 | static void __devexit amd8111_remove(struct pci_dev *dev) |
378 | { | 394 | { |
379 | struct amd_smbus *smbus = pci_get_drvdata(dev); | 395 | struct amd_smbus *smbus = pci_get_drvdata(dev); |
@@ -395,7 +411,6 @@ static int __init i2c_amd8111_init(void) | |||
395 | return pci_register_driver(&amd8111_driver); | 411 | return pci_register_driver(&amd8111_driver); |
396 | } | 412 | } |
397 | 413 | ||
398 | |||
399 | static void __exit i2c_amd8111_exit(void) | 414 | static void __exit i2c_amd8111_exit(void) |
400 | { | 415 | { |
401 | pci_unregister_driver(&amd8111_driver); | 416 | pci_unregister_driver(&amd8111_driver); |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index ae625b854470..8c3569a9775b 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -123,7 +123,7 @@ static int i801_transaction(void) | |||
123 | dev_dbg(&I801_dev->dev, "Failed! (%02x)\n", temp); | 123 | dev_dbg(&I801_dev->dev, "Failed! (%02x)\n", temp); |
124 | return -1; | 124 | return -1; |
125 | } else { | 125 | } else { |
126 | dev_dbg(&I801_dev->dev, "Successfull!\n"); | 126 | dev_dbg(&I801_dev->dev, "Successful!\n"); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
@@ -442,6 +442,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
442 | 442 | ||
443 | static struct i2c_adapter i801_adapter = { | 443 | static struct i2c_adapter i801_adapter = { |
444 | .owner = THIS_MODULE, | 444 | .owner = THIS_MODULE, |
445 | .id = I2C_HW_SMBUS_I801, | ||
445 | .class = I2C_CLASS_HWMON, | 446 | .class = I2C_CLASS_HWMON, |
446 | .algo = &smbus_algorithm, | 447 | .algo = &smbus_algorithm, |
447 | }; | 448 | }; |
diff --git a/drivers/i2c/busses/i2c-i810.c b/drivers/i2c/busses/i2c-i810.c index 10c98bc88aa6..42e8d94c276f 100644 --- a/drivers/i2c/busses/i2c-i810.c +++ b/drivers/i2c/busses/i2c-i810.c | |||
@@ -171,6 +171,7 @@ static struct i2c_algo_bit_data i810_i2c_bit_data = { | |||
171 | 171 | ||
172 | static struct i2c_adapter i810_i2c_adapter = { | 172 | static struct i2c_adapter i810_i2c_adapter = { |
173 | .owner = THIS_MODULE, | 173 | .owner = THIS_MODULE, |
174 | .id = I2C_HW_B_I810, | ||
174 | .name = "I810/I815 I2C Adapter", | 175 | .name = "I810/I815 I2C Adapter", |
175 | .algo_data = &i810_i2c_bit_data, | 176 | .algo_data = &i810_i2c_bit_data, |
176 | }; | 177 | }; |
@@ -186,6 +187,7 @@ static struct i2c_algo_bit_data i810_ddc_bit_data = { | |||
186 | 187 | ||
187 | static struct i2c_adapter i810_ddc_adapter = { | 188 | static struct i2c_adapter i810_ddc_adapter = { |
188 | .owner = THIS_MODULE, | 189 | .owner = THIS_MODULE, |
190 | .id = I2C_HW_B_I810, | ||
189 | .name = "I810/I815 DDC Adapter", | 191 | .name = "I810/I815 DDC Adapter", |
190 | .algo_data = &i810_ddc_bit_data, | 192 | .algo_data = &i810_ddc_bit_data, |
191 | }; | 193 | }; |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 1898e9987021..8b14d14e60ca 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -727,6 +727,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
727 | 727 | ||
728 | /* Register it with i2c layer */ | 728 | /* Register it with i2c layer */ |
729 | adap = &dev->adap; | 729 | adap = &dev->adap; |
730 | adap->dev.parent = &ocp->dev; | ||
730 | strcpy(adap->name, "IBM IIC"); | 731 | strcpy(adap->name, "IBM IIC"); |
731 | i2c_set_adapdata(adap, dev); | 732 | i2c_set_adapdata(adap, dev); |
732 | adap->id = I2C_HW_OCP; | 733 | adap->id = I2C_HW_OCP; |
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c index 8ed59a2dff53..5f33bc9c1e02 100644 --- a/drivers/i2c/busses/i2c-isa.c +++ b/drivers/i2c/busses/i2c-isa.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/i2c.h> | 39 | #include <linux/i2c.h> |
40 | #include <linux/i2c-isa.h> | 40 | #include <linux/i2c-isa.h> |
41 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
42 | #include <linux/completion.h> | ||
42 | 43 | ||
43 | static u32 isa_func(struct i2c_adapter *adapter); | 44 | static u32 isa_func(struct i2c_adapter *adapter); |
44 | 45 | ||
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 490173611d6b..a3283b907eb8 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -520,6 +520,7 @@ mv64xxx_i2c_probe(struct platform_device *pd) | |||
520 | rc = -ENXIO; | 520 | rc = -ENXIO; |
521 | goto exit_unmap_regs; | 521 | goto exit_unmap_regs; |
522 | } | 522 | } |
523 | drv_data->adapter.dev.parent = &pd->dev; | ||
523 | drv_data->adapter.id = I2C_HW_MV64XXX; | 524 | drv_data->adapter.id = I2C_HW_MV64XXX; |
524 | drv_data->adapter.algo = &mv64xxx_i2c_algo; | 525 | drv_data->adapter.algo = &mv64xxx_i2c_algo; |
525 | drv_data->adapter.owner = THIS_MODULE; | 526 | drv_data->adapter.owner = THIS_MODULE; |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index ad37c10e7fec..653555184a64 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -57,7 +57,6 @@ MODULE_DESCRIPTION("nForce2/3/4/5xx SMBus driver"); | |||
57 | 57 | ||
58 | 58 | ||
59 | struct nforce2_smbus { | 59 | struct nforce2_smbus { |
60 | struct pci_dev *dev; | ||
61 | struct i2c_adapter adapter; | 60 | struct i2c_adapter adapter; |
62 | int base; | 61 | int base; |
63 | int size; | 62 | int size; |
@@ -230,7 +229,6 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, | |||
230 | smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK; | 229 | smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK; |
231 | smbus->size = 64; | 230 | smbus->size = 64; |
232 | } | 231 | } |
233 | smbus->dev = dev; | ||
234 | 232 | ||
235 | if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) { | 233 | if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) { |
236 | dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n", | 234 | dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n", |
@@ -238,6 +236,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, | |||
238 | return -1; | 236 | return -1; |
239 | } | 237 | } |
240 | smbus->adapter.owner = THIS_MODULE; | 238 | smbus->adapter.owner = THIS_MODULE; |
239 | smbus->adapter.id = I2C_HW_SMBUS_NFORCE2; | ||
241 | smbus->adapter.class = I2C_CLASS_HWMON; | 240 | smbus->adapter.class = I2C_CLASS_HWMON; |
242 | smbus->adapter.algo = &smbus_algorithm; | 241 | smbus->adapter.algo = &smbus_algorithm; |
243 | smbus->adapter.algo_data = smbus; | 242 | smbus->adapter.algo_data = smbus; |
diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h index 9ddd816d5d0f..ed69d846cb95 100644 --- a/drivers/i2c/busses/i2c-parport.h +++ b/drivers/i2c/busses/i2c-parport.h | |||
@@ -88,6 +88,13 @@ static struct adapter_parm adapter_parm[] = { | |||
88 | .getscl = { 0x40, STAT, 0 }, | 88 | .getscl = { 0x40, STAT, 0 }, |
89 | .init = { 0xfc, DATA, 0 }, | 89 | .init = { 0xfc, DATA, 0 }, |
90 | }, | 90 | }, |
91 | /* type 7: One For All JP1 parallel port adapter */ | ||
92 | { | ||
93 | .setsda = { 0x01, DATA, 0 }, | ||
94 | .setscl = { 0x02, DATA, 0 }, | ||
95 | .getsda = { 0x80, STAT, 1 }, | ||
96 | .init = { 0x04, DATA, 1 }, | ||
97 | }, | ||
91 | }; | 98 | }; |
92 | 99 | ||
93 | static int type = -1; | 100 | static int type = -1; |
@@ -101,4 +108,5 @@ MODULE_PARM_DESC(type, | |||
101 | " 4 = ADM1032 evaluation board\n" | 108 | " 4 = ADM1032 evaluation board\n" |
102 | " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" | 109 | " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" |
103 | " 6 = Barco LPT->DVI (K5800236) adapter\n" | 110 | " 6 = Barco LPT->DVI (K5800236) adapter\n" |
111 | " 7 = One For All JP1 parallel port adapter\n" | ||
104 | ); | 112 | ); |
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c new file mode 100644 index 000000000000..f54fb5d65cc4 --- /dev/null +++ b/drivers/i2c/busses/i2c-pasemi.c | |||
@@ -0,0 +1,426 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006-2007 PA Semi, Inc | ||
3 | * | ||
4 | * SMBus host driver for PA Semi PWRficient | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/pci.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/stddef.h> | ||
24 | #include <linux/sched.h> | ||
25 | #include <linux/i2c.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <asm/io.h> | ||
28 | |||
29 | static struct pci_driver pasemi_smb_driver; | ||
30 | |||
31 | struct pasemi_smbus { | ||
32 | struct pci_dev *dev; | ||
33 | struct i2c_adapter adapter; | ||
34 | unsigned long base; | ||
35 | int size; | ||
36 | }; | ||
37 | |||
38 | /* Register offsets */ | ||
39 | #define REG_MTXFIFO 0x00 | ||
40 | #define REG_MRXFIFO 0x04 | ||
41 | #define REG_SMSTA 0x14 | ||
42 | #define REG_CTL 0x1c | ||
43 | |||
44 | /* Register defs */ | ||
45 | #define MTXFIFO_READ 0x00000400 | ||
46 | #define MTXFIFO_STOP 0x00000200 | ||
47 | #define MTXFIFO_START 0x00000100 | ||
48 | #define MTXFIFO_DATA_M 0x000000ff | ||
49 | |||
50 | #define MRXFIFO_EMPTY 0x00000100 | ||
51 | #define MRXFIFO_DATA_M 0x000000ff | ||
52 | |||
53 | #define SMSTA_XEN 0x08000000 | ||
54 | |||
55 | #define CTL_MRR 0x00000400 | ||
56 | #define CTL_MTR 0x00000200 | ||
57 | #define CTL_CLK_M 0x000000ff | ||
58 | |||
59 | #define CLK_100K_DIV 84 | ||
60 | #define CLK_400K_DIV 21 | ||
61 | |||
62 | static inline void reg_write(struct pasemi_smbus *smbus, int reg, int val) | ||
63 | { | ||
64 | dev_dbg(&smbus->dev->dev, "smbus write reg %lx val %08x\n", | ||
65 | smbus->base + reg, val); | ||
66 | outl(val, smbus->base + reg); | ||
67 | } | ||
68 | |||
69 | static inline int reg_read(struct pasemi_smbus *smbus, int reg) | ||
70 | { | ||
71 | int ret; | ||
72 | ret = inl(smbus->base + reg); | ||
73 | dev_dbg(&smbus->dev->dev, "smbus read reg %lx val %08x\n", | ||
74 | smbus->base + reg, ret); | ||
75 | return ret; | ||
76 | } | ||
77 | |||
78 | #define TXFIFO_WR(smbus, reg) reg_write((smbus), REG_MTXFIFO, (reg)) | ||
79 | #define RXFIFO_RD(smbus) reg_read((smbus), REG_MRXFIFO) | ||
80 | |||
81 | static void pasemi_smb_clear(struct pasemi_smbus *smbus) | ||
82 | { | ||
83 | unsigned int status; | ||
84 | |||
85 | status = reg_read(smbus, REG_SMSTA); | ||
86 | reg_write(smbus, REG_SMSTA, status); | ||
87 | } | ||
88 | |||
89 | static unsigned int pasemi_smb_waitready(struct pasemi_smbus *smbus) | ||
90 | { | ||
91 | int timeout = 10; | ||
92 | unsigned int status; | ||
93 | |||
94 | status = reg_read(smbus, REG_SMSTA); | ||
95 | |||
96 | while (!(status & SMSTA_XEN) && timeout--) { | ||
97 | msleep(1); | ||
98 | status = reg_read(smbus, REG_SMSTA); | ||
99 | } | ||
100 | |||
101 | if (timeout < 0) { | ||
102 | dev_warn(&smbus->dev->dev, "Timeout, status 0x%08x\n", status); | ||
103 | reg_write(smbus, REG_SMSTA, status); | ||
104 | return -ETIME; | ||
105 | } | ||
106 | |||
107 | /* Clear XEN */ | ||
108 | reg_write(smbus, REG_SMSTA, SMSTA_XEN); | ||
109 | |||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | static int pasemi_i2c_xfer_msg(struct i2c_adapter *adapter, | ||
114 | struct i2c_msg *msg, int stop) | ||
115 | { | ||
116 | struct pasemi_smbus *smbus = adapter->algo_data; | ||
117 | int read, i, err; | ||
118 | u32 rd; | ||
119 | |||
120 | read = msg->flags & I2C_M_RD ? 1 : 0; | ||
121 | |||
122 | TXFIFO_WR(smbus, MTXFIFO_START | (msg->addr << 1) | read); | ||
123 | |||
124 | if (read) { | ||
125 | TXFIFO_WR(smbus, msg->len | MTXFIFO_READ | | ||
126 | (stop ? MTXFIFO_STOP : 0)); | ||
127 | |||
128 | err = pasemi_smb_waitready(smbus); | ||
129 | if (err) | ||
130 | goto reset_out; | ||
131 | |||
132 | for (i = 0; i < msg->len; i++) { | ||
133 | rd = RXFIFO_RD(smbus); | ||
134 | if (rd & MRXFIFO_EMPTY) { | ||
135 | err = -ENODATA; | ||
136 | goto reset_out; | ||
137 | } | ||
138 | msg->buf[i] = rd & MRXFIFO_DATA_M; | ||
139 | } | ||
140 | } else { | ||
141 | for (i = 0; i < msg->len - 1; i++) | ||
142 | TXFIFO_WR(smbus, msg->buf[i]); | ||
143 | |||
144 | TXFIFO_WR(smbus, msg->buf[msg->len] | | ||
145 | (stop ? MTXFIFO_STOP : 0)); | ||
146 | } | ||
147 | |||
148 | return 0; | ||
149 | |||
150 | reset_out: | ||
151 | reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | | ||
152 | (CLK_100K_DIV & CTL_CLK_M))); | ||
153 | return err; | ||
154 | } | ||
155 | |||
156 | static int pasemi_i2c_xfer(struct i2c_adapter *adapter, | ||
157 | struct i2c_msg *msgs, int num) | ||
158 | { | ||
159 | struct pasemi_smbus *smbus = adapter->algo_data; | ||
160 | int ret, i; | ||
161 | |||
162 | pasemi_smb_clear(smbus); | ||
163 | |||
164 | ret = 0; | ||
165 | |||
166 | for (i = 0; i < num && !ret; i++) | ||
167 | ret = pasemi_i2c_xfer_msg(adapter, &msgs[i], (i == (num - 1))); | ||
168 | |||
169 | return ret ? ret : num; | ||
170 | } | ||
171 | |||
172 | static int pasemi_smb_xfer(struct i2c_adapter *adapter, | ||
173 | u16 addr, unsigned short flags, char read_write, u8 command, | ||
174 | int size, union i2c_smbus_data *data) | ||
175 | { | ||
176 | struct pasemi_smbus *smbus = adapter->algo_data; | ||
177 | unsigned int rd; | ||
178 | int read_flag, err; | ||
179 | int len = 0, i; | ||
180 | |||
181 | /* All our ops take 8-bit shifted addresses */ | ||
182 | addr <<= 1; | ||
183 | read_flag = read_write == I2C_SMBUS_READ; | ||
184 | |||
185 | pasemi_smb_clear(smbus); | ||
186 | |||
187 | switch (size) { | ||
188 | case I2C_SMBUS_QUICK: | ||
189 | TXFIFO_WR(smbus, addr | read_flag | MTXFIFO_START | | ||
190 | MTXFIFO_STOP); | ||
191 | break; | ||
192 | case I2C_SMBUS_BYTE: | ||
193 | TXFIFO_WR(smbus, addr | read_flag | MTXFIFO_START); | ||
194 | if (read_write) | ||
195 | TXFIFO_WR(smbus, 1 | MTXFIFO_STOP | MTXFIFO_READ); | ||
196 | else | ||
197 | TXFIFO_WR(smbus, MTXFIFO_STOP | command); | ||
198 | break; | ||
199 | case I2C_SMBUS_BYTE_DATA: | ||
200 | TXFIFO_WR(smbus, addr | MTXFIFO_START); | ||
201 | TXFIFO_WR(smbus, command); | ||
202 | if (read_write) { | ||
203 | TXFIFO_WR(smbus, addr | I2C_SMBUS_READ | MTXFIFO_START); | ||
204 | TXFIFO_WR(smbus, 1 | MTXFIFO_READ | MTXFIFO_STOP); | ||
205 | } else { | ||
206 | TXFIFO_WR(smbus, MTXFIFO_STOP | data->byte); | ||
207 | } | ||
208 | break; | ||
209 | case I2C_SMBUS_WORD_DATA: | ||
210 | TXFIFO_WR(smbus, addr | MTXFIFO_START); | ||
211 | TXFIFO_WR(smbus, command); | ||
212 | if (read_write) { | ||
213 | TXFIFO_WR(smbus, addr | I2C_SMBUS_READ | MTXFIFO_START); | ||
214 | TXFIFO_WR(smbus, 2 | MTXFIFO_READ | MTXFIFO_STOP); | ||
215 | } else { | ||
216 | TXFIFO_WR(smbus, data->word & MTXFIFO_DATA_M); | ||
217 | TXFIFO_WR(smbus, MTXFIFO_STOP | (data->word >> 8)); | ||
218 | } | ||
219 | break; | ||
220 | case I2C_SMBUS_BLOCK_DATA: | ||
221 | TXFIFO_WR(smbus, addr | MTXFIFO_START); | ||
222 | TXFIFO_WR(smbus, command); | ||
223 | if (read_write) { | ||
224 | TXFIFO_WR(smbus, addr | I2C_SMBUS_READ | MTXFIFO_START); | ||
225 | TXFIFO_WR(smbus, 1 | MTXFIFO_READ); | ||
226 | rd = RXFIFO_RD(smbus); | ||
227 | len = min_t(u8, (rd & MRXFIFO_DATA_M), | ||
228 | I2C_SMBUS_BLOCK_MAX); | ||
229 | TXFIFO_WR(smbus, (len + 1) | MTXFIFO_READ | | ||
230 | MTXFIFO_STOP); | ||
231 | } else { | ||
232 | len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX); | ||
233 | TXFIFO_WR(smbus, len); | ||
234 | for (i = 1; i < len; i++) | ||
235 | TXFIFO_WR(smbus, data->block[i]); | ||
236 | TXFIFO_WR(smbus, data->block[len] | MTXFIFO_STOP); | ||
237 | } | ||
238 | break; | ||
239 | case I2C_SMBUS_PROC_CALL: | ||
240 | read_write = I2C_SMBUS_READ; | ||
241 | TXFIFO_WR(smbus, addr | MTXFIFO_START); | ||
242 | TXFIFO_WR(smbus, command); | ||
243 | TXFIFO_WR(smbus, data->word & MTXFIFO_DATA_M); | ||
244 | TXFIFO_WR(smbus, (data->word >> 8) & MTXFIFO_DATA_M); | ||
245 | TXFIFO_WR(smbus, addr | I2C_SMBUS_READ | MTXFIFO_START); | ||
246 | TXFIFO_WR(smbus, 2 | MTXFIFO_STOP | MTXFIFO_READ); | ||
247 | break; | ||
248 | case I2C_SMBUS_BLOCK_PROC_CALL: | ||
249 | len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX - 1); | ||
250 | read_write = I2C_SMBUS_READ; | ||
251 | TXFIFO_WR(smbus, addr | MTXFIFO_START); | ||
252 | TXFIFO_WR(smbus, command); | ||
253 | TXFIFO_WR(smbus, len); | ||
254 | for (i = 1; i <= len; i++) | ||
255 | TXFIFO_WR(smbus, data->block[i]); | ||
256 | TXFIFO_WR(smbus, addr | I2C_SMBUS_READ); | ||
257 | TXFIFO_WR(smbus, MTXFIFO_READ | 1); | ||
258 | rd = RXFIFO_RD(smbus); | ||
259 | len = min_t(u8, (rd & MRXFIFO_DATA_M), | ||
260 | I2C_SMBUS_BLOCK_MAX - len); | ||
261 | TXFIFO_WR(smbus, (len + 1) | MTXFIFO_READ | MTXFIFO_STOP); | ||
262 | break; | ||
263 | |||
264 | default: | ||
265 | dev_warn(&adapter->dev, "Unsupported transaction %d\n", size); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | |||
269 | err = pasemi_smb_waitready(smbus); | ||
270 | if (err) | ||
271 | goto reset_out; | ||
272 | |||
273 | if (read_write == I2C_SMBUS_WRITE) | ||
274 | return 0; | ||
275 | |||
276 | switch (size) { | ||
277 | case I2C_SMBUS_BYTE: | ||
278 | case I2C_SMBUS_BYTE_DATA: | ||
279 | rd = RXFIFO_RD(smbus); | ||
280 | if (rd & MRXFIFO_EMPTY) { | ||
281 | err = -ENODATA; | ||
282 | goto reset_out; | ||
283 | } | ||
284 | data->byte = rd & MRXFIFO_DATA_M; | ||
285 | break; | ||
286 | case I2C_SMBUS_WORD_DATA: | ||
287 | case I2C_SMBUS_PROC_CALL: | ||
288 | rd = RXFIFO_RD(smbus); | ||
289 | if (rd & MRXFIFO_EMPTY) { | ||
290 | err = -ENODATA; | ||
291 | goto reset_out; | ||
292 | } | ||
293 | data->word = rd & MRXFIFO_DATA_M; | ||
294 | rd = RXFIFO_RD(smbus); | ||
295 | if (rd & MRXFIFO_EMPTY) { | ||
296 | err = -ENODATA; | ||
297 | goto reset_out; | ||
298 | } | ||
299 | data->word |= (rd & MRXFIFO_DATA_M) << 8; | ||
300 | break; | ||
301 | case I2C_SMBUS_BLOCK_DATA: | ||
302 | case I2C_SMBUS_BLOCK_PROC_CALL: | ||
303 | data->block[0] = len; | ||
304 | for (i = 1; i <= len; i ++) { | ||
305 | rd = RXFIFO_RD(smbus); | ||
306 | if (rd & MRXFIFO_EMPTY) { | ||
307 | err = -ENODATA; | ||
308 | goto reset_out; | ||
309 | } | ||
310 | data->block[i] = rd & MRXFIFO_DATA_M; | ||
311 | } | ||
312 | break; | ||
313 | } | ||
314 | |||
315 | return 0; | ||
316 | |||
317 | reset_out: | ||
318 | reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | | ||
319 | (CLK_100K_DIV & CTL_CLK_M))); | ||
320 | return err; | ||
321 | } | ||
322 | |||
323 | static u32 pasemi_smb_func(struct i2c_adapter *adapter) | ||
324 | { | ||
325 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | ||
326 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | ||
327 | I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_PROC_CALL | | ||
328 | I2C_FUNC_SMBUS_BLOCK_PROC_CALL | I2C_FUNC_I2C; | ||
329 | } | ||
330 | |||
331 | static const struct i2c_algorithm smbus_algorithm = { | ||
332 | .master_xfer = pasemi_i2c_xfer, | ||
333 | .smbus_xfer = pasemi_smb_xfer, | ||
334 | .functionality = pasemi_smb_func, | ||
335 | }; | ||
336 | |||
337 | static int __devinit pasemi_smb_probe(struct pci_dev *dev, | ||
338 | const struct pci_device_id *id) | ||
339 | { | ||
340 | struct pasemi_smbus *smbus; | ||
341 | int error; | ||
342 | |||
343 | if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO)) | ||
344 | return -ENODEV; | ||
345 | |||
346 | smbus = kzalloc(sizeof(struct pasemi_smbus), GFP_KERNEL); | ||
347 | if (!smbus) | ||
348 | return -ENOMEM; | ||
349 | |||
350 | smbus->dev = dev; | ||
351 | smbus->base = pci_resource_start(dev, 0); | ||
352 | smbus->size = pci_resource_len(dev, 0); | ||
353 | |||
354 | if (!request_region(smbus->base, smbus->size, | ||
355 | pasemi_smb_driver.name)) { | ||
356 | error = -EBUSY; | ||
357 | goto out_kfree; | ||
358 | } | ||
359 | |||
360 | smbus->adapter.owner = THIS_MODULE; | ||
361 | snprintf(smbus->adapter.name, I2C_NAME_SIZE, | ||
362 | "PA Semi SMBus adapter at 0x%lx", smbus->base); | ||
363 | smbus->adapter.class = I2C_CLASS_HWMON; | ||
364 | smbus->adapter.algo = &smbus_algorithm; | ||
365 | smbus->adapter.algo_data = smbus; | ||
366 | |||
367 | /* set up the driverfs linkage to our parent device */ | ||
368 | smbus->adapter.dev.parent = &dev->dev; | ||
369 | |||
370 | reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | | ||
371 | (CLK_100K_DIV & CTL_CLK_M))); | ||
372 | |||
373 | error = i2c_add_adapter(&smbus->adapter); | ||
374 | if (error) | ||
375 | goto out_release_region; | ||
376 | |||
377 | pci_set_drvdata(dev, smbus); | ||
378 | |||
379 | return 0; | ||
380 | |||
381 | out_release_region: | ||
382 | release_region(smbus->base, smbus->size); | ||
383 | out_kfree: | ||
384 | kfree(smbus); | ||
385 | return error; | ||
386 | } | ||
387 | |||
388 | static void __devexit pasemi_smb_remove(struct pci_dev *dev) | ||
389 | { | ||
390 | struct pasemi_smbus *smbus = pci_get_drvdata(dev); | ||
391 | |||
392 | i2c_del_adapter(&smbus->adapter); | ||
393 | release_region(smbus->base, smbus->size); | ||
394 | kfree(smbus); | ||
395 | } | ||
396 | |||
397 | static struct pci_device_id pasemi_smb_ids[] = { | ||
398 | { PCI_DEVICE(0x1959, 0xa003) }, | ||
399 | { 0, } | ||
400 | }; | ||
401 | |||
402 | MODULE_DEVICE_TABLE(pci, pasemi_smb_ids); | ||
403 | |||
404 | static struct pci_driver pasemi_smb_driver = { | ||
405 | .name = "i2c-pasemi", | ||
406 | .id_table = pasemi_smb_ids, | ||
407 | .probe = pasemi_smb_probe, | ||
408 | .remove = __devexit_p(pasemi_smb_remove), | ||
409 | }; | ||
410 | |||
411 | static int __init pasemi_smb_init(void) | ||
412 | { | ||
413 | return pci_register_driver(&pasemi_smb_driver); | ||
414 | } | ||
415 | |||
416 | static void __exit pasemi_smb_exit(void) | ||
417 | { | ||
418 | pci_unregister_driver(&pasemi_smb_driver); | ||
419 | } | ||
420 | |||
421 | MODULE_LICENSE("GPL"); | ||
422 | MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); | ||
423 | MODULE_DESCRIPTION("PA Semi PWRficient SMBus driver"); | ||
424 | |||
425 | module_init(pasemi_smb_init); | ||
426 | module_exit(pasemi_smb_exit); | ||
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 30c7a1b38cbd..03d0aeea0189 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -23,6 +23,7 @@ | |||
23 | Supports: | 23 | Supports: |
24 | Intel PIIX4, 440MX | 24 | Intel PIIX4, 440MX |
25 | Serverworks OSB4, CSB5, CSB6, HT-1000 | 25 | Serverworks OSB4, CSB5, CSB6, HT-1000 |
26 | ATI IXP200, IXP300, IXP400, SB600 | ||
26 | SMSC Victory66 | 27 | SMSC Victory66 |
27 | 28 | ||
28 | Note: we assume there can only be one device, with one SMBus interface. | 29 | Note: we assume there can only be one device, with one SMBus interface. |
@@ -383,6 +384,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
383 | 384 | ||
384 | static struct i2c_adapter piix4_adapter = { | 385 | static struct i2c_adapter piix4_adapter = { |
385 | .owner = THIS_MODULE, | 386 | .owner = THIS_MODULE, |
387 | .id = I2C_HW_SMBUS_PIIX4, | ||
386 | .class = I2C_CLASS_HWMON, | 388 | .class = I2C_CLASS_HWMON, |
387 | .algo = &smbus_algorithm, | 389 | .algo = &smbus_algorithm, |
388 | }; | 390 | }; |
@@ -396,6 +398,8 @@ static struct pci_device_id piix4_ids[] = { | |||
396 | .driver_data = 0 }, | 398 | .driver_data = 0 }, |
397 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS), | 399 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS), |
398 | .driver_data = 0 }, | 400 | .driver_data = 0 }, |
401 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SMBUS), | ||
402 | .driver_data = 0 }, | ||
399 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4), | 403 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4), |
400 | .driver_data = 0 }, | 404 | .driver_data = 0 }, |
401 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5), | 405 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5), |
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 648d55533d87..1425d2245c82 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/completion.h> | ||
29 | #include <linux/device.h> | 28 | #include <linux/device.h> |
30 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
31 | #include <asm/prom.h> | 30 | #include <asm/prom.h> |
diff --git a/drivers/i2c/busses/i2c-savage4.c b/drivers/i2c/busses/i2c-savage4.c index 844b4ff90893..b7fb65c30112 100644 --- a/drivers/i2c/busses/i2c-savage4.c +++ b/drivers/i2c/busses/i2c-savage4.c | |||
@@ -145,6 +145,7 @@ static struct i2c_algo_bit_data sav_i2c_bit_data = { | |||
145 | 145 | ||
146 | static struct i2c_adapter savage4_i2c_adapter = { | 146 | static struct i2c_adapter savage4_i2c_adapter = { |
147 | .owner = THIS_MODULE, | 147 | .owner = THIS_MODULE, |
148 | .id = I2C_HW_B_SAVAGE, | ||
148 | .name = "I2C Savage4 adapter", | 149 | .name = "I2C Savage4 adapter", |
149 | .algo_data = &sav_i2c_bit_data, | 150 | .algo_data = &sav_i2c_bit_data, |
150 | }; | 151 | }; |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index 38bbfd840b6b..d333babe4ad3 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -365,6 +365,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
365 | 365 | ||
366 | static struct i2c_adapter sis5595_adapter = { | 366 | static struct i2c_adapter sis5595_adapter = { |
367 | .owner = THIS_MODULE, | 367 | .owner = THIS_MODULE, |
368 | .id = I2C_HW_SMBUS_SIS5595, | ||
368 | .class = I2C_CLASS_HWMON, | 369 | .class = I2C_CLASS_HWMON, |
369 | .algo = &smbus_algorithm, | 370 | .algo = &smbus_algorithm, |
370 | }; | 371 | }; |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index dec0bafb52ab..172bacf932a6 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -457,6 +457,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
457 | 457 | ||
458 | static struct i2c_adapter sis630_adapter = { | 458 | static struct i2c_adapter sis630_adapter = { |
459 | .owner = THIS_MODULE, | 459 | .owner = THIS_MODULE, |
460 | .id = I2C_HW_SMBUS_SIS630, | ||
460 | .class = I2C_CLASS_HWMON, | 461 | .class = I2C_CLASS_HWMON, |
461 | .algo = &smbus_algorithm, | 462 | .algo = &smbus_algorithm, |
462 | }; | 463 | }; |
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index 7fd07fbac336..869a635d37e9 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c | |||
@@ -249,6 +249,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
249 | 249 | ||
250 | static struct i2c_adapter sis96x_adapter = { | 250 | static struct i2c_adapter sis96x_adapter = { |
251 | .owner = THIS_MODULE, | 251 | .owner = THIS_MODULE, |
252 | .id = I2C_HW_SMBUS_SIS96X, | ||
252 | .class = I2C_CLASS_HWMON, | 253 | .class = I2C_CLASS_HWMON, |
253 | .algo = &smbus_algorithm, | 254 | .algo = &smbus_algorithm, |
254 | }; | 255 | }; |
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c index 15d7e00e47e6..bbcc62151f7c 100644 --- a/drivers/i2c/busses/i2c-via.c +++ b/drivers/i2c/busses/i2c-via.c | |||
@@ -86,6 +86,7 @@ static struct i2c_algo_bit_data bit_data = { | |||
86 | 86 | ||
87 | static struct i2c_adapter vt586b_adapter = { | 87 | static struct i2c_adapter vt586b_adapter = { |
88 | .owner = THIS_MODULE, | 88 | .owner = THIS_MODULE, |
89 | .id = I2C_HW_B_VIA, | ||
89 | .class = I2C_CLASS_HWMON, | 90 | .class = I2C_CLASS_HWMON, |
90 | .name = "VIA i2c", | 91 | .name = "VIA i2c", |
91 | .algo_data = &bit_data, | 92 | .algo_data = &bit_data, |
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index efc6bbf0cc0a..03c5fc868548 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -4,7 +4,7 @@ | |||
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 | Copyright (C) 2005 Jean Delvare <khali@linux-fr.org> | 7 | Copyright (C) 2005 - 2007 Jean Delvare <khali@linux-fr.org> |
8 | 8 | ||
9 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | 10 | it under the terms of the GNU General Public License as published by |
@@ -36,6 +36,7 @@ | |||
36 | VT8237R 0x3227 yes | 36 | VT8237R 0x3227 yes |
37 | VT8237A 0x3337 yes | 37 | VT8237A 0x3337 yes |
38 | VT8251 0x3287 yes | 38 | VT8251 0x3287 yes |
39 | CX700 0x8324 yes | ||
39 | 40 | ||
40 | Note: we assume there can only be one device, with one SMBus interface. | 41 | Note: we assume there can only be one device, with one SMBus interface. |
41 | */ | 42 | */ |
@@ -306,6 +307,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
306 | 307 | ||
307 | static struct i2c_adapter vt596_adapter = { | 308 | static struct i2c_adapter vt596_adapter = { |
308 | .owner = THIS_MODULE, | 309 | .owner = THIS_MODULE, |
310 | .id = I2C_HW_SMBUS_VIA2, | ||
309 | .class = I2C_CLASS_HWMON, | 311 | .class = I2C_CLASS_HWMON, |
310 | .algo = &smbus_algorithm, | 312 | .algo = &smbus_algorithm, |
311 | }; | 313 | }; |
@@ -383,6 +385,7 @@ found: | |||
383 | dev_dbg(&pdev->dev, "VT596_smba = 0x%X\n", vt596_smba); | 385 | dev_dbg(&pdev->dev, "VT596_smba = 0x%X\n", vt596_smba); |
384 | 386 | ||
385 | switch (pdev->device) { | 387 | switch (pdev->device) { |
388 | case PCI_DEVICE_ID_VIA_CX700: | ||
386 | case PCI_DEVICE_ID_VIA_8251: | 389 | case PCI_DEVICE_ID_VIA_8251: |
387 | case PCI_DEVICE_ID_VIA_8237: | 390 | case PCI_DEVICE_ID_VIA_8237: |
388 | case PCI_DEVICE_ID_VIA_8237A: | 391 | case PCI_DEVICE_ID_VIA_8237A: |
@@ -442,6 +445,8 @@ static struct pci_device_id vt596_ids[] = { | |||
442 | .driver_data = SMBBA1 }, | 445 | .driver_data = SMBBA1 }, |
443 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8251), | 446 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8251), |
444 | .driver_data = SMBBA3 }, | 447 | .driver_data = SMBBA3 }, |
448 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_CX700), | ||
449 | .driver_data = SMBBA3 }, | ||
445 | { 0, } | 450 | { 0, } |
446 | }; | 451 | }; |
447 | 452 | ||
diff --git a/drivers/i2c/busses/i2c-voodoo3.c b/drivers/i2c/busses/i2c-voodoo3.c index b0377b81744b..88a3447e11e1 100644 --- a/drivers/i2c/busses/i2c-voodoo3.c +++ b/drivers/i2c/busses/i2c-voodoo3.c | |||
@@ -165,6 +165,7 @@ static struct i2c_algo_bit_data voo_i2c_bit_data = { | |||
165 | 165 | ||
166 | static struct i2c_adapter voodoo3_i2c_adapter = { | 166 | static struct i2c_adapter voodoo3_i2c_adapter = { |
167 | .owner = THIS_MODULE, | 167 | .owner = THIS_MODULE, |
168 | .id = I2C_HW_B_VOO, | ||
168 | .class = I2C_CLASS_TV_ANALOG, | 169 | .class = I2C_CLASS_TV_ANALOG, |
169 | .name = "I2C Voodoo3/Banshee adapter", | 170 | .name = "I2C Voodoo3/Banshee adapter", |
170 | .algo_data = &voo_i2c_bit_data, | 171 | .algo_data = &voo_i2c_bit_data, |
@@ -181,6 +182,7 @@ static struct i2c_algo_bit_data voo_ddc_bit_data = { | |||
181 | 182 | ||
182 | static struct i2c_adapter voodoo3_ddc_adapter = { | 183 | static struct i2c_adapter voodoo3_ddc_adapter = { |
183 | .owner = THIS_MODULE, | 184 | .owner = THIS_MODULE, |
185 | .id = I2C_HW_B_VOO, | ||
184 | .class = I2C_CLASS_DDC, | 186 | .class = I2C_CLASS_DDC, |
185 | .name = "DDC Voodoo3/Banshee adapter", | 187 | .name = "DDC Voodoo3/Banshee adapter", |
186 | .algo_data = &voo_ddc_bit_data, | 188 | .algo_data = &voo_ddc_bit_data, |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index 714bae780953..0b082c5a0195 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -428,7 +428,7 @@ static __init int scx200_acb_probe(struct scx200_acb_iface *iface) | |||
428 | } | 428 | } |
429 | 429 | ||
430 | static __init struct scx200_acb_iface *scx200_create_iface(const char *text, | 430 | static __init struct scx200_acb_iface *scx200_create_iface(const char *text, |
431 | int index) | 431 | struct device *dev, int index) |
432 | { | 432 | { |
433 | struct scx200_acb_iface *iface; | 433 | struct scx200_acb_iface *iface; |
434 | struct i2c_adapter *adapter; | 434 | struct i2c_adapter *adapter; |
@@ -446,6 +446,7 @@ static __init struct scx200_acb_iface *scx200_create_iface(const char *text, | |||
446 | adapter->id = I2C_HW_SMBUS_SCX200; | 446 | adapter->id = I2C_HW_SMBUS_SCX200; |
447 | adapter->algo = &scx200_acb_algorithm; | 447 | adapter->algo = &scx200_acb_algorithm; |
448 | adapter->class = I2C_CLASS_HWMON; | 448 | adapter->class = I2C_CLASS_HWMON; |
449 | adapter->dev.parent = dev; | ||
449 | 450 | ||
450 | mutex_init(&iface->mutex); | 451 | mutex_init(&iface->mutex); |
451 | 452 | ||
@@ -486,7 +487,7 @@ static __init int scx200_create_pci(const char *text, struct pci_dev *pdev, | |||
486 | struct scx200_acb_iface *iface; | 487 | struct scx200_acb_iface *iface; |
487 | int rc; | 488 | int rc; |
488 | 489 | ||
489 | iface = scx200_create_iface(text, 0); | 490 | iface = scx200_create_iface(text, &pdev->dev, 0); |
490 | 491 | ||
491 | if (iface == NULL) | 492 | if (iface == NULL) |
492 | return -ENOMEM; | 493 | return -ENOMEM; |
@@ -524,7 +525,7 @@ static int __init scx200_create_isa(const char *text, unsigned long base, | |||
524 | struct scx200_acb_iface *iface; | 525 | struct scx200_acb_iface *iface; |
525 | int rc; | 526 | int rc; |
526 | 527 | ||
527 | iface = scx200_create_iface(text, index); | 528 | iface = scx200_create_iface(text, NULL, index); |
528 | 529 | ||
529 | if (iface == NULL) | 530 | if (iface == NULL) |
530 | return -ENOMEM; | 531 | return -ENOMEM; |
diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c index 6cd96e43aa72..c3022a023449 100644 --- a/drivers/i2c/busses/scx200_i2c.c +++ b/drivers/i2c/busses/scx200_i2c.c | |||
@@ -81,6 +81,7 @@ static struct i2c_algo_bit_data scx200_i2c_data = { | |||
81 | 81 | ||
82 | static struct i2c_adapter scx200_i2c_ops = { | 82 | static struct i2c_adapter scx200_i2c_ops = { |
83 | .owner = THIS_MODULE, | 83 | .owner = THIS_MODULE, |
84 | .id = I2C_HW_B_SCX200, | ||
84 | .algo_data = &scx200_i2c_data, | 85 | .algo_data = &scx200_i2c_data, |
85 | .name = "NatSemi SCx200 I2C", | 86 | .name = "NatSemi SCx200 I2C", |
86 | }; | 87 | }; |