aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-imx.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 671d37c23f4c..e3654d683e15 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -121,6 +121,7 @@ struct imx_i2c_struct {
121 unsigned long i2csr; 121 unsigned long i2csr;
122 unsigned int disable_delay; 122 unsigned int disable_delay;
123 int stopped; 123 int stopped;
124 unsigned int ifdr; /* IMX_I2C_IFDR */
124}; 125};
125 126
126/** Functions for IMX I2C adapter driver *************************************** 127/** Functions for IMX I2C adapter driver ***************************************
@@ -192,6 +193,8 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx)
192 193
193 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); 194 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
194 195
196 clk_enable(i2c_imx->clk);
197 writeb(i2c_imx->ifdr, i2c_imx->base + IMX_I2C_IFDR);
195 /* Enable I2C controller */ 198 /* Enable I2C controller */
196 writeb(0, i2c_imx->base + IMX_I2C_I2SR); 199 writeb(0, i2c_imx->base + IMX_I2C_I2SR);
197 writeb(I2CR_IEN, i2c_imx->base + IMX_I2C_I2CR); 200 writeb(I2CR_IEN, i2c_imx->base + IMX_I2C_I2CR);
@@ -238,6 +241,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
238 241
239 /* Disable I2C controller */ 242 /* Disable I2C controller */
240 writeb(0, i2c_imx->base + IMX_I2C_I2CR); 243 writeb(0, i2c_imx->base + IMX_I2C_I2CR);
244 clk_disable(i2c_imx->clk);
241} 245}
242 246
243static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, 247static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
@@ -257,8 +261,8 @@ static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
257 else 261 else
258 for (i = 0; i2c_clk_div[i][0] < div; i++); 262 for (i = 0; i2c_clk_div[i][0] < div; i++);
259 263
260 /* Write divider value to register */ 264 /* Store divider value */
261 writeb(i2c_clk_div[i][1], i2c_imx->base + IMX_I2C_IFDR); 265 i2c_imx->ifdr = i2c_clk_div[i][1];
262 266
263 /* 267 /*
264 * There dummy delay is calculated. 268 * There dummy delay is calculated.
@@ -528,7 +532,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
528 dev_err(&pdev->dev, "can't get I2C clock\n"); 532 dev_err(&pdev->dev, "can't get I2C clock\n");
529 goto fail3; 533 goto fail3;
530 } 534 }
531 clk_enable(i2c_imx->clk);
532 535
533 /* Request IRQ */ 536 /* Request IRQ */
534 ret = request_irq(i2c_imx->irq, i2c_imx_isr, 0, pdev->name, i2c_imx); 537 ret = request_irq(i2c_imx->irq, i2c_imx_isr, 0, pdev->name, i2c_imx);
@@ -577,7 +580,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
577fail5: 580fail5:
578 free_irq(i2c_imx->irq, i2c_imx); 581 free_irq(i2c_imx->irq, i2c_imx);
579fail4: 582fail4:
580 clk_disable(i2c_imx->clk);
581 clk_put(i2c_imx->clk); 583 clk_put(i2c_imx->clk);
582fail3: 584fail3:
583 release_mem_region(i2c_imx->res->start, resource_size(res)); 585 release_mem_region(i2c_imx->res->start, resource_size(res));
@@ -614,8 +616,6 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
614 if (pdata && pdata->exit) 616 if (pdata && pdata->exit)
615 pdata->exit(&pdev->dev); 617 pdata->exit(&pdev->dev);
616 618
617 /* Disable I2C clock */
618 clk_disable(i2c_imx->clk);
619 clk_put(i2c_imx->clk); 619 clk_put(i2c_imx->clk);
620 620
621 release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res)); 621 release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res));