diff options
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/Kconfig | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-isch.c | 68 |
2 files changed, 28 insertions, 42 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 4cc3807bd31c..f22eff1da87e 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -105,7 +105,7 @@ config I2C_I801 | |||
105 | 105 | ||
106 | config I2C_ISCH | 106 | config I2C_ISCH |
107 | tristate "Intel SCH SMBus 1.0" | 107 | tristate "Intel SCH SMBus 1.0" |
108 | depends on PCI | 108 | select LPC_SCH |
109 | help | 109 | help |
110 | Say Y here if you want to use SMBus controller on the Intel SCH | 110 | Say Y here if you want to use SMBus controller on the Intel SCH |
111 | based systems. | 111 | based systems. |
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c index 69c22f79f231..ddc258edb34f 100644 --- a/drivers/i2c/busses/i2c-isch.c +++ b/drivers/i2c/busses/i2c-isch.c | |||
@@ -27,7 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/pci.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/stddef.h> | 33 | #include <linux/stddef.h> |
@@ -46,12 +46,6 @@ | |||
46 | #define SMBHSTDAT1 (7 + sch_smba) | 46 | #define SMBHSTDAT1 (7 + sch_smba) |
47 | #define SMBBLKDAT (0x20 + sch_smba) | 47 | #define SMBBLKDAT (0x20 + sch_smba) |
48 | 48 | ||
49 | /* count for request_region */ | ||
50 | #define SMBIOSIZE 64 | ||
51 | |||
52 | /* PCI Address Constants */ | ||
53 | #define SMBBA_SCH 0x40 | ||
54 | |||
55 | /* Other settings */ | 49 | /* Other settings */ |
56 | #define MAX_TIMEOUT 500 | 50 | #define MAX_TIMEOUT 500 |
57 | 51 | ||
@@ -63,7 +57,6 @@ | |||
63 | #define SCH_BLOCK_DATA 0x05 | 57 | #define SCH_BLOCK_DATA 0x05 |
64 | 58 | ||
65 | static unsigned short sch_smba; | 59 | static unsigned short sch_smba; |
66 | static struct pci_driver sch_driver; | ||
67 | static struct i2c_adapter sch_adapter; | 60 | static struct i2c_adapter sch_adapter; |
68 | 61 | ||
69 | /* | 62 | /* |
@@ -256,37 +249,23 @@ static struct i2c_adapter sch_adapter = { | |||
256 | .algo = &smbus_algorithm, | 249 | .algo = &smbus_algorithm, |
257 | }; | 250 | }; |
258 | 251 | ||
259 | static const struct pci_device_id sch_ids[] = { | 252 | static int __devinit smbus_sch_probe(struct platform_device *dev) |
260 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SCH_LPC) }, | ||
261 | { 0, } | ||
262 | }; | ||
263 | |||
264 | MODULE_DEVICE_TABLE(pci, sch_ids); | ||
265 | |||
266 | static int __devinit sch_probe(struct pci_dev *dev, | ||
267 | const struct pci_device_id *id) | ||
268 | { | 253 | { |
254 | struct resource *res; | ||
269 | int retval; | 255 | int retval; |
270 | unsigned int smba; | ||
271 | 256 | ||
272 | pci_read_config_dword(dev, SMBBA_SCH, &smba); | 257 | res = platform_get_resource(dev, IORESOURCE_IO, 0); |
273 | if (!(smba & (1 << 31))) { | 258 | if (!res) |
274 | dev_err(&dev->dev, "SMBus I/O space disabled!\n"); | 259 | return -EBUSY; |
275 | return -ENODEV; | ||
276 | } | ||
277 | 260 | ||
278 | sch_smba = (unsigned short)smba; | 261 | if (!request_region(res->start, resource_size(res), dev->name)) { |
279 | if (sch_smba == 0) { | ||
280 | dev_err(&dev->dev, "SMBus base address uninitialized!\n"); | ||
281 | return -ENODEV; | ||
282 | } | ||
283 | if (acpi_check_region(sch_smba, SMBIOSIZE, sch_driver.name)) | ||
284 | return -ENODEV; | ||
285 | if (!request_region(sch_smba, SMBIOSIZE, sch_driver.name)) { | ||
286 | dev_err(&dev->dev, "SMBus region 0x%x already in use!\n", | 262 | dev_err(&dev->dev, "SMBus region 0x%x already in use!\n", |
287 | sch_smba); | 263 | sch_smba); |
288 | return -EBUSY; | 264 | return -EBUSY; |
289 | } | 265 | } |
266 | |||
267 | sch_smba = res->start; | ||
268 | |||
290 | dev_dbg(&dev->dev, "SMBA = 0x%X\n", sch_smba); | 269 | dev_dbg(&dev->dev, "SMBA = 0x%X\n", sch_smba); |
291 | 270 | ||
292 | /* set up the sysfs linkage to our parent device */ | 271 | /* set up the sysfs linkage to our parent device */ |
@@ -298,37 +277,43 @@ static int __devinit sch_probe(struct pci_dev *dev, | |||
298 | retval = i2c_add_adapter(&sch_adapter); | 277 | retval = i2c_add_adapter(&sch_adapter); |
299 | if (retval) { | 278 | if (retval) { |
300 | dev_err(&dev->dev, "Couldn't register adapter!\n"); | 279 | dev_err(&dev->dev, "Couldn't register adapter!\n"); |
301 | release_region(sch_smba, SMBIOSIZE); | 280 | release_region(res->start, resource_size(res)); |
302 | sch_smba = 0; | 281 | sch_smba = 0; |
303 | } | 282 | } |
304 | 283 | ||
305 | return retval; | 284 | return retval; |
306 | } | 285 | } |
307 | 286 | ||
308 | static void __devexit sch_remove(struct pci_dev *dev) | 287 | static int __devexit smbus_sch_remove(struct platform_device *pdev) |
309 | { | 288 | { |
289 | struct resource *res; | ||
310 | if (sch_smba) { | 290 | if (sch_smba) { |
311 | i2c_del_adapter(&sch_adapter); | 291 | i2c_del_adapter(&sch_adapter); |
312 | release_region(sch_smba, SMBIOSIZE); | 292 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
293 | release_region(res->start, resource_size(res)); | ||
313 | sch_smba = 0; | 294 | sch_smba = 0; |
314 | } | 295 | } |
296 | |||
297 | return 0; | ||
315 | } | 298 | } |
316 | 299 | ||
317 | static struct pci_driver sch_driver = { | 300 | static struct platform_driver smbus_sch_driver = { |
318 | .name = "isch_smbus", | 301 | .driver = { |
319 | .id_table = sch_ids, | 302 | .name = "isch_smbus", |
320 | .probe = sch_probe, | 303 | .owner = THIS_MODULE, |
321 | .remove = __devexit_p(sch_remove), | 304 | }, |
305 | .probe = smbus_sch_probe, | ||
306 | .remove = __devexit_p(smbus_sch_remove), | ||
322 | }; | 307 | }; |
323 | 308 | ||
324 | static int __init i2c_sch_init(void) | 309 | static int __init i2c_sch_init(void) |
325 | { | 310 | { |
326 | return pci_register_driver(&sch_driver); | 311 | return platform_driver_register(&smbus_sch_driver); |
327 | } | 312 | } |
328 | 313 | ||
329 | static void __exit i2c_sch_exit(void) | 314 | static void __exit i2c_sch_exit(void) |
330 | { | 315 | { |
331 | pci_unregister_driver(&sch_driver); | 316 | platform_driver_unregister(&smbus_sch_driver); |
332 | } | 317 | } |
333 | 318 | ||
334 | MODULE_AUTHOR("Jacob Pan <jacob.jun.pan@intel.com>"); | 319 | MODULE_AUTHOR("Jacob Pan <jacob.jun.pan@intel.com>"); |
@@ -337,3 +322,4 @@ MODULE_LICENSE("GPL"); | |||
337 | 322 | ||
338 | module_init(i2c_sch_init); | 323 | module_init(i2c_sch_init); |
339 | module_exit(i2c_sch_exit); | 324 | module_exit(i2c_sch_exit); |
325 | MODULE_ALIAS("platform:isch_smbus"); | ||