aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-11-20 06:44:46 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-02-12 12:32:39 -0500
commitebdbbf2003ae2342147c87c2a6c6ed8984b9cede (patch)
tree2d3228b7a0b556e00f9082a5f4d09d426d03f11b
parent0321cb83e1c3f3a4282bd620c6cec78c5b80b572 (diff)
ARM: PNX4008: convert i2c-pnx to use clk API enable/disable calls
clk_set_rate() is not supposed to be used to turn clocks on and off. That's what clk_enable/clk_disable is for. Acked-by: Vitaly Wool <vitalywool@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-pnx4008/clock.c12
-rw-r--r--drivers/i2c/busses/i2c-pnx.c18
2 files changed, 15 insertions, 15 deletions
diff --git a/arch/arm/mach-pnx4008/clock.c b/arch/arm/mach-pnx4008/clock.c
index 5a1515210969..692625cd2001 100644
--- a/arch/arm/mach-pnx4008/clock.c
+++ b/arch/arm/mach-pnx4008/clock.c
@@ -639,30 +639,30 @@ static struct clk i2c0_ck = {
639 .name = "i2c0_ck", 639 .name = "i2c0_ck",
640 .parent = &per_ck, 640 .parent = &per_ck,
641 .flags = NEEDS_INITIALIZATION, 641 .flags = NEEDS_INITIALIZATION,
642 .round_rate = &on_off_round_rate,
643 .set_rate = &on_off_set_rate,
644 .enable_shift = 0, 642 .enable_shift = 0,
645 .enable_reg = I2CCLKCTRL_REG, 643 .enable_reg = I2CCLKCTRL_REG,
644 .enable = clk_reg_enable,
645 .disable = clk_reg_disable,
646}; 646};
647 647
648static struct clk i2c1_ck = { 648static struct clk i2c1_ck = {
649 .name = "i2c1_ck", 649 .name = "i2c1_ck",
650 .parent = &per_ck, 650 .parent = &per_ck,
651 .flags = NEEDS_INITIALIZATION, 651 .flags = NEEDS_INITIALIZATION,
652 .round_rate = &on_off_round_rate,
653 .set_rate = &on_off_set_rate,
654 .enable_shift = 1, 652 .enable_shift = 1,
655 .enable_reg = I2CCLKCTRL_REG, 653 .enable_reg = I2CCLKCTRL_REG,
654 .enable = clk_reg_enable,
655 .disable = clk_reg_disable,
656}; 656};
657 657
658static struct clk i2c2_ck = { 658static struct clk i2c2_ck = {
659 .name = "i2c2_ck", 659 .name = "i2c2_ck",
660 .parent = &per_ck, 660 .parent = &per_ck,
661 .flags = NEEDS_INITIALIZATION, 661 .flags = NEEDS_INITIALIZATION,
662 .round_rate = &on_off_round_rate,
663 .set_rate = &on_off_set_rate,
664 .enable_shift = 2, 662 .enable_shift = 2,
665 .enable_reg = USB_OTG_CLKCTRL_REG, 663 .enable_reg = USB_OTG_CLKCTRL_REG,
664 .enable = clk_reg_enable,
665 .disable = clk_reg_disable,
666}; 666};
667 667
668static struct clk spi0_ck = { 668static struct clk spi0_ck = {
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 98462671cdf7..29f91774c4df 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -555,8 +555,8 @@ static int i2c_pnx_controller_suspend(struct platform_device *pdev,
555 struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); 555 struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev);
556 struct i2c_pnx_algo_data *alg_data = i2c_pnx->adapter->algo_data; 556 struct i2c_pnx_algo_data *alg_data = i2c_pnx->adapter->algo_data;
557 557
558 /* FIXME: disable clock? */ 558 /* FIXME: shouldn't this be clk_disable? */
559 clk_set_rate(alg_data->clk, 1); 559 clk_enable(alg_data->clk);
560 560
561 return 0; 561 return 0;
562} 562}
@@ -566,9 +566,7 @@ static int i2c_pnx_controller_resume(struct platform_device *pdev)
566 struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); 566 struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev);
567 struct i2c_pnx_algo_data *alg_data = i2c_pnx->adapter->algo_data; 567 struct i2c_pnx_algo_data *alg_data = i2c_pnx->adapter->algo_data;
568 568
569 clk_set_rate(alg_data->clk, 1); 569 return clk_enable(alg_data->clk);
570
571 return 0;
572} 570}
573#else 571#else
574#define i2c_pnx_controller_suspend NULL 572#define i2c_pnx_controller_suspend NULL
@@ -630,7 +628,9 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
630 goto out_release; 628 goto out_release;
631 } 629 }
632 630
633 clk_set_rate(alg_data->clk, 1); 631 ret = clk_enable(alg_data->clk);
632 if (ret)
633 goto out_unmap;
634 634
635 /* 635 /*
636 * Clock Divisor High This value is the number of system clocks 636 * Clock Divisor High This value is the number of system clocks
@@ -650,7 +650,7 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
650 iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data)); 650 iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data));
651 if (wait_reset(I2C_PNX_TIMEOUT, alg_data)) { 651 if (wait_reset(I2C_PNX_TIMEOUT, alg_data)) {
652 ret = -ENODEV; 652 ret = -ENODEV;
653 goto out_unmap; 653 goto out_clock;
654 } 654 }
655 init_completion(&alg_data->mif.complete); 655 init_completion(&alg_data->mif.complete);
656 656
@@ -676,7 +676,7 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
676out_irq: 676out_irq:
677 free_irq(alg_data->irq, i2c_pnx->adapter); 677 free_irq(alg_data->irq, i2c_pnx->adapter);
678out_clock: 678out_clock:
679 clk_set_rate(alg_data->clk, 0); 679 clk_disable(alg_data->clk);
680out_unmap: 680out_unmap:
681 iounmap((void *)alg_data->ioaddr); 681 iounmap((void *)alg_data->ioaddr);
682out_release: 682out_release:
@@ -697,7 +697,7 @@ static int __devexit i2c_pnx_remove(struct platform_device *pdev)
697 697
698 free_irq(alg_data->irq, i2c_pnx->adapter); 698 free_irq(alg_data->irq, i2c_pnx->adapter);
699 i2c_del_adapter(adap); 699 i2c_del_adapter(adap);
700 clk_set_rate(alg_data->clk, 0); 700 clk_disable(alg_data->clk);
701 iounmap((void *)alg_data->ioaddr); 701 iounmap((void *)alg_data->ioaddr);
702 release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE); 702 release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE);
703 clk_put(alg_data->clk); 703 clk_put(alg_data->clk);