aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-mpc.c94
1 files changed, 0 insertions, 94 deletions
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 04adde62a003..9ad3e9262e8a 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -382,100 +382,6 @@ static void __exit fsl_i2c_exit(void)
382module_init(fsl_i2c_init); 382module_init(fsl_i2c_init);
383module_exit(fsl_i2c_exit); 383module_exit(fsl_i2c_exit);
384 384
385static int fsl_i2c_probe(struct device *device)
386{
387 int result = 0;
388 struct mpc_i2c *i2c;
389 struct platform_device *pdev = to_platform_device(device);
390 struct fsl_i2c_platform_data *pdata;
391 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
392
393 pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data;
394
395 if (!(i2c = kmalloc(sizeof(*i2c), GFP_KERNEL))) {
396 return -ENOMEM;
397 }
398 memset(i2c, 0, sizeof(*i2c));
399
400 i2c->irq = platform_get_irq(pdev, 0);
401 i2c->flags = pdata->device_flags;
402 init_waitqueue_head(&i2c->queue);
403
404 i2c->base = ioremap((phys_addr_t)r->start, MPC_I2C_REGION);
405
406 if (!i2c->base) {
407 printk(KERN_ERR "i2c-mpc - failed to map controller\n");
408 result = -ENOMEM;
409 goto fail_map;
410 }
411
412 if (i2c->irq != 0)
413 if ((result = request_irq(i2c->irq, mpc_i2c_isr,
414 SA_SHIRQ, "i2c-mpc", i2c)) < 0) {
415 printk(KERN_ERR
416 "i2c-mpc - failed to attach interrupt\n");
417 goto fail_irq;
418 }
419
420 mpc_i2c_setclock(i2c);
421 dev_set_drvdata(device, i2c);
422
423 i2c->adap = mpc_ops;
424 i2c_set_adapdata(&i2c->adap, i2c);
425 i2c->adap.dev.parent = &pdev->dev;
426 if ((result = i2c_add_adapter(&i2c->adap)) < 0) {
427 printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
428 goto fail_add;
429 }
430
431 return result;
432
433 fail_add:
434 if (i2c->irq != 0)
435 free_irq(i2c->irq, NULL);
436 fail_irq:
437 iounmap(i2c->base);
438 fail_map:
439 kfree(i2c);
440 return result;
441};
442
443static int fsl_i2c_remove(struct device *device)
444{
445 struct mpc_i2c *i2c = dev_get_drvdata(device);
446
447 i2c_del_adapter(&i2c->adap);
448 dev_set_drvdata(device, NULL);
449
450 if (i2c->irq != 0)
451 free_irq(i2c->irq, i2c);
452
453 iounmap(i2c->base);
454 kfree(i2c);
455 return 0;
456};
457
458/* Structure for a device driver */
459static struct device_driver fsl_i2c_driver = {
460 .name = "fsl-i2c",
461 .bus = &platform_bus_type,
462 .probe = fsl_i2c_probe,
463 .remove = fsl_i2c_remove,
464};
465
466static int __init fsl_i2c_init(void)
467{
468 return driver_register(&fsl_i2c_driver);
469}
470
471static void __exit fsl_i2c_exit(void)
472{
473 driver_unregister(&fsl_i2c_driver);
474}
475
476module_init(fsl_i2c_init);
477module_exit(fsl_i2c_exit);
478
479MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>"); 385MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>");
480MODULE_DESCRIPTION 386MODULE_DESCRIPTION
481 ("I2C-Bus adapter for MPC107 bridge and MPC824x/85xx/52xx processors"); 387 ("I2C-Bus adapter for MPC107 bridge and MPC824x/85xx/52xx processors");