diff options
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/Kconfig | 33 | ||||
-rw-r--r-- | drivers/i2c/busses/Makefile | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-amd756.c | 5 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-au1550.c | 177 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-au1550.h | 32 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-bfin-twi.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-davinci.c | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 163 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-ibm_iic.c | 191 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-ibm_iic.h | 8 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-iop3xx.c | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-ixp4xx.c | 178 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 29 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-nforce2.c | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-omap.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-pasemi.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-piix4.c | 41 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 189 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-sibyte.c | 29 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-stub.c | 15 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-viapro.c | 11 |
21 files changed, 538 insertions, 575 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index c466c6cfc2e5..8d12b26bb6c6 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -182,7 +182,8 @@ config I2C_I801 | |||
182 | will be called i2c-i801. | 182 | will be called i2c-i801. |
183 | 183 | ||
184 | config I2C_I810 | 184 | config I2C_I810 |
185 | tristate "Intel 810/815" | 185 | tristate "Intel 810/815 (DEPRECATED)" |
186 | default n | ||
186 | depends on PCI | 187 | depends on PCI |
187 | select I2C_ALGOBIT | 188 | select I2C_ALGOBIT |
188 | help | 189 | help |
@@ -195,6 +196,8 @@ config I2C_I810 | |||
195 | i815 | 196 | i815 |
196 | i845G | 197 | i845G |
197 | 198 | ||
199 | This driver is deprecated in favor of the i810fb and intelfb drivers. | ||
200 | |||
198 | This driver can also be built as a module. If so, the module | 201 | This driver can also be built as a module. If so, the module |
199 | will be called i2c-i810. | 202 | will be called i2c-i810. |
200 | 203 | ||
@@ -259,20 +262,6 @@ config I2C_IOP3XX | |||
259 | This driver can also be built as a module. If so, the module | 262 | This driver can also be built as a module. If so, the module |
260 | will be called i2c-iop3xx. | 263 | will be called i2c-iop3xx. |
261 | 264 | ||
262 | config I2C_IXP4XX | ||
263 | tristate "IXP4xx GPIO-Based I2C Interface (DEPRECATED)" | ||
264 | depends on ARCH_IXP4XX | ||
265 | select I2C_ALGOBIT | ||
266 | help | ||
267 | Say Y here if you have an Intel IXP4xx(420,421,422,425) based | ||
268 | system and are using GPIO lines for an I2C bus. | ||
269 | |||
270 | This support is also available as a module. If so, the module | ||
271 | will be called i2c-ixp4xx. | ||
272 | |||
273 | This driver is deprecated and will be dropped soon. Use i2c-gpio | ||
274 | instead. | ||
275 | |||
276 | config I2C_IXP2000 | 265 | config I2C_IXP2000 |
277 | tristate "IXP2000 GPIO-Based I2C Interface (DEPRECATED)" | 266 | tristate "IXP2000 GPIO-Based I2C Interface (DEPRECATED)" |
278 | depends on ARCH_IXP2000 | 267 | depends on ARCH_IXP2000 |
@@ -396,7 +385,8 @@ config I2C_PASEMI | |||
396 | Supports the PA Semi PWRficient on-chip SMBus interfaces. | 385 | Supports the PA Semi PWRficient on-chip SMBus interfaces. |
397 | 386 | ||
398 | config I2C_PROSAVAGE | 387 | config I2C_PROSAVAGE |
399 | tristate "S3/VIA (Pro)Savage" | 388 | tristate "S3/VIA (Pro)Savage (DEPRECATED)" |
389 | default n | ||
400 | depends on PCI | 390 | depends on PCI |
401 | select I2C_ALGOBIT | 391 | select I2C_ALGOBIT |
402 | help | 392 | help |
@@ -407,6 +397,8 @@ config I2C_PROSAVAGE | |||
407 | S3/VIA KM266/VT8375 aka ProSavage8 | 397 | S3/VIA KM266/VT8375 aka ProSavage8 |
408 | S3/VIA KM133/VT8365 aka Savage4 | 398 | S3/VIA KM133/VT8365 aka Savage4 |
409 | 399 | ||
400 | This driver is deprecated in favor of the savagefb driver. | ||
401 | |||
410 | This support is also available as a module. If so, the module | 402 | This support is also available as a module. If so, the module |
411 | will be called i2c-prosavage. | 403 | will be called i2c-prosavage. |
412 | 404 | ||
@@ -418,13 +410,16 @@ config I2C_S3C2410 | |||
418 | Samsung S3C2410 based System-on-Chip devices. | 410 | Samsung S3C2410 based System-on-Chip devices. |
419 | 411 | ||
420 | config I2C_SAVAGE4 | 412 | config I2C_SAVAGE4 |
421 | tristate "S3 Savage 4" | 413 | tristate "S3 Savage 4 (DEPRECATED)" |
422 | depends on PCI && EXPERIMENTAL | 414 | default n |
415 | depends on PCI | ||
423 | select I2C_ALGOBIT | 416 | select I2C_ALGOBIT |
424 | help | 417 | help |
425 | If you say yes to this option, support will be included for the | 418 | If you say yes to this option, support will be included for the |
426 | S3 Savage 4 I2C interface. | 419 | S3 Savage 4 I2C interface. |
427 | 420 | ||
421 | This driver is deprecated in favor of the savagefb driver. | ||
422 | |||
428 | This driver can also be built as a module. If so, the module | 423 | This driver can also be built as a module. If so, the module |
429 | will be called i2c-savage4. | 424 | will be called i2c-savage4. |
430 | 425 | ||
@@ -611,7 +606,7 @@ config I2C_VIAPRO | |||
611 | VT8231 | 606 | VT8231 |
612 | VT8233/A | 607 | VT8233/A |
613 | VT8235 | 608 | VT8235 |
614 | VT8237R/A | 609 | VT8237R/A/S |
615 | VT8251 | 610 | VT8251 |
616 | CX700 | 611 | CX700 |
617 | 612 | ||
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 81d43c27cf93..ea7068f1eb6b 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -20,7 +20,6 @@ obj-$(CONFIG_I2C_I810) += i2c-i810.o | |||
20 | obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o | 20 | obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o |
21 | obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o | 21 | obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o |
22 | obj-$(CONFIG_I2C_IXP2000) += i2c-ixp2000.o | 22 | obj-$(CONFIG_I2C_IXP2000) += i2c-ixp2000.o |
23 | obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o | ||
24 | obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o | 23 | obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o |
25 | obj-$(CONFIG_I2C_MPC) += i2c-mpc.o | 24 | obj-$(CONFIG_I2C_MPC) += i2c-mpc.o |
26 | obj-$(CONFIG_I2C_MV64XXX) += i2c-mv64xxx.o | 25 | obj-$(CONFIG_I2C_MV64XXX) += i2c-mv64xxx.o |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 7490dc1771ae..573abe440842 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -334,6 +334,10 @@ static int __devinit amd756_probe(struct pci_dev *pdev, | |||
334 | int error; | 334 | int error; |
335 | u8 temp; | 335 | u8 temp; |
336 | 336 | ||
337 | /* driver_data might come from user-space, so check it */ | ||
338 | if (id->driver_data > ARRAY_SIZE(chipname)) | ||
339 | return -EINVAL; | ||
340 | |||
337 | if (amd756_ioport) { | 341 | if (amd756_ioport) { |
338 | dev_err(&pdev->dev, "Only one device supported " | 342 | dev_err(&pdev->dev, "Only one device supported " |
339 | "(you have a strange motherboard, btw)\n"); | 343 | "(you have a strange motherboard, btw)\n"); |
@@ -405,6 +409,7 @@ static struct pci_driver amd756_driver = { | |||
405 | .id_table = amd756_ids, | 409 | .id_table = amd756_ids, |
406 | .probe = amd756_probe, | 410 | .probe = amd756_probe, |
407 | .remove = __devexit_p(amd756_remove), | 411 | .remove = __devexit_p(amd756_remove), |
412 | .dynids.use_driver_data = 1, | ||
408 | }; | 413 | }; |
409 | 414 | ||
410 | static int __init amd756_init(void) | 415 | static int __init amd756_init(void) |
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c index 2f684166c43d..1953b26da56a 100644 --- a/drivers/i2c/busses/i2c-au1550.c +++ b/drivers/i2c/busses/i2c-au1550.c | |||
@@ -30,14 +30,22 @@ | |||
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/platform_device.h> | ||
33 | #include <linux/init.h> | 34 | #include <linux/init.h> |
34 | #include <linux/errno.h> | 35 | #include <linux/errno.h> |
35 | #include <linux/i2c.h> | 36 | #include <linux/i2c.h> |
37 | #include <linux/slab.h> | ||
36 | 38 | ||
37 | #include <asm/mach-au1x00/au1xxx.h> | 39 | #include <asm/mach-au1x00/au1xxx.h> |
38 | #include <asm/mach-au1x00/au1xxx_psc.h> | 40 | #include <asm/mach-au1x00/au1xxx_psc.h> |
39 | 41 | ||
40 | #include "i2c-au1550.h" | 42 | struct i2c_au1550_data { |
43 | u32 psc_base; | ||
44 | int xfer_timeout; | ||
45 | int ack_timeout; | ||
46 | struct i2c_adapter adap; | ||
47 | struct resource *ioarea; | ||
48 | }; | ||
41 | 49 | ||
42 | static int | 50 | static int |
43 | wait_xfer_done(struct i2c_au1550_data *adap) | 51 | wait_xfer_done(struct i2c_au1550_data *adap) |
@@ -105,7 +113,7 @@ wait_master_done(struct i2c_au1550_data *adap) | |||
105 | } | 113 | } |
106 | 114 | ||
107 | static int | 115 | static int |
108 | do_address(struct i2c_au1550_data *adap, unsigned int addr, int rd) | 116 | do_address(struct i2c_au1550_data *adap, unsigned int addr, int rd, int q) |
109 | { | 117 | { |
110 | volatile psc_smb_t *sp; | 118 | volatile psc_smb_t *sp; |
111 | u32 stat; | 119 | u32 stat; |
@@ -134,6 +142,10 @@ do_address(struct i2c_au1550_data *adap, unsigned int addr, int rd) | |||
134 | if (rd) | 142 | if (rd) |
135 | addr |= 1; | 143 | addr |= 1; |
136 | 144 | ||
145 | /* zero-byte xfers stop immediately */ | ||
146 | if (q) | ||
147 | addr |= PSC_SMBTXRX_STP; | ||
148 | |||
137 | /* Put byte into fifo, start up master. | 149 | /* Put byte into fifo, start up master. |
138 | */ | 150 | */ |
139 | sp->psc_smbtxrx = addr; | 151 | sp->psc_smbtxrx = addr; |
@@ -142,7 +154,7 @@ do_address(struct i2c_au1550_data *adap, unsigned int addr, int rd) | |||
142 | au_sync(); | 154 | au_sync(); |
143 | if (wait_ack(adap)) | 155 | if (wait_ack(adap)) |
144 | return -EIO; | 156 | return -EIO; |
145 | return 0; | 157 | return (q) ? wait_master_done(adap) : 0; |
146 | } | 158 | } |
147 | 159 | ||
148 | static u32 | 160 | static u32 |
@@ -262,7 +274,8 @@ au1550_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) | |||
262 | 274 | ||
263 | for (i = 0; !err && i < num; i++) { | 275 | for (i = 0; !err && i < num; i++) { |
264 | p = &msgs[i]; | 276 | p = &msgs[i]; |
265 | err = do_address(adap, p->addr, p->flags & I2C_M_RD); | 277 | err = do_address(adap, p->addr, p->flags & I2C_M_RD, |
278 | (p->len == 0)); | ||
266 | if (err || !p->len) | 279 | if (err || !p->len) |
267 | continue; | 280 | continue; |
268 | if (p->flags & I2C_M_RD) | 281 | if (p->flags & I2C_M_RD) |
@@ -294,18 +307,48 @@ static const struct i2c_algorithm au1550_algo = { | |||
294 | * Prior to calling us, the 50MHz clock frequency and routing | 307 | * Prior to calling us, the 50MHz clock frequency and routing |
295 | * must have been set up for the PSC indicated by the adapter. | 308 | * must have been set up for the PSC indicated by the adapter. |
296 | */ | 309 | */ |
297 | int | 310 | static int __devinit |
298 | i2c_au1550_add_bus(struct i2c_adapter *i2c_adap) | 311 | i2c_au1550_probe(struct platform_device *pdev) |
299 | { | 312 | { |
300 | struct i2c_au1550_data *adap = i2c_adap->algo_data; | 313 | struct i2c_au1550_data *priv; |
301 | volatile psc_smb_t *sp; | 314 | volatile psc_smb_t *sp; |
302 | u32 stat; | 315 | struct resource *r; |
316 | u32 stat; | ||
317 | int ret; | ||
318 | |||
319 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
320 | if (!r) { | ||
321 | ret = -ENODEV; | ||
322 | goto out; | ||
323 | } | ||
324 | |||
325 | priv = kzalloc(sizeof(struct i2c_au1550_data), GFP_KERNEL); | ||
326 | if (!priv) { | ||
327 | ret = -ENOMEM; | ||
328 | goto out; | ||
329 | } | ||
330 | |||
331 | priv->ioarea = request_mem_region(r->start, r->end - r->start + 1, | ||
332 | pdev->name); | ||
333 | if (!priv->ioarea) { | ||
334 | ret = -EBUSY; | ||
335 | goto out_mem; | ||
336 | } | ||
303 | 337 | ||
304 | i2c_adap->algo = &au1550_algo; | 338 | priv->psc_base = r->start; |
339 | priv->xfer_timeout = 200; | ||
340 | priv->ack_timeout = 200; | ||
341 | |||
342 | priv->adap.id = I2C_HW_AU1550_PSC; | ||
343 | priv->adap.nr = pdev->id; | ||
344 | priv->adap.algo = &au1550_algo; | ||
345 | priv->adap.algo_data = priv; | ||
346 | priv->adap.dev.parent = &pdev->dev; | ||
347 | strlcpy(priv->adap.name, "Au1xxx PSC I2C", sizeof(priv->adap.name)); | ||
305 | 348 | ||
306 | /* Now, set up the PSC for SMBus PIO mode. | 349 | /* Now, set up the PSC for SMBus PIO mode. |
307 | */ | 350 | */ |
308 | sp = (volatile psc_smb_t *)(adap->psc_base); | 351 | sp = (volatile psc_smb_t *)priv->psc_base; |
309 | sp->psc_ctrl = PSC_CTRL_DISABLE; | 352 | sp->psc_ctrl = PSC_CTRL_DISABLE; |
310 | au_sync(); | 353 | au_sync(); |
311 | sp->psc_sel = PSC_SEL_PS_SMBUSMODE; | 354 | sp->psc_sel = PSC_SEL_PS_SMBUSMODE; |
@@ -343,87 +386,87 @@ i2c_au1550_add_bus(struct i2c_adapter *i2c_adap) | |||
343 | au_sync(); | 386 | au_sync(); |
344 | } while ((stat & PSC_SMBSTAT_DR) == 0); | 387 | } while ((stat & PSC_SMBSTAT_DR) == 0); |
345 | 388 | ||
346 | return i2c_add_adapter(i2c_adap); | 389 | ret = i2c_add_numbered_adapter(&priv->adap); |
347 | } | 390 | if (ret == 0) { |
391 | platform_set_drvdata(pdev, priv); | ||
392 | return 0; | ||
393 | } | ||
348 | 394 | ||
395 | /* disable the PSC */ | ||
396 | sp->psc_smbcfg = 0; | ||
397 | sp->psc_ctrl = PSC_CTRL_DISABLE; | ||
398 | au_sync(); | ||
349 | 399 | ||
350 | int | 400 | release_resource(priv->ioarea); |
351 | i2c_au1550_del_bus(struct i2c_adapter *adap) | 401 | kfree(priv->ioarea); |
402 | out_mem: | ||
403 | kfree(priv); | ||
404 | out: | ||
405 | return ret; | ||
406 | } | ||
407 | |||
408 | static int __devexit | ||
409 | i2c_au1550_remove(struct platform_device *pdev) | ||
352 | { | 410 | { |
353 | return i2c_del_adapter(adap); | 411 | struct i2c_au1550_data *priv = platform_get_drvdata(pdev); |
412 | volatile psc_smb_t *sp = (volatile psc_smb_t *)priv->psc_base; | ||
413 | |||
414 | platform_set_drvdata(pdev, NULL); | ||
415 | i2c_del_adapter(&priv->adap); | ||
416 | sp->psc_smbcfg = 0; | ||
417 | sp->psc_ctrl = PSC_CTRL_DISABLE; | ||
418 | au_sync(); | ||
419 | release_resource(priv->ioarea); | ||
420 | kfree(priv->ioarea); | ||
421 | kfree(priv); | ||
422 | return 0; | ||
354 | } | 423 | } |
355 | 424 | ||
356 | static int | 425 | static int |
357 | pb1550_reg(struct i2c_client *client) | 426 | i2c_au1550_suspend(struct platform_device *pdev, pm_message_t state) |
358 | { | 427 | { |
428 | struct i2c_au1550_data *priv = platform_get_drvdata(pdev); | ||
429 | volatile psc_smb_t *sp = (volatile psc_smb_t *)priv->psc_base; | ||
430 | |||
431 | sp->psc_ctrl = PSC_CTRL_SUSPEND; | ||
432 | au_sync(); | ||
359 | return 0; | 433 | return 0; |
360 | } | 434 | } |
361 | 435 | ||
362 | static int | 436 | static int |
363 | pb1550_unreg(struct i2c_client *client) | 437 | i2c_au1550_resume(struct platform_device *pdev) |
364 | { | 438 | { |
439 | struct i2c_au1550_data *priv = platform_get_drvdata(pdev); | ||
440 | volatile psc_smb_t *sp = (volatile psc_smb_t *)priv->psc_base; | ||
441 | |||
442 | sp->psc_ctrl = PSC_CTRL_ENABLE; | ||
443 | au_sync(); | ||
444 | while (!(sp->psc_smbstat & PSC_SMBSTAT_SR)) | ||
445 | au_sync(); | ||
365 | return 0; | 446 | return 0; |
366 | } | 447 | } |
367 | 448 | ||
368 | static struct i2c_au1550_data pb1550_i2c_info = { | 449 | static struct platform_driver au1xpsc_smbus_driver = { |
369 | SMBUS_PSC_BASE, 200, 200 | 450 | .driver = { |
370 | }; | 451 | .name = "au1xpsc_smbus", |
371 | 452 | .owner = THIS_MODULE, | |
372 | static struct i2c_adapter pb1550_board_adapter = { | 453 | }, |
373 | name: "pb1550 adapter", | 454 | .probe = i2c_au1550_probe, |
374 | id: I2C_HW_AU1550_PSC, | 455 | .remove = __devexit_p(i2c_au1550_remove), |
375 | algo: NULL, | 456 | .suspend = i2c_au1550_suspend, |
376 | algo_data: &pb1550_i2c_info, | 457 | .resume = i2c_au1550_resume, |
377 | client_register: pb1550_reg, | ||
378 | client_unregister: pb1550_unreg, | ||
379 | }; | 458 | }; |
380 | 459 | ||
381 | /* BIG hack to support the control interface on the Wolfson WM8731 | ||
382 | * audio codec on the Pb1550 board. We get an address and two data | ||
383 | * bytes to write, create an i2c message, and send it across the | ||
384 | * i2c transfer function. We do this here because we have access to | ||
385 | * the i2c adapter structure. | ||
386 | */ | ||
387 | static struct i2c_msg wm_i2c_msg; /* We don't want this stuff on the stack */ | ||
388 | static u8 i2cbuf[2]; | ||
389 | |||
390 | int | ||
391 | pb1550_wm_codec_write(u8 addr, u8 reg, u8 val) | ||
392 | { | ||
393 | wm_i2c_msg.addr = addr; | ||
394 | wm_i2c_msg.flags = 0; | ||
395 | wm_i2c_msg.buf = i2cbuf; | ||
396 | wm_i2c_msg.len = 2; | ||
397 | i2cbuf[0] = reg; | ||
398 | i2cbuf[1] = val; | ||
399 | |||
400 | return pb1550_board_adapter.algo->master_xfer(&pb1550_board_adapter, &wm_i2c_msg, 1); | ||
401 | } | ||
402 | |||
403 | static int __init | 460 | static int __init |
404 | i2c_au1550_init(void) | 461 | i2c_au1550_init(void) |
405 | { | 462 | { |
406 | printk(KERN_INFO "Au1550 I2C: "); | 463 | return platform_driver_register(&au1xpsc_smbus_driver); |
407 | |||
408 | /* This is where we would set up a 50MHz clock source | ||
409 | * and routing. On the Pb1550, the SMBus is PSC2, which | ||
410 | * uses a shared clock with USB. This has been already | ||
411 | * configured by Yamon as a 48MHz clock, close enough | ||
412 | * for our work. | ||
413 | */ | ||
414 | if (i2c_au1550_add_bus(&pb1550_board_adapter) < 0) { | ||
415 | printk("failed to initialize.\n"); | ||
416 | return -ENODEV; | ||
417 | } | ||
418 | |||
419 | printk("initialized.\n"); | ||
420 | return 0; | ||
421 | } | 464 | } |
422 | 465 | ||
423 | static void __exit | 466 | static void __exit |
424 | i2c_au1550_exit(void) | 467 | i2c_au1550_exit(void) |
425 | { | 468 | { |
426 | i2c_au1550_del_bus(&pb1550_board_adapter); | 469 | platform_driver_unregister(&au1xpsc_smbus_driver); |
427 | } | 470 | } |
428 | 471 | ||
429 | MODULE_AUTHOR("Dan Malek, Embedded Edge, LLC."); | 472 | MODULE_AUTHOR("Dan Malek, Embedded Edge, LLC."); |
diff --git a/drivers/i2c/busses/i2c-au1550.h b/drivers/i2c/busses/i2c-au1550.h deleted file mode 100644 index fce15d161ae7..000000000000 --- a/drivers/i2c/busses/i2c-au1550.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Embedded Edge, LLC <dan@embeddededge.com> | ||
3 | * 2.6 port by Matt Porter <mporter@kernel.crashing.org> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef I2C_AU1550_H | ||
21 | #define I2C_AU1550_H | ||
22 | |||
23 | struct i2c_au1550_data { | ||
24 | u32 psc_base; | ||
25 | int xfer_timeout; | ||
26 | int ack_timeout; | ||
27 | }; | ||
28 | |||
29 | int i2c_au1550_add_bus(struct i2c_adapter *); | ||
30 | int i2c_au1550_del_bus(struct i2c_adapter *); | ||
31 | |||
32 | #endif /* I2C_AU1550_H */ | ||
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index 67224a424aba..7dbdaeb707a9 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c | |||
@@ -550,6 +550,7 @@ static int i2c_bfin_twi_probe(struct platform_device *dev) | |||
550 | 550 | ||
551 | p_adap = &iface->adap; | 551 | p_adap = &iface->adap; |
552 | p_adap->id = I2C_HW_BLACKFIN; | 552 | p_adap->id = I2C_HW_BLACKFIN; |
553 | p_adap->nr = dev->id; | ||
553 | strlcpy(p_adap->name, dev->name, sizeof(p_adap->name)); | 554 | strlcpy(p_adap->name, dev->name, sizeof(p_adap->name)); |
554 | p_adap->algo = &bfin_twi_algorithm; | 555 | p_adap->algo = &bfin_twi_algorithm; |
555 | p_adap->algo_data = iface; | 556 | p_adap->algo_data = iface; |
@@ -576,7 +577,7 @@ static int i2c_bfin_twi_probe(struct platform_device *dev) | |||
576 | bfin_write_TWI_CONTROL(bfin_read_TWI_CONTROL() | TWI_ENA); | 577 | bfin_write_TWI_CONTROL(bfin_read_TWI_CONTROL() | TWI_ENA); |
577 | SSYNC(); | 578 | SSYNC(); |
578 | 579 | ||
579 | rc = i2c_add_adapter(p_adap); | 580 | rc = i2c_add_numbered_adapter(p_adap); |
580 | if (rc < 0) | 581 | if (rc < 0) |
581 | free_irq(iface->irq, iface); | 582 | free_irq(iface->irq, iface); |
582 | else | 583 | else |
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 67679882ebef..cce5a614758d 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -510,7 +510,6 @@ static int davinci_i2c_probe(struct platform_device *pdev) | |||
510 | 510 | ||
511 | /* FIXME */ | 511 | /* FIXME */ |
512 | adap->timeout = 1; | 512 | adap->timeout = 1; |
513 | adap->retries = 1; | ||
514 | 513 | ||
515 | adap->nr = pdev->id; | 514 | adap->nr = pdev->id; |
516 | r = i2c_add_numbered_adapter(adap); | 515 | r = i2c_add_numbered_adapter(adap); |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index ac27e5f84ebe..aa9157913b9a 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -4,6 +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>, and Mark D. Studebaker | 5 | Philip Edelbrock <phil@netroedge.com>, and Mark D. Studebaker |
6 | <mdsxyz123@yahoo.com> | 6 | <mdsxyz123@yahoo.com> |
7 | Copyright (C) 2007 Jean Delvare <khali@linux-fr.org> | ||
7 | 8 | ||
8 | 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 |
9 | 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 |
@@ -21,25 +22,34 @@ | |||
21 | */ | 22 | */ |
22 | 23 | ||
23 | /* | 24 | /* |
24 | SUPPORTED DEVICES PCI ID | 25 | Supports the following Intel I/O Controller Hubs (ICH): |
25 | 82801AA 2413 | 26 | |
26 | 82801AB 2423 | 27 | I/O Block I2C |
27 | 82801BA 2443 | 28 | region SMBus Block proc. block |
28 | 82801CA/CAM 2483 | 29 | Chip name PCI ID size PEC buffer call read |
29 | 82801DB 24C3 (HW PEC supported) | 30 | ---------------------------------------------------------------------- |
30 | 82801EB 24D3 (HW PEC supported) | 31 | 82801AA (ICH) 0x2413 16 no no no no |
31 | 6300ESB 25A4 | 32 | 82801AB (ICH0) 0x2423 16 no no no no |
32 | ICH6 266A | 33 | 82801BA (ICH2) 0x2443 16 no no no no |
33 | ICH7 27DA | 34 | 82801CA (ICH3) 0x2483 32 soft no no no |
34 | ESB2 269B | 35 | 82801DB (ICH4) 0x24c3 32 hard yes no no |
35 | ICH8 283E | 36 | 82801E (ICH5) 0x24d3 32 hard yes yes yes |
36 | ICH9 2930 | 37 | 6300ESB 0x25a4 32 hard yes yes yes |
37 | Tolapai 5032 | 38 | 82801F (ICH6) 0x266a 32 hard yes yes yes |
38 | This driver supports several versions of Intel's I/O Controller Hubs (ICH). | 39 | 6310ESB/6320ESB 0x269b 32 hard yes yes yes |
39 | For SMBus support, they are similar to the PIIX4 and are part | 40 | 82801G (ICH7) 0x27da 32 hard yes yes yes |
40 | of Intel's '810' and other chipsets. | 41 | 82801H (ICH8) 0x283e 32 hard yes yes yes |
41 | See the file Documentation/i2c/busses/i2c-i801 for details. | 42 | 82801I (ICH9) 0x2930 32 hard yes yes yes |
42 | I2C Block Read and Process Call are not supported. | 43 | Tolapai 0x5032 32 hard yes ? ? |
44 | |||
45 | Features supported by this driver: | ||
46 | Software PEC no | ||
47 | Hardware PEC yes | ||
48 | Block buffer yes | ||
49 | Block process call transaction no | ||
50 | I2C block read transaction yes (doesn't use the block buffer) | ||
51 | |||
52 | See the file Documentation/i2c/busses/i2c-i801 for details. | ||
43 | */ | 53 | */ |
44 | 54 | ||
45 | /* Note: we assume there can only be one I801, with one SMBus interface */ | 55 | /* Note: we assume there can only be one I801, with one SMBus interface */ |
@@ -62,9 +72,9 @@ | |||
62 | #define SMBHSTDAT0 (5 + i801_smba) | 72 | #define SMBHSTDAT0 (5 + i801_smba) |
63 | #define SMBHSTDAT1 (6 + i801_smba) | 73 | #define SMBHSTDAT1 (6 + i801_smba) |
64 | #define SMBBLKDAT (7 + i801_smba) | 74 | #define SMBBLKDAT (7 + i801_smba) |
65 | #define SMBPEC (8 + i801_smba) /* ICH4 only */ | 75 | #define SMBPEC (8 + i801_smba) /* ICH3 and later */ |
66 | #define SMBAUXSTS (12 + i801_smba) /* ICH4 only */ | 76 | #define SMBAUXSTS (12 + i801_smba) /* ICH4 and later */ |
67 | #define SMBAUXCTL (13 + i801_smba) /* ICH4 only */ | 77 | #define SMBAUXCTL (13 + i801_smba) /* ICH4 and later */ |
68 | 78 | ||
69 | /* PCI Address Constants */ | 79 | /* PCI Address Constants */ |
70 | #define SMBBAR 4 | 80 | #define SMBBAR 4 |
@@ -91,13 +101,13 @@ | |||
91 | #define I801_BYTE 0x04 | 101 | #define I801_BYTE 0x04 |
92 | #define I801_BYTE_DATA 0x08 | 102 | #define I801_BYTE_DATA 0x08 |
93 | #define I801_WORD_DATA 0x0C | 103 | #define I801_WORD_DATA 0x0C |
94 | #define I801_PROC_CALL 0x10 /* later chips only, unimplemented */ | 104 | #define I801_PROC_CALL 0x10 /* unimplemented */ |
95 | #define I801_BLOCK_DATA 0x14 | 105 | #define I801_BLOCK_DATA 0x14 |
96 | #define I801_I2C_BLOCK_DATA 0x18 /* unimplemented */ | 106 | #define I801_I2C_BLOCK_DATA 0x18 /* ICH5 and later */ |
97 | #define I801_BLOCK_LAST 0x34 | 107 | #define I801_BLOCK_LAST 0x34 |
98 | #define I801_I2C_BLOCK_LAST 0x38 /* unimplemented */ | 108 | #define I801_I2C_BLOCK_LAST 0x38 /* ICH5 and later */ |
99 | #define I801_START 0x40 | 109 | #define I801_START 0x40 |
100 | #define I801_PEC_EN 0x80 /* ICH4 only */ | 110 | #define I801_PEC_EN 0x80 /* ICH3 and later */ |
101 | 111 | ||
102 | /* I801 Hosts Status register bits */ | 112 | /* I801 Hosts Status register bits */ |
103 | #define SMBHSTSTS_BYTE_DONE 0x80 | 113 | #define SMBHSTSTS_BYTE_DONE 0x80 |
@@ -113,7 +123,12 @@ static unsigned long i801_smba; | |||
113 | static unsigned char i801_original_hstcfg; | 123 | static unsigned char i801_original_hstcfg; |
114 | static struct pci_driver i801_driver; | 124 | static struct pci_driver i801_driver; |
115 | static struct pci_dev *I801_dev; | 125 | static struct pci_dev *I801_dev; |
116 | static int isich4; | 126 | |
127 | #define FEATURE_SMBUS_PEC (1 << 0) | ||
128 | #define FEATURE_BLOCK_BUFFER (1 << 1) | ||
129 | #define FEATURE_BLOCK_PROC (1 << 2) | ||
130 | #define FEATURE_I2C_BLOCK_READ (1 << 3) | ||
131 | static unsigned int i801_features; | ||
117 | 132 | ||
118 | static int i801_transaction(int xact) | 133 | static int i801_transaction(int xact) |
119 | { | 134 | { |
@@ -242,7 +257,8 @@ static int i801_block_transaction_by_block(union i2c_smbus_data *data, | |||
242 | } | 257 | } |
243 | 258 | ||
244 | static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data, | 259 | static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data, |
245 | char read_write, int hwpec) | 260 | char read_write, int command, |
261 | int hwpec) | ||
246 | { | 262 | { |
247 | int i, len; | 263 | int i, len; |
248 | int smbcmd; | 264 | int smbcmd; |
@@ -259,16 +275,24 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data, | |||
259 | } | 275 | } |
260 | 276 | ||
261 | for (i = 1; i <= len; i++) { | 277 | for (i = 1; i <= len; i++) { |
262 | if (i == len && read_write == I2C_SMBUS_READ) | 278 | if (i == len && read_write == I2C_SMBUS_READ) { |
263 | smbcmd = I801_BLOCK_LAST; | 279 | if (command == I2C_SMBUS_I2C_BLOCK_DATA) |
264 | else | 280 | smbcmd = I801_I2C_BLOCK_LAST; |
265 | smbcmd = I801_BLOCK_DATA; | 281 | else |
282 | smbcmd = I801_BLOCK_LAST; | ||
283 | } else { | ||
284 | if (command == I2C_SMBUS_I2C_BLOCK_DATA | ||
285 | && read_write == I2C_SMBUS_READ) | ||
286 | smbcmd = I801_I2C_BLOCK_DATA; | ||
287 | else | ||
288 | smbcmd = I801_BLOCK_DATA; | ||
289 | } | ||
266 | outb_p(smbcmd | ENABLE_INT9, SMBHSTCNT); | 290 | outb_p(smbcmd | ENABLE_INT9, SMBHSTCNT); |
267 | 291 | ||
268 | dev_dbg(&I801_dev->dev, "Block (pre %d): CNT=%02x, CMD=%02x, " | 292 | dev_dbg(&I801_dev->dev, "Block (pre %d): CNT=%02x, CMD=%02x, " |
269 | "ADD=%02x, DAT0=%02x, BLKDAT=%02x\n", i, | 293 | "ADD=%02x, DAT0=%02x, DAT1=%02x, BLKDAT=%02x\n", i, |
270 | inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD), | 294 | inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD), |
271 | inb_p(SMBHSTDAT0), inb_p(SMBBLKDAT)); | 295 | inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1), inb_p(SMBBLKDAT)); |
272 | 296 | ||
273 | /* Make sure the SMBus host is ready to start transmitting */ | 297 | /* Make sure the SMBus host is ready to start transmitting */ |
274 | temp = inb_p(SMBHSTSTS); | 298 | temp = inb_p(SMBHSTSTS); |
@@ -332,7 +356,8 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data, | |||
332 | dev_dbg(&I801_dev->dev, "Error: no response!\n"); | 356 | dev_dbg(&I801_dev->dev, "Error: no response!\n"); |
333 | } | 357 | } |
334 | 358 | ||
335 | if (i == 1 && read_write == I2C_SMBUS_READ) { | 359 | if (i == 1 && read_write == I2C_SMBUS_READ |
360 | && command != I2C_SMBUS_I2C_BLOCK_DATA) { | ||
336 | len = inb_p(SMBHSTDAT0); | 361 | len = inb_p(SMBHSTDAT0); |
337 | if (len < 1 || len > I2C_SMBUS_BLOCK_MAX) | 362 | if (len < 1 || len > I2C_SMBUS_BLOCK_MAX) |
338 | return -1; | 363 | return -1; |
@@ -353,9 +378,9 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data, | |||
353 | temp); | 378 | temp); |
354 | } | 379 | } |
355 | dev_dbg(&I801_dev->dev, "Block (post %d): CNT=%02x, CMD=%02x, " | 380 | dev_dbg(&I801_dev->dev, "Block (post %d): CNT=%02x, CMD=%02x, " |
356 | "ADD=%02x, DAT0=%02x, BLKDAT=%02x\n", i, | 381 | "ADD=%02x, DAT0=%02x, DAT1=%02x, BLKDAT=%02x\n", i, |
357 | inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD), | 382 | inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD), |
358 | inb_p(SMBHSTDAT0), inb_p(SMBBLKDAT)); | 383 | inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1), inb_p(SMBBLKDAT)); |
359 | 384 | ||
360 | if (result < 0) | 385 | if (result < 0) |
361 | return result; | 386 | return result; |
@@ -384,33 +409,38 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, | |||
384 | pci_read_config_byte(I801_dev, SMBHSTCFG, &hostc); | 409 | pci_read_config_byte(I801_dev, SMBHSTCFG, &hostc); |
385 | pci_write_config_byte(I801_dev, SMBHSTCFG, | 410 | pci_write_config_byte(I801_dev, SMBHSTCFG, |
386 | hostc | SMBHSTCFG_I2C_EN); | 411 | hostc | SMBHSTCFG_I2C_EN); |
387 | } else { | 412 | } else if (!(i801_features & FEATURE_I2C_BLOCK_READ)) { |
388 | dev_err(&I801_dev->dev, | 413 | dev_err(&I801_dev->dev, |
389 | "I2C_SMBUS_I2C_BLOCK_READ not DB!\n"); | 414 | "I2C block read is unsupported!\n"); |
390 | return -1; | 415 | return -1; |
391 | } | 416 | } |
392 | } | 417 | } |
393 | 418 | ||
394 | if (read_write == I2C_SMBUS_WRITE) { | 419 | if (read_write == I2C_SMBUS_WRITE |
420 | || command == I2C_SMBUS_I2C_BLOCK_DATA) { | ||
395 | if (data->block[0] < 1) | 421 | if (data->block[0] < 1) |
396 | data->block[0] = 1; | 422 | data->block[0] = 1; |
397 | if (data->block[0] > I2C_SMBUS_BLOCK_MAX) | 423 | if (data->block[0] > I2C_SMBUS_BLOCK_MAX) |
398 | data->block[0] = I2C_SMBUS_BLOCK_MAX; | 424 | data->block[0] = I2C_SMBUS_BLOCK_MAX; |
399 | } else { | 425 | } else { |
400 | data->block[0] = 32; /* max for reads */ | 426 | data->block[0] = 32; /* max for SMBus block reads */ |
401 | } | 427 | } |
402 | 428 | ||
403 | if (isich4 && i801_set_block_buffer_mode() == 0 ) | 429 | if ((i801_features & FEATURE_BLOCK_BUFFER) |
430 | && !(command == I2C_SMBUS_I2C_BLOCK_DATA | ||
431 | && read_write == I2C_SMBUS_READ) | ||
432 | && i801_set_block_buffer_mode() == 0) | ||
404 | result = i801_block_transaction_by_block(data, read_write, | 433 | result = i801_block_transaction_by_block(data, read_write, |
405 | hwpec); | 434 | hwpec); |
406 | else | 435 | else |
407 | result = i801_block_transaction_byte_by_byte(data, read_write, | 436 | result = i801_block_transaction_byte_by_byte(data, read_write, |
408 | hwpec); | 437 | command, hwpec); |
409 | 438 | ||
410 | if (result == 0 && hwpec) | 439 | if (result == 0 && hwpec) |
411 | i801_wait_hwpec(); | 440 | i801_wait_hwpec(); |
412 | 441 | ||
413 | if (command == I2C_SMBUS_I2C_BLOCK_DATA) { | 442 | if (command == I2C_SMBUS_I2C_BLOCK_DATA |
443 | && read_write == I2C_SMBUS_WRITE) { | ||
414 | /* restore saved configuration register value */ | 444 | /* restore saved configuration register value */ |
415 | pci_write_config_byte(I801_dev, SMBHSTCFG, hostc); | 445 | pci_write_config_byte(I801_dev, SMBHSTCFG, hostc); |
416 | } | 446 | } |
@@ -426,7 +456,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
426 | int block = 0; | 456 | int block = 0; |
427 | int ret, xact = 0; | 457 | int ret, xact = 0; |
428 | 458 | ||
429 | hwpec = isich4 && (flags & I2C_CLIENT_PEC) | 459 | hwpec = (i801_features & FEATURE_SMBUS_PEC) && (flags & I2C_CLIENT_PEC) |
430 | && size != I2C_SMBUS_QUICK | 460 | && size != I2C_SMBUS_QUICK |
431 | && size != I2C_SMBUS_I2C_BLOCK_DATA; | 461 | && size != I2C_SMBUS_I2C_BLOCK_DATA; |
432 | 462 | ||
@@ -462,12 +492,23 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
462 | xact = I801_WORD_DATA; | 492 | xact = I801_WORD_DATA; |
463 | break; | 493 | break; |
464 | case I2C_SMBUS_BLOCK_DATA: | 494 | case I2C_SMBUS_BLOCK_DATA: |
465 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
466 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | 495 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), |
467 | SMBHSTADD); | 496 | SMBHSTADD); |
468 | outb_p(command, SMBHSTCMD); | 497 | outb_p(command, SMBHSTCMD); |
469 | block = 1; | 498 | block = 1; |
470 | break; | 499 | break; |
500 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
501 | /* NB: page 240 of ICH5 datasheet shows that the R/#W | ||
502 | * bit should be cleared here, even when reading */ | ||
503 | outb_p((addr & 0x7f) << 1, SMBHSTADD); | ||
504 | if (read_write == I2C_SMBUS_READ) { | ||
505 | /* NB: page 240 of ICH5 datasheet also shows | ||
506 | * that DATA1 is the cmd field when reading */ | ||
507 | outb_p(command, SMBHSTDAT1); | ||
508 | } else | ||
509 | outb_p(command, SMBHSTCMD); | ||
510 | block = 1; | ||
511 | break; | ||
471 | case I2C_SMBUS_PROC_CALL: | 512 | case I2C_SMBUS_PROC_CALL: |
472 | default: | 513 | default: |
473 | dev_err(&I801_dev->dev, "Unsupported transaction %d\n", size); | 514 | dev_err(&I801_dev->dev, "Unsupported transaction %d\n", size); |
@@ -487,7 +528,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
487 | /* Some BIOSes don't like it when PEC is enabled at reboot or resume | 528 | /* Some BIOSes don't like it when PEC is enabled at reboot or resume |
488 | time, so we forcibly disable it after every transaction. Turn off | 529 | time, so we forcibly disable it after every transaction. Turn off |
489 | E32B for the same reason. */ | 530 | E32B for the same reason. */ |
490 | if (hwpec) | 531 | if (hwpec || block) |
491 | outb_p(inb_p(SMBAUXCTL) & ~(SMBAUXCTL_CRC | SMBAUXCTL_E32B), | 532 | outb_p(inb_p(SMBAUXCTL) & ~(SMBAUXCTL_CRC | SMBAUXCTL_E32B), |
492 | SMBAUXCTL); | 533 | SMBAUXCTL); |
493 | 534 | ||
@@ -514,9 +555,11 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
514 | static u32 i801_func(struct i2c_adapter *adapter) | 555 | static u32 i801_func(struct i2c_adapter *adapter) |
515 | { | 556 | { |
516 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 557 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
517 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | 558 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | |
518 | I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK | 559 | I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK | |
519 | | (isich4 ? I2C_FUNC_SMBUS_PEC : 0); | 560 | ((i801_features & FEATURE_SMBUS_PEC) ? I2C_FUNC_SMBUS_PEC : 0) | |
561 | ((i801_features & FEATURE_I2C_BLOCK_READ) ? | ||
562 | I2C_FUNC_SMBUS_READ_I2C_BLOCK : 0); | ||
520 | } | 563 | } |
521 | 564 | ||
522 | static const struct i2c_algorithm smbus_algorithm = { | 565 | static const struct i2c_algorithm smbus_algorithm = { |
@@ -556,8 +599,8 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id | |||
556 | int err; | 599 | int err; |
557 | 600 | ||
558 | I801_dev = dev; | 601 | I801_dev = dev; |
602 | i801_features = 0; | ||
559 | switch (dev->device) { | 603 | switch (dev->device) { |
560 | case PCI_DEVICE_ID_INTEL_82801DB_3: | ||
561 | case PCI_DEVICE_ID_INTEL_82801EB_3: | 604 | case PCI_DEVICE_ID_INTEL_82801EB_3: |
562 | case PCI_DEVICE_ID_INTEL_ESB_4: | 605 | case PCI_DEVICE_ID_INTEL_ESB_4: |
563 | case PCI_DEVICE_ID_INTEL_ICH6_16: | 606 | case PCI_DEVICE_ID_INTEL_ICH6_16: |
@@ -565,11 +608,13 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id | |||
565 | case PCI_DEVICE_ID_INTEL_ESB2_17: | 608 | case PCI_DEVICE_ID_INTEL_ESB2_17: |
566 | case PCI_DEVICE_ID_INTEL_ICH8_5: | 609 | case PCI_DEVICE_ID_INTEL_ICH8_5: |
567 | case PCI_DEVICE_ID_INTEL_ICH9_6: | 610 | case PCI_DEVICE_ID_INTEL_ICH9_6: |
611 | i801_features |= FEATURE_I2C_BLOCK_READ; | ||
612 | /* fall through */ | ||
613 | case PCI_DEVICE_ID_INTEL_82801DB_3: | ||
568 | case PCI_DEVICE_ID_INTEL_TOLAPAI_1: | 614 | case PCI_DEVICE_ID_INTEL_TOLAPAI_1: |
569 | isich4 = 1; | 615 | i801_features |= FEATURE_SMBUS_PEC; |
616 | i801_features |= FEATURE_BLOCK_BUFFER; | ||
570 | break; | 617 | break; |
571 | default: | ||
572 | isich4 = 0; | ||
573 | } | 618 | } |
574 | 619 | ||
575 | err = pci_enable_device(dev); | 620 | err = pci_enable_device(dev); |
@@ -610,6 +655,11 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id | |||
610 | else | 655 | else |
611 | dev_dbg(&dev->dev, "SMBus using PCI Interrupt\n"); | 656 | dev_dbg(&dev->dev, "SMBus using PCI Interrupt\n"); |
612 | 657 | ||
658 | /* Clear special mode bits */ | ||
659 | if (i801_features & (FEATURE_SMBUS_PEC | FEATURE_BLOCK_BUFFER)) | ||
660 | outb_p(inb_p(SMBAUXCTL) & ~(SMBAUXCTL_CRC | SMBAUXCTL_E32B), | ||
661 | SMBAUXCTL); | ||
662 | |||
613 | /* set up the sysfs linkage to our parent device */ | 663 | /* set up the sysfs linkage to our parent device */ |
614 | i801_adapter.dev.parent = &dev->dev; | 664 | i801_adapter.dev.parent = &dev->dev; |
615 | 665 | ||
@@ -678,9 +728,8 @@ static void __exit i2c_i801_exit(void) | |||
678 | pci_unregister_driver(&i801_driver); | 728 | pci_unregister_driver(&i801_driver); |
679 | } | 729 | } |
680 | 730 | ||
681 | MODULE_AUTHOR ("Frodo Looijaard <frodol@dds.nl>, " | 731 | MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>, " |
682 | "Philip Edelbrock <phil@netroedge.com>, " | 732 | "Jean Delvare <khali@linux-fr.org>"); |
683 | "and Mark D. Studebaker <mdsxyz123@yahoo.com>"); | ||
684 | MODULE_DESCRIPTION("I801 SMBus driver"); | 733 | MODULE_DESCRIPTION("I801 SMBus driver"); |
685 | MODULE_LICENSE("GPL"); | 734 | MODULE_LICENSE("GPL"); |
686 | 735 | ||
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 9b43ff7270d0..7c7eb0cfeceb 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (c) 2003, 2004 Zultys Technologies. | 6 | * Copyright (c) 2003, 2004 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 8 | * |
9 | * Based on original work by | 9 | * Based on original work by |
10 | * Ian DaSilva <idasilva@mvista.com> | 10 | * Ian DaSilva <idasilva@mvista.com> |
11 | * Armin Kuster <akuster@mvista.com> | 11 | * Armin Kuster <akuster@mvista.com> |
12 | * Matt Porter <mporter@mvista.com> | 12 | * Matt Porter <mporter@mvista.com> |
@@ -86,8 +86,8 @@ static void dump_iic_regs(const char* header, struct ibm_iic_private* dev) | |||
86 | KERN_DEBUG " sts = 0x%02x, extsts = 0x%02x\n" | 86 | KERN_DEBUG " sts = 0x%02x, extsts = 0x%02x\n" |
87 | KERN_DEBUG " clkdiv = 0x%02x, xfrcnt = 0x%02x\n" | 87 | KERN_DEBUG " clkdiv = 0x%02x, xfrcnt = 0x%02x\n" |
88 | KERN_DEBUG " xtcntlss = 0x%02x, directcntl = 0x%02x\n", | 88 | KERN_DEBUG " xtcntlss = 0x%02x, directcntl = 0x%02x\n", |
89 | in_8(&iic->cntl), in_8(&iic->mdcntl), in_8(&iic->sts), | 89 | in_8(&iic->cntl), in_8(&iic->mdcntl), in_8(&iic->sts), |
90 | in_8(&iic->extsts), in_8(&iic->clkdiv), in_8(&iic->xfrcnt), | 90 | in_8(&iic->extsts), in_8(&iic->clkdiv), in_8(&iic->xfrcnt), |
91 | in_8(&iic->xtcntlss), in_8(&iic->directcntl)); | 91 | in_8(&iic->xtcntlss), in_8(&iic->directcntl)); |
92 | } | 92 | } |
93 | # define DUMP_REGS(h,dev) dump_iic_regs((h),(dev)) | 93 | # define DUMP_REGS(h,dev) dump_iic_regs((h),(dev)) |
@@ -125,7 +125,7 @@ static inline void iic_interrupt_mode(struct ibm_iic_private* dev, int enable) | |||
125 | { | 125 | { |
126 | out_8(&dev->vaddr->intmsk, enable ? INTRMSK_EIMTC : 0); | 126 | out_8(&dev->vaddr->intmsk, enable ? INTRMSK_EIMTC : 0); |
127 | } | 127 | } |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * Initialize IIC interface. | 130 | * Initialize IIC interface. |
131 | */ | 131 | */ |
@@ -134,7 +134,7 @@ static void iic_dev_init(struct ibm_iic_private* dev) | |||
134 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 134 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
135 | 135 | ||
136 | DBG("%d: init\n", dev->idx); | 136 | DBG("%d: init\n", dev->idx); |
137 | 137 | ||
138 | /* Clear master address */ | 138 | /* Clear master address */ |
139 | out_8(&iic->lmadr, 0); | 139 | out_8(&iic->lmadr, 0); |
140 | out_8(&iic->hmadr, 0); | 140 | out_8(&iic->hmadr, 0); |
@@ -160,7 +160,7 @@ static void iic_dev_init(struct ibm_iic_private* dev) | |||
160 | 160 | ||
161 | /* Clear control register */ | 161 | /* Clear control register */ |
162 | out_8(&iic->cntl, 0); | 162 | out_8(&iic->cntl, 0); |
163 | 163 | ||
164 | /* Enable interrupts if possible */ | 164 | /* Enable interrupts if possible */ |
165 | iic_interrupt_mode(dev, dev->irq >= 0); | 165 | iic_interrupt_mode(dev, dev->irq >= 0); |
166 | 166 | ||
@@ -171,7 +171,7 @@ static void iic_dev_init(struct ibm_iic_private* dev) | |||
171 | DUMP_REGS("iic_init", dev); | 171 | DUMP_REGS("iic_init", dev); |
172 | } | 172 | } |
173 | 173 | ||
174 | /* | 174 | /* |
175 | * Reset IIC interface | 175 | * Reset IIC interface |
176 | */ | 176 | */ |
177 | static void iic_dev_reset(struct ibm_iic_private* dev) | 177 | static void iic_dev_reset(struct ibm_iic_private* dev) |
@@ -179,42 +179,42 @@ static void iic_dev_reset(struct ibm_iic_private* dev) | |||
179 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 179 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
180 | int i; | 180 | int i; |
181 | u8 dc; | 181 | u8 dc; |
182 | 182 | ||
183 | DBG("%d: soft reset\n", dev->idx); | 183 | DBG("%d: soft reset\n", dev->idx); |
184 | DUMP_REGS("reset", dev); | 184 | DUMP_REGS("reset", dev); |
185 | 185 | ||
186 | /* Place chip in the reset state */ | 186 | /* Place chip in the reset state */ |
187 | out_8(&iic->xtcntlss, XTCNTLSS_SRST); | 187 | out_8(&iic->xtcntlss, XTCNTLSS_SRST); |
188 | 188 | ||
189 | /* Check if bus is free */ | 189 | /* Check if bus is free */ |
190 | dc = in_8(&iic->directcntl); | 190 | dc = in_8(&iic->directcntl); |
191 | if (!DIRCTNL_FREE(dc)){ | 191 | if (!DIRCTNL_FREE(dc)){ |
192 | DBG("%d: trying to regain bus control\n", dev->idx); | 192 | DBG("%d: trying to regain bus control\n", dev->idx); |
193 | 193 | ||
194 | /* Try to set bus free state */ | 194 | /* Try to set bus free state */ |
195 | out_8(&iic->directcntl, DIRCNTL_SDAC | DIRCNTL_SCC); | 195 | out_8(&iic->directcntl, DIRCNTL_SDAC | DIRCNTL_SCC); |
196 | 196 | ||
197 | /* Wait until we regain bus control */ | 197 | /* Wait until we regain bus control */ |
198 | for (i = 0; i < 100; ++i){ | 198 | for (i = 0; i < 100; ++i){ |
199 | dc = in_8(&iic->directcntl); | 199 | dc = in_8(&iic->directcntl); |
200 | if (DIRCTNL_FREE(dc)) | 200 | if (DIRCTNL_FREE(dc)) |
201 | break; | 201 | break; |
202 | 202 | ||
203 | /* Toggle SCL line */ | 203 | /* Toggle SCL line */ |
204 | dc ^= DIRCNTL_SCC; | 204 | dc ^= DIRCNTL_SCC; |
205 | out_8(&iic->directcntl, dc); | 205 | out_8(&iic->directcntl, dc); |
206 | udelay(10); | 206 | udelay(10); |
207 | dc ^= DIRCNTL_SCC; | 207 | dc ^= DIRCNTL_SCC; |
208 | out_8(&iic->directcntl, dc); | 208 | out_8(&iic->directcntl, dc); |
209 | 209 | ||
210 | /* be nice */ | 210 | /* be nice */ |
211 | cond_resched(); | 211 | cond_resched(); |
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | /* Remove reset */ | 215 | /* Remove reset */ |
216 | out_8(&iic->xtcntlss, 0); | 216 | out_8(&iic->xtcntlss, 0); |
217 | 217 | ||
218 | /* Reinitialize interface */ | 218 | /* Reinitialize interface */ |
219 | iic_dev_init(dev); | 219 | iic_dev_init(dev); |
220 | } | 220 | } |
@@ -324,14 +324,14 @@ static irqreturn_t iic_handler(int irq, void *dev_id) | |||
324 | { | 324 | { |
325 | struct ibm_iic_private* dev = (struct ibm_iic_private*)dev_id; | 325 | struct ibm_iic_private* dev = (struct ibm_iic_private*)dev_id; |
326 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 326 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
327 | 327 | ||
328 | DBG2("%d: irq handler, STS = 0x%02x, EXTSTS = 0x%02x\n", | 328 | DBG2("%d: irq handler, STS = 0x%02x, EXTSTS = 0x%02x\n", |
329 | dev->idx, in_8(&iic->sts), in_8(&iic->extsts)); | 329 | dev->idx, in_8(&iic->sts), in_8(&iic->extsts)); |
330 | 330 | ||
331 | /* Acknowledge IRQ and wakeup iic_wait_for_tc */ | 331 | /* Acknowledge IRQ and wakeup iic_wait_for_tc */ |
332 | out_8(&iic->sts, STS_IRQA | STS_SCMP); | 332 | out_8(&iic->sts, STS_IRQA | STS_SCMP); |
333 | wake_up_interruptible(&dev->wq); | 333 | wake_up_interruptible(&dev->wq); |
334 | 334 | ||
335 | return IRQ_HANDLED; | 335 | return IRQ_HANDLED; |
336 | } | 336 | } |
337 | 337 | ||
@@ -341,19 +341,19 @@ static irqreturn_t iic_handler(int irq, void *dev_id) | |||
341 | */ | 341 | */ |
342 | static int iic_xfer_result(struct ibm_iic_private* dev) | 342 | static int iic_xfer_result(struct ibm_iic_private* dev) |
343 | { | 343 | { |
344 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 344 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
345 | 345 | ||
346 | if (unlikely(in_8(&iic->sts) & STS_ERR)){ | 346 | if (unlikely(in_8(&iic->sts) & STS_ERR)){ |
347 | DBG("%d: xfer error, EXTSTS = 0x%02x\n", dev->idx, | 347 | DBG("%d: xfer error, EXTSTS = 0x%02x\n", dev->idx, |
348 | in_8(&iic->extsts)); | 348 | in_8(&iic->extsts)); |
349 | 349 | ||
350 | /* Clear errors and possible pending IRQs */ | 350 | /* Clear errors and possible pending IRQs */ |
351 | out_8(&iic->extsts, EXTSTS_IRQP | EXTSTS_IRQD | | 351 | out_8(&iic->extsts, EXTSTS_IRQP | EXTSTS_IRQD | |
352 | EXTSTS_LA | EXTSTS_ICT | EXTSTS_XFRA); | 352 | EXTSTS_LA | EXTSTS_ICT | EXTSTS_XFRA); |
353 | 353 | ||
354 | /* Flush master data buffer */ | 354 | /* Flush master data buffer */ |
355 | out_8(&iic->mdcntl, in_8(&iic->mdcntl) | MDCNTL_FMDB); | 355 | out_8(&iic->mdcntl, in_8(&iic->mdcntl) | MDCNTL_FMDB); |
356 | 356 | ||
357 | /* Is bus free? | 357 | /* Is bus free? |
358 | * If error happened during combined xfer | 358 | * If error happened during combined xfer |
359 | * IIC interface is usually stuck in some strange | 359 | * IIC interface is usually stuck in some strange |
@@ -376,11 +376,11 @@ static void iic_abort_xfer(struct ibm_iic_private* dev) | |||
376 | { | 376 | { |
377 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 377 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
378 | unsigned long x; | 378 | unsigned long x; |
379 | 379 | ||
380 | DBG("%d: iic_abort_xfer\n", dev->idx); | 380 | DBG("%d: iic_abort_xfer\n", dev->idx); |
381 | 381 | ||
382 | out_8(&iic->cntl, CNTL_HMT); | 382 | out_8(&iic->cntl, CNTL_HMT); |
383 | 383 | ||
384 | /* | 384 | /* |
385 | * Wait for the abort command to complete. | 385 | * Wait for the abort command to complete. |
386 | * It's not worth to be optimized, just poll (timeout >= 1 tick) | 386 | * It's not worth to be optimized, just poll (timeout >= 1 tick) |
@@ -405,13 +405,13 @@ static void iic_abort_xfer(struct ibm_iic_private* dev) | |||
405 | * Returns the number of transferred bytes or error (<0) | 405 | * Returns the number of transferred bytes or error (<0) |
406 | */ | 406 | */ |
407 | static int iic_wait_for_tc(struct ibm_iic_private* dev){ | 407 | static int iic_wait_for_tc(struct ibm_iic_private* dev){ |
408 | 408 | ||
409 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 409 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
410 | int ret = 0; | 410 | int ret = 0; |
411 | 411 | ||
412 | if (dev->irq >= 0){ | 412 | if (dev->irq >= 0){ |
413 | /* Interrupt mode */ | 413 | /* Interrupt mode */ |
414 | ret = wait_event_interruptible_timeout(dev->wq, | 414 | ret = wait_event_interruptible_timeout(dev->wq, |
415 | !(in_8(&iic->sts) & STS_PT), dev->adap.timeout * HZ); | 415 | !(in_8(&iic->sts) & STS_PT), dev->adap.timeout * HZ); |
416 | 416 | ||
417 | if (unlikely(ret < 0)) | 417 | if (unlikely(ret < 0)) |
@@ -424,37 +424,37 @@ static int iic_wait_for_tc(struct ibm_iic_private* dev){ | |||
424 | else { | 424 | else { |
425 | /* Polling mode */ | 425 | /* Polling mode */ |
426 | unsigned long x = jiffies + dev->adap.timeout * HZ; | 426 | unsigned long x = jiffies + dev->adap.timeout * HZ; |
427 | 427 | ||
428 | while (in_8(&iic->sts) & STS_PT){ | 428 | while (in_8(&iic->sts) & STS_PT){ |
429 | if (unlikely(time_after(jiffies, x))){ | 429 | if (unlikely(time_after(jiffies, x))){ |
430 | DBG("%d: poll timeout\n", dev->idx); | 430 | DBG("%d: poll timeout\n", dev->idx); |
431 | ret = -ETIMEDOUT; | 431 | ret = -ETIMEDOUT; |
432 | break; | 432 | break; |
433 | } | 433 | } |
434 | 434 | ||
435 | if (unlikely(signal_pending(current))){ | 435 | if (unlikely(signal_pending(current))){ |
436 | DBG("%d: poll interrupted\n", dev->idx); | 436 | DBG("%d: poll interrupted\n", dev->idx); |
437 | ret = -ERESTARTSYS; | 437 | ret = -ERESTARTSYS; |
438 | break; | 438 | break; |
439 | } | 439 | } |
440 | schedule(); | 440 | schedule(); |
441 | } | 441 | } |
442 | } | 442 | } |
443 | 443 | ||
444 | if (unlikely(ret < 0)) | 444 | if (unlikely(ret < 0)) |
445 | iic_abort_xfer(dev); | 445 | iic_abort_xfer(dev); |
446 | else | 446 | else |
447 | ret = iic_xfer_result(dev); | 447 | ret = iic_xfer_result(dev); |
448 | 448 | ||
449 | DBG2("%d: iic_wait_for_tc -> %d\n", dev->idx, ret); | 449 | DBG2("%d: iic_wait_for_tc -> %d\n", dev->idx, ret); |
450 | 450 | ||
451 | return ret; | 451 | return ret; |
452 | } | 452 | } |
453 | 453 | ||
454 | /* | 454 | /* |
455 | * Low level master transfer routine | 455 | * Low level master transfer routine |
456 | */ | 456 | */ |
457 | static int iic_xfer_bytes(struct ibm_iic_private* dev, struct i2c_msg* pm, | 457 | static int iic_xfer_bytes(struct ibm_iic_private* dev, struct i2c_msg* pm, |
458 | int combined_xfer) | 458 | int combined_xfer) |
459 | { | 459 | { |
460 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 460 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
@@ -465,48 +465,48 @@ static int iic_xfer_bytes(struct ibm_iic_private* dev, struct i2c_msg* pm, | |||
465 | u8 cntl = (in_8(&iic->cntl) & CNTL_AMD) | CNTL_PT; | 465 | u8 cntl = (in_8(&iic->cntl) & CNTL_AMD) | CNTL_PT; |
466 | if (pm->flags & I2C_M_RD) | 466 | if (pm->flags & I2C_M_RD) |
467 | cntl |= CNTL_RW; | 467 | cntl |= CNTL_RW; |
468 | 468 | ||
469 | loops = (len + 3) / 4; | 469 | loops = (len + 3) / 4; |
470 | for (i = 0; i < loops; ++i, len -= 4){ | 470 | for (i = 0; i < loops; ++i, len -= 4){ |
471 | int count = len > 4 ? 4 : len; | 471 | int count = len > 4 ? 4 : len; |
472 | u8 cmd = cntl | ((count - 1) << CNTL_TCT_SHIFT); | 472 | u8 cmd = cntl | ((count - 1) << CNTL_TCT_SHIFT); |
473 | 473 | ||
474 | if (!(cntl & CNTL_RW)) | 474 | if (!(cntl & CNTL_RW)) |
475 | for (j = 0; j < count; ++j) | 475 | for (j = 0; j < count; ++j) |
476 | out_8((void __iomem *)&iic->mdbuf, *buf++); | 476 | out_8((void __iomem *)&iic->mdbuf, *buf++); |
477 | 477 | ||
478 | if (i < loops - 1) | 478 | if (i < loops - 1) |
479 | cmd |= CNTL_CHT; | 479 | cmd |= CNTL_CHT; |
480 | else if (combined_xfer) | 480 | else if (combined_xfer) |
481 | cmd |= CNTL_RPST; | 481 | cmd |= CNTL_RPST; |
482 | 482 | ||
483 | DBG2("%d: xfer_bytes, %d, CNTL = 0x%02x\n", dev->idx, count, cmd); | 483 | DBG2("%d: xfer_bytes, %d, CNTL = 0x%02x\n", dev->idx, count, cmd); |
484 | 484 | ||
485 | /* Start transfer */ | 485 | /* Start transfer */ |
486 | out_8(&iic->cntl, cmd); | 486 | out_8(&iic->cntl, cmd); |
487 | 487 | ||
488 | /* Wait for completion */ | 488 | /* Wait for completion */ |
489 | ret = iic_wait_for_tc(dev); | 489 | ret = iic_wait_for_tc(dev); |
490 | 490 | ||
491 | if (unlikely(ret < 0)) | 491 | if (unlikely(ret < 0)) |
492 | break; | 492 | break; |
493 | else if (unlikely(ret != count)){ | 493 | else if (unlikely(ret != count)){ |
494 | DBG("%d: xfer_bytes, requested %d, transfered %d\n", | 494 | DBG("%d: xfer_bytes, requested %d, transfered %d\n", |
495 | dev->idx, count, ret); | 495 | dev->idx, count, ret); |
496 | 496 | ||
497 | /* If it's not a last part of xfer, abort it */ | 497 | /* If it's not a last part of xfer, abort it */ |
498 | if (combined_xfer || (i < loops - 1)) | 498 | if (combined_xfer || (i < loops - 1)) |
499 | iic_abort_xfer(dev); | 499 | iic_abort_xfer(dev); |
500 | 500 | ||
501 | ret = -EREMOTEIO; | 501 | ret = -EREMOTEIO; |
502 | break; | 502 | break; |
503 | } | 503 | } |
504 | 504 | ||
505 | if (cntl & CNTL_RW) | 505 | if (cntl & CNTL_RW) |
506 | for (j = 0; j < count; ++j) | 506 | for (j = 0; j < count; ++j) |
507 | *buf++ = in_8((void __iomem *)&iic->mdbuf); | 507 | *buf++ = in_8((void __iomem *)&iic->mdbuf); |
508 | } | 508 | } |
509 | 509 | ||
510 | return ret > 0 ? 0 : ret; | 510 | return ret > 0 ? 0 : ret; |
511 | } | 511 | } |
512 | 512 | ||
@@ -517,10 +517,10 @@ static inline void iic_address(struct ibm_iic_private* dev, struct i2c_msg* msg) | |||
517 | { | 517 | { |
518 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 518 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
519 | u16 addr = msg->addr; | 519 | u16 addr = msg->addr; |
520 | 520 | ||
521 | DBG2("%d: iic_address, 0x%03x (%d-bit)\n", dev->idx, | 521 | DBG2("%d: iic_address, 0x%03x (%d-bit)\n", dev->idx, |
522 | addr, msg->flags & I2C_M_TEN ? 10 : 7); | 522 | addr, msg->flags & I2C_M_TEN ? 10 : 7); |
523 | 523 | ||
524 | if (msg->flags & I2C_M_TEN){ | 524 | if (msg->flags & I2C_M_TEN){ |
525 | out_8(&iic->cntl, CNTL_AMD); | 525 | out_8(&iic->cntl, CNTL_AMD); |
526 | out_8(&iic->lmadr, addr); | 526 | out_8(&iic->lmadr, addr); |
@@ -537,15 +537,15 @@ static inline int iic_invalid_address(const struct i2c_msg* p) | |||
537 | return (p->addr > 0x3ff) || (!(p->flags & I2C_M_TEN) && (p->addr > 0x7f)); | 537 | return (p->addr > 0x3ff) || (!(p->flags & I2C_M_TEN) && (p->addr > 0x7f)); |
538 | } | 538 | } |
539 | 539 | ||
540 | static inline int iic_address_neq(const struct i2c_msg* p1, | 540 | static inline int iic_address_neq(const struct i2c_msg* p1, |
541 | const struct i2c_msg* p2) | 541 | const struct i2c_msg* p2) |
542 | { | 542 | { |
543 | return (p1->addr != p2->addr) | 543 | return (p1->addr != p2->addr) |
544 | || ((p1->flags & I2C_M_TEN) != (p2->flags & I2C_M_TEN)); | 544 | || ((p1->flags & I2C_M_TEN) != (p2->flags & I2C_M_TEN)); |
545 | } | 545 | } |
546 | 546 | ||
547 | /* | 547 | /* |
548 | * Generic master transfer entrypoint. | 548 | * Generic master transfer entrypoint. |
549 | * Returns the number of processed messages or error (<0) | 549 | * Returns the number of processed messages or error (<0) |
550 | */ | 550 | */ |
551 | static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | 551 | static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) |
@@ -553,20 +553,20 @@ static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
553 | struct ibm_iic_private* dev = (struct ibm_iic_private*)(i2c_get_adapdata(adap)); | 553 | struct ibm_iic_private* dev = (struct ibm_iic_private*)(i2c_get_adapdata(adap)); |
554 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 554 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
555 | int i, ret = 0; | 555 | int i, ret = 0; |
556 | 556 | ||
557 | DBG2("%d: iic_xfer, %d msg(s)\n", dev->idx, num); | 557 | DBG2("%d: iic_xfer, %d msg(s)\n", dev->idx, num); |
558 | 558 | ||
559 | if (!num) | 559 | if (!num) |
560 | return 0; | 560 | return 0; |
561 | 561 | ||
562 | /* Check the sanity of the passed messages. | 562 | /* Check the sanity of the passed messages. |
563 | * Uhh, generic i2c layer is more suitable place for such code... | 563 | * Uhh, generic i2c layer is more suitable place for such code... |
564 | */ | 564 | */ |
565 | if (unlikely(iic_invalid_address(&msgs[0]))){ | 565 | if (unlikely(iic_invalid_address(&msgs[0]))){ |
566 | DBG("%d: invalid address 0x%03x (%d-bit)\n", dev->idx, | 566 | DBG("%d: invalid address 0x%03x (%d-bit)\n", dev->idx, |
567 | msgs[0].addr, msgs[0].flags & I2C_M_TEN ? 10 : 7); | 567 | msgs[0].addr, msgs[0].flags & I2C_M_TEN ? 10 : 7); |
568 | return -EINVAL; | 568 | return -EINVAL; |
569 | } | 569 | } |
570 | for (i = 0; i < num; ++i){ | 570 | for (i = 0; i < num; ++i){ |
571 | if (unlikely(msgs[i].len <= 0)){ | 571 | if (unlikely(msgs[i].len <= 0)){ |
572 | if (num == 1 && !msgs[0].len){ | 572 | if (num == 1 && !msgs[0].len){ |
@@ -576,7 +576,7 @@ static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
576 | */ | 576 | */ |
577 | return iic_smbus_quick(dev, &msgs[0]); | 577 | return iic_smbus_quick(dev, &msgs[0]); |
578 | } | 578 | } |
579 | DBG("%d: invalid len %d in msg[%d]\n", dev->idx, | 579 | DBG("%d: invalid len %d in msg[%d]\n", dev->idx, |
580 | msgs[i].len, i); | 580 | msgs[i].len, i); |
581 | return -EINVAL; | 581 | return -EINVAL; |
582 | } | 582 | } |
@@ -585,34 +585,34 @@ static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
585 | return -EINVAL; | 585 | return -EINVAL; |
586 | } | 586 | } |
587 | } | 587 | } |
588 | 588 | ||
589 | /* Check bus state */ | 589 | /* Check bus state */ |
590 | if (unlikely((in_8(&iic->extsts) & EXTSTS_BCS_MASK) != EXTSTS_BCS_FREE)){ | 590 | if (unlikely((in_8(&iic->extsts) & EXTSTS_BCS_MASK) != EXTSTS_BCS_FREE)){ |
591 | DBG("%d: iic_xfer, bus is not free\n", dev->idx); | 591 | DBG("%d: iic_xfer, bus is not free\n", dev->idx); |
592 | 592 | ||
593 | /* Usually it means something serious has happend. | 593 | /* Usually it means something serious has happend. |
594 | * We *cannot* have unfinished previous transfer | 594 | * We *cannot* have unfinished previous transfer |
595 | * so it doesn't make any sense to try to stop it. | 595 | * so it doesn't make any sense to try to stop it. |
596 | * Probably we were not able to recover from the | 596 | * Probably we were not able to recover from the |
597 | * previous error. | 597 | * previous error. |
598 | * The only *reasonable* thing I can think of here | 598 | * The only *reasonable* thing I can think of here |
599 | * is soft reset. --ebs | 599 | * is soft reset. --ebs |
600 | */ | 600 | */ |
601 | iic_dev_reset(dev); | 601 | iic_dev_reset(dev); |
602 | 602 | ||
603 | if ((in_8(&iic->extsts) & EXTSTS_BCS_MASK) != EXTSTS_BCS_FREE){ | 603 | if ((in_8(&iic->extsts) & EXTSTS_BCS_MASK) != EXTSTS_BCS_FREE){ |
604 | DBG("%d: iic_xfer, bus is still not free\n", dev->idx); | 604 | DBG("%d: iic_xfer, bus is still not free\n", dev->idx); |
605 | return -EREMOTEIO; | 605 | return -EREMOTEIO; |
606 | } | 606 | } |
607 | } | 607 | } |
608 | else { | 608 | else { |
609 | /* Flush master data buffer (just in case) */ | 609 | /* Flush master data buffer (just in case) */ |
610 | out_8(&iic->mdcntl, in_8(&iic->mdcntl) | MDCNTL_FMDB); | 610 | out_8(&iic->mdcntl, in_8(&iic->mdcntl) | MDCNTL_FMDB); |
611 | } | 611 | } |
612 | 612 | ||
613 | /* Load slave address */ | 613 | /* Load slave address */ |
614 | iic_address(dev, &msgs[0]); | 614 | iic_address(dev, &msgs[0]); |
615 | 615 | ||
616 | /* Do real transfer */ | 616 | /* Do real transfer */ |
617 | for (i = 0; i < num && !ret; ++i) | 617 | for (i = 0; i < num && !ret; ++i) |
618 | ret = iic_xfer_bytes(dev, &msgs[i], i < num - 1); | 618 | ret = iic_xfer_bytes(dev, &msgs[i], i < num - 1); |
@@ -648,7 +648,7 @@ static inline u8 iic_clckdiv(unsigned int opb) | |||
648 | 648 | ||
649 | /* Convert to MHz */ | 649 | /* Convert to MHz */ |
650 | opb /= 1000000; | 650 | opb /= 1000000; |
651 | 651 | ||
652 | if (opb < 20 || opb > 150){ | 652 | if (opb < 20 || opb > 150){ |
653 | printk(KERN_CRIT "ibm-iic: invalid OPB clock frequency %u MHz\n", | 653 | printk(KERN_CRIT "ibm-iic: invalid OPB clock frequency %u MHz\n", |
654 | opb); | 654 | opb); |
@@ -666,7 +666,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
666 | struct i2c_adapter* adap; | 666 | struct i2c_adapter* adap; |
667 | struct ocp_func_iic_data* iic_data = ocp->def->additions; | 667 | struct ocp_func_iic_data* iic_data = ocp->def->additions; |
668 | int ret; | 668 | int ret; |
669 | 669 | ||
670 | if (!iic_data) | 670 | if (!iic_data) |
671 | printk(KERN_WARNING"ibm-iic%d: missing additional data!\n", | 671 | printk(KERN_WARNING"ibm-iic%d: missing additional data!\n", |
672 | ocp->def->index); | 672 | ocp->def->index); |
@@ -679,7 +679,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
679 | 679 | ||
680 | dev->idx = ocp->def->index; | 680 | dev->idx = ocp->def->index; |
681 | ocp_set_drvdata(ocp, dev); | 681 | ocp_set_drvdata(ocp, dev); |
682 | 682 | ||
683 | if (!request_mem_region(ocp->def->paddr, sizeof(struct iic_regs), | 683 | if (!request_mem_region(ocp->def->paddr, sizeof(struct iic_regs), |
684 | "ibm_iic")) { | 684 | "ibm_iic")) { |
685 | ret = -EBUSY; | 685 | ret = -EBUSY; |
@@ -692,7 +692,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
692 | ret = -ENXIO; | 692 | ret = -ENXIO; |
693 | goto fail2; | 693 | goto fail2; |
694 | } | 694 | } |
695 | 695 | ||
696 | init_waitqueue_head(&dev->wq); | 696 | init_waitqueue_head(&dev->wq); |
697 | 697 | ||
698 | dev->irq = iic_force_poll ? -1 : ocp->def->irq; | 698 | dev->irq = iic_force_poll ? -1 : ocp->def->irq; |
@@ -702,29 +702,29 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
702 | */ | 702 | */ |
703 | iic_interrupt_mode(dev, 0); | 703 | iic_interrupt_mode(dev, 0); |
704 | if (request_irq(dev->irq, iic_handler, 0, "IBM IIC", dev)){ | 704 | if (request_irq(dev->irq, iic_handler, 0, "IBM IIC", dev)){ |
705 | printk(KERN_ERR "ibm-iic%d: request_irq %d failed\n", | 705 | printk(KERN_ERR "ibm-iic%d: request_irq %d failed\n", |
706 | dev->idx, dev->irq); | 706 | dev->idx, dev->irq); |
707 | /* Fallback to the polling mode */ | 707 | /* Fallback to the polling mode */ |
708 | dev->irq = -1; | 708 | dev->irq = -1; |
709 | } | 709 | } |
710 | } | 710 | } |
711 | 711 | ||
712 | if (dev->irq < 0) | 712 | if (dev->irq < 0) |
713 | printk(KERN_WARNING "ibm-iic%d: using polling mode\n", | 713 | printk(KERN_WARNING "ibm-iic%d: using polling mode\n", |
714 | dev->idx); | 714 | dev->idx); |
715 | 715 | ||
716 | /* Board specific settings */ | 716 | /* Board specific settings */ |
717 | dev->fast_mode = iic_force_fast ? 1 : (iic_data ? iic_data->fast_mode : 0); | 717 | dev->fast_mode = iic_force_fast ? 1 : (iic_data ? iic_data->fast_mode : 0); |
718 | 718 | ||
719 | /* clckdiv is the same for *all* IIC interfaces, | 719 | /* clckdiv is the same for *all* IIC interfaces, |
720 | * but I'd rather make a copy than introduce another global. --ebs | 720 | * but I'd rather make a copy than introduce another global. --ebs |
721 | */ | 721 | */ |
722 | dev->clckdiv = iic_clckdiv(ocp_sys_info.opb_bus_freq); | 722 | dev->clckdiv = iic_clckdiv(ocp_sys_info.opb_bus_freq); |
723 | DBG("%d: clckdiv = %d\n", dev->idx, dev->clckdiv); | 723 | DBG("%d: clckdiv = %d\n", dev->idx, dev->clckdiv); |
724 | 724 | ||
725 | /* Initialize IIC interface */ | 725 | /* Initialize IIC interface */ |
726 | iic_dev_init(dev); | 726 | iic_dev_init(dev); |
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 | adap->dev.parent = &ocp->dev; |
@@ -736,7 +736,6 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
736 | adap->client_register = NULL; | 736 | adap->client_register = NULL; |
737 | adap->client_unregister = NULL; | 737 | adap->client_unregister = NULL; |
738 | adap->timeout = 1; | 738 | adap->timeout = 1; |
739 | adap->retries = 1; | ||
740 | 739 | ||
741 | /* | 740 | /* |
742 | * If "dev->idx" is negative we consider it as zero. | 741 | * If "dev->idx" is negative we consider it as zero. |
@@ -750,24 +749,24 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
750 | dev->idx); | 749 | dev->idx); |
751 | goto fail; | 750 | goto fail; |
752 | } | 751 | } |
753 | 752 | ||
754 | printk(KERN_INFO "ibm-iic%d: using %s mode\n", dev->idx, | 753 | printk(KERN_INFO "ibm-iic%d: using %s mode\n", dev->idx, |
755 | dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)"); | 754 | dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)"); |
756 | 755 | ||
757 | return 0; | 756 | return 0; |
758 | 757 | ||
759 | fail: | 758 | fail: |
760 | if (dev->irq >= 0){ | 759 | if (dev->irq >= 0){ |
761 | iic_interrupt_mode(dev, 0); | 760 | iic_interrupt_mode(dev, 0); |
762 | free_irq(dev->irq, dev); | 761 | free_irq(dev->irq, dev); |
763 | } | 762 | } |
764 | 763 | ||
765 | iounmap(dev->vaddr); | 764 | iounmap(dev->vaddr); |
766 | fail2: | 765 | fail2: |
767 | release_mem_region(ocp->def->paddr, sizeof(struct iic_regs)); | 766 | release_mem_region(ocp->def->paddr, sizeof(struct iic_regs)); |
768 | fail1: | 767 | fail1: |
769 | ocp_set_drvdata(ocp, NULL); | 768 | ocp_set_drvdata(ocp, NULL); |
770 | kfree(dev); | 769 | kfree(dev); |
771 | return ret; | 770 | return ret; |
772 | } | 771 | } |
773 | 772 | ||
@@ -783,13 +782,13 @@ static void __devexit iic_remove(struct ocp_device *ocp) | |||
783 | dev->idx); | 782 | dev->idx); |
784 | /* That's *very* bad, just shutdown IRQ ... */ | 783 | /* That's *very* bad, just shutdown IRQ ... */ |
785 | if (dev->irq >= 0){ | 784 | if (dev->irq >= 0){ |
786 | iic_interrupt_mode(dev, 0); | 785 | iic_interrupt_mode(dev, 0); |
787 | free_irq(dev->irq, dev); | 786 | free_irq(dev->irq, dev); |
788 | dev->irq = -1; | 787 | dev->irq = -1; |
789 | } | 788 | } |
790 | } else { | 789 | } else { |
791 | if (dev->irq >= 0){ | 790 | if (dev->irq >= 0){ |
792 | iic_interrupt_mode(dev, 0); | 791 | iic_interrupt_mode(dev, 0); |
793 | free_irq(dev->irq, dev); | 792 | free_irq(dev->irq, dev); |
794 | } | 793 | } |
795 | iounmap(dev->vaddr); | 794 | iounmap(dev->vaddr); |
@@ -798,7 +797,7 @@ static void __devexit iic_remove(struct ocp_device *ocp) | |||
798 | } | 797 | } |
799 | } | 798 | } |
800 | 799 | ||
801 | static struct ocp_device_id ibm_iic_ids[] __devinitdata = | 800 | static struct ocp_device_id ibm_iic_ids[] __devinitdata = |
802 | { | 801 | { |
803 | { .vendor = OCP_VENDOR_IBM, .function = OCP_FUNC_IIC }, | 802 | { .vendor = OCP_VENDOR_IBM, .function = OCP_FUNC_IIC }, |
804 | { .vendor = OCP_VENDOR_INVALID } | 803 | { .vendor = OCP_VENDOR_INVALID } |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.h b/drivers/i2c/busses/i2c-ibm_iic.h index 59d7b437f7ff..fdaa48292cb6 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.h +++ b/drivers/i2c/busses/i2c-ibm_iic.h | |||
@@ -2,11 +2,11 @@ | |||
2 | * drivers/i2c/busses/i2c-ibm_iic.h | 2 | * drivers/i2c/busses/i2c-ibm_iic.h |
3 | * | 3 | * |
4 | * Support for the IIC peripheral on IBM PPC 4xx | 4 | * Support for the IIC peripheral on IBM PPC 4xx |
5 | * | 5 | * |
6 | * Copyright (c) 2003 Zultys Technologies. | 6 | * Copyright (c) 2003 Zultys Technologies. |
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | 7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
8 | * | 8 | * |
9 | * Based on original work by | 9 | * Based on original work by |
10 | * Ian DaSilva <idasilva@mvista.com> | 10 | * Ian DaSilva <idasilva@mvista.com> |
11 | * Armin Kuster <akuster@mvista.com> | 11 | * Armin Kuster <akuster@mvista.com> |
12 | * Matt Porter <mporter@mvista.com> | 12 | * Matt Porter <mporter@mvista.com> |
@@ -22,7 +22,7 @@ | |||
22 | #ifndef __I2C_IBM_IIC_H_ | 22 | #ifndef __I2C_IBM_IIC_H_ |
23 | #define __I2C_IBM_IIC_H_ | 23 | #define __I2C_IBM_IIC_H_ |
24 | 24 | ||
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | 26 | ||
27 | struct iic_regs { | 27 | struct iic_regs { |
28 | u16 mdbuf; | 28 | u16 mdbuf; |
@@ -58,7 +58,7 @@ struct ibm_iic_private { | |||
58 | #define CNTL_TCT_MASK 0x30 | 58 | #define CNTL_TCT_MASK 0x30 |
59 | #define CNTL_TCT_SHIFT 4 | 59 | #define CNTL_TCT_SHIFT 4 |
60 | #define CNTL_RPST 0x08 | 60 | #define CNTL_RPST 0x08 |
61 | #define CNTL_CHT 0x04 | 61 | #define CNTL_CHT 0x04 |
62 | #define CNTL_RW 0x02 | 62 | #define CNTL_RW 0x02 |
63 | #define CNTL_PT 0x01 | 63 | #define CNTL_PT 0x01 |
64 | 64 | ||
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index c70146e4c2c0..ab41400c883e 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c | |||
@@ -490,7 +490,6 @@ iop3xx_i2c_probe(struct platform_device *pdev) | |||
490 | * Default values...should these come in from board code? | 490 | * Default values...should these come in from board code? |
491 | */ | 491 | */ |
492 | new_adapter->timeout = 100; | 492 | new_adapter->timeout = 100; |
493 | new_adapter->retries = 3; | ||
494 | new_adapter->algo = &iop3xx_i2c_algo; | 493 | new_adapter->algo = &iop3xx_i2c_algo; |
495 | 494 | ||
496 | init_waitqueue_head(&adapter_data->waitq); | 495 | init_waitqueue_head(&adapter_data->waitq); |
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c deleted file mode 100644 index 069ed7f3b395..000000000000 --- a/drivers/i2c/busses/i2c-ixp4xx.c +++ /dev/null | |||
@@ -1,178 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/i2c/busses/i2c-ixp4xx.c | ||
3 | * | ||
4 | * Intel's IXP4xx XScale NPU chipsets (IXP420, 421, 422, 425) do not have | ||
5 | * an on board I2C controller but provide 16 GPIO pins that are often | ||
6 | * used to create an I2C bus. This driver provides an i2c_adapter | ||
7 | * interface that plugs in under algo_bit and drives the GPIO pins | ||
8 | * as instructed by the alogorithm driver. | ||
9 | * | ||
10 | * Author: Deepak Saxena <dsaxena@plexity.net> | ||
11 | * | ||
12 | * Copyright (c) 2003-2004 MontaVista Software Inc. | ||
13 | * | ||
14 | * This file is licensed under the terms of the GNU General Public | ||
15 | * License version 2. This program is licensed "as is" without any | ||
16 | * warranty of any kind, whether express or implied. | ||
17 | * | ||
18 | * NOTE: Since different platforms will use different GPIO pins for | ||
19 | * I2C, this driver uses an IXP4xx-specific platform_data | ||
20 | * pointer to pass the GPIO numbers to the driver. This | ||
21 | * allows us to support all the different IXP4xx platforms | ||
22 | * w/o having to put #ifdefs in this driver. | ||
23 | * | ||
24 | * See arch/arm/mach-ixp4xx/ixdp425.c for an example of building a | ||
25 | * device list and filling in the ixp4xx_i2c_pins data structure | ||
26 | * that is passed as the platform_data to this driver. | ||
27 | */ | ||
28 | |||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/platform_device.h> | ||
32 | #include <linux/module.h> | ||
33 | #include <linux/i2c.h> | ||
34 | #include <linux/i2c-algo-bit.h> | ||
35 | |||
36 | #include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ | ||
37 | |||
38 | static inline int ixp4xx_scl_pin(void *data) | ||
39 | { | ||
40 | return ((struct ixp4xx_i2c_pins*)data)->scl_pin; | ||
41 | } | ||
42 | |||
43 | static inline int ixp4xx_sda_pin(void *data) | ||
44 | { | ||
45 | return ((struct ixp4xx_i2c_pins*)data)->sda_pin; | ||
46 | } | ||
47 | |||
48 | static void ixp4xx_bit_setscl(void *data, int val) | ||
49 | { | ||
50 | gpio_line_set(ixp4xx_scl_pin(data), 0); | ||
51 | gpio_line_config(ixp4xx_scl_pin(data), | ||
52 | val ? IXP4XX_GPIO_IN : IXP4XX_GPIO_OUT ); | ||
53 | } | ||
54 | |||
55 | static void ixp4xx_bit_setsda(void *data, int val) | ||
56 | { | ||
57 | gpio_line_set(ixp4xx_sda_pin(data), 0); | ||
58 | gpio_line_config(ixp4xx_sda_pin(data), | ||
59 | val ? IXP4XX_GPIO_IN : IXP4XX_GPIO_OUT ); | ||
60 | } | ||
61 | |||
62 | static int ixp4xx_bit_getscl(void *data) | ||
63 | { | ||
64 | int scl; | ||
65 | |||
66 | gpio_line_config(ixp4xx_scl_pin(data), IXP4XX_GPIO_IN ); | ||
67 | gpio_line_get(ixp4xx_scl_pin(data), &scl); | ||
68 | |||
69 | return scl; | ||
70 | } | ||
71 | |||
72 | static int ixp4xx_bit_getsda(void *data) | ||
73 | { | ||
74 | int sda; | ||
75 | |||
76 | gpio_line_config(ixp4xx_sda_pin(data), IXP4XX_GPIO_IN ); | ||
77 | gpio_line_get(ixp4xx_sda_pin(data), &sda); | ||
78 | |||
79 | return sda; | ||
80 | } | ||
81 | |||
82 | struct ixp4xx_i2c_data { | ||
83 | struct ixp4xx_i2c_pins *gpio_pins; | ||
84 | struct i2c_adapter adapter; | ||
85 | struct i2c_algo_bit_data algo_data; | ||
86 | }; | ||
87 | |||
88 | static int ixp4xx_i2c_remove(struct platform_device *plat_dev) | ||
89 | { | ||
90 | struct ixp4xx_i2c_data *drv_data = platform_get_drvdata(plat_dev); | ||
91 | |||
92 | platform_set_drvdata(plat_dev, NULL); | ||
93 | |||
94 | i2c_del_adapter(&drv_data->adapter); | ||
95 | |||
96 | kfree(drv_data); | ||
97 | |||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static int ixp4xx_i2c_probe(struct platform_device *plat_dev) | ||
102 | { | ||
103 | int err; | ||
104 | struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data; | ||
105 | struct ixp4xx_i2c_data *drv_data = | ||
106 | kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL); | ||
107 | |||
108 | if(!drv_data) | ||
109 | return -ENOMEM; | ||
110 | |||
111 | drv_data->gpio_pins = gpio; | ||
112 | |||
113 | /* | ||
114 | * We could make a lot of these structures static, but | ||
115 | * certain platforms may have multiple GPIO-based I2C | ||
116 | * buses for various device domains, so we need per-device | ||
117 | * algo_data->data. | ||
118 | */ | ||
119 | drv_data->algo_data.data = gpio; | ||
120 | drv_data->algo_data.setsda = ixp4xx_bit_setsda; | ||
121 | drv_data->algo_data.setscl = ixp4xx_bit_setscl; | ||
122 | drv_data->algo_data.getsda = ixp4xx_bit_getsda; | ||
123 | drv_data->algo_data.getscl = ixp4xx_bit_getscl; | ||
124 | drv_data->algo_data.udelay = 10; | ||
125 | drv_data->algo_data.timeout = 100; | ||
126 | |||
127 | drv_data->adapter.id = I2C_HW_B_IXP4XX; | ||
128 | drv_data->adapter.class = I2C_CLASS_HWMON; | ||
129 | strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, | ||
130 | sizeof(drv_data->adapter.name)); | ||
131 | drv_data->adapter.algo_data = &drv_data->algo_data; | ||
132 | |||
133 | drv_data->adapter.dev.parent = &plat_dev->dev; | ||
134 | |||
135 | gpio_line_config(gpio->scl_pin, IXP4XX_GPIO_IN); | ||
136 | gpio_line_config(gpio->sda_pin, IXP4XX_GPIO_IN); | ||
137 | gpio_line_set(gpio->scl_pin, 0); | ||
138 | gpio_line_set(gpio->sda_pin, 0); | ||
139 | |||
140 | err = i2c_bit_add_bus(&drv_data->adapter); | ||
141 | if (err) { | ||
142 | printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id); | ||
143 | |||
144 | kfree(drv_data); | ||
145 | return err; | ||
146 | } | ||
147 | |||
148 | platform_set_drvdata(plat_dev, drv_data); | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static struct platform_driver ixp4xx_i2c_driver = { | ||
154 | .probe = ixp4xx_i2c_probe, | ||
155 | .remove = ixp4xx_i2c_remove, | ||
156 | .driver = { | ||
157 | .name = "IXP4XX-I2C", | ||
158 | .owner = THIS_MODULE, | ||
159 | }, | ||
160 | }; | ||
161 | |||
162 | static int __init ixp4xx_i2c_init(void) | ||
163 | { | ||
164 | return platform_driver_register(&ixp4xx_i2c_driver); | ||
165 | } | ||
166 | |||
167 | static void __exit ixp4xx_i2c_exit(void) | ||
168 | { | ||
169 | platform_driver_unregister(&ixp4xx_i2c_driver); | ||
170 | } | ||
171 | |||
172 | module_init(ixp4xx_i2c_init); | ||
173 | module_exit(ixp4xx_i2c_exit); | ||
174 | |||
175 | MODULE_DESCRIPTION("GPIO-based I2C adapter for IXP4xx systems"); | ||
176 | MODULE_LICENSE("GPL"); | ||
177 | MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>"); | ||
178 | |||
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index d8de4ac88b7d..bbe787b243b7 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -180,7 +180,7 @@ static void mpc_i2c_stop(struct mpc_i2c *i2c) | |||
180 | static int mpc_write(struct mpc_i2c *i2c, int target, | 180 | static int mpc_write(struct mpc_i2c *i2c, int target, |
181 | const u8 * data, int length, int restart) | 181 | const u8 * data, int length, int restart) |
182 | { | 182 | { |
183 | int i; | 183 | int i, result; |
184 | unsigned timeout = i2c->adap.timeout; | 184 | unsigned timeout = i2c->adap.timeout; |
185 | u32 flags = restart ? CCR_RSTA : 0; | 185 | u32 flags = restart ? CCR_RSTA : 0; |
186 | 186 | ||
@@ -192,15 +192,17 @@ static int mpc_write(struct mpc_i2c *i2c, int target, | |||
192 | /* Write target byte */ | 192 | /* Write target byte */ |
193 | writeb((target << 1), i2c->base + MPC_I2C_DR); | 193 | writeb((target << 1), i2c->base + MPC_I2C_DR); |
194 | 194 | ||
195 | if (i2c_wait(i2c, timeout, 1) < 0) | 195 | result = i2c_wait(i2c, timeout, 1); |
196 | return -1; | 196 | if (result < 0) |
197 | return result; | ||
197 | 198 | ||
198 | for (i = 0; i < length; i++) { | 199 | for (i = 0; i < length; i++) { |
199 | /* Write data byte */ | 200 | /* Write data byte */ |
200 | writeb(data[i], i2c->base + MPC_I2C_DR); | 201 | writeb(data[i], i2c->base + MPC_I2C_DR); |
201 | 202 | ||
202 | if (i2c_wait(i2c, timeout, 1) < 0) | 203 | result = i2c_wait(i2c, timeout, 1); |
203 | return -1; | 204 | if (result < 0) |
205 | return result; | ||
204 | } | 206 | } |
205 | 207 | ||
206 | return 0; | 208 | return 0; |
@@ -210,7 +212,7 @@ static int mpc_read(struct mpc_i2c *i2c, int target, | |||
210 | u8 * data, int length, int restart) | 212 | u8 * data, int length, int restart) |
211 | { | 213 | { |
212 | unsigned timeout = i2c->adap.timeout; | 214 | unsigned timeout = i2c->adap.timeout; |
213 | int i; | 215 | int i, result; |
214 | u32 flags = restart ? CCR_RSTA : 0; | 216 | u32 flags = restart ? CCR_RSTA : 0; |
215 | 217 | ||
216 | /* Start with MEN */ | 218 | /* Start with MEN */ |
@@ -221,8 +223,9 @@ static int mpc_read(struct mpc_i2c *i2c, int target, | |||
221 | /* Write target address byte - this time with the read flag set */ | 223 | /* Write target address byte - this time with the read flag set */ |
222 | writeb((target << 1) | 1, i2c->base + MPC_I2C_DR); | 224 | writeb((target << 1) | 1, i2c->base + MPC_I2C_DR); |
223 | 225 | ||
224 | if (i2c_wait(i2c, timeout, 1) < 0) | 226 | result = i2c_wait(i2c, timeout, 1); |
225 | return -1; | 227 | if (result < 0) |
228 | return result; | ||
226 | 229 | ||
227 | if (length) { | 230 | if (length) { |
228 | if (length == 1) | 231 | if (length == 1) |
@@ -234,8 +237,9 @@ static int mpc_read(struct mpc_i2c *i2c, int target, | |||
234 | } | 237 | } |
235 | 238 | ||
236 | for (i = 0; i < length; i++) { | 239 | for (i = 0; i < length; i++) { |
237 | if (i2c_wait(i2c, timeout, 0) < 0) | 240 | result = i2c_wait(i2c, timeout, 0); |
238 | return -1; | 241 | if (result < 0) |
242 | return result; | ||
239 | 243 | ||
240 | /* Generate txack on next to last byte */ | 244 | /* Generate txack on next to last byte */ |
241 | if (i == length - 2) | 245 | if (i == length - 2) |
@@ -309,7 +313,6 @@ static struct i2c_adapter mpc_ops = { | |||
309 | .algo = &mpc_algo, | 313 | .algo = &mpc_algo, |
310 | .class = I2C_CLASS_HWMON, | 314 | .class = I2C_CLASS_HWMON, |
311 | .timeout = 1, | 315 | .timeout = 1, |
312 | .retries = 1 | ||
313 | }; | 316 | }; |
314 | 317 | ||
315 | static int fsl_i2c_probe(struct platform_device *pdev) | 318 | static int fsl_i2c_probe(struct platform_device *pdev) |
@@ -321,9 +324,9 @@ static int fsl_i2c_probe(struct platform_device *pdev) | |||
321 | 324 | ||
322 | pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data; | 325 | pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data; |
323 | 326 | ||
324 | if (!(i2c = kzalloc(sizeof(*i2c), GFP_KERNEL))) { | 327 | i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); |
328 | if (!i2c) | ||
325 | return -ENOMEM; | 329 | return -ENOMEM; |
326 | } | ||
327 | 330 | ||
328 | i2c->irq = platform_get_irq(pdev, 0); | 331 | i2c->irq = platform_get_irq(pdev, 0); |
329 | if (i2c->irq < 0) { | 332 | if (i2c->irq < 0) { |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 1bf590c74166..3dac920e53ea 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -351,6 +351,7 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_ | |||
351 | pci_set_drvdata(dev, smbuses); | 351 | pci_set_drvdata(dev, smbuses); |
352 | 352 | ||
353 | switch(dev->device) { | 353 | switch(dev->device) { |
354 | case PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS: | ||
354 | case PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS: | 355 | case PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS: |
355 | case PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS: | 356 | case PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS: |
356 | smbuses[0].blockops = 1; | 357 | smbuses[0].blockops = 1; |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index f2552b19ea60..da6639707ea3 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -362,8 +362,6 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | |||
362 | 362 | ||
363 | omap_i2c_enable_clocks(dev); | 363 | omap_i2c_enable_clocks(dev); |
364 | 364 | ||
365 | /* REVISIT: initialize and use adap->retries. This is an optional | ||
366 | * feature */ | ||
367 | if ((r = omap_i2c_wait_for_bb(dev)) < 0) | 365 | if ((r = omap_i2c_wait_for_bb(dev)) < 0) |
368 | goto out; | 366 | goto out; |
369 | 367 | ||
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c index ca18e0be4901..1603c81e39d4 100644 --- a/drivers/i2c/busses/i2c-pasemi.c +++ b/drivers/i2c/busses/i2c-pasemi.c | |||
@@ -368,6 +368,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev, | |||
368 | smbus->adapter.class = I2C_CLASS_HWMON; | 368 | smbus->adapter.class = I2C_CLASS_HWMON; |
369 | smbus->adapter.algo = &smbus_algorithm; | 369 | smbus->adapter.algo = &smbus_algorithm; |
370 | smbus->adapter.algo_data = smbus; | 370 | smbus->adapter.algo_data = smbus; |
371 | smbus->adapter.nr = PCI_FUNC(dev->devfn); | ||
371 | 372 | ||
372 | /* set up the sysfs linkage to our parent device */ | 373 | /* set up the sysfs linkage to our parent device */ |
373 | smbus->adapter.dev.parent = &dev->dev; | 374 | smbus->adapter.dev.parent = &dev->dev; |
@@ -375,7 +376,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev, | |||
375 | reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | | 376 | reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | |
376 | (CLK_100K_DIV & CTL_CLK_M))); | 377 | (CLK_100K_DIV & CTL_CLK_M))); |
377 | 378 | ||
378 | error = i2c_add_adapter(&smbus->adapter); | 379 | error = i2c_add_numbered_adapter(&smbus->adapter); |
379 | if (error) | 380 | if (error) |
380 | goto out_release_region; | 381 | goto out_release_region; |
381 | 382 | ||
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 167e4137ee21..9bbe96cef719 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -121,10 +121,6 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev, | |||
121 | { | 121 | { |
122 | unsigned char temp; | 122 | unsigned char temp; |
123 | 123 | ||
124 | /* match up the function */ | ||
125 | if (PCI_FUNC(PIIX4_dev->devfn) != id->driver_data) | ||
126 | return -ENODEV; | ||
127 | |||
128 | dev_info(&PIIX4_dev->dev, "Found %s device\n", pci_name(PIIX4_dev)); | 124 | dev_info(&PIIX4_dev->dev, "Found %s device\n", pci_name(PIIX4_dev)); |
129 | 125 | ||
130 | /* Don't access SMBus on IBM systems which get corrupted eeproms */ | 126 | /* Don't access SMBus on IBM systems which get corrupted eeproms */ |
@@ -389,28 +385,21 @@ static struct i2c_adapter piix4_adapter = { | |||
389 | }; | 385 | }; |
390 | 386 | ||
391 | static struct pci_device_id piix4_ids[] = { | 387 | static struct pci_device_id piix4_ids[] = { |
392 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3), | 388 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3) }, |
393 | .driver_data = 3 }, | 389 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3) }, |
394 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP200_SMBUS), | 390 | { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_3) }, |
395 | .driver_data = 0 }, | 391 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP200_SMBUS) }, |
396 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_SMBUS), | 392 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_SMBUS) }, |
397 | .driver_data = 0 }, | 393 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS) }, |
398 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS), | 394 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS) }, |
399 | .driver_data = 0 }, | 395 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, |
400 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS), | 396 | PCI_DEVICE_ID_SERVERWORKS_OSB4) }, |
401 | .driver_data = 0 }, | 397 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, |
402 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4), | 398 | PCI_DEVICE_ID_SERVERWORKS_CSB5) }, |
403 | .driver_data = 0 }, | 399 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, |
404 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5), | 400 | PCI_DEVICE_ID_SERVERWORKS_CSB6) }, |
405 | .driver_data = 0 }, | 401 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, |
406 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6), | 402 | PCI_DEVICE_ID_SERVERWORKS_HT1000SB) }, |
407 | .driver_data = 0 }, | ||
408 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000SB), | ||
409 | .driver_data = 0 }, | ||
410 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3), | ||
411 | .driver_data = 3 }, | ||
412 | { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_3), | ||
413 | .driver_data = 0 }, | ||
414 | { 0, } | 403 | { 0, } |
415 | }; | 404 | }; |
416 | 405 | ||
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 6426a61f8d4d..2598d29fd7a4 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -65,6 +65,7 @@ struct pxa_i2c { | |||
65 | unsigned long iosize; | 65 | unsigned long iosize; |
66 | 66 | ||
67 | int irq; | 67 | int irq; |
68 | int use_pio; | ||
68 | }; | 69 | }; |
69 | 70 | ||
70 | #define _IBMR(i2c) ((i2c)->reg_base + 0) | 71 | #define _IBMR(i2c) ((i2c)->reg_base + 0) |
@@ -163,6 +164,7 @@ static void i2c_pxa_show_state(struct pxa_i2c *i2c, int lno, const char *fname) | |||
163 | #define eedbg(lvl, x...) do { if ((lvl) < 1) { printk(KERN_DEBUG "" x); } } while(0) | 164 | #define eedbg(lvl, x...) do { if ((lvl) < 1) { printk(KERN_DEBUG "" x); } } while(0) |
164 | 165 | ||
165 | static void i2c_pxa_master_complete(struct pxa_i2c *i2c, int ret); | 166 | static void i2c_pxa_master_complete(struct pxa_i2c *i2c, int ret); |
167 | static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id); | ||
166 | 168 | ||
167 | static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why) | 169 | static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why) |
168 | { | 170 | { |
@@ -554,6 +556,71 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c) | |||
554 | writel(icr, _ICR(i2c)); | 556 | writel(icr, _ICR(i2c)); |
555 | } | 557 | } |
556 | 558 | ||
559 | static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c) | ||
560 | { | ||
561 | /* make timeout the same as for interrupt based functions */ | ||
562 | long timeout = 2 * DEF_TIMEOUT; | ||
563 | |||
564 | /* | ||
565 | * Wait for the bus to become free. | ||
566 | */ | ||
567 | while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) { | ||
568 | udelay(1000); | ||
569 | show_state(i2c); | ||
570 | } | ||
571 | |||
572 | if (timeout <= 0) { | ||
573 | show_state(i2c); | ||
574 | dev_err(&i2c->adap.dev, | ||
575 | "i2c_pxa: timeout waiting for bus free\n"); | ||
576 | return I2C_RETRY; | ||
577 | } | ||
578 | |||
579 | /* | ||
580 | * Set master mode. | ||
581 | */ | ||
582 | writel(readl(_ICR(i2c)) | ICR_SCLE, _ICR(i2c)); | ||
583 | |||
584 | return 0; | ||
585 | } | ||
586 | |||
587 | static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c, | ||
588 | struct i2c_msg *msg, int num) | ||
589 | { | ||
590 | unsigned long timeout = 500000; /* 5 seconds */ | ||
591 | int ret = 0; | ||
592 | |||
593 | ret = i2c_pxa_pio_set_master(i2c); | ||
594 | if (ret) | ||
595 | goto out; | ||
596 | |||
597 | i2c->msg = msg; | ||
598 | i2c->msg_num = num; | ||
599 | i2c->msg_idx = 0; | ||
600 | i2c->msg_ptr = 0; | ||
601 | i2c->irqlogidx = 0; | ||
602 | |||
603 | i2c_pxa_start_message(i2c); | ||
604 | |||
605 | while (timeout-- && i2c->msg_num > 0) { | ||
606 | i2c_pxa_handler(0, i2c); | ||
607 | udelay(10); | ||
608 | } | ||
609 | |||
610 | i2c_pxa_stop_message(i2c); | ||
611 | |||
612 | /* | ||
613 | * We place the return code in i2c->msg_idx. | ||
614 | */ | ||
615 | ret = i2c->msg_idx; | ||
616 | |||
617 | out: | ||
618 | if (timeout == 0) | ||
619 | i2c_pxa_scream_blue_murder(i2c, "timeout"); | ||
620 | |||
621 | return ret; | ||
622 | } | ||
623 | |||
557 | /* | 624 | /* |
558 | * We are protected by the adapter bus mutex. | 625 | * We are protected by the adapter bus mutex. |
559 | */ | 626 | */ |
@@ -610,6 +677,35 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num) | |||
610 | return ret; | 677 | return ret; |
611 | } | 678 | } |
612 | 679 | ||
680 | static int i2c_pxa_pio_xfer(struct i2c_adapter *adap, | ||
681 | struct i2c_msg msgs[], int num) | ||
682 | { | ||
683 | struct pxa_i2c *i2c = adap->algo_data; | ||
684 | int ret, i; | ||
685 | |||
686 | /* If the I2C controller is disabled we need to reset it | ||
687 | (probably due to a suspend/resume destroying state). We do | ||
688 | this here as we can then avoid worrying about resuming the | ||
689 | controller before its users. */ | ||
690 | if (!(readl(_ICR(i2c)) & ICR_IUE)) | ||
691 | i2c_pxa_reset(i2c); | ||
692 | |||
693 | for (i = adap->retries; i >= 0; i--) { | ||
694 | ret = i2c_pxa_do_pio_xfer(i2c, msgs, num); | ||
695 | if (ret != I2C_RETRY) | ||
696 | goto out; | ||
697 | |||
698 | if (i2c_debug) | ||
699 | dev_dbg(&adap->dev, "Retrying transmission\n"); | ||
700 | udelay(100); | ||
701 | } | ||
702 | i2c_pxa_scream_blue_murder(i2c, "exhausted retries"); | ||
703 | ret = -EREMOTEIO; | ||
704 | out: | ||
705 | i2c_pxa_set_slave(i2c, ret); | ||
706 | return ret; | ||
707 | } | ||
708 | |||
613 | /* | 709 | /* |
614 | * i2c_pxa_master_complete - complete the message and wake up. | 710 | * i2c_pxa_master_complete - complete the message and wake up. |
615 | */ | 711 | */ |
@@ -621,7 +717,8 @@ static void i2c_pxa_master_complete(struct pxa_i2c *i2c, int ret) | |||
621 | i2c->msg_num = 0; | 717 | i2c->msg_num = 0; |
622 | if (ret) | 718 | if (ret) |
623 | i2c->msg_idx = ret; | 719 | i2c->msg_idx = ret; |
624 | wake_up(&i2c->wait); | 720 | if (!i2c->use_pio) |
721 | wake_up(&i2c->wait); | ||
625 | } | 722 | } |
626 | 723 | ||
627 | static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) | 724 | static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) |
@@ -840,6 +937,37 @@ static const struct i2c_algorithm i2c_pxa_algorithm = { | |||
840 | .functionality = i2c_pxa_functionality, | 937 | .functionality = i2c_pxa_functionality, |
841 | }; | 938 | }; |
842 | 939 | ||
940 | static const struct i2c_algorithm i2c_pxa_pio_algorithm = { | ||
941 | .master_xfer = i2c_pxa_pio_xfer, | ||
942 | .functionality = i2c_pxa_functionality, | ||
943 | }; | ||
944 | |||
945 | static void i2c_pxa_enable(struct platform_device *dev) | ||
946 | { | ||
947 | if (cpu_is_pxa27x()) { | ||
948 | switch (dev->id) { | ||
949 | case 0: | ||
950 | pxa_gpio_mode(GPIO117_I2CSCL_MD); | ||
951 | pxa_gpio_mode(GPIO118_I2CSDA_MD); | ||
952 | break; | ||
953 | case 1: | ||
954 | local_irq_disable(); | ||
955 | PCFR |= PCFR_PI2CEN; | ||
956 | local_irq_enable(); | ||
957 | break; | ||
958 | } | ||
959 | } | ||
960 | } | ||
961 | |||
962 | static void i2c_pxa_disable(struct platform_device *dev) | ||
963 | { | ||
964 | if (cpu_is_pxa27x() && dev->id == 1) { | ||
965 | local_irq_disable(); | ||
966 | PCFR &= ~PCFR_PI2CEN; | ||
967 | local_irq_enable(); | ||
968 | } | ||
969 | } | ||
970 | |||
843 | #define res_len(r) ((r)->end - (r)->start + 1) | 971 | #define res_len(r) ((r)->end - (r)->start + 1) |
844 | static int i2c_pxa_probe(struct platform_device *dev) | 972 | static int i2c_pxa_probe(struct platform_device *dev) |
845 | { | 973 | { |
@@ -864,7 +992,6 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
864 | } | 992 | } |
865 | 993 | ||
866 | i2c->adap.owner = THIS_MODULE; | 994 | i2c->adap.owner = THIS_MODULE; |
867 | i2c->adap.algo = &i2c_pxa_algorithm; | ||
868 | i2c->adap.retries = 5; | 995 | i2c->adap.retries = 5; |
869 | 996 | ||
870 | spin_lock_init(&i2c->lock); | 997 | spin_lock_init(&i2c->lock); |
@@ -899,34 +1026,28 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
899 | #endif | 1026 | #endif |
900 | 1027 | ||
901 | clk_enable(i2c->clk); | 1028 | clk_enable(i2c->clk); |
902 | #ifdef CONFIG_PXA27x | 1029 | i2c_pxa_enable(dev); |
903 | switch (dev->id) { | ||
904 | case 0: | ||
905 | pxa_gpio_mode(GPIO117_I2CSCL_MD); | ||
906 | pxa_gpio_mode(GPIO118_I2CSDA_MD); | ||
907 | break; | ||
908 | case 1: | ||
909 | local_irq_disable(); | ||
910 | PCFR |= PCFR_PI2CEN; | ||
911 | local_irq_enable(); | ||
912 | } | ||
913 | #endif | ||
914 | 1030 | ||
915 | ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED, | 1031 | if (plat) { |
916 | i2c->adap.name, i2c); | 1032 | i2c->adap.class = plat->class; |
917 | if (ret) | 1033 | i2c->use_pio = plat->use_pio; |
918 | goto ereqirq; | 1034 | } |
919 | 1035 | ||
1036 | if (i2c->use_pio) { | ||
1037 | i2c->adap.algo = &i2c_pxa_pio_algorithm; | ||
1038 | } else { | ||
1039 | i2c->adap.algo = &i2c_pxa_algorithm; | ||
1040 | ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED, | ||
1041 | i2c->adap.name, i2c); | ||
1042 | if (ret) | ||
1043 | goto ereqirq; | ||
1044 | } | ||
920 | 1045 | ||
921 | i2c_pxa_reset(i2c); | 1046 | i2c_pxa_reset(i2c); |
922 | 1047 | ||
923 | i2c->adap.algo_data = i2c; | 1048 | i2c->adap.algo_data = i2c; |
924 | i2c->adap.dev.parent = &dev->dev; | 1049 | i2c->adap.dev.parent = &dev->dev; |
925 | 1050 | ||
926 | if (plat) { | ||
927 | i2c->adap.class = plat->class; | ||
928 | } | ||
929 | |||
930 | /* | 1051 | /* |
931 | * If "dev->id" is negative we consider it as zero. | 1052 | * If "dev->id" is negative we consider it as zero. |
932 | * The reason to do so is to avoid sysfs names that only make | 1053 | * The reason to do so is to avoid sysfs names that only make |
@@ -952,17 +1073,11 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
952 | return 0; | 1073 | return 0; |
953 | 1074 | ||
954 | eadapt: | 1075 | eadapt: |
955 | free_irq(irq, i2c); | 1076 | if (!i2c->use_pio) |
1077 | free_irq(irq, i2c); | ||
956 | ereqirq: | 1078 | ereqirq: |
957 | clk_disable(i2c->clk); | 1079 | clk_disable(i2c->clk); |
958 | 1080 | i2c_pxa_disable(dev); | |
959 | #ifdef CONFIG_PXA27x | ||
960 | if (dev->id == 1) { | ||
961 | local_irq_disable(); | ||
962 | PCFR &= ~PCFR_PI2CEN; | ||
963 | local_irq_enable(); | ||
964 | } | ||
965 | #endif | ||
966 | eremap: | 1081 | eremap: |
967 | clk_put(i2c->clk); | 1082 | clk_put(i2c->clk); |
968 | eclk: | 1083 | eclk: |
@@ -979,18 +1094,12 @@ static int i2c_pxa_remove(struct platform_device *dev) | |||
979 | platform_set_drvdata(dev, NULL); | 1094 | platform_set_drvdata(dev, NULL); |
980 | 1095 | ||
981 | i2c_del_adapter(&i2c->adap); | 1096 | i2c_del_adapter(&i2c->adap); |
982 | free_irq(i2c->irq, i2c); | 1097 | if (!i2c->use_pio) |
1098 | free_irq(i2c->irq, i2c); | ||
983 | 1099 | ||
984 | clk_disable(i2c->clk); | 1100 | clk_disable(i2c->clk); |
985 | clk_put(i2c->clk); | 1101 | clk_put(i2c->clk); |
986 | 1102 | i2c_pxa_disable(dev); | |
987 | #ifdef CONFIG_PXA27x | ||
988 | if (dev->id == 1) { | ||
989 | local_irq_disable(); | ||
990 | PCFR &= ~PCFR_PI2CEN; | ||
991 | local_irq_enable(); | ||
992 | } | ||
993 | #endif | ||
994 | 1103 | ||
995 | release_mem_region(i2c->iobase, i2c->iosize); | 1104 | release_mem_region(i2c->iobase, i2c->iosize); |
996 | kfree(i2c); | 1105 | kfree(i2c); |
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c index 503a134ec803..8fbbdb4c2f35 100644 --- a/drivers/i2c/busses/i2c-sibyte.c +++ b/drivers/i2c/busses/i2c-sibyte.c | |||
@@ -36,14 +36,6 @@ struct i2c_algo_sibyte_data { | |||
36 | /* ----- global defines ----------------------------------------------- */ | 36 | /* ----- global defines ----------------------------------------------- */ |
37 | #define SMB_CSR(a,r) ((long)(a->reg_base + r)) | 37 | #define SMB_CSR(a,r) ((long)(a->reg_base + r)) |
38 | 38 | ||
39 | /* ----- global variables --------------------------------------------- */ | ||
40 | |||
41 | /* module parameters: | ||
42 | */ | ||
43 | static int bit_scan; /* have a look at what's hanging 'round */ | ||
44 | module_param(bit_scan, int, 0); | ||
45 | MODULE_PARM_DESC(bit_scan, "Scan for active chips on the bus"); | ||
46 | |||
47 | 39 | ||
48 | static int smbus_xfer(struct i2c_adapter *i2c_adap, u16 addr, | 40 | static int smbus_xfer(struct i2c_adapter *i2c_adap, u16 addr, |
49 | unsigned short flags, char read_write, | 41 | unsigned short flags, char read_write, |
@@ -140,9 +132,8 @@ static const struct i2c_algorithm i2c_sibyte_algo = { | |||
140 | /* | 132 | /* |
141 | * registering functions to load algorithms at runtime | 133 | * registering functions to load algorithms at runtime |
142 | */ | 134 | */ |
143 | int i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed) | 135 | int __init i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed) |
144 | { | 136 | { |
145 | int i; | ||
146 | struct i2c_algo_sibyte_data *adap = i2c_adap->algo_data; | 137 | struct i2c_algo_sibyte_data *adap = i2c_adap->algo_data; |
147 | 138 | ||
148 | /* register new adapter to i2c module... */ | 139 | /* register new adapter to i2c module... */ |
@@ -152,24 +143,6 @@ int i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed) | |||
152 | csr_out32(speed, SMB_CSR(adap,R_SMB_FREQ)); | 143 | csr_out32(speed, SMB_CSR(adap,R_SMB_FREQ)); |
153 | csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL)); | 144 | csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL)); |
154 | 145 | ||
155 | /* scan bus */ | ||
156 | if (bit_scan) { | ||
157 | union i2c_smbus_data data; | ||
158 | int rc; | ||
159 | printk(KERN_INFO " i2c-algo-sibyte.o: scanning bus %s.\n", | ||
160 | i2c_adap->name); | ||
161 | for (i = 0x00; i < 0x7f; i++) { | ||
162 | /* XXXKW is this a realistic probe? */ | ||
163 | rc = smbus_xfer(i2c_adap, i, 0, I2C_SMBUS_READ, 0, | ||
164 | I2C_SMBUS_BYTE_DATA, &data); | ||
165 | if (!rc) { | ||
166 | printk("(%02x)",i); | ||
167 | } else | ||
168 | printk("."); | ||
169 | } | ||
170 | printk("\n"); | ||
171 | } | ||
172 | |||
173 | return i2c_add_adapter(i2c_adap); | 146 | return i2c_add_adapter(i2c_adap); |
174 | } | 147 | } |
175 | 148 | ||
diff --git a/drivers/i2c/busses/i2c-stub.c b/drivers/i2c/busses/i2c-stub.c index 84df29da1ddc..c2a9f8c94f5e 100644 --- a/drivers/i2c/busses/i2c-stub.c +++ b/drivers/i2c/busses/i2c-stub.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | i2c-stub.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | i2c-stub.c - I2C/SMBus chip emulator |
3 | monitoring | ||
4 | 3 | ||
5 | Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com> | 4 | Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com> |
5 | Copyright (C) 2007 Jean Delvare <khali@linux-fr.org> | ||
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
@@ -37,8 +37,8 @@ MODULE_PARM_DESC(chip_addr, | |||
37 | 37 | ||
38 | struct stub_chip { | 38 | struct stub_chip { |
39 | u8 pointer; | 39 | u8 pointer; |
40 | u8 bytes[256]; | 40 | u16 words[256]; /* Byte operations use the LSB as per SMBus |
41 | u16 words[256]; | 41 | specification */ |
42 | }; | 42 | }; |
43 | 43 | ||
44 | static struct stub_chip *stub_chips; | 44 | static struct stub_chip *stub_chips; |
@@ -75,7 +75,7 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
75 | "wrote 0x%02x.\n", | 75 | "wrote 0x%02x.\n", |
76 | addr, command); | 76 | addr, command); |
77 | } else { | 77 | } else { |
78 | data->byte = chip->bytes[chip->pointer++]; | 78 | data->byte = chip->words[chip->pointer++] & 0xff; |
79 | dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, " | 79 | dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, " |
80 | "read 0x%02x.\n", | 80 | "read 0x%02x.\n", |
81 | addr, data->byte); | 81 | addr, data->byte); |
@@ -86,12 +86,13 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
86 | 86 | ||
87 | case I2C_SMBUS_BYTE_DATA: | 87 | case I2C_SMBUS_BYTE_DATA: |
88 | if (read_write == I2C_SMBUS_WRITE) { | 88 | if (read_write == I2C_SMBUS_WRITE) { |
89 | chip->bytes[command] = data->byte; | 89 | chip->words[command] &= 0xff00; |
90 | chip->words[command] |= data->byte; | ||
90 | dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " | 91 | dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " |
91 | "wrote 0x%02x at 0x%02x.\n", | 92 | "wrote 0x%02x at 0x%02x.\n", |
92 | addr, data->byte, command); | 93 | addr, data->byte, command); |
93 | } else { | 94 | } else { |
94 | data->byte = chip->bytes[command]; | 95 | data->byte = chip->words[command] & 0xff; |
95 | dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " | 96 | dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " |
96 | "read 0x%02x at 0x%02x.\n", | 97 | "read 0x%02x at 0x%02x.\n", |
97 | addr, data->byte, command); | 98 | addr, data->byte, command); |
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index c9ce77f13c0e..77b13d027f86 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 - 2007 Jean Delvare <khali@linux-fr.org> | 7 | Copyright (C) 2005 - 2008 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 |
@@ -35,6 +35,7 @@ | |||
35 | VT8235 0x3177 yes | 35 | VT8235 0x3177 yes |
36 | VT8237R 0x3227 yes | 36 | VT8237R 0x3227 yes |
37 | VT8237A 0x3337 yes | 37 | VT8237A 0x3337 yes |
38 | VT8237S 0x3372 yes | ||
38 | VT8251 0x3287 yes | 39 | VT8251 0x3287 yes |
39 | CX700 0x8324 yes | 40 | CX700 0x8324 yes |
40 | 41 | ||
@@ -318,6 +319,10 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
318 | unsigned char temp; | 319 | unsigned char temp; |
319 | int error = -ENODEV; | 320 | int error = -ENODEV; |
320 | 321 | ||
322 | /* driver_data might come from user-space, so check it */ | ||
323 | if (id->driver_data & 1 || id->driver_data > 0xff) | ||
324 | return -EINVAL; | ||
325 | |||
321 | /* Determine the address of the SMBus areas */ | 326 | /* Determine the address of the SMBus areas */ |
322 | if (force_addr) { | 327 | if (force_addr) { |
323 | vt596_smba = force_addr & 0xfff0; | 328 | vt596_smba = force_addr & 0xfff0; |
@@ -389,6 +394,7 @@ found: | |||
389 | case PCI_DEVICE_ID_VIA_8251: | 394 | case PCI_DEVICE_ID_VIA_8251: |
390 | case PCI_DEVICE_ID_VIA_8237: | 395 | case PCI_DEVICE_ID_VIA_8237: |
391 | case PCI_DEVICE_ID_VIA_8237A: | 396 | case PCI_DEVICE_ID_VIA_8237A: |
397 | case PCI_DEVICE_ID_VIA_8237S: | ||
392 | case PCI_DEVICE_ID_VIA_8235: | 398 | case PCI_DEVICE_ID_VIA_8235: |
393 | case PCI_DEVICE_ID_VIA_8233A: | 399 | case PCI_DEVICE_ID_VIA_8233A: |
394 | case PCI_DEVICE_ID_VIA_8233_0: | 400 | case PCI_DEVICE_ID_VIA_8233_0: |
@@ -440,6 +446,8 @@ static struct pci_device_id vt596_ids[] = { | |||
440 | .driver_data = SMBBA3 }, | 446 | .driver_data = SMBBA3 }, |
441 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237A), | 447 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237A), |
442 | .driver_data = SMBBA3 }, | 448 | .driver_data = SMBBA3 }, |
449 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237S), | ||
450 | .driver_data = SMBBA3 }, | ||
443 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4), | 451 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4), |
444 | .driver_data = SMBBA1 }, | 452 | .driver_data = SMBBA1 }, |
445 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8251), | 453 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8251), |
@@ -455,6 +463,7 @@ static struct pci_driver vt596_driver = { | |||
455 | .name = "vt596_smbus", | 463 | .name = "vt596_smbus", |
456 | .id_table = vt596_ids, | 464 | .id_table = vt596_ids, |
457 | .probe = vt596_probe, | 465 | .probe = vt596_probe, |
466 | .dynids.use_driver_data = 1, | ||
458 | }; | 467 | }; |
459 | 468 | ||
460 | static int __init i2c_vt596_init(void) | 469 | static int __init i2c_vt596_init(void) |