aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/clock-sh7372.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-11-24 02:21:08 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-11-24 02:21:08 -0500
commit540565257101f7c52b6fc5a57651f7505f8d20fe (patch)
tree7adee0bc65a02fead0dd9cae4f2d4632b227ac56 /arch/arm/mach-shmobile/clock-sh7372.c
parent4d048435e9864998f6a6ad16422393d42322716d (diff)
parent421b446abeec55bed1251fab80cb5c12be58b773 (diff)
Merge branch 'rmobile/fsi-despair' into rmobile-fixes-for-linus
Diffstat (limited to 'arch/arm/mach-shmobile/clock-sh7372.c')
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index d3313a95dbfc..d0011a5b165d 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -230,21 +230,13 @@ static int pllc2_set_rate(struct clk *clk,
230 if (idx < 0) 230 if (idx < 0)
231 return idx; 231 return idx;
232 232
233 if (rate == clk->parent->rate) { 233 if (rate == clk->parent->rate)
234 pllc2_disable(clk); 234 return -EINVAL;
235 return 0;
236 }
237 235
238 value = __raw_readl(PLLC2CR) & ~(0x3f << 24); 236 value = __raw_readl(PLLC2CR) & ~(0x3f << 24);
239 237
240 if (value & 0x80000000)
241 pllc2_disable(clk);
242
243 __raw_writel((value & ~0x80000000) | ((idx + 19) << 24), PLLC2CR); 238 __raw_writel((value & ~0x80000000) | ((idx + 19) << 24), PLLC2CR);
244 239
245 if (value & 0x80000000)
246 return pllc2_enable(clk);
247
248 return 0; 240 return 0;
249} 241}
250 242
@@ -453,10 +445,8 @@ static int fsidiv_enable(struct clk *clk)
453 unsigned long value; 445 unsigned long value;
454 446
455 value = __raw_readl(clk->mapping->base) >> 16; 447 value = __raw_readl(clk->mapping->base) >> 16;
456 if (value < 2) { 448 if (value < 2)
457 fsidiv_disable(clk); 449 return -EIO;
458 return -ENOENT;
459 }
460 450
461 __raw_writel((value << 16) | 0x3, clk->mapping->base); 451 __raw_writel((value << 16) | 0x3, clk->mapping->base);
462 452
@@ -468,17 +458,12 @@ static int fsidiv_set_rate(struct clk *clk,
468{ 458{
469 int idx; 459 int idx;
470 460
471 if (clk->parent->rate == rate) {
472 fsidiv_disable(clk);
473 return 0;
474 }
475
476 idx = (clk->parent->rate / rate) & 0xffff; 461 idx = (clk->parent->rate / rate) & 0xffff;
477 if (idx < 2) 462 if (idx < 2)
478 return -ENOENT; 463 return -EINVAL;
479 464
480 __raw_writel(idx << 16, clk->mapping->base); 465 __raw_writel(idx << 16, clk->mapping->base);
481 return fsidiv_enable(clk); 466 return 0;
482} 467}
483 468
484static struct clk_ops fsidiv_clk_ops = { 469static struct clk_ops fsidiv_clk_ops = {
@@ -609,8 +594,6 @@ static struct clk_lookup lookups[] = {
609 CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]), 594 CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]),
610 CLKDEV_CON_ID("fmsi_clk", &div6_clks[DIV6_FMSI]), 595 CLKDEV_CON_ID("fmsi_clk", &div6_clks[DIV6_FMSI]),
611 CLKDEV_CON_ID("fmso_clk", &div6_clks[DIV6_FMSO]), 596 CLKDEV_CON_ID("fmso_clk", &div6_clks[DIV6_FMSO]),
612 CLKDEV_CON_ID("fsia_clk", &div6_reparent_clks[DIV6_FSIA]),
613 CLKDEV_CON_ID("fsib_clk", &div6_reparent_clks[DIV6_FSIB]),
614 CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]), 597 CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]),
615 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]), 598 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]),
616 CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]), 599 CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]),