aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ep93xx/clock.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2010-03-01 17:19:05 -0500
committerTony Lindgren <tony@atomide.com>2010-03-01 17:19:05 -0500
commitd702d12167a2c05a346f49aac7a311d597762495 (patch)
treebaae42c299cce34d6df24b5d01f8b1d0b481bd9a /arch/arm/mach-ep93xx/clock.c
parent9418c65f9bd861d0f7e39aab9cfb3aa6f2275d11 (diff)
parentac0f6f927db539e03e1f3f61bcd4ed57d5cde7a9 (diff)
Merge with mainline to remove plat-omap/Kconfig conflict
Conflicts: arch/arm/plat-omap/Kconfig
Diffstat (limited to 'arch/arm/mach-ep93xx/clock.c')
-rw-r--r--arch/arm/mach-ep93xx/clock.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 1d0f9d8aff2e..5f80092b6ace 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -10,6 +10,8 @@
10 * your option) any later version. 10 * your option) any later version.
11 */ 11 */
12 12
13#define pr_fmt(fmt) "ep93xx " KBUILD_MODNAME ": " fmt
14
13#include <linux/kernel.h> 15#include <linux/kernel.h>
14#include <linux/clk.h> 16#include <linux/clk.h>
15#include <linux/err.h> 17#include <linux/err.h>
@@ -445,37 +447,39 @@ static void __init ep93xx_dma_clock_init(void)
445static int __init ep93xx_clock_init(void) 447static int __init ep93xx_clock_init(void)
446{ 448{
447 u32 value; 449 u32 value;
448 int i;
449 450
450 value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); 451 /* Determine the bootloader configured pll1 rate */
451 if (!(value & 0x00800000)) { /* PLL1 bypassed? */ 452 value = __raw_readl(EP93XX_SYSCON_CLKSET1);
453 if (!(value & EP93XX_SYSCON_CLKSET1_NBYP1))
452 clk_pll1.rate = clk_xtali.rate; 454 clk_pll1.rate = clk_xtali.rate;
453 } else { 455 else
454 clk_pll1.rate = calc_pll_rate(value); 456 clk_pll1.rate = calc_pll_rate(value);
455 } 457
458 /* Initialize the pll1 derived clocks */
456 clk_f.rate = clk_pll1.rate / fclk_divisors[(value >> 25) & 0x7]; 459 clk_f.rate = clk_pll1.rate / fclk_divisors[(value >> 25) & 0x7];
457 clk_h.rate = clk_pll1.rate / hclk_divisors[(value >> 20) & 0x7]; 460 clk_h.rate = clk_pll1.rate / hclk_divisors[(value >> 20) & 0x7];
458 clk_p.rate = clk_h.rate / pclk_divisors[(value >> 18) & 0x3]; 461 clk_p.rate = clk_h.rate / pclk_divisors[(value >> 18) & 0x3];
459 ep93xx_dma_clock_init(); 462 ep93xx_dma_clock_init();
460 463
461 value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2); 464 /* Determine the bootloader configured pll2 rate */
462 if (!(value & 0x00080000)) { /* PLL2 bypassed? */ 465 value = __raw_readl(EP93XX_SYSCON_CLKSET2);
466 if (!(value & EP93XX_SYSCON_CLKSET2_NBYP2))
463 clk_pll2.rate = clk_xtali.rate; 467 clk_pll2.rate = clk_xtali.rate;
464 } else if (value & 0x00040000) { /* PLL2 enabled? */ 468 else if (value & EP93XX_SYSCON_CLKSET2_PLL2_EN)
465 clk_pll2.rate = calc_pll_rate(value); 469 clk_pll2.rate = calc_pll_rate(value);
466 } else { 470 else
467 clk_pll2.rate = 0; 471 clk_pll2.rate = 0;
468 } 472
473 /* Initialize the pll2 derived clocks */
469 clk_usb_host.rate = clk_pll2.rate / (((value >> 28) & 0xf) + 1); 474 clk_usb_host.rate = clk_pll2.rate / (((value >> 28) & 0xf) + 1);
470 475
471 printk(KERN_INFO "ep93xx: PLL1 running at %ld MHz, PLL2 at %ld MHz\n", 476 pr_info("PLL1 running at %ld MHz, PLL2 at %ld MHz\n",
472 clk_pll1.rate / 1000000, clk_pll2.rate / 1000000); 477 clk_pll1.rate / 1000000, clk_pll2.rate / 1000000);
473 printk(KERN_INFO "ep93xx: FCLK %ld MHz, HCLK %ld MHz, PCLK %ld MHz\n", 478 pr_info("FCLK %ld MHz, HCLK %ld MHz, PCLK %ld MHz\n",
474 clk_f.rate / 1000000, clk_h.rate / 1000000, 479 clk_f.rate / 1000000, clk_h.rate / 1000000,
475 clk_p.rate / 1000000); 480 clk_p.rate / 1000000);
476 481
477 for (i = 0; i < ARRAY_SIZE(clocks); i++) 482 clkdev_add_table(clocks, ARRAY_SIZE(clocks));
478 clkdev_add(&clocks[i]);
479 return 0; 483 return 0;
480} 484}
481arch_initcall(ep93xx_clock_init); 485arch_initcall(ep93xx_clock_init);