aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/clock.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2009-01-28 14:18:48 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-02-08 12:50:37 -0500
commitfed415e48f07799b278cd4353385fee1464d4aca (patch)
treeba99ee966eab37c127b31f40d63e894aeb4d3665 /arch/arm/mach-omap1/clock.c
parentda0747d4faf55320f0f6cbcd8525e2a8e4619925 (diff)
[ARM] omap: Fix omap1 clock issues
This fixes booting, and is a step toward fixing things properly: - Make enable_reg u32 instead of u16 [rmk: virtual addresses are void __iomem *, not u32] - Get rid of VIRTUAL_IO_ADDRESS for clocks - Use __raw_read/write instead of omap_read/write for clock registers This patch adds a bunch of compile warnings until omap1 clock also uses offsets. linux-omap source commit is 9d1dff8638c9e96a401e1885f9948662e9ff9636. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Paul Walmsley <paul@pwsan.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap1/clock.c')
-rw-r--r--arch/arm/mach-omap1/clock.c77
1 files changed, 23 insertions, 54 deletions
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 7c4554317907..1e477af666ee 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -163,7 +163,7 @@ static void omap1_watchdog_recalc(struct clk * clk)
163 163
164static void omap1_uart_recalc(struct clk * clk) 164static void omap1_uart_recalc(struct clk * clk)
165{ 165{
166 unsigned int val = omap_readl(clk->enable_reg); 166 unsigned int val = __raw_readl(clk->enable_reg);
167 if (val & clk->enable_bit) 167 if (val & clk->enable_bit)
168 clk->rate = 48000000; 168 clk->rate = 48000000;
169 else 169 else
@@ -517,14 +517,14 @@ static int omap1_set_uart_rate(struct clk * clk, unsigned long rate)
517{ 517{
518 unsigned int val; 518 unsigned int val;
519 519
520 val = omap_readl(clk->enable_reg); 520 val = __raw_readl(clk->enable_reg);
521 if (rate == 12000000) 521 if (rate == 12000000)
522 val &= ~(1 << clk->enable_bit); 522 val &= ~(1 << clk->enable_bit);
523 else if (rate == 48000000) 523 else if (rate == 48000000)
524 val |= (1 << clk->enable_bit); 524 val |= (1 << clk->enable_bit);
525 else 525 else
526 return -EINVAL; 526 return -EINVAL;
527 omap_writel(val, clk->enable_reg); 527 __raw_writel(val, clk->enable_reg);
528 clk->rate = rate; 528 clk->rate = rate;
529 529
530 return 0; 530 return 0;
@@ -543,8 +543,8 @@ static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate)
543 else 543 else
544 ratio_bits = (dsor - 2) << 2; 544 ratio_bits = (dsor - 2) << 2;
545 545
546 ratio_bits |= omap_readw(clk->enable_reg) & ~0xfd; 546 ratio_bits |= __raw_readw(clk->enable_reg) & ~0xfd;
547 omap_writew(ratio_bits, clk->enable_reg); 547 __raw_writew(ratio_bits, clk->enable_reg);
548 548
549 return 0; 549 return 0;
550} 550}
@@ -583,8 +583,8 @@ static void omap1_init_ext_clk(struct clk * clk)
583 __u16 ratio_bits; 583 __u16 ratio_bits;
584 584
585 /* Determine current rate and ensure clock is based on 96MHz APLL */ 585 /* Determine current rate and ensure clock is based on 96MHz APLL */
586 ratio_bits = omap_readw(clk->enable_reg) & ~1; 586 ratio_bits = __raw_readw(clk->enable_reg) & ~1;
587 omap_writew(ratio_bits, clk->enable_reg); 587 __raw_writew(ratio_bits, clk->enable_reg);
588 588
589 ratio_bits = (ratio_bits & 0xfc) >> 2; 589 ratio_bits = (ratio_bits & 0xfc) >> 2;
590 if (ratio_bits > 6) 590 if (ratio_bits > 6)
@@ -646,25 +646,13 @@ static int omap1_clk_enable_generic(struct clk *clk)
646 } 646 }
647 647
648 if (clk->flags & ENABLE_REG_32BIT) { 648 if (clk->flags & ENABLE_REG_32BIT) {
649 if (clk->flags & VIRTUAL_IO_ADDRESS) { 649 regval32 = __raw_readl(clk->enable_reg);
650 regval32 = __raw_readl(clk->enable_reg); 650 regval32 |= (1 << clk->enable_bit);
651 regval32 |= (1 << clk->enable_bit); 651 __raw_writel(regval32, clk->enable_reg);
652 __raw_writel(regval32, clk->enable_reg);
653 } else {
654 regval32 = omap_readl(clk->enable_reg);
655 regval32 |= (1 << clk->enable_bit);
656 omap_writel(regval32, clk->enable_reg);
657 }
658 } else { 652 } else {
659 if (clk->flags & VIRTUAL_IO_ADDRESS) { 653 regval16 = __raw_readw(clk->enable_reg);
660 regval16 = __raw_readw(clk->enable_reg); 654 regval16 |= (1 << clk->enable_bit);
661 regval16 |= (1 << clk->enable_bit); 655 __raw_writew(regval16, clk->enable_reg);
662 __raw_writew(regval16, clk->enable_reg);
663 } else {
664 regval16 = omap_readw(clk->enable_reg);
665 regval16 |= (1 << clk->enable_bit);
666 omap_writew(regval16, clk->enable_reg);
667 }
668 } 656 }
669 657
670 return 0; 658 return 0;
@@ -679,25 +667,13 @@ static void omap1_clk_disable_generic(struct clk *clk)
679 return; 667 return;
680 668
681 if (clk->flags & ENABLE_REG_32BIT) { 669 if (clk->flags & ENABLE_REG_32BIT) {
682 if (clk->flags & VIRTUAL_IO_ADDRESS) { 670 regval32 = __raw_readl(clk->enable_reg);
683 regval32 = __raw_readl(clk->enable_reg); 671 regval32 &= ~(1 << clk->enable_bit);
684 regval32 &= ~(1 << clk->enable_bit); 672 __raw_writel(regval32, clk->enable_reg);
685 __raw_writel(regval32, clk->enable_reg);
686 } else {
687 regval32 = omap_readl(clk->enable_reg);
688 regval32 &= ~(1 << clk->enable_bit);
689 omap_writel(regval32, clk->enable_reg);
690 }
691 } else { 673 } else {
692 if (clk->flags & VIRTUAL_IO_ADDRESS) { 674 regval16 = __raw_readw(clk->enable_reg);
693 regval16 = __raw_readw(clk->enable_reg); 675 regval16 &= ~(1 << clk->enable_bit);
694 regval16 &= ~(1 << clk->enable_bit); 676 __raw_writew(regval16, clk->enable_reg);
695 __raw_writew(regval16, clk->enable_reg);
696 } else {
697 regval16 = omap_readw(clk->enable_reg);
698 regval16 &= ~(1 << clk->enable_bit);
699 omap_writew(regval16, clk->enable_reg);
700 }
701 } 677 }
702} 678}
703 679
@@ -745,17 +721,10 @@ static void __init omap1_clk_disable_unused(struct clk *clk)
745 } 721 }
746 722
747 /* Is the clock already disabled? */ 723 /* Is the clock already disabled? */
748 if (clk->flags & ENABLE_REG_32BIT) { 724 if (clk->flags & ENABLE_REG_32BIT)
749 if (clk->flags & VIRTUAL_IO_ADDRESS) 725 regval32 = __raw_readl(clk->enable_reg);
750 regval32 = __raw_readl(clk->enable_reg); 726 else
751 else 727 regval32 = __raw_readw(clk->enable_reg);
752 regval32 = omap_readl(clk->enable_reg);
753 } else {
754 if (clk->flags & VIRTUAL_IO_ADDRESS)
755 regval32 = __raw_readw(clk->enable_reg);
756 else
757 regval32 = omap_readw(clk->enable_reg);
758 }
759 728
760 if ((regval32 & (1 << clk->enable_bit)) == 0) 729 if ((regval32 & (1 << clk->enable_bit)) == 0)
761 return; 730 return;