diff options
author | Tony Lindgren <tony@atomide.com> | 2006-09-25 06:27:20 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2006-09-25 06:27:20 -0400 |
commit | 90afd5cb2ac0977c38e83b6b21493da911b242b3 (patch) | |
tree | 7d0dedf7bfedb76e9bb2149f7f8aec1aaed159f9 /arch/arm/mach-omap1/clock.c | |
parent | 1630b52ddf4fc27e0dc421a57e4788bf9d3886cc (diff) |
ARM: OMAP: Sync clocks with linux-omap tree
Mostly clean up CONFIG_OMAP_RESET_CLOCKS. Also includes a
patch from Imre Deak to make McSPI clocks use id.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1/clock.c')
-rw-r--r-- | arch/arm/mach-omap1/clock.c | 107 |
1 files changed, 48 insertions, 59 deletions
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index f1958e882e86..638490e62d5f 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | #include <asm/mach-types.h> | ||
23 | 24 | ||
24 | #include <asm/arch/cpu.h> | 25 | #include <asm/arch/cpu.h> |
25 | #include <asm/arch/usb.h> | 26 | #include <asm/arch/usb.h> |
@@ -586,77 +587,53 @@ static int omap1_clk_set_rate(struct clk *clk, unsigned long rate) | |||
586 | *-------------------------------------------------------------------------*/ | 587 | *-------------------------------------------------------------------------*/ |
587 | 588 | ||
588 | #ifdef CONFIG_OMAP_RESET_CLOCKS | 589 | #ifdef CONFIG_OMAP_RESET_CLOCKS |
589 | /* | ||
590 | * Resets some clocks that may be left on from bootloader, | ||
591 | * but leaves serial clocks on. See also omap_late_clk_reset(). | ||
592 | */ | ||
593 | static inline void omap1_early_clk_reset(void) | ||
594 | { | ||
595 | //omap_writel(0x3 << 29, MOD_CONF_CTRL_0); | ||
596 | } | ||
597 | 590 | ||
598 | static int __init omap1_late_clk_reset(void) | 591 | static void __init omap1_clk_disable_unused(struct clk *clk) |
599 | { | 592 | { |
600 | /* Turn off all unused clocks */ | ||
601 | struct clk *p; | ||
602 | __u32 regval32; | 593 | __u32 regval32; |
603 | 594 | ||
604 | /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */ | 595 | /* Clocks in the DSP domain need api_ck. Just assume bootloader |
605 | regval32 = omap_readw(SOFT_REQ_REG) & (1 << 4); | 596 | * has not enabled any DSP clocks */ |
606 | omap_writew(regval32, SOFT_REQ_REG); | 597 | if ((u32)clk->enable_reg == DSP_IDLECT2) { |
607 | omap_writew(0, SOFT_REQ_REG2); | 598 | printk(KERN_INFO "Skipping reset check for DSP domain " |
608 | 599 | "clock \"%s\"\n", clk->name); | |
609 | list_for_each_entry(p, &clocks, node) { | 600 | return; |
610 | if (p->usecount > 0 || (p->flags & ALWAYS_ENABLED) || | 601 | } |
611 | p->enable_reg == 0) | ||
612 | continue; | ||
613 | |||
614 | /* Clocks in the DSP domain need api_ck. Just assume bootloader | ||
615 | * has not enabled any DSP clocks */ | ||
616 | if ((u32)p->enable_reg == DSP_IDLECT2) { | ||
617 | printk(KERN_INFO "Skipping reset check for DSP domain " | ||
618 | "clock \"%s\"\n", p->name); | ||
619 | continue; | ||
620 | } | ||
621 | 602 | ||
622 | /* Is the clock already disabled? */ | 603 | /* Is the clock already disabled? */ |
623 | if (p->flags & ENABLE_REG_32BIT) { | 604 | if (clk->flags & ENABLE_REG_32BIT) { |
624 | if (p->flags & VIRTUAL_IO_ADDRESS) | 605 | if (clk->flags & VIRTUAL_IO_ADDRESS) |
625 | regval32 = __raw_readl(p->enable_reg); | 606 | regval32 = __raw_readl(clk->enable_reg); |
626 | else | ||
627 | regval32 = omap_readl(p->enable_reg); | ||
628 | } else { | ||
629 | if (p->flags & VIRTUAL_IO_ADDRESS) | ||
630 | regval32 = __raw_readw(p->enable_reg); | ||
631 | else | 607 | else |
632 | regval32 = omap_readw(p->enable_reg); | 608 | regval32 = omap_readl(clk->enable_reg); |
633 | } | 609 | } else { |
634 | 610 | if (clk->flags & VIRTUAL_IO_ADDRESS) | |
635 | if ((regval32 & (1 << p->enable_bit)) == 0) | 611 | regval32 = __raw_readw(clk->enable_reg); |
636 | continue; | 612 | else |
613 | regval32 = omap_readw(clk->enable_reg); | ||
614 | } | ||
637 | 615 | ||
638 | /* FIXME: This clock seems to be necessary but no-one | 616 | if ((regval32 & (1 << clk->enable_bit)) == 0) |
639 | * has asked for its activation. */ | 617 | return; |
640 | if (p == &tc2_ck // FIX: pm.c (SRAM), CCP, Camera | ||
641 | || p == &ck_dpll1out.clk // FIX: SoSSI, SSR | ||
642 | || p == &arm_gpio_ck // FIX: GPIO code for 1510 | ||
643 | ) { | ||
644 | printk(KERN_INFO "FIXME: Clock \"%s\" seems unused\n", | ||
645 | p->name); | ||
646 | continue; | ||
647 | } | ||
648 | 618 | ||
649 | printk(KERN_INFO "Disabling unused clock \"%s\"... ", p->name); | 619 | /* FIXME: This clock seems to be necessary but no-one |
650 | p->disable(p); | 620 | * has asked for its activation. */ |
651 | printk(" done\n"); | 621 | if (clk == &tc2_ck // FIX: pm.c (SRAM), CCP, Camera |
622 | || clk == &ck_dpll1out.clk // FIX: SoSSI, SSR | ||
623 | || clk == &arm_gpio_ck // FIX: GPIO code for 1510 | ||
624 | ) { | ||
625 | printk(KERN_INFO "FIXME: Clock \"%s\" seems unused\n", | ||
626 | clk->name); | ||
627 | return; | ||
652 | } | 628 | } |
653 | 629 | ||
654 | return 0; | 630 | printk(KERN_INFO "Disabling unused clock \"%s\"... ", clk->name); |
631 | clk->disable(clk); | ||
632 | printk(" done\n"); | ||
655 | } | 633 | } |
656 | late_initcall(omap1_late_clk_reset); | ||
657 | 634 | ||
658 | #else | 635 | #else |
659 | #define omap1_early_clk_reset() {} | 636 | #define omap1_clk_disable_unused NULL |
660 | #endif | 637 | #endif |
661 | 638 | ||
662 | static struct clk_functions omap1_clk_functions = { | 639 | static struct clk_functions omap1_clk_functions = { |
@@ -664,6 +641,7 @@ static struct clk_functions omap1_clk_functions = { | |||
664 | .clk_disable = omap1_clk_disable, | 641 | .clk_disable = omap1_clk_disable, |
665 | .clk_round_rate = omap1_clk_round_rate, | 642 | .clk_round_rate = omap1_clk_round_rate, |
666 | .clk_set_rate = omap1_clk_set_rate, | 643 | .clk_set_rate = omap1_clk_set_rate, |
644 | .clk_disable_unused = omap1_clk_disable_unused, | ||
667 | }; | 645 | }; |
668 | 646 | ||
669 | int __init omap1_clk_init(void) | 647 | int __init omap1_clk_init(void) |
@@ -671,8 +649,13 @@ int __init omap1_clk_init(void) | |||
671 | struct clk ** clkp; | 649 | struct clk ** clkp; |
672 | const struct omap_clock_config *info; | 650 | const struct omap_clock_config *info; |
673 | int crystal_type = 0; /* Default 12 MHz */ | 651 | int crystal_type = 0; /* Default 12 MHz */ |
652 | u32 reg; | ||
653 | |||
654 | /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */ | ||
655 | reg = omap_readw(SOFT_REQ_REG) & (1 << 4); | ||
656 | omap_writew(reg, SOFT_REQ_REG); | ||
657 | omap_writew(0, SOFT_REQ_REG2); | ||
674 | 658 | ||
675 | omap1_early_clk_reset(); | ||
676 | clk_init(&omap1_clk_functions); | 659 | clk_init(&omap1_clk_functions); |
677 | 660 | ||
678 | /* By default all idlect1 clocks are allowed to idle */ | 661 | /* By default all idlect1 clocks are allowed to idle */ |
@@ -772,6 +755,12 @@ int __init omap1_clk_init(void) | |||
772 | omap_writew(omap_readw(OMAP730_PCC_UPLD_CTRL) & ~0x1, OMAP730_PCC_UPLD_CTRL); | 755 | omap_writew(omap_readw(OMAP730_PCC_UPLD_CTRL) & ~0x1, OMAP730_PCC_UPLD_CTRL); |
773 | #endif | 756 | #endif |
774 | 757 | ||
758 | /* Amstrad Delta wants BCLK high when inactive */ | ||
759 | if (machine_is_ams_delta()) | ||
760 | omap_writel(omap_readl(ULPD_CLOCK_CTRL) | | ||
761 | (1 << SDW_MCLK_INV_BIT), | ||
762 | ULPD_CLOCK_CTRL); | ||
763 | |||
775 | /* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */ | 764 | /* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */ |
776 | /* (on 730, bit 13 must not be cleared) */ | 765 | /* (on 730, bit 13 must not be cleared) */ |
777 | if (cpu_is_omap730()) | 766 | if (cpu_is_omap730()) |