aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-08-08 03:51:32 -0400
committerStephen Warren <swarren@nvidia.com>2012-09-13 13:40:29 -0400
commit14e92bd4ff7381e84bc7f24596721e0054b5f783 (patch)
tree323071195fe6c04ad1a5c4feae28c2d9fc4bbb9b /drivers/i2c
parente54848d9ba7114ac2fa51b104eb6b1e7c67d9b28 (diff)
i2c: tegra: pass proper name for getting clock
Tegra's i2c controller require two clock sources named as div_clk and fast_clk. This change make sure that driver pass the correct clock's name when it acquires clock handle. Also change the variable name to reflect the correct clock handles. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-tegra.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 9a08c57bc93..8514d3a95a6 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -117,8 +117,8 @@ enum msg_end_type {
117 * struct tegra_i2c_dev - per device i2c context 117 * struct tegra_i2c_dev - per device i2c context
118 * @dev: device reference for power management 118 * @dev: device reference for power management
119 * @adapter: core i2c layer adapter information 119 * @adapter: core i2c layer adapter information
120 * @clk: clock reference for i2c controller 120 * @div_clk: clock reference for div clock of i2c controller.
121 * @i2c_clk: clock reference for i2c bus 121 * @fast_clk: clock reference for fast clock of i2c controller.
122 * @base: ioremapped registers cookie 122 * @base: ioremapped registers cookie
123 * @cont_id: i2c controller id, used for for packet header 123 * @cont_id: i2c controller id, used for for packet header
124 * @irq: irq number of transfer complete interrupt 124 * @irq: irq number of transfer complete interrupt
@@ -134,8 +134,8 @@ enum msg_end_type {
134struct tegra_i2c_dev { 134struct tegra_i2c_dev {
135 struct device *dev; 135 struct device *dev;
136 struct i2c_adapter adapter; 136 struct i2c_adapter adapter;
137 struct clk *clk; 137 struct clk *div_clk;
138 struct clk *i2c_clk; 138 struct clk *fast_clk;
139 void __iomem *base; 139 void __iomem *base;
140 int cont_id; 140 int cont_id;
141 int irq; 141 int irq;
@@ -356,11 +356,11 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
356 u32 val; 356 u32 val;
357 int err = 0; 357 int err = 0;
358 358
359 clk_prepare_enable(i2c_dev->clk); 359 clk_prepare_enable(i2c_dev->div_clk);
360 360
361 tegra_periph_reset_assert(i2c_dev->clk); 361 tegra_periph_reset_assert(i2c_dev->div_clk);
362 udelay(2); 362 udelay(2);
363 tegra_periph_reset_deassert(i2c_dev->clk); 363 tegra_periph_reset_deassert(i2c_dev->div_clk);
364 364
365 if (i2c_dev->is_dvc) 365 if (i2c_dev->is_dvc)
366 tegra_dvc_init(i2c_dev); 366 tegra_dvc_init(i2c_dev);
@@ -369,7 +369,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
369 (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT); 369 (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT);
370 i2c_writel(i2c_dev, val, I2C_CNFG); 370 i2c_writel(i2c_dev, val, I2C_CNFG);
371 i2c_writel(i2c_dev, 0, I2C_INT_MASK); 371 i2c_writel(i2c_dev, 0, I2C_INT_MASK);
372 clk_set_rate(i2c_dev->clk, i2c_dev->bus_clk_rate * 8); 372 clk_set_rate(i2c_dev->div_clk, i2c_dev->bus_clk_rate * 8);
373 373
374 if (!i2c_dev->is_dvc) { 374 if (!i2c_dev->is_dvc) {
375 u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG); 375 u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG);
@@ -387,7 +387,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
387 if (tegra_i2c_flush_fifos(i2c_dev)) 387 if (tegra_i2c_flush_fifos(i2c_dev))
388 err = -ETIMEDOUT; 388 err = -ETIMEDOUT;
389 389
390 clk_disable_unprepare(i2c_dev->clk); 390 clk_disable_unprepare(i2c_dev->div_clk);
391 391
392 if (i2c_dev->irq_disabled) { 392 if (i2c_dev->irq_disabled) {
393 i2c_dev->irq_disabled = 0; 393 i2c_dev->irq_disabled = 0;
@@ -563,7 +563,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
563 if (i2c_dev->is_suspended) 563 if (i2c_dev->is_suspended)
564 return -EBUSY; 564 return -EBUSY;
565 565
566 clk_prepare_enable(i2c_dev->clk); 566 clk_prepare_enable(i2c_dev->div_clk);
567 for (i = 0; i < num; i++) { 567 for (i = 0; i < num; i++) {
568 enum msg_end_type end_type = MSG_END_STOP; 568 enum msg_end_type end_type = MSG_END_STOP;
569 if (i < (num - 1)) { 569 if (i < (num - 1)) {
@@ -576,7 +576,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
576 if (ret) 576 if (ret)
577 break; 577 break;
578 } 578 }
579 clk_disable_unprepare(i2c_dev->clk); 579 clk_disable_unprepare(i2c_dev->div_clk);
580 return ret ?: i; 580 return ret ?: i;
581} 581}
582 582
@@ -596,8 +596,8 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
596 struct tegra_i2c_dev *i2c_dev; 596 struct tegra_i2c_dev *i2c_dev;
597 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data; 597 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;
598 struct resource *res; 598 struct resource *res;
599 struct clk *clk; 599 struct clk *div_clk;
600 struct clk *i2c_clk; 600 struct clk *fast_clk;
601 const unsigned int *prop; 601 const unsigned int *prop;
602 void __iomem *base; 602 void __iomem *base;
603 int irq; 603 int irq;
@@ -622,16 +622,16 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
622 } 622 }
623 irq = res->start; 623 irq = res->start;
624 624
625 clk = devm_clk_get(&pdev->dev, NULL); 625 div_clk = devm_clk_get(&pdev->dev, "div-clk");
626 if (IS_ERR(clk)) { 626 if (IS_ERR(div_clk)) {
627 dev_err(&pdev->dev, "missing controller clock"); 627 dev_err(&pdev->dev, "missing controller clock");
628 return PTR_ERR(clk); 628 return PTR_ERR(div_clk);
629 } 629 }
630 630
631 i2c_clk = devm_clk_get(&pdev->dev, "i2c"); 631 fast_clk = devm_clk_get(&pdev->dev, "fast-clk");
632 if (IS_ERR(i2c_clk)) { 632 if (IS_ERR(fast_clk)) {
633 dev_err(&pdev->dev, "missing bus clock"); 633 dev_err(&pdev->dev, "missing bus clock");
634 return PTR_ERR(i2c_clk); 634 return PTR_ERR(fast_clk);
635 } 635 }
636 636
637 i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); 637 i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL);
@@ -641,8 +641,8 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
641 } 641 }
642 642
643 i2c_dev->base = base; 643 i2c_dev->base = base;
644 i2c_dev->clk = clk; 644 i2c_dev->div_clk = div_clk;
645 i2c_dev->i2c_clk = i2c_clk; 645 i2c_dev->fast_clk = fast_clk;
646 i2c_dev->adapter.algo = &tegra_i2c_algo; 646 i2c_dev->adapter.algo = &tegra_i2c_algo;
647 i2c_dev->irq = irq; 647 i2c_dev->irq = irq;
648 i2c_dev->cont_id = pdev->id; 648 i2c_dev->cont_id = pdev->id;
@@ -681,7 +681,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
681 return ret; 681 return ret;
682 } 682 }
683 683
684 clk_prepare_enable(i2c_dev->i2c_clk); 684 clk_prepare_enable(i2c_dev->fast_clk);
685 685
686 i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); 686 i2c_set_adapdata(&i2c_dev->adapter, i2c_dev);
687 i2c_dev->adapter.owner = THIS_MODULE; 687 i2c_dev->adapter.owner = THIS_MODULE;
@@ -696,7 +696,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
696 ret = i2c_add_numbered_adapter(&i2c_dev->adapter); 696 ret = i2c_add_numbered_adapter(&i2c_dev->adapter);
697 if (ret) { 697 if (ret) {
698 dev_err(&pdev->dev, "Failed to add I2C adapter\n"); 698 dev_err(&pdev->dev, "Failed to add I2C adapter\n");
699 clk_disable_unprepare(i2c_dev->i2c_clk); 699 clk_disable_unprepare(i2c_dev->fast_clk);
700 return ret; 700 return ret;
701 } 701 }
702 702