diff options
author | Hartley Sweeten <hartleys@visionengravers.com> | 2010-01-11 15:41:29 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-01-12 07:39:47 -0500 |
commit | 346e34abb2c56695ee4bd6af924141c97a0babfb (patch) | |
tree | e8abac19d024499688b3c182a889a6d5d19e4edd /arch/arm | |
parent | 1fbd972ad0f97253ebfbb04881dc4ad95541153c (diff) |
ARM: 5879/1: ep93xx: define magic numbers for pll1 and pll2
Add defines for the pll register magic numbers that determine if
the pll's are bypassed and if pll2 is enabled. Rename the clock
set registers to more closely match the datasheet. Also, remove
the unnecessary braces since each conditional statement is a single
statement.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Ryan Mallon <ryan@bluewatersys.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-ep93xx/clock.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | 7 |
2 files changed, 17 insertions, 10 deletions
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c index 07a58d03ae8c..27e335131799 100644 --- a/arch/arm/mach-ep93xx/clock.c +++ b/arch/arm/mach-ep93xx/clock.c | |||
@@ -449,25 +449,29 @@ static int __init ep93xx_clock_init(void) | |||
449 | u32 value; | 449 | u32 value; |
450 | int i; | 450 | int i; |
451 | 451 | ||
452 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); | 452 | /* Determine the bootloader configured pll1 rate */ |
453 | if (!(value & 0x00800000)) { /* PLL1 bypassed? */ | 453 | value = __raw_readl(EP93XX_SYSCON_CLKSET1); |
454 | if (!(value & EP93XX_SYSCON_CLKSET1_NBYP1)) | ||
454 | clk_pll1.rate = clk_xtali.rate; | 455 | clk_pll1.rate = clk_xtali.rate; |
455 | } else { | 456 | else |
456 | clk_pll1.rate = calc_pll_rate(value); | 457 | clk_pll1.rate = calc_pll_rate(value); |
457 | } | 458 | |
459 | /* Initialize the pll1 derived clocks */ | ||
458 | clk_f.rate = clk_pll1.rate / fclk_divisors[(value >> 25) & 0x7]; | 460 | clk_f.rate = clk_pll1.rate / fclk_divisors[(value >> 25) & 0x7]; |
459 | clk_h.rate = clk_pll1.rate / hclk_divisors[(value >> 20) & 0x7]; | 461 | clk_h.rate = clk_pll1.rate / hclk_divisors[(value >> 20) & 0x7]; |
460 | clk_p.rate = clk_h.rate / pclk_divisors[(value >> 18) & 0x3]; | 462 | clk_p.rate = clk_h.rate / pclk_divisors[(value >> 18) & 0x3]; |
461 | ep93xx_dma_clock_init(); | 463 | ep93xx_dma_clock_init(); |
462 | 464 | ||
465 | /* Determine the bootloader configured pll2 rate */ | ||
463 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2); | 466 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2); |
464 | if (!(value & 0x00080000)) { /* PLL2 bypassed? */ | 467 | if (!(value & EP93XX_SYSCON_CLKSET2_NBYP2)) |
465 | clk_pll2.rate = clk_xtali.rate; | 468 | clk_pll2.rate = clk_xtali.rate; |
466 | } else if (value & 0x00040000) { /* PLL2 enabled? */ | 469 | else if (value & EP93XX_SYSCON_CLKSET2_PLL2_EN) |
467 | clk_pll2.rate = calc_pll_rate(value); | 470 | clk_pll2.rate = calc_pll_rate(value); |
468 | } else { | 471 | else |
469 | clk_pll2.rate = 0; | 472 | clk_pll2.rate = 0; |
470 | } | 473 | |
474 | /* Initialize the pll2 derived clocks */ | ||
471 | clk_usb_host.rate = clk_pll2.rate / (((value >> 28) & 0xf) + 1); | 475 | clk_usb_host.rate = clk_pll2.rate / (((value >> 28) & 0xf) + 1); |
472 | 476 | ||
473 | pr_info("PLL1 running at %ld MHz, PLL2 at %ld MHz\n", | 477 | pr_info("PLL1 running at %ld MHz, PLL2 at %ld MHz\n", |
diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h index d55194a4c093..cd359120c1f5 100644 --- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | |||
@@ -167,8 +167,11 @@ | |||
167 | #define EP93XX_SYSCON_PWRCNT_DMA_M2P1 (1<<16) | 167 | #define EP93XX_SYSCON_PWRCNT_DMA_M2P1 (1<<16) |
168 | #define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08) | 168 | #define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08) |
169 | #define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c) | 169 | #define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c) |
170 | #define EP93XX_SYSCON_CLOCK_SET1 EP93XX_SYSCON_REG(0x20) | 170 | #define EP93XX_SYSCON_CLKSET1 EP93XX_SYSCON_REG(0x20) |
171 | #define EP93XX_SYSCON_CLOCK_SET2 EP93XX_SYSCON_REG(0x24) | 171 | #define EP93XX_SYSCON_CLKSET1_NBYP1 (1<<23) |
172 | #define EP93XX_SYSCON_CLKSET2 EP93XX_SYSCON_REG(0x24) | ||
173 | #define EP93XX_SYSCON_CLKSET2_NBYP2 (1<<19) | ||
174 | #define EP93XX_SYSCON_CLKSET2_PLL2_EN (1<<18) | ||
172 | #define EP93XX_SYSCON_DEVCFG EP93XX_SYSCON_REG(0x80) | 175 | #define EP93XX_SYSCON_DEVCFG EP93XX_SYSCON_REG(0x80) |
173 | #define EP93XX_SYSCON_DEVCFG_SWRST (1<<31) | 176 | #define EP93XX_SYSCON_DEVCFG_SWRST (1<<31) |
174 | #define EP93XX_SYSCON_DEVCFG_D1ONG (1<<30) | 177 | #define EP93XX_SYSCON_DEVCFG_D1ONG (1<<30) |