diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-30 01:58:41 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-30 01:58:41 -0500 |
commit | fce45c1c8a6b5334fa88bbb9b1496b0699d3fef0 (patch) | |
tree | cba2597077cf33d122f8d771bf84618cc5374cf6 /drivers/i2c/busses | |
parent | 15dbb5a3f971a28040ae6cbcd8bbdf19b629fa83 (diff) | |
parent | 81cfb8864c73230eb1c37753aba517db15cf4d8f (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers/i2c/busses')
33 files changed, 350 insertions, 324 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 3badfec75b1c..4010fe92e72b 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -135,11 +135,12 @@ config I2C_I810 | |||
135 | help | 135 | help |
136 | If you say yes to this option, support will be included for the Intel | 136 | If you say yes to this option, support will be included for the Intel |
137 | 810/815 family of mainboard I2C interfaces. Specifically, the | 137 | 810/815 family of mainboard I2C interfaces. Specifically, the |
138 | following versions of the chipset is supported: | 138 | following versions of the chipset are supported: |
139 | i810AA | 139 | i810AA |
140 | i810AB | 140 | i810AB |
141 | i810E | 141 | i810E |
142 | i815 | 142 | i815 |
143 | i845G | ||
143 | 144 | ||
144 | This driver can also be built as a module. If so, the module | 145 | This driver can also be built as a module. If so, the module |
145 | will be called i2c-i810. | 146 | will be called i2c-i810. |
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index f021acd2674e..ba90f5140af6 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c | |||
@@ -134,7 +134,7 @@ | |||
134 | /* -> Read = 1 */ | 134 | /* -> Read = 1 */ |
135 | #define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */ | 135 | #define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */ |
136 | 136 | ||
137 | 137 | static struct pci_driver ali1535_driver; | |
138 | static unsigned short ali1535_smba; | 138 | static unsigned short ali1535_smba; |
139 | static DECLARE_MUTEX(i2c_ali1535_sem); | 139 | static DECLARE_MUTEX(i2c_ali1535_sem); |
140 | 140 | ||
@@ -162,7 +162,8 @@ static int ali1535_setup(struct pci_dev *dev) | |||
162 | goto exit; | 162 | goto exit; |
163 | } | 163 | } |
164 | 164 | ||
165 | if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE, "ali1535-smb")) { | 165 | if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE, |
166 | ali1535_driver.name)) { | ||
166 | dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n", | 167 | dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n", |
167 | ali1535_smba); | 168 | ali1535_smba); |
168 | goto exit; | 169 | goto exit; |
@@ -480,7 +481,6 @@ static struct i2c_adapter ali1535_adapter = { | |||
480 | .owner = THIS_MODULE, | 481 | .owner = THIS_MODULE, |
481 | .class = I2C_CLASS_HWMON, | 482 | .class = I2C_CLASS_HWMON, |
482 | .algo = &smbus_algorithm, | 483 | .algo = &smbus_algorithm, |
483 | .name = "unset", | ||
484 | }; | 484 | }; |
485 | 485 | ||
486 | static struct pci_device_id ali1535_ids[] = { | 486 | static struct pci_device_id ali1535_ids[] = { |
@@ -513,6 +513,7 @@ static void __devexit ali1535_remove(struct pci_dev *dev) | |||
513 | } | 513 | } |
514 | 514 | ||
515 | static struct pci_driver ali1535_driver = { | 515 | static struct pci_driver ali1535_driver = { |
516 | .owner = THIS_MODULE, | ||
516 | .name = "ali1535_smbus", | 517 | .name = "ali1535_smbus", |
517 | .id_table = ali1535_ids, | 518 | .id_table = ali1535_ids, |
518 | .probe = ali1535_probe, | 519 | .probe = ali1535_probe, |
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c index 86947504aea1..f1a62d892425 100644 --- a/drivers/i2c/busses/i2c-ali1563.c +++ b/drivers/i2c/busses/i2c-ali1563.c | |||
@@ -60,6 +60,7 @@ | |||
60 | 60 | ||
61 | #define HST_CNTL2_SIZEMASK 0x38 | 61 | #define HST_CNTL2_SIZEMASK 0x38 |
62 | 62 | ||
63 | static struct pci_driver ali1563_pci_driver; | ||
63 | static unsigned short ali1563_smba; | 64 | static unsigned short ali1563_smba; |
64 | 65 | ||
65 | static int ali1563_transaction(struct i2c_adapter * a, int size) | 66 | static int ali1563_transaction(struct i2c_adapter * a, int size) |
@@ -350,7 +351,8 @@ static int __devinit ali1563_setup(struct pci_dev * dev) | |||
350 | dev_warn(&dev->dev,"ali1563_smba Uninitialized\n"); | 351 | dev_warn(&dev->dev,"ali1563_smba Uninitialized\n"); |
351 | goto Err; | 352 | goto Err; |
352 | } | 353 | } |
353 | if (!request_region(ali1563_smba,ALI1563_SMB_IOSIZE,"i2c-ali1563")) { | 354 | if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE, |
355 | ali1563_pci_driver.name)) { | ||
354 | dev_warn(&dev->dev,"Could not allocate I/O space"); | 356 | dev_warn(&dev->dev,"Could not allocate I/O space"); |
355 | goto Err; | 357 | goto Err; |
356 | } | 358 | } |
@@ -406,7 +408,8 @@ static struct pci_device_id __devinitdata ali1563_id_table[] = { | |||
406 | MODULE_DEVICE_TABLE (pci, ali1563_id_table); | 408 | MODULE_DEVICE_TABLE (pci, ali1563_id_table); |
407 | 409 | ||
408 | static struct pci_driver ali1563_pci_driver = { | 410 | static struct pci_driver ali1563_pci_driver = { |
409 | .name = "ali1563_i2c", | 411 | .owner = THIS_MODULE, |
412 | .name = "ali1563_smbus", | ||
410 | .id_table = ali1563_id_table, | 413 | .id_table = ali1563_id_table, |
411 | .probe = ali1563_probe, | 414 | .probe = ali1563_probe, |
412 | .remove = __devexit_p(ali1563_remove), | 415 | .remove = __devexit_p(ali1563_remove), |
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index b3f50bff39a0..400b08ed4299 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c | |||
@@ -125,12 +125,13 @@ | |||
125 | 125 | ||
126 | /* If force_addr is set to anything different from 0, we forcibly enable | 126 | /* If force_addr is set to anything different from 0, we forcibly enable |
127 | the device at the given address. */ | 127 | the device at the given address. */ |
128 | static u16 force_addr = 0; | 128 | static u16 force_addr; |
129 | module_param(force_addr, ushort, 0); | 129 | module_param(force_addr, ushort, 0); |
130 | MODULE_PARM_DESC(force_addr, | 130 | MODULE_PARM_DESC(force_addr, |
131 | "Initialize the base address of the i2c controller"); | 131 | "Initialize the base address of the i2c controller"); |
132 | 132 | ||
133 | static unsigned short ali15x3_smba = 0; | 133 | static struct pci_driver ali15x3_driver; |
134 | static unsigned short ali15x3_smba; | ||
134 | 135 | ||
135 | static int ali15x3_setup(struct pci_dev *ALI15X3_dev) | 136 | static int ali15x3_setup(struct pci_dev *ALI15X3_dev) |
136 | { | 137 | { |
@@ -166,7 +167,8 @@ static int ali15x3_setup(struct pci_dev *ALI15X3_dev) | |||
166 | if(force_addr) | 167 | if(force_addr) |
167 | ali15x3_smba = force_addr & ~(ALI15X3_SMB_IOSIZE - 1); | 168 | ali15x3_smba = force_addr & ~(ALI15X3_SMB_IOSIZE - 1); |
168 | 169 | ||
169 | if (!request_region(ali15x3_smba, ALI15X3_SMB_IOSIZE, "ali15x3-smb")) { | 170 | if (!request_region(ali15x3_smba, ALI15X3_SMB_IOSIZE, |
171 | ali15x3_driver.name)) { | ||
170 | dev_err(&ALI15X3_dev->dev, | 172 | dev_err(&ALI15X3_dev->dev, |
171 | "ALI15X3_smb region 0x%x already in use!\n", | 173 | "ALI15X3_smb region 0x%x already in use!\n", |
172 | ali15x3_smba); | 174 | ali15x3_smba); |
@@ -470,7 +472,6 @@ static struct i2c_adapter ali15x3_adapter = { | |||
470 | .owner = THIS_MODULE, | 472 | .owner = THIS_MODULE, |
471 | .class = I2C_CLASS_HWMON, | 473 | .class = I2C_CLASS_HWMON, |
472 | .algo = &smbus_algorithm, | 474 | .algo = &smbus_algorithm, |
473 | .name = "unset", | ||
474 | }; | 475 | }; |
475 | 476 | ||
476 | static struct pci_device_id ali15x3_ids[] = { | 477 | static struct pci_device_id ali15x3_ids[] = { |
@@ -503,6 +504,7 @@ static void __devexit ali15x3_remove(struct pci_dev *dev) | |||
503 | } | 504 | } |
504 | 505 | ||
505 | static struct pci_driver ali15x3_driver = { | 506 | static struct pci_driver ali15x3_driver = { |
507 | .owner = THIS_MODULE, | ||
506 | .name = "ali15x3_smbus", | 508 | .name = "ali15x3_smbus", |
507 | .id_table = ali15x3_ids, | 509 | .id_table = ali15x3_ids, |
508 | .probe = ali15x3_probe, | 510 | .probe = ali15x3_probe, |
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c index 4e553e8c5cba..f51ab652300a 100644 --- a/drivers/i2c/busses/i2c-amd756-s4882.c +++ b/drivers/i2c/busses/i2c-amd756-s4882.c | |||
@@ -169,12 +169,12 @@ static int __init amd756_s4882_init(void) | |||
169 | init_MUTEX(&amd756_lock); | 169 | init_MUTEX(&amd756_lock); |
170 | 170 | ||
171 | /* Define the 5 virtual adapters and algorithms structures */ | 171 | /* Define the 5 virtual adapters and algorithms structures */ |
172 | if (!(s4882_adapter = kmalloc(5 * sizeof(struct i2c_adapter), | 172 | if (!(s4882_adapter = kzalloc(5 * sizeof(struct i2c_adapter), |
173 | GFP_KERNEL))) { | 173 | GFP_KERNEL))) { |
174 | error = -ENOMEM; | 174 | error = -ENOMEM; |
175 | goto ERROR1; | 175 | goto ERROR1; |
176 | } | 176 | } |
177 | if (!(s4882_algo = kmalloc(5 * sizeof(struct i2c_algorithm), | 177 | if (!(s4882_algo = kzalloc(5 * sizeof(struct i2c_algorithm), |
178 | GFP_KERNEL))) { | 178 | GFP_KERNEL))) { |
179 | error = -ENOMEM; | 179 | error = -ENOMEM; |
180 | goto ERROR2; | 180 | goto ERROR2; |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 6ad0603384b8..de035d137c3f 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -85,8 +85,8 @@ | |||
85 | #define AMD756_PROCESS_CALL 0x04 | 85 | #define AMD756_PROCESS_CALL 0x04 |
86 | #define AMD756_BLOCK_DATA 0x05 | 86 | #define AMD756_BLOCK_DATA 0x05 |
87 | 87 | ||
88 | 88 | static struct pci_driver amd756_driver; | |
89 | static unsigned short amd756_ioport = 0; | 89 | static unsigned short amd756_ioport; |
90 | 90 | ||
91 | /* | 91 | /* |
92 | SMBUS event = I/O 28-29 bit 11 | 92 | SMBUS event = I/O 28-29 bit 11 |
@@ -303,7 +303,6 @@ struct i2c_adapter amd756_smbus = { | |||
303 | .owner = THIS_MODULE, | 303 | .owner = THIS_MODULE, |
304 | .class = I2C_CLASS_HWMON, | 304 | .class = I2C_CLASS_HWMON, |
305 | .algo = &smbus_algorithm, | 305 | .algo = &smbus_algorithm, |
306 | .name = "unset", | ||
307 | }; | 306 | }; |
308 | 307 | ||
309 | enum chiptype { AMD756, AMD766, AMD768, NFORCE, AMD8111 }; | 308 | enum chiptype { AMD756, AMD766, AMD768, NFORCE, AMD8111 }; |
@@ -365,7 +364,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev, | |||
365 | amd756_ioport += SMB_ADDR_OFFSET; | 364 | amd756_ioport += SMB_ADDR_OFFSET; |
366 | } | 365 | } |
367 | 366 | ||
368 | if (!request_region(amd756_ioport, SMB_IOSIZE, "amd756-smbus")) { | 367 | if (!request_region(amd756_ioport, SMB_IOSIZE, amd756_driver.name)) { |
369 | dev_err(&pdev->dev, "SMB region 0x%x already in use!\n", | 368 | dev_err(&pdev->dev, "SMB region 0x%x already in use!\n", |
370 | amd756_ioport); | 369 | amd756_ioport); |
371 | return -ENODEV; | 370 | return -ENODEV; |
@@ -402,6 +401,7 @@ static void __devexit amd756_remove(struct pci_dev *dev) | |||
402 | } | 401 | } |
403 | 402 | ||
404 | static struct pci_driver amd756_driver = { | 403 | static struct pci_driver amd756_driver = { |
404 | .owner = THIS_MODULE, | ||
405 | .name = "amd756_smbus", | 405 | .name = "amd756_smbus", |
406 | .id_table = amd756_ids, | 406 | .id_table = amd756_ids, |
407 | .probe = amd756_probe, | 407 | .probe = amd756_probe, |
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index 45ea24ba14d5..f3b79a68dbec 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c | |||
@@ -30,6 +30,8 @@ struct amd_smbus { | |||
30 | int size; | 30 | int size; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | static struct pci_driver amd8111_driver; | ||
34 | |||
33 | /* | 35 | /* |
34 | * AMD PCI control registers definitions. | 36 | * AMD PCI control registers definitions. |
35 | */ | 37 | */ |
@@ -242,7 +244,6 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
242 | break; | 244 | break; |
243 | 245 | ||
244 | case I2C_SMBUS_BLOCK_PROC_CALL: | 246 | case I2C_SMBUS_BLOCK_PROC_CALL: |
245 | protocol |= pec; | ||
246 | len = min_t(u8, data->block[0], 31); | 247 | len = min_t(u8, data->block[0], 31); |
247 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 248 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
248 | amd_ec_write(smbus, AMD_SMB_BCNT, len); | 249 | amd_ec_write(smbus, AMD_SMB_BCNT, len); |
@@ -252,13 +253,6 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
252 | read_write = I2C_SMBUS_READ; | 253 | read_write = I2C_SMBUS_READ; |
253 | break; | 254 | break; |
254 | 255 | ||
255 | case I2C_SMBUS_WORD_DATA_PEC: | ||
256 | case I2C_SMBUS_BLOCK_DATA_PEC: | ||
257 | case I2C_SMBUS_PROC_CALL_PEC: | ||
258 | case I2C_SMBUS_BLOCK_PROC_CALL_PEC: | ||
259 | dev_warn(&adap->dev, "Unexpected software PEC transaction %d\n.", size); | ||
260 | return -1; | ||
261 | |||
262 | default: | 256 | default: |
263 | dev_warn(&adap->dev, "Unsupported transaction %d\n", size); | 257 | dev_warn(&adap->dev, "Unsupported transaction %d\n", size); |
264 | return -1; | 258 | return -1; |
@@ -343,16 +337,15 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ | |||
343 | if (~pci_resource_flags(dev, 0) & IORESOURCE_IO) | 337 | if (~pci_resource_flags(dev, 0) & IORESOURCE_IO) |
344 | return -ENODEV; | 338 | return -ENODEV; |
345 | 339 | ||
346 | smbus = kmalloc(sizeof(struct amd_smbus), GFP_KERNEL); | 340 | smbus = kzalloc(sizeof(struct amd_smbus), GFP_KERNEL); |
347 | if (!smbus) | 341 | if (!smbus) |
348 | return -ENOMEM; | 342 | return -ENOMEM; |
349 | memset(smbus, 0, sizeof(struct amd_smbus)); | ||
350 | 343 | ||
351 | smbus->dev = dev; | 344 | smbus->dev = dev; |
352 | smbus->base = pci_resource_start(dev, 0); | 345 | smbus->base = pci_resource_start(dev, 0); |
353 | smbus->size = pci_resource_len(dev, 0); | 346 | smbus->size = pci_resource_len(dev, 0); |
354 | 347 | ||
355 | if (!request_region(smbus->base, smbus->size, "amd8111 SMBus 2.0")) | 348 | if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) |
356 | goto out_kfree; | 349 | goto out_kfree; |
357 | 350 | ||
358 | smbus->adapter.owner = THIS_MODULE; | 351 | smbus->adapter.owner = THIS_MODULE; |
@@ -391,6 +384,7 @@ static void __devexit amd8111_remove(struct pci_dev *dev) | |||
391 | } | 384 | } |
392 | 385 | ||
393 | static struct pci_driver amd8111_driver = { | 386 | static struct pci_driver amd8111_driver = { |
387 | .owner = THIS_MODULE, | ||
394 | .name = "amd8111_smbus2", | 388 | .name = "amd8111_smbus2", |
395 | .id_table = amd8111_ids, | 389 | .id_table = amd8111_ids, |
396 | .probe = amd8111_probe, | 390 | .probe = amd8111_probe, |
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c index 6930b660e508..59f8308c2356 100644 --- a/drivers/i2c/busses/i2c-elektor.c +++ b/drivers/i2c/busses/i2c-elektor.c | |||
@@ -22,7 +22,7 @@ | |||
22 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even | 22 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even |
23 | Frodo Looijaard <frodol@dds.nl> */ | 23 | Frodo Looijaard <frodol@dds.nl> */ |
24 | 24 | ||
25 | /* Partialy rewriten by Oleg I. Vdovikin for mmapped support of | 25 | /* Partialy rewriten by Oleg I. Vdovikin for mmapped support of |
26 | for Alpha Processor Inc. UP-2000(+) boards */ | 26 | for Alpha Processor Inc. UP-2000(+) boards */ |
27 | 27 | ||
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
@@ -46,12 +46,14 @@ | |||
46 | #define DEFAULT_BASE 0x330 | 46 | #define DEFAULT_BASE 0x330 |
47 | 47 | ||
48 | static int base; | 48 | static int base; |
49 | static u8 __iomem *base_iomem; | ||
50 | |||
49 | static int irq; | 51 | static int irq; |
50 | static int clock = 0x1c; | 52 | static int clock = 0x1c; |
51 | static int own = 0x55; | 53 | static int own = 0x55; |
52 | static int mmapped; | 54 | static int mmapped; |
53 | 55 | ||
54 | /* vdovikin: removed static struct i2c_pcf_isa gpi; code - | 56 | /* vdovikin: removed static struct i2c_pcf_isa gpi; code - |
55 | this module in real supports only one device, due to missing arguments | 57 | this module in real supports only one device, due to missing arguments |
56 | in some functions, called from the algo-pcf module. Sometimes it's | 58 | in some functions, called from the algo-pcf module. Sometimes it's |
57 | need to be rewriten - but for now just remove this for simpler reading */ | 59 | need to be rewriten - but for now just remove this for simpler reading */ |
@@ -60,40 +62,33 @@ static wait_queue_head_t pcf_wait; | |||
60 | static int pcf_pending; | 62 | static int pcf_pending; |
61 | static spinlock_t lock; | 63 | static spinlock_t lock; |
62 | 64 | ||
65 | static struct i2c_adapter pcf_isa_ops; | ||
66 | |||
63 | /* ----- local functions ---------------------------------------------- */ | 67 | /* ----- local functions ---------------------------------------------- */ |
64 | 68 | ||
65 | static void pcf_isa_setbyte(void *data, int ctl, int val) | 69 | static void pcf_isa_setbyte(void *data, int ctl, int val) |
66 | { | 70 | { |
67 | int address = ctl ? (base + 1) : base; | 71 | u8 __iomem *address = ctl ? (base_iomem + 1) : base_iomem; |
68 | 72 | ||
69 | /* enable irq if any specified for serial operation */ | 73 | /* enable irq if any specified for serial operation */ |
70 | if (ctl && irq && (val & I2C_PCF_ESO)) { | 74 | if (ctl && irq && (val & I2C_PCF_ESO)) { |
71 | val |= I2C_PCF_ENI; | 75 | val |= I2C_PCF_ENI; |
72 | } | 76 | } |
73 | 77 | ||
74 | pr_debug("i2c-elektor: Write 0x%X 0x%02X\n", address, val & 255); | 78 | pr_debug("%s: Write %p 0x%02X\n", pcf_isa_ops.name, address, val); |
75 | 79 | iowrite8(val, address); | |
76 | switch (mmapped) { | 80 | #ifdef __alpha__ |
77 | case 0: /* regular I/O */ | 81 | /* API UP2000 needs some hardware fudging to make the write stick */ |
78 | outb(val, address); | 82 | iowrite8(val, address); |
79 | break; | 83 | #endif |
80 | case 2: /* double mapped I/O needed for UP2000 board, | ||
81 | I don't know why this... */ | ||
82 | writeb(val, (void *)address); | ||
83 | /* fall */ | ||
84 | case 1: /* memory mapped I/O */ | ||
85 | writeb(val, (void *)address); | ||
86 | break; | ||
87 | } | ||
88 | } | 84 | } |
89 | 85 | ||
90 | static int pcf_isa_getbyte(void *data, int ctl) | 86 | static int pcf_isa_getbyte(void *data, int ctl) |
91 | { | 87 | { |
92 | int address = ctl ? (base + 1) : base; | 88 | u8 __iomem *address = ctl ? (base_iomem + 1) : base_iomem; |
93 | int val = mmapped ? readb((void *)address) : inb(address); | 89 | int val = ioread8(address); |
94 | |||
95 | pr_debug("i2c-elektor: Read 0x%X 0x%02X\n", address, val); | ||
96 | 90 | ||
91 | pr_debug("%s: Read %p 0x%02X\n", pcf_isa_ops.name, address, val); | ||
97 | return (val); | 92 | return (val); |
98 | } | 93 | } |
99 | 94 | ||
@@ -149,16 +144,40 @@ static int pcf_isa_init(void) | |||
149 | { | 144 | { |
150 | spin_lock_init(&lock); | 145 | spin_lock_init(&lock); |
151 | if (!mmapped) { | 146 | if (!mmapped) { |
152 | if (!request_region(base, 2, "i2c (isa bus adapter)")) { | 147 | if (!request_region(base, 2, pcf_isa_ops.name)) { |
153 | printk(KERN_ERR | 148 | printk(KERN_ERR "%s: requested I/O region (%#x:2) is " |
154 | "i2c-elektor: requested I/O region (0x%X:2) " | 149 | "in use\n", pcf_isa_ops.name, base); |
155 | "is in use.\n", base); | 150 | return -ENODEV; |
151 | } | ||
152 | base_iomem = ioport_map(base, 2); | ||
153 | if (!base_iomem) { | ||
154 | printk(KERN_ERR "%s: remap of I/O region %#x failed\n", | ||
155 | pcf_isa_ops.name, base); | ||
156 | release_region(base, 2); | ||
157 | return -ENODEV; | ||
158 | } | ||
159 | } else { | ||
160 | if (!request_mem_region(base, 2, pcf_isa_ops.name)) { | ||
161 | printk(KERN_ERR "%s: requested memory region (%#x:2) " | ||
162 | "is in use\n", pcf_isa_ops.name, base); | ||
163 | return -ENODEV; | ||
164 | } | ||
165 | base_iomem = ioremap(base, 2); | ||
166 | if (base_iomem == NULL) { | ||
167 | printk(KERN_ERR "%s: remap of memory region %#x " | ||
168 | "failed\n", pcf_isa_ops.name, base); | ||
169 | release_mem_region(base, 2); | ||
156 | return -ENODEV; | 170 | return -ENODEV; |
157 | } | 171 | } |
158 | } | 172 | } |
173 | pr_debug("%s: registers %#x remapped to %p\n", pcf_isa_ops.name, base, | ||
174 | base_iomem); | ||
175 | |||
159 | if (irq > 0) { | 176 | if (irq > 0) { |
160 | if (request_irq(irq, pcf_isa_handler, 0, "PCF8584", NULL) < 0) { | 177 | if (request_irq(irq, pcf_isa_handler, 0, pcf_isa_ops.name, |
161 | printk(KERN_ERR "i2c-elektor: Request irq%d failed\n", irq); | 178 | NULL) < 0) { |
179 | printk(KERN_ERR "%s: Request irq%d failed\n", | ||
180 | pcf_isa_ops.name, irq); | ||
162 | irq = 0; | 181 | irq = 0; |
163 | } else | 182 | } else |
164 | enable_irq(irq); | 183 | enable_irq(irq); |
@@ -186,47 +205,49 @@ static struct i2c_adapter pcf_isa_ops = { | |||
186 | .class = I2C_CLASS_HWMON, | 205 | .class = I2C_CLASS_HWMON, |
187 | .id = I2C_HW_P_ELEK, | 206 | .id = I2C_HW_P_ELEK, |
188 | .algo_data = &pcf_isa_data, | 207 | .algo_data = &pcf_isa_data, |
189 | .name = "PCF8584 ISA adapter", | 208 | .name = "i2c-elektor", |
190 | }; | 209 | }; |
191 | 210 | ||
192 | static int __init i2c_pcfisa_init(void) | 211 | static int __init i2c_pcfisa_init(void) |
193 | { | 212 | { |
194 | #ifdef __alpha__ | 213 | #ifdef __alpha__ |
195 | /* check to see we have memory mapped PCF8584 connected to the | 214 | /* check to see we have memory mapped PCF8584 connected to the |
196 | Cypress cy82c693 PCI-ISA bridge as on UP2000 board */ | 215 | Cypress cy82c693 PCI-ISA bridge as on UP2000 board */ |
197 | if (base == 0) { | 216 | if (base == 0) { |
198 | struct pci_dev *cy693_dev; | 217 | struct pci_dev *cy693_dev; |
199 | 218 | ||
200 | cy693_dev = pci_get_device(PCI_VENDOR_ID_CONTAQ, | 219 | cy693_dev = pci_get_device(PCI_VENDOR_ID_CONTAQ, |
201 | PCI_DEVICE_ID_CONTAQ_82C693, NULL); | 220 | PCI_DEVICE_ID_CONTAQ_82C693, NULL); |
202 | if (cy693_dev) { | 221 | if (cy693_dev) { |
203 | char config; | 222 | unsigned char config; |
204 | /* yeap, we've found cypress, let's check config */ | 223 | /* yeap, we've found cypress, let's check config */ |
205 | if (!pci_read_config_byte(cy693_dev, 0x47, &config)) { | 224 | if (!pci_read_config_byte(cy693_dev, 0x47, &config)) { |
206 | 225 | ||
207 | pr_debug("i2c-elektor: found cy82c693, config register 0x47 = 0x%02x.\n", config); | 226 | pr_debug("%s: found cy82c693, config " |
227 | "register 0x47 = 0x%02x\n", | ||
228 | pcf_isa_ops.name, config); | ||
208 | 229 | ||
209 | /* UP2000 board has this register set to 0xe1, | 230 | /* UP2000 board has this register set to 0xe1, |
210 | but the most significant bit as seems can be | 231 | but the most significant bit as seems can be |
211 | reset during the proper initialisation | 232 | reset during the proper initialisation |
212 | sequence if guys from API decides to do that | 233 | sequence if guys from API decides to do that |
213 | (so, we can even enable Tsunami Pchip | 234 | (so, we can even enable Tsunami Pchip |
214 | window for the upper 1 Gb) */ | 235 | window for the upper 1 Gb) */ |
215 | 236 | ||
216 | /* so just check for ROMCS at 0xe0000, | 237 | /* so just check for ROMCS at 0xe0000, |
217 | ROMCS enabled for writes | 238 | ROMCS enabled for writes |
218 | and external XD Bus buffer in use. */ | 239 | and external XD Bus buffer in use. */ |
219 | if ((config & 0x7f) == 0x61) { | 240 | if ((config & 0x7f) == 0x61) { |
220 | /* seems to be UP2000 like board */ | 241 | /* seems to be UP2000 like board */ |
221 | base = 0xe0000; | 242 | base = 0xe0000; |
222 | /* I don't know why we need to | 243 | mmapped = 1; |
223 | write twice */ | 244 | /* UP2000 drives ISA with |
224 | mmapped = 2; | ||
225 | /* UP2000 drives ISA with | ||
226 | 8.25 MHz (PCI/4) clock | 245 | 8.25 MHz (PCI/4) clock |
227 | (this can be read from cypress) */ | 246 | (this can be read from cypress) */ |
228 | clock = I2C_PCF_CLK | I2C_PCF_TRNS90; | 247 | clock = I2C_PCF_CLK | I2C_PCF_TRNS90; |
229 | printk(KERN_INFO "i2c-elektor: found API UP2000 like board, will probe PCF8584 later.\n"); | 248 | pr_info("%s: found API UP2000 like " |
249 | "board, will probe PCF8584 " | ||
250 | "later\n", pcf_isa_ops.name); | ||
230 | } | 251 | } |
231 | } | 252 | } |
232 | pci_dev_put(cy693_dev); | 253 | pci_dev_put(cy693_dev); |
@@ -236,12 +257,11 @@ static int __init i2c_pcfisa_init(void) | |||
236 | 257 | ||
237 | /* sanity checks for mmapped I/O */ | 258 | /* sanity checks for mmapped I/O */ |
238 | if (mmapped && base < 0xc8000) { | 259 | if (mmapped && base < 0xc8000) { |
239 | printk(KERN_ERR "i2c-elektor: incorrect base address (0x%0X) specified for mmapped I/O.\n", base); | 260 | printk(KERN_ERR "%s: incorrect base address (%#x) specified " |
261 | "for mmapped I/O\n", pcf_isa_ops.name, base); | ||
240 | return -ENODEV; | 262 | return -ENODEV; |
241 | } | 263 | } |
242 | 264 | ||
243 | printk(KERN_INFO "i2c-elektor: i2c pcf8584-isa adapter driver\n"); | ||
244 | |||
245 | if (base == 0) { | 265 | if (base == 0) { |
246 | base = DEFAULT_BASE; | 266 | base = DEFAULT_BASE; |
247 | } | 267 | } |
@@ -251,8 +271,8 @@ static int __init i2c_pcfisa_init(void) | |||
251 | return -ENODEV; | 271 | return -ENODEV; |
252 | if (i2c_pcf_add_bus(&pcf_isa_ops) < 0) | 272 | if (i2c_pcf_add_bus(&pcf_isa_ops) < 0) |
253 | goto fail; | 273 | goto fail; |
254 | 274 | ||
255 | printk(KERN_ERR "i2c-elektor: found device at %#x.\n", base); | 275 | dev_info(&pcf_isa_ops.dev, "found device at %#x\n", base); |
256 | 276 | ||
257 | return 0; | 277 | return 0; |
258 | 278 | ||
@@ -262,8 +282,13 @@ static int __init i2c_pcfisa_init(void) | |||
262 | free_irq(irq, NULL); | 282 | free_irq(irq, NULL); |
263 | } | 283 | } |
264 | 284 | ||
265 | if (!mmapped) | 285 | if (!mmapped) { |
266 | release_region(base , 2); | 286 | ioport_unmap(base_iomem); |
287 | release_region(base, 2); | ||
288 | } else { | ||
289 | iounmap(base_iomem); | ||
290 | release_mem_region(base, 2); | ||
291 | } | ||
267 | return -ENODEV; | 292 | return -ENODEV; |
268 | } | 293 | } |
269 | 294 | ||
@@ -276,8 +301,13 @@ static void i2c_pcfisa_exit(void) | |||
276 | free_irq(irq, NULL); | 301 | free_irq(irq, NULL); |
277 | } | 302 | } |
278 | 303 | ||
279 | if (!mmapped) | 304 | if (!mmapped) { |
280 | release_region(base , 2); | 305 | ioport_unmap(base_iomem); |
306 | release_region(base, 2); | ||
307 | } else { | ||
308 | iounmap(base_iomem); | ||
309 | release_mem_region(base, 2); | ||
310 | } | ||
281 | } | 311 | } |
282 | 312 | ||
283 | MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>"); | 313 | MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>"); |
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c index e0cb3b0f92fa..1b5354e24bf5 100644 --- a/drivers/i2c/busses/i2c-hydra.c +++ b/drivers/i2c/busses/i2c-hydra.c | |||
@@ -155,6 +155,7 @@ static void __devexit hydra_remove(struct pci_dev *dev) | |||
155 | 155 | ||
156 | 156 | ||
157 | static struct pci_driver hydra_driver = { | 157 | static struct pci_driver hydra_driver = { |
158 | .owner = THIS_MODULE, | ||
158 | .name = "hydra_smbus", | 159 | .name = "hydra_smbus", |
159 | .id_table = hydra_ids, | 160 | .id_table = hydra_ids, |
160 | .probe = hydra_probe, | 161 | .probe = hydra_probe, |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 709beab76609..4f63195069da 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -52,10 +52,6 @@ | |||
52 | #include <linux/i2c.h> | 52 | #include <linux/i2c.h> |
53 | #include <asm/io.h> | 53 | #include <asm/io.h> |
54 | 54 | ||
55 | #ifdef I2C_FUNC_SMBUS_BLOCK_DATA_PEC | ||
56 | #define HAVE_PEC | ||
57 | #endif | ||
58 | |||
59 | /* I801 SMBus address offsets */ | 55 | /* I801 SMBus address offsets */ |
60 | #define SMBHSTSTS (0 + i801_smba) | 56 | #define SMBHSTSTS (0 + i801_smba) |
61 | #define SMBHSTCNT (2 + i801_smba) | 57 | #define SMBHSTCNT (2 + i801_smba) |
@@ -106,10 +102,11 @@ MODULE_PARM_DESC(force_addr, | |||
106 | "EXTREMELY DANGEROUS!"); | 102 | "EXTREMELY DANGEROUS!"); |
107 | 103 | ||
108 | static int i801_transaction(void); | 104 | static int i801_transaction(void); |
109 | static int i801_block_transaction(union i2c_smbus_data *data, | 105 | static int i801_block_transaction(union i2c_smbus_data *data, char read_write, |
110 | char read_write, int command); | 106 | int command, int hwpec); |
111 | 107 | ||
112 | static unsigned short i801_smba; | 108 | static unsigned short i801_smba; |
109 | static struct pci_driver i801_driver; | ||
113 | static struct pci_dev *I801_dev; | 110 | static struct pci_dev *I801_dev; |
114 | static int isich4; | 111 | static int isich4; |
115 | 112 | ||
@@ -143,7 +140,7 @@ static int i801_setup(struct pci_dev *dev) | |||
143 | } | 140 | } |
144 | } | 141 | } |
145 | 142 | ||
146 | if (!request_region(i801_smba, (isich4 ? 16 : 8), "i801-smbus")) { | 143 | if (!request_region(i801_smba, (isich4 ? 16 : 8), i801_driver.name)) { |
147 | dev_err(&dev->dev, "I801_smb region 0x%x already in use!\n", | 144 | dev_err(&dev->dev, "I801_smb region 0x%x already in use!\n", |
148 | i801_smba); | 145 | i801_smba); |
149 | error_return = -EBUSY; | 146 | error_return = -EBUSY; |
@@ -252,7 +249,7 @@ static int i801_transaction(void) | |||
252 | 249 | ||
253 | /* All-inclusive block transaction function */ | 250 | /* All-inclusive block transaction function */ |
254 | static int i801_block_transaction(union i2c_smbus_data *data, char read_write, | 251 | static int i801_block_transaction(union i2c_smbus_data *data, char read_write, |
255 | int command) | 252 | int command, int hwpec) |
256 | { | 253 | { |
257 | int i, len; | 254 | int i, len; |
258 | int smbcmd; | 255 | int smbcmd; |
@@ -391,8 +388,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, | |||
391 | goto END; | 388 | goto END; |
392 | } | 389 | } |
393 | 390 | ||
394 | #ifdef HAVE_PEC | 391 | if (hwpec) { |
395 | if(isich4 && command == I2C_SMBUS_BLOCK_DATA_PEC) { | ||
396 | /* wait for INTR bit as advised by Intel */ | 392 | /* wait for INTR bit as advised by Intel */ |
397 | timeout = 0; | 393 | timeout = 0; |
398 | do { | 394 | do { |
@@ -406,7 +402,6 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, | |||
406 | } | 402 | } |
407 | outb_p(temp, SMBHSTSTS); | 403 | outb_p(temp, SMBHSTSTS); |
408 | } | 404 | } |
409 | #endif | ||
410 | result = 0; | 405 | result = 0; |
411 | END: | 406 | END: |
412 | if (command == I2C_SMBUS_I2C_BLOCK_DATA) { | 407 | if (command == I2C_SMBUS_I2C_BLOCK_DATA) { |
@@ -421,14 +416,13 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
421 | unsigned short flags, char read_write, u8 command, | 416 | unsigned short flags, char read_write, u8 command, |
422 | int size, union i2c_smbus_data * data) | 417 | int size, union i2c_smbus_data * data) |
423 | { | 418 | { |
424 | int hwpec = 0; | 419 | int hwpec; |
425 | int block = 0; | 420 | int block = 0; |
426 | int ret, xact = 0; | 421 | int ret, xact = 0; |
427 | 422 | ||
428 | #ifdef HAVE_PEC | 423 | hwpec = isich4 && (flags & I2C_CLIENT_PEC) |
429 | if(isich4) | 424 | && size != I2C_SMBUS_QUICK |
430 | hwpec = (flags & I2C_CLIENT_PEC) != 0; | 425 | && size != I2C_SMBUS_I2C_BLOCK_DATA; |
431 | #endif | ||
432 | 426 | ||
433 | switch (size) { | 427 | switch (size) { |
434 | case I2C_SMBUS_QUICK: | 428 | case I2C_SMBUS_QUICK: |
@@ -463,11 +457,6 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
463 | break; | 457 | break; |
464 | case I2C_SMBUS_BLOCK_DATA: | 458 | case I2C_SMBUS_BLOCK_DATA: |
465 | case I2C_SMBUS_I2C_BLOCK_DATA: | 459 | case I2C_SMBUS_I2C_BLOCK_DATA: |
466 | #ifdef HAVE_PEC | ||
467 | case I2C_SMBUS_BLOCK_DATA_PEC: | ||
468 | if(hwpec && size == I2C_SMBUS_BLOCK_DATA) | ||
469 | size = I2C_SMBUS_BLOCK_DATA_PEC; | ||
470 | #endif | ||
471 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | 460 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), |
472 | SMBHSTADD); | 461 | SMBHSTADD); |
473 | outb_p(command, SMBHSTCMD); | 462 | outb_p(command, SMBHSTCMD); |
@@ -479,27 +468,18 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
479 | return -1; | 468 | return -1; |
480 | } | 469 | } |
481 | 470 | ||
482 | #ifdef HAVE_PEC | 471 | if (hwpec) |
483 | if(isich4 && hwpec) { | 472 | outb_p(1, SMBAUXCTL); /* enable hardware PEC */ |
484 | if(size != I2C_SMBUS_QUICK && | 473 | |
485 | size != I2C_SMBUS_I2C_BLOCK_DATA) | ||
486 | outb_p(1, SMBAUXCTL); /* enable HW PEC */ | ||
487 | } | ||
488 | #endif | ||
489 | if(block) | 474 | if(block) |
490 | ret = i801_block_transaction(data, read_write, size); | 475 | ret = i801_block_transaction(data, read_write, size, hwpec); |
491 | else { | 476 | else { |
492 | outb_p(xact | ENABLE_INT9, SMBHSTCNT); | 477 | outb_p(xact | ENABLE_INT9, SMBHSTCNT); |
493 | ret = i801_transaction(); | 478 | ret = i801_transaction(); |
494 | } | 479 | } |
495 | 480 | ||
496 | #ifdef HAVE_PEC | 481 | if (hwpec) |
497 | if(isich4 && hwpec) { | 482 | outb_p(0, SMBAUXCTL); /* disable hardware PEC */ |
498 | if(size != I2C_SMBUS_QUICK && | ||
499 | size != I2C_SMBUS_I2C_BLOCK_DATA) | ||
500 | outb_p(0, SMBAUXCTL); | ||
501 | } | ||
502 | #endif | ||
503 | 483 | ||
504 | if(block) | 484 | if(block) |
505 | return ret; | 485 | return ret; |
@@ -526,12 +506,7 @@ static u32 i801_func(struct i2c_adapter *adapter) | |||
526 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 506 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
527 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | 507 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | |
528 | I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK | 508 | I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK |
529 | #ifdef HAVE_PEC | 509 | | (isich4 ? I2C_FUNC_SMBUS_HWPEC_CALC : 0); |
530 | | (isich4 ? I2C_FUNC_SMBUS_BLOCK_DATA_PEC | | ||
531 | I2C_FUNC_SMBUS_HWPEC_CALC | ||
532 | : 0) | ||
533 | #endif | ||
534 | ; | ||
535 | } | 510 | } |
536 | 511 | ||
537 | static struct i2c_algorithm smbus_algorithm = { | 512 | static struct i2c_algorithm smbus_algorithm = { |
@@ -543,7 +518,6 @@ static struct i2c_adapter i801_adapter = { | |||
543 | .owner = THIS_MODULE, | 518 | .owner = THIS_MODULE, |
544 | .class = I2C_CLASS_HWMON, | 519 | .class = I2C_CLASS_HWMON, |
545 | .algo = &smbus_algorithm, | 520 | .algo = &smbus_algorithm, |
546 | .name = "unset", | ||
547 | }; | 521 | }; |
548 | 522 | ||
549 | static struct pci_device_id i801_ids[] = { | 523 | static struct pci_device_id i801_ids[] = { |
@@ -586,6 +560,7 @@ static void __devexit i801_remove(struct pci_dev *dev) | |||
586 | } | 560 | } |
587 | 561 | ||
588 | static struct pci_driver i801_driver = { | 562 | static struct pci_driver i801_driver = { |
563 | .owner = THIS_MODULE, | ||
589 | .name = "i801_smbus", | 564 | .name = "i801_smbus", |
590 | .id_table = i801_ids, | 565 | .id_table = i801_ids, |
591 | .probe = i801_probe, | 566 | .probe = i801_probe, |
diff --git a/drivers/i2c/busses/i2c-i810.c b/drivers/i2c/busses/i2c-i810.c index 0ff7016e0629..52bc30593bd7 100644 --- a/drivers/i2c/busses/i2c-i810.c +++ b/drivers/i2c/busses/i2c-i810.c | |||
@@ -32,6 +32,7 @@ | |||
32 | i810AB 7123 | 32 | i810AB 7123 |
33 | i810E 7125 | 33 | i810E 7125 |
34 | i815 1132 | 34 | i815 1132 |
35 | i845G 2562 | ||
35 | */ | 36 | */ |
36 | 37 | ||
37 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
@@ -232,6 +233,7 @@ static void __devexit i810_remove(struct pci_dev *dev) | |||
232 | } | 233 | } |
233 | 234 | ||
234 | static struct pci_driver i810_driver = { | 235 | static struct pci_driver i810_driver = { |
236 | .owner = THIS_MODULE, | ||
235 | .name = "i810_smbus", | 237 | .name = "i810_smbus", |
236 | .id_table = i810_ids, | 238 | .id_table = i810_ids, |
237 | .probe = i810_probe, | 239 | .probe = i810_probe, |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index a3ed9590f028..1a587253d716 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -672,13 +672,12 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
672 | printk(KERN_WARNING"ibm-iic%d: missing additional data!\n", | 672 | printk(KERN_WARNING"ibm-iic%d: missing additional data!\n", |
673 | ocp->def->index); | 673 | ocp->def->index); |
674 | 674 | ||
675 | if (!(dev = kmalloc(sizeof(*dev), GFP_KERNEL))){ | 675 | if (!(dev = kzalloc(sizeof(*dev), GFP_KERNEL))) { |
676 | printk(KERN_CRIT "ibm-iic%d: failed to allocate device data\n", | 676 | printk(KERN_CRIT "ibm-iic%d: failed to allocate device data\n", |
677 | ocp->def->index); | 677 | ocp->def->index); |
678 | return -ENOMEM; | 678 | return -ENOMEM; |
679 | } | 679 | } |
680 | 680 | ||
681 | memset(dev, 0, sizeof(*dev)); | ||
682 | dev->idx = ocp->def->index; | 681 | dev->idx = ocp->def->index; |
683 | ocp_set_drvdata(ocp, dev); | 682 | ocp_set_drvdata(ocp, dev); |
684 | 683 | ||
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index 7bd9102db701..9888fae1f37a 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include "i2c-iop3xx.h" | 43 | #include "i2c-iop3xx.h" |
44 | 44 | ||
45 | /* global unit counter */ | 45 | /* global unit counter */ |
46 | static int i2c_id = 0; | 46 | static int i2c_id; |
47 | 47 | ||
48 | static inline unsigned char | 48 | static inline unsigned char |
49 | iic_cook_addr(struct i2c_msg *msg) | 49 | iic_cook_addr(struct i2c_msg *msg) |
@@ -440,19 +440,17 @@ iop3xx_i2c_probe(struct device *dev) | |||
440 | struct i2c_adapter *new_adapter; | 440 | struct i2c_adapter *new_adapter; |
441 | struct i2c_algo_iop3xx_data *adapter_data; | 441 | struct i2c_algo_iop3xx_data *adapter_data; |
442 | 442 | ||
443 | new_adapter = kmalloc(sizeof(struct i2c_adapter), GFP_KERNEL); | 443 | new_adapter = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL); |
444 | if (!new_adapter) { | 444 | if (!new_adapter) { |
445 | ret = -ENOMEM; | 445 | ret = -ENOMEM; |
446 | goto out; | 446 | goto out; |
447 | } | 447 | } |
448 | memset((void*)new_adapter, 0, sizeof(*new_adapter)); | ||
449 | 448 | ||
450 | adapter_data = kmalloc(sizeof(struct i2c_algo_iop3xx_data), GFP_KERNEL); | 449 | adapter_data = kzalloc(sizeof(struct i2c_algo_iop3xx_data), GFP_KERNEL); |
451 | if (!adapter_data) { | 450 | if (!adapter_data) { |
452 | ret = -ENOMEM; | 451 | ret = -ENOMEM; |
453 | goto free_adapter; | 452 | goto free_adapter; |
454 | } | 453 | } |
455 | memset((void*)adapter_data, 0, sizeof(*adapter_data)); | ||
456 | 454 | ||
457 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 455 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
458 | if (!res) { | 456 | if (!res) { |
@@ -525,6 +523,7 @@ out: | |||
525 | 523 | ||
526 | 524 | ||
527 | static struct device_driver iop3xx_i2c_driver = { | 525 | static struct device_driver iop3xx_i2c_driver = { |
526 | .owner = THIS_MODULE, | ||
528 | .name = "IOP3xx-I2C", | 527 | .name = "IOP3xx-I2C", |
529 | .bus = &platform_bus_type, | 528 | .bus = &platform_bus_type, |
530 | .probe = iop3xx_i2c_probe, | 529 | .probe = iop3xx_i2c_probe, |
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c index bdc6806dafae..4fdc02411609 100644 --- a/drivers/i2c/busses/i2c-isa.c +++ b/drivers/i2c/busses/i2c-isa.c | |||
@@ -92,6 +92,7 @@ int i2c_isa_add_driver(struct i2c_driver *driver) | |||
92 | 92 | ||
93 | /* Add the driver to the list of i2c drivers in the driver core */ | 93 | /* Add the driver to the list of i2c drivers in the driver core */ |
94 | driver->driver.name = driver->name; | 94 | driver->driver.name = driver->name; |
95 | driver->driver.owner = driver->owner; | ||
95 | driver->driver.bus = &i2c_bus_type; | 96 | driver->driver.bus = &i2c_bus_type; |
96 | driver->driver.probe = i2c_isa_device_probe; | 97 | driver->driver.probe = i2c_isa_device_probe; |
97 | driver->driver.remove = i2c_isa_device_remove; | 98 | driver->driver.remove = i2c_isa_device_remove; |
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c index 1956af382cd8..42016ee6ef13 100644 --- a/drivers/i2c/busses/i2c-ixp2000.c +++ b/drivers/i2c/busses/i2c-ixp2000.c | |||
@@ -36,6 +36,8 @@ | |||
36 | #include <asm/hardware.h> /* Pick up IXP2000-specific bits */ | 36 | #include <asm/hardware.h> /* Pick up IXP2000-specific bits */ |
37 | #include <asm/arch/gpio.h> | 37 | #include <asm/arch/gpio.h> |
38 | 38 | ||
39 | static struct device_driver ixp2000_i2c_driver; | ||
40 | |||
39 | static inline int ixp2000_scl_pin(void *data) | 41 | static inline int ixp2000_scl_pin(void *data) |
40 | { | 42 | { |
41 | return ((struct ixp2000_i2c_pins*)data)->scl_pin; | 43 | return ((struct ixp2000_i2c_pins*)data)->scl_pin; |
@@ -104,11 +106,10 @@ static int ixp2000_i2c_probe(struct device *dev) | |||
104 | struct platform_device *plat_dev = to_platform_device(dev); | 106 | struct platform_device *plat_dev = to_platform_device(dev); |
105 | struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; | 107 | struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; |
106 | struct ixp2000_i2c_data *drv_data = | 108 | struct ixp2000_i2c_data *drv_data = |
107 | kmalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); | 109 | kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); |
108 | 110 | ||
109 | if (!drv_data) | 111 | if (!drv_data) |
110 | return -ENOMEM; | 112 | return -ENOMEM; |
111 | memzero(drv_data, sizeof(*drv_data)); | ||
112 | drv_data->gpio_pins = gpio; | 113 | drv_data->gpio_pins = gpio; |
113 | 114 | ||
114 | drv_data->algo_data.data = gpio; | 115 | drv_data->algo_data.data = gpio; |
@@ -121,6 +122,8 @@ static int ixp2000_i2c_probe(struct device *dev) | |||
121 | drv_data->algo_data.timeout = 100; | 122 | drv_data->algo_data.timeout = 100; |
122 | 123 | ||
123 | drv_data->adapter.id = I2C_HW_B_IXP2000, | 124 | drv_data->adapter.id = I2C_HW_B_IXP2000, |
125 | strlcpy(drv_data->adapter.name, ixp2000_i2c_driver.name, | ||
126 | I2C_NAME_SIZE); | ||
124 | drv_data->adapter.algo_data = &drv_data->algo_data, | 127 | drv_data->adapter.algo_data = &drv_data->algo_data, |
125 | 128 | ||
126 | drv_data->adapter.dev.parent = &plat_dev->dev; | 129 | drv_data->adapter.dev.parent = &plat_dev->dev; |
@@ -142,6 +145,7 @@ static int ixp2000_i2c_probe(struct device *dev) | |||
142 | } | 145 | } |
143 | 146 | ||
144 | static struct device_driver ixp2000_i2c_driver = { | 147 | static struct device_driver ixp2000_i2c_driver = { |
148 | .owner = THIS_MODULE, | ||
145 | .name = "IXP2000-I2C", | 149 | .name = "IXP2000-I2C", |
146 | .bus = &platform_bus_type, | 150 | .bus = &platform_bus_type, |
147 | .probe = ixp2000_i2c_probe, | 151 | .probe = ixp2000_i2c_probe, |
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c index f6f5ca31fdba..69303ab65e04 100644 --- a/drivers/i2c/busses/i2c-ixp4xx.c +++ b/drivers/i2c/busses/i2c-ixp4xx.c | |||
@@ -35,6 +35,8 @@ | |||
35 | 35 | ||
36 | #include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ | 36 | #include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ |
37 | 37 | ||
38 | static struct device_driver ixp4xx_i2c_driver; | ||
39 | |||
38 | static inline int ixp4xx_scl_pin(void *data) | 40 | static inline int ixp4xx_scl_pin(void *data) |
39 | { | 41 | { |
40 | return ((struct ixp4xx_i2c_pins*)data)->scl_pin; | 42 | return ((struct ixp4xx_i2c_pins*)data)->scl_pin; |
@@ -105,12 +107,11 @@ static int ixp4xx_i2c_probe(struct device *dev) | |||
105 | struct platform_device *plat_dev = to_platform_device(dev); | 107 | struct platform_device *plat_dev = to_platform_device(dev); |
106 | struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data; | 108 | struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data; |
107 | struct ixp4xx_i2c_data *drv_data = | 109 | struct ixp4xx_i2c_data *drv_data = |
108 | kmalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL); | 110 | kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL); |
109 | 111 | ||
110 | if(!drv_data) | 112 | if(!drv_data) |
111 | return -ENOMEM; | 113 | return -ENOMEM; |
112 | 114 | ||
113 | memzero(drv_data, sizeof(struct ixp4xx_i2c_data)); | ||
114 | drv_data->gpio_pins = gpio; | 115 | drv_data->gpio_pins = gpio; |
115 | 116 | ||
116 | /* | 117 | /* |
@@ -129,6 +130,8 @@ static int ixp4xx_i2c_probe(struct device *dev) | |||
129 | drv_data->algo_data.timeout = 100; | 130 | drv_data->algo_data.timeout = 100; |
130 | 131 | ||
131 | drv_data->adapter.id = I2C_HW_B_IXP4XX; | 132 | drv_data->adapter.id = I2C_HW_B_IXP4XX; |
133 | strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.name, | ||
134 | I2C_NAME_SIZE); | ||
132 | drv_data->adapter.algo_data = &drv_data->algo_data; | 135 | drv_data->adapter.algo_data = &drv_data->algo_data; |
133 | 136 | ||
134 | drv_data->adapter.dev.parent = &plat_dev->dev; | 137 | drv_data->adapter.dev.parent = &plat_dev->dev; |
@@ -151,6 +154,7 @@ static int ixp4xx_i2c_probe(struct device *dev) | |||
151 | } | 154 | } |
152 | 155 | ||
153 | static struct device_driver ixp4xx_i2c_driver = { | 156 | static struct device_driver ixp4xx_i2c_driver = { |
157 | .owner = THIS_MODULE, | ||
154 | .name = "IXP4XX-I2C", | 158 | .name = "IXP4XX-I2C", |
155 | .bus = &platform_bus_type, | 159 | .bus = &platform_bus_type, |
156 | .probe = ixp4xx_i2c_probe, | 160 | .probe = ixp4xx_i2c_probe, |
diff --git a/drivers/i2c/busses/i2c-keywest.c b/drivers/i2c/busses/i2c-keywest.c index eff5896ce865..d61f748278fc 100644 --- a/drivers/i2c/busses/i2c-keywest.c +++ b/drivers/i2c/busses/i2c-keywest.c | |||
@@ -535,13 +535,12 @@ create_iface(struct device_node *np, struct device *dev) | |||
535 | 535 | ||
536 | tsize = sizeof(struct keywest_iface) + | 536 | tsize = sizeof(struct keywest_iface) + |
537 | (sizeof(struct keywest_chan) + 4) * nchan; | 537 | (sizeof(struct keywest_chan) + 4) * nchan; |
538 | iface = (struct keywest_iface *) kmalloc(tsize, GFP_KERNEL); | 538 | iface = kzalloc(tsize, GFP_KERNEL); |
539 | if (iface == NULL) { | 539 | if (iface == NULL) { |
540 | printk(KERN_ERR "i2c-keywest: can't allocate inteface !\n"); | 540 | printk(KERN_ERR "i2c-keywest: can't allocate inteface !\n"); |
541 | pmac_low_i2c_unlock(np); | 541 | pmac_low_i2c_unlock(np); |
542 | return -ENOMEM; | 542 | return -ENOMEM; |
543 | } | 543 | } |
544 | memset(iface, 0, tsize); | ||
545 | spin_lock_init(&iface->lock); | 544 | spin_lock_init(&iface->lock); |
546 | init_completion(&iface->complete); | 545 | init_completion(&iface->complete); |
547 | iface->node = of_node_get(np); | 546 | iface->node = of_node_get(np); |
@@ -716,6 +715,7 @@ static struct of_device_id i2c_keywest_match[] = | |||
716 | 715 | ||
717 | static struct macio_driver i2c_keywest_macio_driver = | 716 | static struct macio_driver i2c_keywest_macio_driver = |
718 | { | 717 | { |
718 | .owner = THIS_MODULE, | ||
719 | .name = "i2c-keywest", | 719 | .name = "i2c-keywest", |
720 | .match_table = i2c_keywest_match, | 720 | .match_table = i2c_keywest_match, |
721 | .probe = create_iface_macio, | 721 | .probe = create_iface_macio, |
@@ -724,6 +724,7 @@ static struct macio_driver i2c_keywest_macio_driver = | |||
724 | 724 | ||
725 | static struct of_platform_driver i2c_keywest_of_platform_driver = | 725 | static struct of_platform_driver i2c_keywest_of_platform_driver = |
726 | { | 726 | { |
727 | .owner = THIS_MODULE, | ||
727 | .name = "i2c-keywest", | 728 | .name = "i2c-keywest", |
728 | .match_table = i2c_keywest_match, | 729 | .match_table = i2c_keywest_match, |
729 | .probe = create_iface_of_platform, | 730 | .probe = create_iface_of_platform, |
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index f065583ddcf1..8491633005b8 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -296,10 +296,9 @@ static int fsl_i2c_probe(struct device *device) | |||
296 | 296 | ||
297 | pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data; | 297 | pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data; |
298 | 298 | ||
299 | if (!(i2c = kmalloc(sizeof(*i2c), GFP_KERNEL))) { | 299 | if (!(i2c = kzalloc(sizeof(*i2c), GFP_KERNEL))) { |
300 | return -ENOMEM; | 300 | return -ENOMEM; |
301 | } | 301 | } |
302 | memset(i2c, 0, sizeof(*i2c)); | ||
303 | 302 | ||
304 | i2c->irq = platform_get_irq(pdev, 0); | 303 | i2c->irq = platform_get_irq(pdev, 0); |
305 | i2c->flags = pdata->device_flags; | 304 | i2c->flags = pdata->device_flags; |
@@ -361,6 +360,7 @@ static int fsl_i2c_remove(struct device *device) | |||
361 | 360 | ||
362 | /* Structure for a device driver */ | 361 | /* Structure for a device driver */ |
363 | static struct device_driver fsl_i2c_driver = { | 362 | static struct device_driver fsl_i2c_driver = { |
363 | .owner = THIS_MODULE, | ||
364 | .name = "fsl-i2c", | 364 | .name = "fsl-i2c", |
365 | .bus = &platform_bus_type, | 365 | .bus = &platform_bus_type, |
366 | .probe = fsl_i2c_probe, | 366 | .probe = fsl_i2c_probe, |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 99abca45fece..d0d2a6f1386e 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -500,13 +500,10 @@ mv64xxx_i2c_probe(struct device *dev) | |||
500 | if ((pd->id != 0) || !pdata) | 500 | if ((pd->id != 0) || !pdata) |
501 | return -ENODEV; | 501 | return -ENODEV; |
502 | 502 | ||
503 | drv_data = kmalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL); | 503 | drv_data = kzalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL); |
504 | |||
505 | if (!drv_data) | 504 | if (!drv_data) |
506 | return -ENOMEM; | 505 | return -ENOMEM; |
507 | 506 | ||
508 | memset(drv_data, 0, sizeof(struct mv64xxx_i2c_data)); | ||
509 | |||
510 | if (mv64xxx_i2c_map_regs(pd, drv_data)) { | 507 | if (mv64xxx_i2c_map_regs(pd, drv_data)) { |
511 | rc = -ENODEV; | 508 | rc = -ENODEV; |
512 | goto exit_kfree; | 509 | goto exit_kfree; |
@@ -570,6 +567,7 @@ mv64xxx_i2c_remove(struct device *dev) | |||
570 | } | 567 | } |
571 | 568 | ||
572 | static struct device_driver mv64xxx_i2c_driver = { | 569 | static struct device_driver mv64xxx_i2c_driver = { |
570 | .owner = THIS_MODULE, | ||
573 | .name = MV64XXX_I2C_CTLR_NAME, | 571 | .name = MV64XXX_I2C_CTLR_NAME, |
574 | .bus = &platform_bus_type, | 572 | .bus = &platform_bus_type, |
575 | .probe = mv64xxx_i2c_probe, | 573 | .probe = mv64xxx_i2c_probe, |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index fe9c0f42a2b7..fd26036e68a3 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -97,6 +97,7 @@ struct nforce2_smbus { | |||
97 | #define NVIDIA_SMB_PRTCL_I2C_BLOCK_DATA 0x4a | 97 | #define NVIDIA_SMB_PRTCL_I2C_BLOCK_DATA 0x4a |
98 | #define NVIDIA_SMB_PRTCL_PEC 0x80 | 98 | #define NVIDIA_SMB_PRTCL_PEC 0x80 |
99 | 99 | ||
100 | static struct pci_driver nforce2_driver; | ||
100 | 101 | ||
101 | static s32 nforce2_access(struct i2c_adapter *adap, u16 addr, | 102 | static s32 nforce2_access(struct i2c_adapter *adap, u16 addr, |
102 | unsigned short flags, char read_write, | 103 | unsigned short flags, char read_write, |
@@ -113,7 +114,6 @@ static struct i2c_adapter nforce2_adapter = { | |||
113 | .owner = THIS_MODULE, | 114 | .owner = THIS_MODULE, |
114 | .class = I2C_CLASS_HWMON, | 115 | .class = I2C_CLASS_HWMON, |
115 | .algo = &smbus_algorithm, | 116 | .algo = &smbus_algorithm, |
116 | .name = "unset", | ||
117 | }; | 117 | }; |
118 | 118 | ||
119 | /* Return -1 on error. See smbus.h for more information */ | 119 | /* Return -1 on error. See smbus.h for more information */ |
@@ -188,13 +188,6 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr, | |||
188 | dev_err(&adap->dev, "I2C_SMBUS_BLOCK_PROC_CALL not supported!\n"); | 188 | dev_err(&adap->dev, "I2C_SMBUS_BLOCK_PROC_CALL not supported!\n"); |
189 | return -1; | 189 | return -1; |
190 | 190 | ||
191 | case I2C_SMBUS_WORD_DATA_PEC: | ||
192 | case I2C_SMBUS_BLOCK_DATA_PEC: | ||
193 | case I2C_SMBUS_PROC_CALL_PEC: | ||
194 | case I2C_SMBUS_BLOCK_PROC_CALL_PEC: | ||
195 | dev_err(&adap->dev, "Unexpected software PEC transaction %d\n.", size); | ||
196 | return -1; | ||
197 | |||
198 | default: | 191 | default: |
199 | dev_err(&adap->dev, "Unsupported transaction %d\n", size); | 192 | dev_err(&adap->dev, "Unsupported transaction %d\n", size); |
200 | return -1; | 193 | return -1; |
@@ -285,7 +278,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int reg, | |||
285 | smbus->base = iobase & 0xfffc; | 278 | smbus->base = iobase & 0xfffc; |
286 | smbus->size = 8; | 279 | smbus->size = 8; |
287 | 280 | ||
288 | if (!request_region(smbus->base, smbus->size, "nForce2 SMBus")) { | 281 | if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) { |
289 | dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n", | 282 | dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n", |
290 | smbus->base, smbus->base+smbus->size-1, name); | 283 | smbus->base, smbus->base+smbus->size-1, name); |
291 | return -1; | 284 | return -1; |
@@ -313,10 +306,8 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_ | |||
313 | int res1, res2; | 306 | int res1, res2; |
314 | 307 | ||
315 | /* we support 2 SMBus adapters */ | 308 | /* we support 2 SMBus adapters */ |
316 | if (!(smbuses = (void *)kmalloc(2*sizeof(struct nforce2_smbus), | 309 | if (!(smbuses = kzalloc(2*sizeof(struct nforce2_smbus), GFP_KERNEL))) |
317 | GFP_KERNEL))) | ||
318 | return -ENOMEM; | 310 | return -ENOMEM; |
319 | memset (smbuses, 0, 2*sizeof(struct nforce2_smbus)); | ||
320 | pci_set_drvdata(dev, smbuses); | 311 | pci_set_drvdata(dev, smbuses); |
321 | 312 | ||
322 | /* SMBus adapter 1 */ | 313 | /* SMBus adapter 1 */ |
@@ -356,6 +347,7 @@ static void __devexit nforce2_remove(struct pci_dev *dev) | |||
356 | } | 347 | } |
357 | 348 | ||
358 | static struct pci_driver nforce2_driver = { | 349 | static struct pci_driver nforce2_driver = { |
350 | .owner = THIS_MODULE, | ||
359 | .name = "nForce2_smbus", | 351 | .name = "nForce2_smbus", |
360 | .id_table = nforce2_ids, | 352 | .id_table = nforce2_ids, |
361 | .probe = nforce2_probe, | 353 | .probe = nforce2_probe, |
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index 71a2502fe069..2854d858fc9b 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -155,12 +155,11 @@ static void i2c_parport_attach (struct parport *port) | |||
155 | { | 155 | { |
156 | struct i2c_par *adapter; | 156 | struct i2c_par *adapter; |
157 | 157 | ||
158 | adapter = kmalloc(sizeof(struct i2c_par), GFP_KERNEL); | 158 | adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL); |
159 | if (adapter == NULL) { | 159 | if (adapter == NULL) { |
160 | printk(KERN_ERR "i2c-parport: Failed to kmalloc\n"); | 160 | printk(KERN_ERR "i2c-parport: Failed to kzalloc\n"); |
161 | return; | 161 | return; |
162 | } | 162 | } |
163 | memset(adapter, 0x00, sizeof(struct i2c_par)); | ||
164 | 163 | ||
165 | pr_debug("i2c-parport: attaching to %s\n", port->name); | 164 | pr_debug("i2c-parport: attaching to %s\n", port->name); |
166 | adapter->pdev = parport_register_device(port, "i2c-parport", | 165 | adapter->pdev = parport_register_device(port, "i2c-parport", |
@@ -232,7 +231,7 @@ static void i2c_parport_detach (struct parport *port) | |||
232 | } | 231 | } |
233 | } | 232 | } |
234 | 233 | ||
235 | static struct parport_driver i2c_driver = { | 234 | static struct parport_driver i2c_parport_driver = { |
236 | .name = "i2c-parport", | 235 | .name = "i2c-parport", |
237 | .attach = i2c_parport_attach, | 236 | .attach = i2c_parport_attach, |
238 | .detach = i2c_parport_detach, | 237 | .detach = i2c_parport_detach, |
@@ -250,12 +249,12 @@ static int __init i2c_parport_init(void) | |||
250 | type = 0; | 249 | type = 0; |
251 | } | 250 | } |
252 | 251 | ||
253 | return parport_register_driver(&i2c_driver); | 252 | return parport_register_driver(&i2c_parport_driver); |
254 | } | 253 | } |
255 | 254 | ||
256 | static void __exit i2c_parport_exit(void) | 255 | static void __exit i2c_parport_exit(void) |
257 | { | 256 | { |
258 | parport_unregister_driver(&i2c_driver); | 257 | parport_unregister_driver(&i2c_parport_driver); |
259 | } | 258 | } |
260 | 259 | ||
261 | MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>"); | 260 | MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>"); |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 6d48a4da7bed..7d63eec423fe 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -90,13 +90,13 @@ struct sd { | |||
90 | 90 | ||
91 | /* If force is set to anything different from 0, we forcibly enable the | 91 | /* If force is set to anything different from 0, we forcibly enable the |
92 | PIIX4. DANGEROUS! */ | 92 | PIIX4. DANGEROUS! */ |
93 | static int force = 0; | 93 | static int force; |
94 | module_param (force, int, 0); | 94 | module_param (force, int, 0); |
95 | MODULE_PARM_DESC(force, "Forcibly enable the PIIX4. DANGEROUS!"); | 95 | MODULE_PARM_DESC(force, "Forcibly enable the PIIX4. DANGEROUS!"); |
96 | 96 | ||
97 | /* If force_addr is set to anything different from 0, we forcibly enable | 97 | /* If force_addr is set to anything different from 0, we forcibly enable |
98 | the PIIX4 at the given address. VERY DANGEROUS! */ | 98 | the PIIX4 at the given address. VERY DANGEROUS! */ |
99 | static int force_addr = 0; | 99 | static int force_addr; |
100 | module_param (force_addr, int, 0); | 100 | module_param (force_addr, int, 0); |
101 | MODULE_PARM_DESC(force_addr, | 101 | MODULE_PARM_DESC(force_addr, |
102 | "Forcibly enable the PIIX4 at the given address. " | 102 | "Forcibly enable the PIIX4 at the given address. " |
@@ -104,14 +104,15 @@ MODULE_PARM_DESC(force_addr, | |||
104 | 104 | ||
105 | /* If fix_hstcfg is set to anything different from 0, we reset one of the | 105 | /* If fix_hstcfg is set to anything different from 0, we reset one of the |
106 | registers to be a valid value. */ | 106 | registers to be a valid value. */ |
107 | static int fix_hstcfg = 0; | 107 | static int fix_hstcfg; |
108 | module_param (fix_hstcfg, int, 0); | 108 | module_param (fix_hstcfg, int, 0); |
109 | MODULE_PARM_DESC(fix_hstcfg, | 109 | MODULE_PARM_DESC(fix_hstcfg, |
110 | "Fix config register. Needed on some boards (Force CPCI735)."); | 110 | "Fix config register. Needed on some boards (Force CPCI735)."); |
111 | 111 | ||
112 | static int piix4_transaction(void); | 112 | static int piix4_transaction(void); |
113 | 113 | ||
114 | static unsigned short piix4_smba = 0; | 114 | static unsigned short piix4_smba; |
115 | static struct pci_driver piix4_driver; | ||
115 | static struct i2c_adapter piix4_adapter; | 116 | static struct i2c_adapter piix4_adapter; |
116 | 117 | ||
117 | static struct dmi_system_id __devinitdata piix4_dmi_table[] = { | 118 | static struct dmi_system_id __devinitdata piix4_dmi_table[] = { |
@@ -157,7 +158,7 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev, | |||
157 | } | 158 | } |
158 | } | 159 | } |
159 | 160 | ||
160 | if (!request_region(piix4_smba, SMBIOSIZE, "piix4-smbus")) { | 161 | if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) { |
161 | dev_err(&PIIX4_dev->dev, "SMB region 0x%x already in use!\n", | 162 | dev_err(&PIIX4_dev->dev, "SMB region 0x%x already in use!\n", |
162 | piix4_smba); | 163 | piix4_smba); |
163 | return -ENODEV; | 164 | return -ENODEV; |
@@ -407,7 +408,6 @@ static struct i2c_adapter piix4_adapter = { | |||
407 | .owner = THIS_MODULE, | 408 | .owner = THIS_MODULE, |
408 | .class = I2C_CLASS_HWMON, | 409 | .class = I2C_CLASS_HWMON, |
409 | .algo = &smbus_algorithm, | 410 | .algo = &smbus_algorithm, |
410 | .name = "unset", | ||
411 | }; | 411 | }; |
412 | 412 | ||
413 | static struct pci_device_id piix4_ids[] = { | 413 | static struct pci_device_id piix4_ids[] = { |
@@ -462,6 +462,7 @@ static void __devexit piix4_remove(struct pci_dev *dev) | |||
462 | } | 462 | } |
463 | 463 | ||
464 | static struct pci_driver piix4_driver = { | 464 | static struct pci_driver piix4_driver = { |
465 | .owner = THIS_MODULE, | ||
465 | .name = "piix4_smbus", | 466 | .name = "piix4_smbus", |
466 | .id_table = piix4_ids, | 467 | .id_table = piix4_ids, |
467 | .probe = piix4_probe, | 468 | .probe = piix4_probe, |
diff --git a/drivers/i2c/busses/i2c-pmac-smu.c b/drivers/i2c/busses/i2c-pmac-smu.c index 8a9f5648a23d..bfefe7f7a53d 100644 --- a/drivers/i2c/busses/i2c-pmac-smu.c +++ b/drivers/i2c/busses/i2c-pmac-smu.c | |||
@@ -211,12 +211,11 @@ static int create_iface(struct device_node *np, struct device *dev) | |||
211 | } | 211 | } |
212 | busid = *reg; | 212 | busid = *reg; |
213 | 213 | ||
214 | iface = kmalloc(sizeof(struct smu_iface), GFP_KERNEL); | 214 | iface = kzalloc(sizeof(struct smu_iface), GFP_KERNEL); |
215 | if (iface == NULL) { | 215 | if (iface == NULL) { |
216 | printk(KERN_ERR "i2c-pmac-smu: can't allocate inteface !\n"); | 216 | printk(KERN_ERR "i2c-pmac-smu: can't allocate inteface !\n"); |
217 | return -ENOMEM; | 217 | return -ENOMEM; |
218 | } | 218 | } |
219 | memset(iface, 0, sizeof(struct smu_iface)); | ||
220 | init_completion(&iface->complete); | 219 | init_completion(&iface->complete); |
221 | iface->busid = busid; | 220 | iface->busid = busid; |
222 | 221 | ||
diff --git a/drivers/i2c/busses/i2c-prosavage.c b/drivers/i2c/busses/i2c-prosavage.c index 83fd16d61ce5..42cb1d8ca659 100644 --- a/drivers/i2c/busses/i2c-prosavage.c +++ b/drivers/i2c/busses/i2c-prosavage.c | |||
@@ -83,11 +83,6 @@ struct s_i2c_chip { | |||
83 | /* | 83 | /* |
84 | * i2c configuration | 84 | * i2c configuration |
85 | */ | 85 | */ |
86 | #ifndef I2C_HW_B_S3VIA | ||
87 | #define I2C_HW_B_S3VIA 0x18 /* S3VIA ProSavage adapter */ | ||
88 | #endif | ||
89 | |||
90 | /* delays */ | ||
91 | #define CYCLE_DELAY 10 | 86 | #define CYCLE_DELAY 10 |
92 | #define TIMEOUT (HZ / 2) | 87 | #define TIMEOUT (HZ / 2) |
93 | 88 | ||
@@ -241,14 +236,12 @@ static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_devic | |||
241 | struct s_i2c_chip *chip; | 236 | struct s_i2c_chip *chip; |
242 | struct s_i2c_bus *bus; | 237 | struct s_i2c_bus *bus; |
243 | 238 | ||
244 | pci_set_drvdata(dev, kmalloc(sizeof(struct s_i2c_chip), GFP_KERNEL)); | 239 | pci_set_drvdata(dev, kzalloc(sizeof(struct s_i2c_chip), GFP_KERNEL)); |
245 | chip = (struct s_i2c_chip *)pci_get_drvdata(dev); | 240 | chip = (struct s_i2c_chip *)pci_get_drvdata(dev); |
246 | if (chip == NULL) { | 241 | if (chip == NULL) { |
247 | return -ENOMEM; | 242 | return -ENOMEM; |
248 | } | 243 | } |
249 | 244 | ||
250 | memset(chip, 0, sizeof(struct s_i2c_chip)); | ||
251 | |||
252 | base = dev->resource[0].start & PCI_BASE_ADDRESS_MEM_MASK; | 245 | base = dev->resource[0].start & PCI_BASE_ADDRESS_MEM_MASK; |
253 | len = dev->resource[0].end - base + 1; | 246 | len = dev->resource[0].end - base + 1; |
254 | chip->mmio = ioremap_nocache(base, len); | 247 | chip->mmio = ioremap_nocache(base, len); |
@@ -308,6 +301,7 @@ static struct pci_device_id prosavage_pci_tbl[] = { | |||
308 | MODULE_DEVICE_TABLE (pci, prosavage_pci_tbl); | 301 | MODULE_DEVICE_TABLE (pci, prosavage_pci_tbl); |
309 | 302 | ||
310 | static struct pci_driver prosavage_driver = { | 303 | static struct pci_driver prosavage_driver = { |
304 | .owner = THIS_MODULE, | ||
311 | .name = "prosavage_smbus", | 305 | .name = "prosavage_smbus", |
312 | .id_table = prosavage_pci_tbl, | 306 | .id_table = prosavage_pci_tbl, |
313 | .probe = prosavage_probe, | 307 | .probe = prosavage_probe, |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 73a092fb0e7e..6ced28e90070 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -879,14 +879,12 @@ static int s3c24xx_i2c_remove(struct device *dev) | |||
879 | } | 879 | } |
880 | 880 | ||
881 | #ifdef CONFIG_PM | 881 | #ifdef CONFIG_PM |
882 | static int s3c24xx_i2c_resume(struct device *dev, u32 level) | 882 | static int s3c24xx_i2c_resume(struct device *dev) |
883 | { | 883 | { |
884 | struct s3c24xx_i2c *i2c = dev_get_drvdata(dev); | 884 | struct s3c24xx_i2c *i2c = dev_get_drvdata(dev); |
885 | 885 | ||
886 | if (i2c != NULL && level == RESUME_ENABLE) { | 886 | if (i2c != NULL) |
887 | dev_dbg(dev, "resume: level %d\n", level); | ||
888 | s3c24xx_i2c_init(i2c); | 887 | s3c24xx_i2c_init(i2c); |
889 | } | ||
890 | 888 | ||
891 | return 0; | 889 | return 0; |
892 | } | 890 | } |
@@ -898,6 +896,7 @@ static int s3c24xx_i2c_resume(struct device *dev, u32 level) | |||
898 | /* device driver for platform bus bits */ | 896 | /* device driver for platform bus bits */ |
899 | 897 | ||
900 | static struct device_driver s3c2410_i2c_driver = { | 898 | static struct device_driver s3c2410_i2c_driver = { |
899 | .owner = THIS_MODULE, | ||
901 | .name = "s3c2410-i2c", | 900 | .name = "s3c2410-i2c", |
902 | .bus = &platform_bus_type, | 901 | .bus = &platform_bus_type, |
903 | .probe = s3c24xx_i2c_probe, | 902 | .probe = s3c24xx_i2c_probe, |
@@ -906,6 +905,7 @@ static struct device_driver s3c2410_i2c_driver = { | |||
906 | }; | 905 | }; |
907 | 906 | ||
908 | static struct device_driver s3c2440_i2c_driver = { | 907 | static struct device_driver s3c2440_i2c_driver = { |
908 | .owner = THIS_MODULE, | ||
909 | .name = "s3c2440-i2c", | 909 | .name = "s3c2440-i2c", |
910 | .bus = &platform_bus_type, | 910 | .bus = &platform_bus_type, |
911 | .probe = s3c24xx_i2c_probe, | 911 | .probe = s3c24xx_i2c_probe, |
diff --git a/drivers/i2c/busses/i2c-savage4.c b/drivers/i2c/busses/i2c-savage4.c index 0c8518298e4d..aebe87ba4033 100644 --- a/drivers/i2c/busses/i2c-savage4.c +++ b/drivers/i2c/busses/i2c-savage4.c | |||
@@ -179,6 +179,7 @@ static void __devexit savage4_remove(struct pci_dev *dev) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | static struct pci_driver savage4_driver = { | 181 | static struct pci_driver savage4_driver = { |
182 | .owner = THIS_MODULE, | ||
182 | .name = "savage4_smbus", | 183 | .name = "savage4_smbus", |
183 | .id_table = savage4_ids, | 184 | .id_table = savage4_ids, |
184 | .probe = savage4_probe, | 185 | .probe = savage4_probe, |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index 080318d6f54b..3ad27c3ba15b 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -123,11 +123,12 @@ static int blacklist[] = { | |||
123 | 123 | ||
124 | /* If force_addr is set to anything different from 0, we forcibly enable | 124 | /* If force_addr is set to anything different from 0, we forcibly enable |
125 | the device at the given address. */ | 125 | the device at the given address. */ |
126 | static u16 force_addr = 0; | 126 | static u16 force_addr; |
127 | module_param(force_addr, ushort, 0); | 127 | module_param(force_addr, ushort, 0); |
128 | MODULE_PARM_DESC(force_addr, "Initialize the base address of the i2c controller"); | 128 | MODULE_PARM_DESC(force_addr, "Initialize the base address of the i2c controller"); |
129 | 129 | ||
130 | static unsigned short sis5595_base = 0; | 130 | static struct pci_driver sis5595_driver; |
131 | static unsigned short sis5595_base; | ||
131 | 132 | ||
132 | static u8 sis5595_read(u8 reg) | 133 | static u8 sis5595_read(u8 reg) |
133 | { | 134 | { |
@@ -172,7 +173,8 @@ static int sis5595_setup(struct pci_dev *SIS5595_dev) | |||
172 | 173 | ||
173 | /* NB: We grab just the two SMBus registers here, but this may still | 174 | /* NB: We grab just the two SMBus registers here, but this may still |
174 | * interfere with ACPI :-( */ | 175 | * interfere with ACPI :-( */ |
175 | if (!request_region(sis5595_base + SMB_INDEX, 2, "sis5595-smbus")) { | 176 | if (!request_region(sis5595_base + SMB_INDEX, 2, |
177 | sis5595_driver.name)) { | ||
176 | dev_err(&SIS5595_dev->dev, "SMBus registers 0x%04x-0x%04x already in use!\n", | 178 | dev_err(&SIS5595_dev->dev, "SMBus registers 0x%04x-0x%04x already in use!\n", |
177 | sis5595_base + SMB_INDEX, sis5595_base + SMB_INDEX + 1); | 179 | sis5595_base + SMB_INDEX, sis5595_base + SMB_INDEX + 1); |
178 | return -ENODEV; | 180 | return -ENODEV; |
@@ -364,7 +366,6 @@ static struct i2c_algorithm smbus_algorithm = { | |||
364 | static struct i2c_adapter sis5595_adapter = { | 366 | static struct i2c_adapter sis5595_adapter = { |
365 | .owner = THIS_MODULE, | 367 | .owner = THIS_MODULE, |
366 | .class = I2C_CLASS_HWMON, | 368 | .class = I2C_CLASS_HWMON, |
367 | .name = "unset", | ||
368 | .algo = &smbus_algorithm, | 369 | .algo = &smbus_algorithm, |
369 | }; | 370 | }; |
370 | 371 | ||
@@ -397,6 +398,7 @@ static void __devexit sis5595_remove(struct pci_dev *dev) | |||
397 | } | 398 | } |
398 | 399 | ||
399 | static struct pci_driver sis5595_driver = { | 400 | static struct pci_driver sis5595_driver = { |
401 | .owner = THIS_MODULE, | ||
400 | .name = "sis5595_smbus", | 402 | .name = "sis5595_smbus", |
401 | .id_table = sis5595_ids, | 403 | .id_table = sis5595_ids, |
402 | .probe = sis5595_probe, | 404 | .probe = sis5595_probe, |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index 86f0f448fa0b..7f49e5fd3ff0 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -92,6 +92,8 @@ | |||
92 | #define SIS630_PCALL 0x04 | 92 | #define SIS630_PCALL 0x04 |
93 | #define SIS630_BLOCK_DATA 0x05 | 93 | #define SIS630_BLOCK_DATA 0x05 |
94 | 94 | ||
95 | static struct pci_driver sis630_driver; | ||
96 | |||
95 | /* insmod parameters */ | 97 | /* insmod parameters */ |
96 | static int high_clock; | 98 | static int high_clock; |
97 | static int force; | 99 | static int force; |
@@ -101,7 +103,7 @@ module_param(force, bool, 0); | |||
101 | MODULE_PARM_DESC(force, "Forcibly enable the SIS630. DANGEROUS!"); | 103 | MODULE_PARM_DESC(force, "Forcibly enable the SIS630. DANGEROUS!"); |
102 | 104 | ||
103 | /* acpi base address */ | 105 | /* acpi base address */ |
104 | static unsigned short acpi_base = 0; | 106 | static unsigned short acpi_base; |
105 | 107 | ||
106 | /* supported chips */ | 108 | /* supported chips */ |
107 | static int supported[] = { | 109 | static int supported[] = { |
@@ -432,7 +434,8 @@ static int sis630_setup(struct pci_dev *sis630_dev) | |||
432 | dev_dbg(&sis630_dev->dev, "ACPI base at 0x%04x\n", acpi_base); | 434 | dev_dbg(&sis630_dev->dev, "ACPI base at 0x%04x\n", acpi_base); |
433 | 435 | ||
434 | /* Everything is happy, let's grab the memory and set things up. */ | 436 | /* Everything is happy, let's grab the memory and set things up. */ |
435 | if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, "sis630-smbus")) { | 437 | if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, |
438 | sis630_driver.name)) { | ||
436 | dev_err(&sis630_dev->dev, "SMBus registers 0x%04x-0x%04x already " | 439 | dev_err(&sis630_dev->dev, "SMBus registers 0x%04x-0x%04x already " |
437 | "in use!\n", acpi_base + SMB_STS, acpi_base + SMB_SAA); | 440 | "in use!\n", acpi_base + SMB_STS, acpi_base + SMB_SAA); |
438 | goto exit; | 441 | goto exit; |
@@ -455,7 +458,6 @@ static struct i2c_algorithm smbus_algorithm = { | |||
455 | static struct i2c_adapter sis630_adapter = { | 458 | static struct i2c_adapter sis630_adapter = { |
456 | .owner = THIS_MODULE, | 459 | .owner = THIS_MODULE, |
457 | .class = I2C_CLASS_HWMON, | 460 | .class = I2C_CLASS_HWMON, |
458 | .name = "unset", | ||
459 | .algo = &smbus_algorithm, | 461 | .algo = &smbus_algorithm, |
460 | }; | 462 | }; |
461 | 463 | ||
@@ -494,6 +496,7 @@ static void __devexit sis630_remove(struct pci_dev *dev) | |||
494 | 496 | ||
495 | 497 | ||
496 | static struct pci_driver sis630_driver = { | 498 | static struct pci_driver sis630_driver = { |
499 | .owner = THIS_MODULE, | ||
497 | .name = "sis630_smbus", | 500 | .name = "sis630_smbus", |
498 | .id_table = sis630_ids, | 501 | .id_table = sis630_ids, |
499 | .probe = sis630_probe, | 502 | .probe = sis630_probe, |
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index ead2ff3cf60e..6a134c091324 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c | |||
@@ -82,8 +82,9 @@ | |||
82 | #define SIS96x_PROC_CALL 0x04 | 82 | #define SIS96x_PROC_CALL 0x04 |
83 | #define SIS96x_BLOCK_DATA 0x05 | 83 | #define SIS96x_BLOCK_DATA 0x05 |
84 | 84 | ||
85 | static struct pci_driver sis96x_driver; | ||
85 | static struct i2c_adapter sis96x_adapter; | 86 | static struct i2c_adapter sis96x_adapter; |
86 | static u16 sis96x_smbus_base = 0; | 87 | static u16 sis96x_smbus_base; |
87 | 88 | ||
88 | static inline u8 sis96x_read(u8 reg) | 89 | static inline u8 sis96x_read(u8 reg) |
89 | { | 90 | { |
@@ -257,7 +258,6 @@ static struct i2c_adapter sis96x_adapter = { | |||
257 | .owner = THIS_MODULE, | 258 | .owner = THIS_MODULE, |
258 | .class = I2C_CLASS_HWMON, | 259 | .class = I2C_CLASS_HWMON, |
259 | .algo = &smbus_algorithm, | 260 | .algo = &smbus_algorithm, |
260 | .name = "unset", | ||
261 | }; | 261 | }; |
262 | 262 | ||
263 | static struct pci_device_id sis96x_ids[] = { | 263 | static struct pci_device_id sis96x_ids[] = { |
@@ -294,7 +294,8 @@ static int __devinit sis96x_probe(struct pci_dev *dev, | |||
294 | sis96x_smbus_base); | 294 | sis96x_smbus_base); |
295 | 295 | ||
296 | /* Everything is happy, let's grab the memory and set things up. */ | 296 | /* Everything is happy, let's grab the memory and set things up. */ |
297 | if (!request_region(sis96x_smbus_base, SMB_IOSIZE, "sis96x-smbus")) { | 297 | if (!request_region(sis96x_smbus_base, SMB_IOSIZE, |
298 | sis96x_driver.name)) { | ||
298 | dev_err(&dev->dev, "SMBus registers 0x%04x-0x%04x " | 299 | dev_err(&dev->dev, "SMBus registers 0x%04x-0x%04x " |
299 | "already in use!\n", sis96x_smbus_base, | 300 | "already in use!\n", sis96x_smbus_base, |
300 | sis96x_smbus_base + SMB_IOSIZE - 1); | 301 | sis96x_smbus_base + SMB_IOSIZE - 1); |
@@ -328,6 +329,7 @@ static void __devexit sis96x_remove(struct pci_dev *dev) | |||
328 | } | 329 | } |
329 | 330 | ||
330 | static struct pci_driver sis96x_driver = { | 331 | static struct pci_driver sis96x_driver = { |
332 | .owner = THIS_MODULE, | ||
331 | .name = "sis96x_smbus", | 333 | .name = "sis96x_smbus", |
332 | .id_table = sis96x_ids, | 334 | .id_table = sis96x_ids, |
333 | .probe = sis96x_probe, | 335 | .probe = sis96x_probe, |
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c index 040b8abeabba..544a38e64394 100644 --- a/drivers/i2c/busses/i2c-via.c +++ b/drivers/i2c/busses/i2c-via.c | |||
@@ -43,9 +43,9 @@ | |||
43 | 43 | ||
44 | /* io-region reservation */ | 44 | /* io-region reservation */ |
45 | #define IOSPACE 0x06 | 45 | #define IOSPACE 0x06 |
46 | #define IOTEXT "via-i2c" | ||
47 | 46 | ||
48 | static u16 pm_io_base = 0; | 47 | static struct pci_driver vt586b_driver; |
48 | static u16 pm_io_base; | ||
49 | 49 | ||
50 | /* | 50 | /* |
51 | It does not appear from the datasheet that the GPIO pins are | 51 | It does not appear from the datasheet that the GPIO pins are |
@@ -130,7 +130,7 @@ static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_i | |||
130 | pci_read_config_word(dev, base, &pm_io_base); | 130 | pci_read_config_word(dev, base, &pm_io_base); |
131 | pm_io_base &= (0xff << 8); | 131 | pm_io_base &= (0xff << 8); |
132 | 132 | ||
133 | if (!request_region(I2C_DIR, IOSPACE, IOTEXT)) { | 133 | if (!request_region(I2C_DIR, IOSPACE, vt586b_driver.name)) { |
134 | dev_err(&dev->dev, "IO 0x%x-0x%x already in use\n", I2C_DIR, I2C_DIR + IOSPACE); | 134 | dev_err(&dev->dev, "IO 0x%x-0x%x already in use\n", I2C_DIR, I2C_DIR + IOSPACE); |
135 | return -ENODEV; | 135 | return -ENODEV; |
136 | } | 136 | } |
@@ -159,6 +159,7 @@ static void __devexit vt586b_remove(struct pci_dev *dev) | |||
159 | 159 | ||
160 | 160 | ||
161 | static struct pci_driver vt586b_driver = { | 161 | static struct pci_driver vt586b_driver = { |
162 | .owner = THIS_MODULE, | ||
162 | .name = "vt586b_smbus", | 163 | .name = "vt586b_smbus", |
163 | .id_table = vt586b_ids, | 164 | .id_table = vt586b_ids, |
164 | .probe = vt586b_probe, | 165 | .probe = vt586b_probe, |
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index 99d209e0485a..c9366b504833 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -1,9 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware |
3 | monitoring | 3 | monitoring |
4 | Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, | 4 | Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, |
5 | Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>, | 5 | Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>, |
6 | Mark D. Studebaker <mdsxyz123@yahoo.com> | 6 | Mark D. Studebaker <mdsxyz123@yahoo.com> |
7 | Copyright (C) 2005 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,15 +22,19 @@ | |||
21 | */ | 22 | */ |
22 | 23 | ||
23 | /* | 24 | /* |
24 | Supports Via devices: | 25 | Supports the following VIA south bridges: |
25 | 82C596A/B (0x3050) | 26 | |
26 | 82C596B (0x3051) | 27 | Chip name PCI ID REV I2C block |
27 | 82C686A/B | 28 | VT82C596A 0x3050 no |
28 | 8231 | 29 | VT82C596B 0x3051 no |
29 | 8233 | 30 | VT82C686A 0x3057 0x30 no |
30 | 8233A (0x3147 and 0x3177) | 31 | VT82C686B 0x3057 0x40 yes |
31 | 8235 | 32 | VT8231 0x8235 no? |
32 | 8237 | 33 | VT8233 0x3074 yes |
34 | VT8233A 0x3147 yes? | ||
35 | VT8235 0x3177 yes | ||
36 | VT8237R 0x3227 yes | ||
37 | |||
33 | Note: we assume there can only be one device, with one SMBus interface. | 38 | Note: we assume there can only be one device, with one SMBus interface. |
34 | */ | 39 | */ |
35 | 40 | ||
@@ -38,7 +43,6 @@ | |||
38 | #include <linux/pci.h> | 43 | #include <linux/pci.h> |
39 | #include <linux/kernel.h> | 44 | #include <linux/kernel.h> |
40 | #include <linux/stddef.h> | 45 | #include <linux/stddef.h> |
41 | #include <linux/sched.h> | ||
42 | #include <linux/ioport.h> | 46 | #include <linux/ioport.h> |
43 | #include <linux/i2c.h> | 47 | #include <linux/i2c.h> |
44 | #include <linux/init.h> | 48 | #include <linux/init.h> |
@@ -46,48 +50,37 @@ | |||
46 | 50 | ||
47 | static struct pci_dev *vt596_pdev; | 51 | static struct pci_dev *vt596_pdev; |
48 | 52 | ||
49 | #define SMBBA1 0x90 | 53 | #define SMBBA1 0x90 |
50 | #define SMBBA2 0x80 | 54 | #define SMBBA2 0x80 |
51 | #define SMBBA3 0xD0 | 55 | #define SMBBA3 0xD0 |
52 | 56 | ||
53 | /* SMBus address offsets */ | 57 | /* SMBus address offsets */ |
54 | static unsigned short vt596_smba; | 58 | static unsigned short vt596_smba; |
55 | #define SMBHSTSTS (vt596_smba + 0) | 59 | #define SMBHSTSTS (vt596_smba + 0) |
56 | #define SMBHSLVSTS (vt596_smba + 1) | ||
57 | #define SMBHSTCNT (vt596_smba + 2) | 60 | #define SMBHSTCNT (vt596_smba + 2) |
58 | #define SMBHSTCMD (vt596_smba + 3) | 61 | #define SMBHSTCMD (vt596_smba + 3) |
59 | #define SMBHSTADD (vt596_smba + 4) | 62 | #define SMBHSTADD (vt596_smba + 4) |
60 | #define SMBHSTDAT0 (vt596_smba + 5) | 63 | #define SMBHSTDAT0 (vt596_smba + 5) |
61 | #define SMBHSTDAT1 (vt596_smba + 6) | 64 | #define SMBHSTDAT1 (vt596_smba + 6) |
62 | #define SMBBLKDAT (vt596_smba + 7) | 65 | #define SMBBLKDAT (vt596_smba + 7) |
63 | #define SMBSLVCNT (vt596_smba + 8) | ||
64 | #define SMBSHDWCMD (vt596_smba + 9) | ||
65 | #define SMBSLVEVT (vt596_smba + 0xA) | ||
66 | #define SMBSLVDAT (vt596_smba + 0xC) | ||
67 | 66 | ||
68 | /* PCI Address Constants */ | 67 | /* PCI Address Constants */ |
69 | 68 | ||
70 | /* SMBus data in configuration space can be found in two places, | 69 | /* SMBus data in configuration space can be found in two places, |
71 | We try to select the better one*/ | 70 | We try to select the better one */ |
72 | |||
73 | static unsigned short smb_cf_hstcfg = 0xD2; | ||
74 | 71 | ||
75 | #define SMBHSTCFG (smb_cf_hstcfg) | 72 | static unsigned short SMBHSTCFG = 0xD2; |
76 | #define SMBSLVC (smb_cf_hstcfg + 1) | ||
77 | #define SMBSHDW1 (smb_cf_hstcfg + 2) | ||
78 | #define SMBSHDW2 (smb_cf_hstcfg + 3) | ||
79 | #define SMBREV (smb_cf_hstcfg + 4) | ||
80 | 73 | ||
81 | /* Other settings */ | 74 | /* Other settings */ |
82 | #define MAX_TIMEOUT 500 | 75 | #define MAX_TIMEOUT 500 |
83 | #define ENABLE_INT9 0 | ||
84 | 76 | ||
85 | /* VT82C596 constants */ | 77 | /* VT82C596 constants */ |
86 | #define VT596_QUICK 0x00 | 78 | #define VT596_QUICK 0x00 |
87 | #define VT596_BYTE 0x04 | 79 | #define VT596_BYTE 0x04 |
88 | #define VT596_BYTE_DATA 0x08 | 80 | #define VT596_BYTE_DATA 0x08 |
89 | #define VT596_WORD_DATA 0x0C | 81 | #define VT596_WORD_DATA 0x0C |
90 | #define VT596_BLOCK_DATA 0x14 | 82 | #define VT596_BLOCK_DATA 0x14 |
83 | #define VT596_I2C_BLOCK_DATA 0x34 | ||
91 | 84 | ||
92 | 85 | ||
93 | /* If force is set to anything different from 0, we forcibly enable the | 86 | /* If force is set to anything different from 0, we forcibly enable the |
@@ -105,40 +98,65 @@ MODULE_PARM_DESC(force_addr, | |||
105 | "EXTREMELY DANGEROUS!"); | 98 | "EXTREMELY DANGEROUS!"); |
106 | 99 | ||
107 | 100 | ||
101 | static struct pci_driver vt596_driver; | ||
108 | static struct i2c_adapter vt596_adapter; | 102 | static struct i2c_adapter vt596_adapter; |
109 | 103 | ||
110 | /* Another internally used function */ | 104 | #define FEATURE_I2CBLOCK (1<<0) |
111 | static int vt596_transaction(void) | 105 | static unsigned int vt596_features; |
106 | |||
107 | #ifdef DEBUG | ||
108 | static void vt596_dump_regs(const char *msg, u8 size) | ||
109 | { | ||
110 | dev_dbg(&vt596_adapter.dev, "%s: STS=%02x CNT=%02x CMD=%02x ADD=%02x " | ||
111 | "DAT=%02x,%02x\n", msg, inb_p(SMBHSTSTS), inb_p(SMBHSTCNT), | ||
112 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), | ||
113 | inb_p(SMBHSTDAT1)); | ||
114 | |||
115 | if (size == VT596_BLOCK_DATA | ||
116 | || size == VT596_I2C_BLOCK_DATA) { | ||
117 | int i; | ||
118 | |||
119 | dev_dbg(&vt596_adapter.dev, "BLK="); | ||
120 | for (i = 0; i < I2C_SMBUS_BLOCK_MAX / 2; i++) | ||
121 | printk("%02x,", inb_p(SMBBLKDAT)); | ||
122 | printk("\n"); | ||
123 | dev_dbg(&vt596_adapter.dev, " "); | ||
124 | for (; i < I2C_SMBUS_BLOCK_MAX - 1; i++) | ||
125 | printk("%02x,", inb_p(SMBBLKDAT)); | ||
126 | printk("%02x\n", inb_p(SMBBLKDAT)); | ||
127 | } | ||
128 | } | ||
129 | #else | ||
130 | static inline void vt596_dump_regs(const char *msg, u8 size) { } | ||
131 | #endif | ||
132 | |||
133 | /* Return -1 on error, 0 on success */ | ||
134 | static int vt596_transaction(u8 size) | ||
112 | { | 135 | { |
113 | int temp; | 136 | int temp; |
114 | int result = 0; | 137 | int result = 0; |
115 | int timeout = 0; | 138 | int timeout = 0; |
116 | 139 | ||
117 | dev_dbg(&vt596_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, " | 140 | vt596_dump_regs("Transaction (pre)", size); |
118 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), | ||
119 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), | ||
120 | inb_p(SMBHSTDAT1)); | ||
121 | 141 | ||
122 | /* Make sure the SMBus host is ready to start transmitting */ | 142 | /* Make sure the SMBus host is ready to start transmitting */ |
123 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { | 143 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { |
124 | dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). " | 144 | dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). " |
125 | "Resetting...\n", temp); | 145 | "Resetting... ", temp); |
126 | 146 | ||
127 | outb_p(temp, SMBHSTSTS); | 147 | outb_p(temp, SMBHSTSTS); |
128 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { | 148 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { |
129 | dev_dbg(&vt596_adapter.dev, "Failed! (0x%02x)\n", temp); | 149 | printk("Failed! (0x%02x)\n", temp); |
130 | |||
131 | return -1; | 150 | return -1; |
132 | } else { | 151 | } else { |
133 | dev_dbg(&vt596_adapter.dev, "Successfull!\n"); | 152 | printk("Successful!\n"); |
134 | } | 153 | } |
135 | } | 154 | } |
136 | 155 | ||
137 | /* start the transaction by setting bit 6 */ | 156 | /* Start the transaction by setting bit 6 */ |
138 | outb_p(inb(SMBHSTCNT) | 0x040, SMBHSTCNT); | 157 | outb_p(0x40 | (size & 0x3C), SMBHSTCNT); |
139 | 158 | ||
140 | /* We will always wait for a fraction of a second! | 159 | /* We will always wait for a fraction of a second */ |
141 | I don't know if VIA needs this, Intel did */ | ||
142 | do { | 160 | do { |
143 | msleep(1); | 161 | msleep(1); |
144 | temp = inb_p(SMBHSTSTS); | 162 | temp = inb_p(SMBHSTSTS); |
@@ -147,77 +165,61 @@ static int vt596_transaction(void) | |||
147 | /* If the SMBus is still busy, we give up */ | 165 | /* If the SMBus is still busy, we give up */ |
148 | if (timeout >= MAX_TIMEOUT) { | 166 | if (timeout >= MAX_TIMEOUT) { |
149 | result = -1; | 167 | result = -1; |
150 | dev_dbg(&vt596_adapter.dev, "SMBus Timeout!\n"); | 168 | dev_err(&vt596_adapter.dev, "SMBus timeout!\n"); |
151 | } | 169 | } |
152 | 170 | ||
153 | if (temp & 0x10) { | 171 | if (temp & 0x10) { |
154 | result = -1; | 172 | result = -1; |
155 | dev_dbg(&vt596_adapter.dev, "Error: Failed bus transaction\n"); | 173 | dev_err(&vt596_adapter.dev, "Transaction failed (0x%02x)\n", |
174 | inb_p(SMBHSTCNT) & 0x3C); | ||
156 | } | 175 | } |
157 | 176 | ||
158 | if (temp & 0x08) { | 177 | if (temp & 0x08) { |
159 | result = -1; | 178 | result = -1; |
160 | dev_info(&vt596_adapter.dev, "Bus collision! SMBus may be " | 179 | dev_err(&vt596_adapter.dev, "SMBus collision!\n"); |
161 | "locked until next hard\nreset. (sorry!)\n"); | ||
162 | /* Clock stops and slave is stuck in mid-transmission */ | ||
163 | } | 180 | } |
164 | 181 | ||
165 | if (temp & 0x04) { | 182 | if (temp & 0x04) { |
166 | result = -1; | 183 | result = -1; |
167 | dev_dbg(&vt596_adapter.dev, "Error: no response!\n"); | 184 | /* Quick commands are used to probe for chips, so |
185 | errors are expected, and we don't want to frighten the | ||
186 | user. */ | ||
187 | if ((inb_p(SMBHSTCNT) & 0x3C) != VT596_QUICK) | ||
188 | dev_err(&vt596_adapter.dev, "Transaction error!\n"); | ||
168 | } | 189 | } |
169 | 190 | ||
170 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { | 191 | /* Resetting status register */ |
192 | if (temp & 0x1F) | ||
171 | outb_p(temp, SMBHSTSTS); | 193 | outb_p(temp, SMBHSTSTS); |
172 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { | ||
173 | dev_warn(&vt596_adapter.dev, "Failed reset at end " | ||
174 | "of transaction (%02x)\n", temp); | ||
175 | } | ||
176 | } | ||
177 | 194 | ||
178 | dev_dbg(&vt596_adapter.dev, "Transaction (post): CNT=%02x, CMD=%02x, " | 195 | vt596_dump_regs("Transaction (post)", size); |
179 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), | 196 | |
180 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), | ||
181 | inb_p(SMBHSTDAT1)); | ||
182 | |||
183 | return result; | 197 | return result; |
184 | } | 198 | } |
185 | 199 | ||
186 | /* Return -1 on error. */ | 200 | /* Return -1 on error, 0 on success */ |
187 | static s32 vt596_access(struct i2c_adapter *adap, u16 addr, | 201 | static s32 vt596_access(struct i2c_adapter *adap, u16 addr, |
188 | unsigned short flags, char read_write, u8 command, | 202 | unsigned short flags, char read_write, u8 command, |
189 | int size, union i2c_smbus_data *data) | 203 | int size, union i2c_smbus_data *data) |
190 | { | 204 | { |
191 | int i, len; | 205 | int i; |
192 | 206 | ||
193 | switch (size) { | 207 | switch (size) { |
194 | case I2C_SMBUS_PROC_CALL: | ||
195 | dev_info(&vt596_adapter.dev, | ||
196 | "I2C_SMBUS_PROC_CALL not supported!\n"); | ||
197 | return -1; | ||
198 | case I2C_SMBUS_QUICK: | 208 | case I2C_SMBUS_QUICK: |
199 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | ||
200 | SMBHSTADD); | ||
201 | size = VT596_QUICK; | 209 | size = VT596_QUICK; |
202 | break; | 210 | break; |
203 | case I2C_SMBUS_BYTE: | 211 | case I2C_SMBUS_BYTE: |
204 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | ||
205 | SMBHSTADD); | ||
206 | if (read_write == I2C_SMBUS_WRITE) | 212 | if (read_write == I2C_SMBUS_WRITE) |
207 | outb_p(command, SMBHSTCMD); | 213 | outb_p(command, SMBHSTCMD); |
208 | size = VT596_BYTE; | 214 | size = VT596_BYTE; |
209 | break; | 215 | break; |
210 | case I2C_SMBUS_BYTE_DATA: | 216 | case I2C_SMBUS_BYTE_DATA: |
211 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | ||
212 | SMBHSTADD); | ||
213 | outb_p(command, SMBHSTCMD); | 217 | outb_p(command, SMBHSTCMD); |
214 | if (read_write == I2C_SMBUS_WRITE) | 218 | if (read_write == I2C_SMBUS_WRITE) |
215 | outb_p(data->byte, SMBHSTDAT0); | 219 | outb_p(data->byte, SMBHSTDAT0); |
216 | size = VT596_BYTE_DATA; | 220 | size = VT596_BYTE_DATA; |
217 | break; | 221 | break; |
218 | case I2C_SMBUS_WORD_DATA: | 222 | case I2C_SMBUS_WORD_DATA: |
219 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | ||
220 | SMBHSTADD); | ||
221 | outb_p(command, SMBHSTCMD); | 223 | outb_p(command, SMBHSTCMD); |
222 | if (read_write == I2C_SMBUS_WRITE) { | 224 | if (read_write == I2C_SMBUS_WRITE) { |
223 | outb_p(data->word & 0xff, SMBHSTDAT0); | 225 | outb_p(data->word & 0xff, SMBHSTDAT0); |
@@ -225,28 +227,33 @@ static s32 vt596_access(struct i2c_adapter *adap, u16 addr, | |||
225 | } | 227 | } |
226 | size = VT596_WORD_DATA; | 228 | size = VT596_WORD_DATA; |
227 | break; | 229 | break; |
230 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
231 | if (!(vt596_features & FEATURE_I2CBLOCK)) | ||
232 | goto exit_unsupported; | ||
233 | if (read_write == I2C_SMBUS_READ) | ||
234 | outb_p(I2C_SMBUS_BLOCK_MAX, SMBHSTDAT0); | ||
235 | /* Fall through */ | ||
228 | case I2C_SMBUS_BLOCK_DATA: | 236 | case I2C_SMBUS_BLOCK_DATA: |
229 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | ||
230 | SMBHSTADD); | ||
231 | outb_p(command, SMBHSTCMD); | 237 | outb_p(command, SMBHSTCMD); |
232 | if (read_write == I2C_SMBUS_WRITE) { | 238 | if (read_write == I2C_SMBUS_WRITE) { |
233 | len = data->block[0]; | 239 | u8 len = data->block[0]; |
234 | if (len < 0) | ||
235 | len = 0; | ||
236 | if (len > I2C_SMBUS_BLOCK_MAX) | 240 | if (len > I2C_SMBUS_BLOCK_MAX) |
237 | len = I2C_SMBUS_BLOCK_MAX; | 241 | len = I2C_SMBUS_BLOCK_MAX; |
238 | outb_p(len, SMBHSTDAT0); | 242 | outb_p(len, SMBHSTDAT0); |
239 | i = inb_p(SMBHSTCNT); /* Reset SMBBLKDAT */ | 243 | inb_p(SMBHSTCNT); /* Reset SMBBLKDAT */ |
240 | for (i = 1; i <= len; i++) | 244 | for (i = 1; i <= len; i++) |
241 | outb_p(data->block[i], SMBBLKDAT); | 245 | outb_p(data->block[i], SMBBLKDAT); |
242 | } | 246 | } |
243 | size = VT596_BLOCK_DATA; | 247 | size = (size == I2C_SMBUS_I2C_BLOCK_DATA) ? |
248 | VT596_I2C_BLOCK_DATA : VT596_BLOCK_DATA; | ||
244 | break; | 249 | break; |
250 | default: | ||
251 | goto exit_unsupported; | ||
245 | } | 252 | } |
246 | 253 | ||
247 | outb_p((size & 0x1C) + (ENABLE_INT9 & 1), SMBHSTCNT); | 254 | outb_p(((addr & 0x7f) << 1) | read_write, SMBHSTADD); |
248 | 255 | ||
249 | if (vt596_transaction()) /* Error in transaction */ | 256 | if (vt596_transaction(size)) /* Error in transaction */ |
250 | return -1; | 257 | return -1; |
251 | 258 | ||
252 | if ((read_write == I2C_SMBUS_WRITE) || (size == VT596_QUICK)) | 259 | if ((read_write == I2C_SMBUS_WRITE) || (size == VT596_QUICK)) |
@@ -254,35 +261,39 @@ static s32 vt596_access(struct i2c_adapter *adap, u16 addr, | |||
254 | 261 | ||
255 | switch (size) { | 262 | switch (size) { |
256 | case VT596_BYTE: | 263 | case VT596_BYTE: |
257 | /* Where is the result put? I assume here it is in | ||
258 | * SMBHSTDAT0 but it might just as well be in the | ||
259 | * SMBHSTCMD. No clue in the docs | ||
260 | */ | ||
261 | data->byte = inb_p(SMBHSTDAT0); | ||
262 | break; | ||
263 | case VT596_BYTE_DATA: | 264 | case VT596_BYTE_DATA: |
264 | data->byte = inb_p(SMBHSTDAT0); | 265 | data->byte = inb_p(SMBHSTDAT0); |
265 | break; | 266 | break; |
266 | case VT596_WORD_DATA: | 267 | case VT596_WORD_DATA: |
267 | data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); | 268 | data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); |
268 | break; | 269 | break; |
270 | case VT596_I2C_BLOCK_DATA: | ||
269 | case VT596_BLOCK_DATA: | 271 | case VT596_BLOCK_DATA: |
270 | data->block[0] = inb_p(SMBHSTDAT0); | 272 | data->block[0] = inb_p(SMBHSTDAT0); |
271 | if (data->block[0] > I2C_SMBUS_BLOCK_MAX) | 273 | if (data->block[0] > I2C_SMBUS_BLOCK_MAX) |
272 | data->block[0] = I2C_SMBUS_BLOCK_MAX; | 274 | data->block[0] = I2C_SMBUS_BLOCK_MAX; |
273 | i = inb_p(SMBHSTCNT); /* Reset SMBBLKDAT */ | 275 | inb_p(SMBHSTCNT); /* Reset SMBBLKDAT */ |
274 | for (i = 1; i <= data->block[0]; i++) | 276 | for (i = 1; i <= data->block[0]; i++) |
275 | data->block[i] = inb_p(SMBBLKDAT); | 277 | data->block[i] = inb_p(SMBBLKDAT); |
276 | break; | 278 | break; |
277 | } | 279 | } |
278 | return 0; | 280 | return 0; |
281 | |||
282 | exit_unsupported: | ||
283 | dev_warn(&vt596_adapter.dev, "Unsupported command invoked! (0x%02x)\n", | ||
284 | size); | ||
285 | return -1; | ||
279 | } | 286 | } |
280 | 287 | ||
281 | static u32 vt596_func(struct i2c_adapter *adapter) | 288 | static u32 vt596_func(struct i2c_adapter *adapter) |
282 | { | 289 | { |
283 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 290 | u32 func = I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
284 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | 291 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | |
285 | I2C_FUNC_SMBUS_BLOCK_DATA; | 292 | I2C_FUNC_SMBUS_BLOCK_DATA; |
293 | |||
294 | if (vt596_features & FEATURE_I2CBLOCK) | ||
295 | func |= I2C_FUNC_SMBUS_I2C_BLOCK; | ||
296 | return func; | ||
286 | } | 297 | } |
287 | 298 | ||
288 | static struct i2c_algorithm smbus_algorithm = { | 299 | static struct i2c_algorithm smbus_algorithm = { |
@@ -294,7 +305,6 @@ static struct i2c_adapter vt596_adapter = { | |||
294 | .owner = THIS_MODULE, | 305 | .owner = THIS_MODULE, |
295 | .class = I2C_CLASS_HWMON, | 306 | .class = I2C_CLASS_HWMON, |
296 | .algo = &smbus_algorithm, | 307 | .algo = &smbus_algorithm, |
297 | .name = "unset", | ||
298 | }; | 308 | }; |
299 | 309 | ||
300 | static int __devinit vt596_probe(struct pci_dev *pdev, | 310 | static int __devinit vt596_probe(struct pci_dev *pdev, |
@@ -302,7 +312,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
302 | { | 312 | { |
303 | unsigned char temp; | 313 | unsigned char temp; |
304 | int error = -ENODEV; | 314 | int error = -ENODEV; |
305 | 315 | ||
306 | /* Determine the address of the SMBus areas */ | 316 | /* Determine the address of the SMBus areas */ |
307 | if (force_addr) { | 317 | if (force_addr) { |
308 | vt596_smba = force_addr & 0xfff0; | 318 | vt596_smba = force_addr & 0xfff0; |
@@ -311,12 +321,12 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
311 | } | 321 | } |
312 | 322 | ||
313 | if ((pci_read_config_word(pdev, id->driver_data, &vt596_smba)) || | 323 | if ((pci_read_config_word(pdev, id->driver_data, &vt596_smba)) || |
314 | !(vt596_smba & 0x1)) { | 324 | !(vt596_smba & 0x0001)) { |
315 | /* try 2nd address and config reg. for 596 */ | 325 | /* try 2nd address and config reg. for 596 */ |
316 | if (id->device == PCI_DEVICE_ID_VIA_82C596_3 && | 326 | if (id->device == PCI_DEVICE_ID_VIA_82C596_3 && |
317 | !pci_read_config_word(pdev, SMBBA2, &vt596_smba) && | 327 | !pci_read_config_word(pdev, SMBBA2, &vt596_smba) && |
318 | (vt596_smba & 0x1)) { | 328 | (vt596_smba & 0x0001)) { |
319 | smb_cf_hstcfg = 0x84; | 329 | SMBHSTCFG = 0x84; |
320 | } else { | 330 | } else { |
321 | /* no matches at all */ | 331 | /* no matches at all */ |
322 | dev_err(&pdev->dev, "Cannot configure " | 332 | dev_err(&pdev->dev, "Cannot configure " |
@@ -333,10 +343,10 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
333 | return -ENODEV; | 343 | return -ENODEV; |
334 | } | 344 | } |
335 | 345 | ||
336 | found: | 346 | found: |
337 | if (!request_region(vt596_smba, 8, "viapro-smbus")) { | 347 | if (!request_region(vt596_smba, 8, vt596_driver.name)) { |
338 | dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n", | 348 | dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n", |
339 | vt596_smba); | 349 | vt596_smba); |
340 | return -ENODEV; | 350 | return -ENODEV; |
341 | } | 351 | } |
342 | 352 | ||
@@ -348,16 +358,16 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
348 | pci_write_config_word(pdev, id->driver_data, vt596_smba); | 358 | pci_write_config_word(pdev, id->driver_data, vt596_smba); |
349 | pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01); | 359 | pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01); |
350 | dev_warn(&pdev->dev, "WARNING: SMBus interface set to new " | 360 | dev_warn(&pdev->dev, "WARNING: SMBus interface set to new " |
351 | "address 0x%04x!\n", vt596_smba); | 361 | "address 0x%04x!\n", vt596_smba); |
352 | } else if ((temp & 1) == 0) { | 362 | } else if (!(temp & 0x01)) { |
353 | if (force) { | 363 | if (force) { |
354 | /* NOTE: This assumes I/O space and other allocations | 364 | /* NOTE: This assumes I/O space and other allocations |
355 | * WERE done by the Bios! Don't complain if your | 365 | * WERE done by the Bios! Don't complain if your |
356 | * hardware does weird things after enabling this. | 366 | * hardware does weird things after enabling this. |
357 | * :') Check for Bios updates before resorting to | 367 | * :') Check for Bios updates before resorting to |
358 | * this. | 368 | * this. |
359 | */ | 369 | */ |
360 | pci_write_config_byte(pdev, SMBHSTCFG, temp | 1); | 370 | pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01); |
361 | dev_info(&pdev->dev, "Enabling SMBus device\n"); | 371 | dev_info(&pdev->dev, "Enabling SMBus device\n"); |
362 | } else { | 372 | } else { |
363 | dev_err(&pdev->dev, "SMBUS: Error: Host SMBus " | 373 | dev_err(&pdev->dev, "SMBUS: Error: Host SMBus " |
@@ -367,22 +377,28 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
367 | } | 377 | } |
368 | } | 378 | } |
369 | 379 | ||
370 | if ((temp & 0x0E) == 8) | ||
371 | dev_dbg(&pdev->dev, "using Interrupt 9 for SMBus.\n"); | ||
372 | else if ((temp & 0x0E) == 0) | ||
373 | dev_dbg(&pdev->dev, "using Interrupt SMI# for SMBus.\n"); | ||
374 | else | ||
375 | dev_dbg(&pdev->dev, "Illegal Interrupt configuration " | ||
376 | "(or code out of date)!\n"); | ||
377 | |||
378 | pci_read_config_byte(pdev, SMBREV, &temp); | ||
379 | dev_dbg(&pdev->dev, "SMBREV = 0x%X\n", temp); | ||
380 | dev_dbg(&pdev->dev, "VT596_smba = 0x%X\n", vt596_smba); | 380 | dev_dbg(&pdev->dev, "VT596_smba = 0x%X\n", vt596_smba); |
381 | 381 | ||
382 | switch (pdev->device) { | ||
383 | case PCI_DEVICE_ID_VIA_8237: | ||
384 | case PCI_DEVICE_ID_VIA_8235: | ||
385 | case PCI_DEVICE_ID_VIA_8233A: | ||
386 | case PCI_DEVICE_ID_VIA_8233_0: | ||
387 | vt596_features |= FEATURE_I2CBLOCK; | ||
388 | break; | ||
389 | case PCI_DEVICE_ID_VIA_82C686_4: | ||
390 | /* The VT82C686B (rev 0x40) does support I2C block | ||
391 | transactions, but the VT82C686A (rev 0x30) doesn't */ | ||
392 | if (!pci_read_config_byte(pdev, PCI_REVISION_ID, &temp) | ||
393 | && temp >= 0x40) | ||
394 | vt596_features |= FEATURE_I2CBLOCK; | ||
395 | break; | ||
396 | } | ||
397 | |||
382 | vt596_adapter.dev.parent = &pdev->dev; | 398 | vt596_adapter.dev.parent = &pdev->dev; |
383 | snprintf(vt596_adapter.name, I2C_NAME_SIZE, | 399 | snprintf(vt596_adapter.name, I2C_NAME_SIZE, |
384 | "SMBus Via Pro adapter at %04x", vt596_smba); | 400 | "SMBus Via Pro adapter at %04x", vt596_smba); |
385 | 401 | ||
386 | vt596_pdev = pci_dev_get(pdev); | 402 | vt596_pdev = pci_dev_get(pdev); |
387 | if (i2c_add_adapter(&vt596_adapter)) { | 403 | if (i2c_add_adapter(&vt596_adapter)) { |
388 | pci_dev_put(vt596_pdev); | 404 | pci_dev_put(vt596_pdev); |
@@ -395,7 +411,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
395 | */ | 411 | */ |
396 | return -ENODEV; | 412 | return -ENODEV; |
397 | 413 | ||
398 | release_region: | 414 | release_region: |
399 | release_region(vt596_smba, 8); | 415 | release_region(vt596_smba, 8); |
400 | return error; | 416 | return error; |
401 | } | 417 | } |
@@ -420,9 +436,10 @@ static struct pci_device_id vt596_ids[] = { | |||
420 | { 0, } | 436 | { 0, } |
421 | }; | 437 | }; |
422 | 438 | ||
423 | MODULE_DEVICE_TABLE (pci, vt596_ids); | 439 | MODULE_DEVICE_TABLE(pci, vt596_ids); |
424 | 440 | ||
425 | static struct pci_driver vt596_driver = { | 441 | static struct pci_driver vt596_driver = { |
442 | .owner = THIS_MODULE, | ||
426 | .name = "vt596_smbus", | 443 | .name = "vt596_smbus", |
427 | .id_table = vt596_ids, | 444 | .id_table = vt596_ids, |
428 | .probe = vt596_probe, | 445 | .probe = vt596_probe, |
diff --git a/drivers/i2c/busses/i2c-voodoo3.c b/drivers/i2c/busses/i2c-voodoo3.c index b675773b0cc1..650c3ebde84c 100644 --- a/drivers/i2c/busses/i2c-voodoo3.c +++ b/drivers/i2c/busses/i2c-voodoo3.c | |||
@@ -225,6 +225,7 @@ static void __devexit voodoo3_remove(struct pci_dev *dev) | |||
225 | } | 225 | } |
226 | 226 | ||
227 | static struct pci_driver voodoo3_driver = { | 227 | static struct pci_driver voodoo3_driver = { |
228 | .owner = THIS_MODULE, | ||
228 | .name = "voodoo3_smbus", | 229 | .name = "voodoo3_smbus", |
229 | .id_table = voodoo3_ids, | 230 | .id_table = voodoo3_ids, |
230 | .probe = voodoo3_probe, | 231 | .probe = voodoo3_probe, |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index a1d580e05361..d3478e084522 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -442,14 +442,13 @@ static int __init scx200_acb_create(int base, int index) | |||
442 | int rc = 0; | 442 | int rc = 0; |
443 | char description[64]; | 443 | char description[64]; |
444 | 444 | ||
445 | iface = kmalloc(sizeof(*iface), GFP_KERNEL); | 445 | iface = kzalloc(sizeof(*iface), GFP_KERNEL); |
446 | if (!iface) { | 446 | if (!iface) { |
447 | printk(KERN_ERR NAME ": can't allocate memory\n"); | 447 | printk(KERN_ERR NAME ": can't allocate memory\n"); |
448 | rc = -ENOMEM; | 448 | rc = -ENOMEM; |
449 | goto errout; | 449 | goto errout; |
450 | } | 450 | } |
451 | 451 | ||
452 | memset(iface, 0, sizeof(*iface)); | ||
453 | adapter = &iface->adapter; | 452 | adapter = &iface->adapter; |
454 | i2c_set_adapdata(adapter, iface); | 453 | i2c_set_adapdata(adapter, iface); |
455 | snprintf(adapter->name, I2C_NAME_SIZE, "SCx200 ACB%d", index); | 454 | snprintf(adapter->name, I2C_NAME_SIZE, "SCx200 ACB%d", index); |