aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/plat-mxc/include/mach/i2c.h4
-rw-r--r--drivers/i2c/busses/i2c-imx.c21
2 files changed, 3 insertions, 22 deletions
diff --git a/arch/arm/plat-mxc/include/mach/i2c.h b/arch/arm/plat-mxc/include/mach/i2c.h
index 4a5dc5c6d8e8..375cdd0cf876 100644
--- a/arch/arm/plat-mxc/include/mach/i2c.h
+++ b/arch/arm/plat-mxc/include/mach/i2c.h
@@ -11,14 +11,10 @@
11 11
12/** 12/**
13 * struct imxi2c_platform_data - structure of platform data for MXC I2C driver 13 * struct imxi2c_platform_data - structure of platform data for MXC I2C driver
14 * @init: Initialise gpio's and other board specific things
15 * @exit: Free everything initialised by @init
16 * @bitrate: Bus speed measured in Hz 14 * @bitrate: Bus speed measured in Hz
17 * 15 *
18 **/ 16 **/
19struct imxi2c_platform_data { 17struct imxi2c_platform_data {
20 int (*init)(struct device *dev);
21 void (*exit)(struct device *dev);
22 int bitrate; 18 int bitrate;
23}; 19};
24 20
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 4c2a62b75b5c..54d809ed20be 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -466,7 +466,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
466{ 466{
467 struct imx_i2c_struct *i2c_imx; 467 struct imx_i2c_struct *i2c_imx;
468 struct resource *res; 468 struct resource *res;
469 struct imxi2c_platform_data *pdata; 469 struct imxi2c_platform_data *pdata = pdev->dev.platform_data;
470 void __iomem *base; 470 void __iomem *base;
471 resource_size_t res_size; 471 resource_size_t res_size;
472 int irq; 472 int irq;
@@ -485,19 +485,11 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
485 return -ENOENT; 485 return -ENOENT;
486 } 486 }
487 487
488 pdata = pdev->dev.platform_data;
489
490 if (pdata && pdata->init) {
491 ret = pdata->init(&pdev->dev);
492 if (ret)
493 return ret;
494 }
495
496 res_size = resource_size(res); 488 res_size = resource_size(res);
497 489
498 if (!request_mem_region(res->start, res_size, DRIVER_NAME)) { 490 if (!request_mem_region(res->start, res_size, DRIVER_NAME)) {
499 ret = -EBUSY; 491 dev_err(&pdev->dev, "request_mem_region failed\n");
500 goto fail0; 492 return -EBUSY;
501 } 493 }
502 494
503 base = ioremap(res->start, res_size); 495 base = ioremap(res->start, res_size);
@@ -586,9 +578,6 @@ fail2:
586 iounmap(base); 578 iounmap(base);
587fail1: 579fail1:
588 release_mem_region(res->start, resource_size(res)); 580 release_mem_region(res->start, resource_size(res));
589fail0:
590 if (pdata && pdata->exit)
591 pdata->exit(&pdev->dev);
592 return ret; /* Return error number */ 581 return ret; /* Return error number */
593} 582}
594 583
@@ -611,10 +600,6 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
611 writeb(0, i2c_imx->base + IMX_I2C_I2CR); 600 writeb(0, i2c_imx->base + IMX_I2C_I2CR);
612 writeb(0, i2c_imx->base + IMX_I2C_I2SR); 601 writeb(0, i2c_imx->base + IMX_I2C_I2SR);
613 602
614 /* Shut down hardware */
615 if (pdata && pdata->exit)
616 pdata->exit(&pdev->dev);
617
618 clk_put(i2c_imx->clk); 603 clk_put(i2c_imx->clk);
619 604
620 iounmap(i2c_imx->base); 605 iounmap(i2c_imx->base);