diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-06-20 05:57:40 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-06-20 05:57:40 -0400 |
commit | 312cec5d094a5d4e68434ace4c5cb55e4f8dfee5 (patch) | |
tree | d1471ecdc5005835a1861406d4a3395625381094 | |
parent | 48ec2b53fe6a7244d62c74876ae00b0d7e03b4c5 (diff) | |
parent | 2687069f3ac297b820c58de7222e4d16adbca498 (diff) |
Merge branch 'omap-clock-for-next' of git://git.pwsan.com/linux-2.6 into devel
-rw-r--r-- | arch/arm/mach-omap2/clock.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock34xx.c | 42 | ||||
-rw-r--r-- | arch/arm/mach-omap2/io.c | 36 | ||||
-rw-r--r-- | arch/arm/mach-omap2/powerdomain.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/sram34xx.S | 129 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/sram.h | 6 | ||||
-rw-r--r-- | arch/arm/plat-omap/sram.c | 8 |
7 files changed, 163 insertions, 62 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index ba528f85749c..b0665f161c03 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -302,7 +302,7 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name) | |||
302 | udelay(1); | 302 | udelay(1); |
303 | } | 303 | } |
304 | 304 | ||
305 | if (i < MAX_CLOCK_ENABLE_WAIT) | 305 | if (i <= MAX_CLOCK_ENABLE_WAIT) |
306 | pr_debug("Clock %s stable after %d loops\n", name, i); | 306 | pr_debug("Clock %s stable after %d loops\n", name, i); |
307 | else | 307 | else |
308 | printk(KERN_ERR "Clock %s didn't enable in %d tries\n", | 308 | printk(KERN_ERR "Clock %s didn't enable in %d tries\n", |
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index 9e43fe5209d3..045da923e75b 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c | |||
@@ -286,6 +286,20 @@ static struct omap_clk omap34xx_clks[] = { | |||
286 | 286 | ||
287 | #define MIN_SDRC_DLL_LOCK_FREQ 83000000 | 287 | #define MIN_SDRC_DLL_LOCK_FREQ 83000000 |
288 | 288 | ||
289 | #define CYCLES_PER_MHZ 1000000 | ||
290 | |||
291 | /* Scale factor for fixed-point arith in omap3_core_dpll_m2_set_rate() */ | ||
292 | #define SDRC_MPURATE_SCALE 8 | ||
293 | |||
294 | /* 2^SDRC_MPURATE_BASE_SHIFT: MPU MHz that SDRC_MPURATE_LOOPS is defined for */ | ||
295 | #define SDRC_MPURATE_BASE_SHIFT 9 | ||
296 | |||
297 | /* | ||
298 | * SDRC_MPURATE_LOOPS: Number of MPU loops to execute at | ||
299 | * 2^MPURATE_BASE_SHIFT MHz for SDRC to stabilize | ||
300 | */ | ||
301 | #define SDRC_MPURATE_LOOPS 96 | ||
302 | |||
289 | /** | 303 | /** |
290 | * omap3_dpll_recalc - recalculate DPLL rate | 304 | * omap3_dpll_recalc - recalculate DPLL rate |
291 | * @clk: DPLL struct clk | 305 | * @clk: DPLL struct clk |
@@ -709,7 +723,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) | |||
709 | { | 723 | { |
710 | u32 new_div = 0; | 724 | u32 new_div = 0; |
711 | u32 unlock_dll = 0; | 725 | u32 unlock_dll = 0; |
712 | unsigned long validrate, sdrcrate; | 726 | u32 c; |
727 | unsigned long validrate, sdrcrate, mpurate; | ||
713 | struct omap_sdrc_params *sp; | 728 | struct omap_sdrc_params *sp; |
714 | 729 | ||
715 | if (!clk || !rate) | 730 | if (!clk || !rate) |
@@ -718,18 +733,15 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) | |||
718 | if (clk != &dpll3_m2_ck) | 733 | if (clk != &dpll3_m2_ck) |
719 | return -EINVAL; | 734 | return -EINVAL; |
720 | 735 | ||
721 | if (rate == clk->rate) | ||
722 | return 0; | ||
723 | |||
724 | validrate = omap2_clksel_round_rate_div(clk, rate, &new_div); | 736 | validrate = omap2_clksel_round_rate_div(clk, rate, &new_div); |
725 | if (validrate != rate) | 737 | if (validrate != rate) |
726 | return -EINVAL; | 738 | return -EINVAL; |
727 | 739 | ||
728 | sdrcrate = sdrc_ick.rate; | 740 | sdrcrate = sdrc_ick.rate; |
729 | if (rate > clk->rate) | 741 | if (rate > clk->rate) |
730 | sdrcrate <<= ((rate / clk->rate) - 1); | 742 | sdrcrate <<= ((rate / clk->rate) >> 1); |
731 | else | 743 | else |
732 | sdrcrate >>= ((clk->rate / rate) - 1); | 744 | sdrcrate >>= ((clk->rate / rate) >> 1); |
733 | 745 | ||
734 | sp = omap2_sdrc_get_params(sdrcrate); | 746 | sp = omap2_sdrc_get_params(sdrcrate); |
735 | if (!sp) | 747 | if (!sp) |
@@ -740,17 +752,25 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) | |||
740 | unlock_dll = 1; | 752 | unlock_dll = 1; |
741 | } | 753 | } |
742 | 754 | ||
755 | /* | ||
756 | * XXX This only needs to be done when the CPU frequency changes | ||
757 | */ | ||
758 | mpurate = arm_fck.rate / CYCLES_PER_MHZ; | ||
759 | c = (mpurate << SDRC_MPURATE_SCALE) >> SDRC_MPURATE_BASE_SHIFT; | ||
760 | c += 1; /* for safety */ | ||
761 | c *= SDRC_MPURATE_LOOPS; | ||
762 | c >>= SDRC_MPURATE_SCALE; | ||
763 | if (c == 0) | ||
764 | c = 1; | ||
765 | |||
743 | pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate, | 766 | pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate, |
744 | validrate); | 767 | validrate); |
745 | pr_debug("clock: SDRC timing params used: %08x %08x %08x\n", | 768 | pr_debug("clock: SDRC timing params used: %08x %08x %08x\n", |
746 | sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb); | 769 | sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb); |
747 | 770 | ||
748 | /* REVISIT: SRAM code doesn't support other M2 divisors yet */ | ||
749 | WARN_ON(new_div != 1 && new_div != 2); | ||
750 | |||
751 | /* REVISIT: Add SDRC_MR changing to this code also */ | ||
752 | omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla, | 771 | omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla, |
753 | sp->actim_ctrlb, new_div, unlock_dll); | 772 | sp->actim_ctrlb, new_div, unlock_dll, c, |
773 | sp->mr, rate > clk->rate); | ||
754 | 774 | ||
755 | return 0; | 775 | return 0; |
756 | } | 776 | } |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 32afd9448216..3a86b0f66031 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/clk.h> | ||
24 | 25 | ||
25 | #include <asm/tlb.h> | 26 | #include <asm/tlb.h> |
26 | 27 | ||
@@ -241,6 +242,40 @@ void __init omap2_map_common_io(void) | |||
241 | omapfb_reserve_sdram(); | 242 | omapfb_reserve_sdram(); |
242 | } | 243 | } |
243 | 244 | ||
245 | /* | ||
246 | * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters | ||
247 | * | ||
248 | * Sets the CORE DPLL3 M2 divider to the same value that it's at | ||
249 | * currently. This has the effect of setting the SDRC SDRAM AC timing | ||
250 | * registers to the values currently defined by the kernel. Currently | ||
251 | * only defined for OMAP3; will return 0 if called on OMAP2. Returns | ||
252 | * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2, | ||
253 | * or passes along the return value of clk_set_rate(). | ||
254 | */ | ||
255 | static int __init _omap2_init_reprogram_sdrc(void) | ||
256 | { | ||
257 | struct clk *dpll3_m2_ck; | ||
258 | int v = -EINVAL; | ||
259 | long rate; | ||
260 | |||
261 | if (!cpu_is_omap34xx()) | ||
262 | return 0; | ||
263 | |||
264 | dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck"); | ||
265 | if (!dpll3_m2_ck) | ||
266 | return -EINVAL; | ||
267 | |||
268 | rate = clk_get_rate(dpll3_m2_ck); | ||
269 | pr_info("Reprogramming SDRC clock to %ld Hz\n", rate); | ||
270 | v = clk_set_rate(dpll3_m2_ck, rate); | ||
271 | if (v) | ||
272 | pr_err("dpll3_m2_clk rate change failed: %d\n", v); | ||
273 | |||
274 | clk_put(dpll3_m2_ck); | ||
275 | |||
276 | return v; | ||
277 | } | ||
278 | |||
244 | void __init omap2_init_common_hw(struct omap_sdrc_params *sp) | 279 | void __init omap2_init_common_hw(struct omap_sdrc_params *sp) |
245 | { | 280 | { |
246 | omap2_mux_init(); | 281 | omap2_mux_init(); |
@@ -249,6 +284,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sp) | |||
249 | clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps); | 284 | clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps); |
250 | omap2_clk_init(); | 285 | omap2_clk_init(); |
251 | omap2_sdrc_init(sp); | 286 | omap2_sdrc_init(sp); |
287 | _omap2_init_reprogram_sdrc(); | ||
252 | #endif | 288 | #endif |
253 | gpmc_init(); | 289 | gpmc_init(); |
254 | } | 290 | } |
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 73e2971b1757..983f1cb676be 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
@@ -1099,7 +1099,7 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm) | |||
1099 | (c++ < PWRDM_TRANSITION_BAILOUT)) | 1099 | (c++ < PWRDM_TRANSITION_BAILOUT)) |
1100 | udelay(1); | 1100 | udelay(1); |
1101 | 1101 | ||
1102 | if (c >= PWRDM_TRANSITION_BAILOUT) { | 1102 | if (c > PWRDM_TRANSITION_BAILOUT) { |
1103 | printk(KERN_ERR "powerdomain: waited too long for " | 1103 | printk(KERN_ERR "powerdomain: waited too long for " |
1104 | "powerdomain %s to complete transition\n", pwrdm->name); | 1104 | "powerdomain %s to complete transition\n", pwrdm->name); |
1105 | return -EAGAIN; | 1105 | return -EAGAIN; |
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S index c080c82521e1..f41f8d96ddba 100644 --- a/arch/arm/mach-omap2/sram34xx.S +++ b/arch/arm/mach-omap2/sram34xx.S | |||
@@ -3,13 +3,12 @@ | |||
3 | * | 3 | * |
4 | * Omap3 specific functions that need to be run in internal SRAM | 4 | * Omap3 specific functions that need to be run in internal SRAM |
5 | * | 5 | * |
6 | * (C) Copyright 2007 | 6 | * Copyright (C) 2004, 2007, 2008 Texas Instruments, Inc. |
7 | * Texas Instruments Inc. | 7 | * Copyright (C) 2008 Nokia Corporation |
8 | * Rajendra Nayak <rnayak@ti.com> | ||
9 | * | 8 | * |
10 | * (C) Copyright 2004 | 9 | * Rajendra Nayak <rnayak@ti.com> |
11 | * Texas Instruments, <www.ti.com> | ||
12 | * Richard Woodruff <r-woodruff2@ti.com> | 10 | * Richard Woodruff <r-woodruff2@ti.com> |
11 | * Paul Walmsley | ||
13 | * | 12 | * |
14 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
15 | * modify it under the terms of the GNU General Public License as | 14 | * modify it under the terms of the GNU General Public License as |
@@ -37,61 +36,112 @@ | |||
37 | 36 | ||
38 | .text | 37 | .text |
39 | 38 | ||
39 | /* r4 parameters */ | ||
40 | #define SDRC_NO_UNLOCK_DLL 0x0 | ||
41 | #define SDRC_UNLOCK_DLL 0x1 | ||
42 | |||
43 | /* SDRC_DLLA_CTRL bit settings */ | ||
44 | #define FIXEDDELAY_SHIFT 24 | ||
45 | #define FIXEDDELAY_MASK (0xff << FIXEDDELAY_SHIFT) | ||
46 | #define DLLIDLE_MASK 0x4 | ||
47 | |||
48 | /* | ||
49 | * SDRC_DLLA_CTRL default values: TI hardware team indicates that | ||
50 | * FIXEDDELAY should be initialized to 0xf. This apparently was | ||
51 | * empirically determined during process testing, so no derivation | ||
52 | * was provided. | ||
53 | */ | ||
54 | #define FIXEDDELAY_DEFAULT (0x0f << FIXEDDELAY_SHIFT) | ||
55 | |||
56 | /* SDRC_DLLA_STATUS bit settings */ | ||
57 | #define LOCKSTATUS_MASK 0x4 | ||
58 | |||
59 | /* SDRC_POWER bit settings */ | ||
60 | #define SRFRONIDLEREQ_MASK 0x40 | ||
61 | #define PWDENA_MASK 0x4 | ||
62 | |||
63 | /* CM_IDLEST1_CORE bit settings */ | ||
64 | #define ST_SDRC_MASK 0x2 | ||
65 | |||
66 | /* CM_ICLKEN1_CORE bit settings */ | ||
67 | #define EN_SDRC_MASK 0x2 | ||
68 | |||
69 | /* CM_CLKSEL1_PLL bit settings */ | ||
70 | #define CORE_DPLL_CLKOUT_DIV_SHIFT 0x1b | ||
71 | |||
40 | /* | 72 | /* |
41 | * Change frequency of core dpll | 73 | * omap3_sram_configure_core_dpll - change DPLL3 M2 divider |
42 | * r0 = sdrc_rfr_ctrl r1 = sdrc_actim_ctrla r2 = sdrc_actim_ctrlb r3 = M2 | 74 | * r0 = new SDRC_RFR_CTRL register contents |
43 | * r4 = Unlock SDRC DLL? (1 = yes, 0 = no) -- only unlock DLL for | 75 | * r1 = new SDRC_ACTIM_CTRLA register contents |
76 | * r2 = new SDRC_ACTIM_CTRLB register contents | ||
77 | * r3 = new M2 divider setting (only 1 and 2 supported right now) | ||
78 | * r4 = unlock SDRC DLL? (1 = yes, 0 = no). Only unlock DLL for | ||
44 | * SDRC rates < 83MHz | 79 | * SDRC rates < 83MHz |
80 | * r5 = number of MPU cycles to wait for SDRC to stabilize after | ||
81 | * reprogramming the SDRC when switching to a slower MPU speed | ||
82 | * r6 = new SDRC_MR_0 register value | ||
83 | * r7 = increasing SDRC rate? (1 = yes, 0 = no) | ||
84 | * | ||
45 | */ | 85 | */ |
46 | ENTRY(omap3_sram_configure_core_dpll) | 86 | ENTRY(omap3_sram_configure_core_dpll) |
47 | stmfd sp!, {r1-r12, lr} @ store regs to stack | 87 | stmfd sp!, {r1-r12, lr} @ store regs to stack |
48 | ldr r4, [sp, #52] @ pull extra args off the stack | 88 | ldr r4, [sp, #52] @ pull extra args off the stack |
89 | ldr r5, [sp, #56] @ load extra args from the stack | ||
90 | ldr r6, [sp, #60] @ load extra args from the stack | ||
91 | ldr r7, [sp, #64] @ load extra args from the stack | ||
49 | dsb @ flush buffered writes to interconnect | 92 | dsb @ flush buffered writes to interconnect |
50 | cmp r3, #0x2 | 93 | cmp r7, #1 @ if increasing SDRC clk rate, |
51 | blne configure_sdrc | 94 | bleq configure_sdrc @ program the SDRC regs early (for RFR) |
52 | cmp r4, #0x1 | 95 | cmp r4, #SDRC_UNLOCK_DLL @ set the intended DLL state |
53 | bleq unlock_dll | 96 | bleq unlock_dll |
54 | blne lock_dll | 97 | blne lock_dll |
55 | bl sdram_in_selfrefresh @ put the SDRAM in self refresh | 98 | bl sdram_in_selfrefresh @ put SDRAM in self refresh, idle SDRC |
56 | bl configure_core_dpll | 99 | bl configure_core_dpll @ change the DPLL3 M2 divider |
57 | bl enable_sdrc | 100 | bl enable_sdrc @ take SDRC out of idle |
58 | cmp r4, #0x1 | 101 | cmp r4, #SDRC_UNLOCK_DLL @ wait for DLL status to change |
59 | bleq wait_dll_unlock | 102 | bleq wait_dll_unlock |
60 | blne wait_dll_lock | 103 | blne wait_dll_lock |
61 | cmp r3, #0x1 | 104 | cmp r7, #1 @ if increasing SDRC clk rate, |
62 | blne configure_sdrc | 105 | beq return_to_sdram @ return to SDRAM code, otherwise, |
106 | bl configure_sdrc @ reprogram SDRC regs now | ||
107 | mov r12, r5 | ||
108 | bl wait_clk_stable @ wait for SDRC to stabilize | ||
109 | return_to_sdram: | ||
63 | isb @ prevent speculative exec past here | 110 | isb @ prevent speculative exec past here |
64 | mov r0, #0 @ return value | 111 | mov r0, #0 @ return value |
65 | ldmfd sp!, {r1-r12, pc} @ restore regs and return | 112 | ldmfd sp!, {r1-r12, pc} @ restore regs and return |
66 | unlock_dll: | 113 | unlock_dll: |
67 | ldr r11, omap3_sdrc_dlla_ctrl | 114 | ldr r11, omap3_sdrc_dlla_ctrl |
68 | ldr r12, [r11] | 115 | ldr r12, [r11] |
69 | orr r12, r12, #0x4 | 116 | and r12, r12, #FIXEDDELAY_MASK |
117 | orr r12, r12, #FIXEDDELAY_DEFAULT | ||
118 | orr r12, r12, #DLLIDLE_MASK | ||
70 | str r12, [r11] @ (no OCP barrier needed) | 119 | str r12, [r11] @ (no OCP barrier needed) |
71 | bx lr | 120 | bx lr |
72 | lock_dll: | 121 | lock_dll: |
73 | ldr r11, omap3_sdrc_dlla_ctrl | 122 | ldr r11, omap3_sdrc_dlla_ctrl |
74 | ldr r12, [r11] | 123 | ldr r12, [r11] |
75 | bic r12, r12, #0x4 | 124 | bic r12, r12, #DLLIDLE_MASK |
76 | str r12, [r11] @ (no OCP barrier needed) | 125 | str r12, [r11] @ (no OCP barrier needed) |
77 | bx lr | 126 | bx lr |
78 | sdram_in_selfrefresh: | 127 | sdram_in_selfrefresh: |
79 | ldr r11, omap3_sdrc_power @ read the SDRC_POWER register | 128 | ldr r11, omap3_sdrc_power @ read the SDRC_POWER register |
80 | ldr r12, [r11] @ read the contents of SDRC_POWER | 129 | ldr r12, [r11] @ read the contents of SDRC_POWER |
81 | mov r9, r12 @ keep a copy of SDRC_POWER bits | 130 | mov r9, r12 @ keep a copy of SDRC_POWER bits |
82 | orr r12, r12, #0x40 @ enable self refresh on idle req | 131 | orr r12, r12, #SRFRONIDLEREQ_MASK @ enable self refresh on idle |
83 | bic r12, r12, #0x4 @ clear PWDENA | 132 | bic r12, r12, #PWDENA_MASK @ clear PWDENA |
84 | str r12, [r11] @ write back to SDRC_POWER register | 133 | str r12, [r11] @ write back to SDRC_POWER register |
85 | ldr r12, [r11] @ posted-write barrier for SDRC | 134 | ldr r12, [r11] @ posted-write barrier for SDRC |
135 | idle_sdrc: | ||
86 | ldr r11, omap3_cm_iclken1_core @ read the CM_ICLKEN1_CORE reg | 136 | ldr r11, omap3_cm_iclken1_core @ read the CM_ICLKEN1_CORE reg |
87 | ldr r12, [r11] | 137 | ldr r12, [r11] |
88 | bic r12, r12, #0x2 @ disable iclk bit for SDRC | 138 | bic r12, r12, #EN_SDRC_MASK @ disable iclk bit for SDRC |
89 | str r12, [r11] | 139 | str r12, [r11] |
90 | wait_sdrc_idle: | 140 | wait_sdrc_idle: |
91 | ldr r11, omap3_cm_idlest1_core | 141 | ldr r11, omap3_cm_idlest1_core |
92 | ldr r12, [r11] | 142 | ldr r12, [r11] |
93 | and r12, r12, #0x2 @ check for SDRC idle | 143 | and r12, r12, #ST_SDRC_MASK @ check for SDRC idle |
94 | cmp r12, #2 | 144 | cmp r12, #ST_SDRC_MASK |
95 | bne wait_sdrc_idle | 145 | bne wait_sdrc_idle |
96 | bx lr | 146 | bx lr |
97 | configure_core_dpll: | 147 | configure_core_dpll: |
@@ -99,36 +149,23 @@ configure_core_dpll: | |||
99 | ldr r12, [r11] | 149 | ldr r12, [r11] |
100 | ldr r10, core_m2_mask_val @ modify m2 for core dpll | 150 | ldr r10, core_m2_mask_val @ modify m2 for core dpll |
101 | and r12, r12, r10 | 151 | and r12, r12, r10 |
102 | orr r12, r12, r3, lsl #0x1B @ r3 contains the M2 val | 152 | orr r12, r12, r3, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT |
103 | str r12, [r11] | 153 | str r12, [r11] |
104 | ldr r12, [r11] @ posted-write barrier for CM | 154 | ldr r12, [r11] @ posted-write barrier for CM |
105 | mov r12, #0x800 @ wait for the clock to stabilise | ||
106 | cmp r3, #2 | ||
107 | bne wait_clk_stable | ||
108 | bx lr | 155 | bx lr |
109 | wait_clk_stable: | 156 | wait_clk_stable: |
110 | subs r12, r12, #1 | 157 | subs r12, r12, #1 |
111 | bne wait_clk_stable | 158 | bne wait_clk_stable |
112 | nop | ||
113 | nop | ||
114 | nop | ||
115 | nop | ||
116 | nop | ||
117 | nop | ||
118 | nop | ||
119 | nop | ||
120 | nop | ||
121 | nop | ||
122 | bx lr | 159 | bx lr |
123 | enable_sdrc: | 160 | enable_sdrc: |
124 | ldr r11, omap3_cm_iclken1_core | 161 | ldr r11, omap3_cm_iclken1_core |
125 | ldr r12, [r11] | 162 | ldr r12, [r11] |
126 | orr r12, r12, #0x2 @ enable iclk bit for SDRC | 163 | orr r12, r12, #EN_SDRC_MASK @ enable iclk bit for SDRC |
127 | str r12, [r11] | 164 | str r12, [r11] |
128 | wait_sdrc_idle1: | 165 | wait_sdrc_idle1: |
129 | ldr r11, omap3_cm_idlest1_core | 166 | ldr r11, omap3_cm_idlest1_core |
130 | ldr r12, [r11] | 167 | ldr r12, [r11] |
131 | and r12, r12, #0x2 | 168 | and r12, r12, #ST_SDRC_MASK |
132 | cmp r12, #0 | 169 | cmp r12, #0 |
133 | bne wait_sdrc_idle1 | 170 | bne wait_sdrc_idle1 |
134 | restore_sdrc_power_val: | 171 | restore_sdrc_power_val: |
@@ -138,14 +175,14 @@ restore_sdrc_power_val: | |||
138 | wait_dll_lock: | 175 | wait_dll_lock: |
139 | ldr r11, omap3_sdrc_dlla_status | 176 | ldr r11, omap3_sdrc_dlla_status |
140 | ldr r12, [r11] | 177 | ldr r12, [r11] |
141 | and r12, r12, #0x4 | 178 | and r12, r12, #LOCKSTATUS_MASK |
142 | cmp r12, #0x4 | 179 | cmp r12, #LOCKSTATUS_MASK |
143 | bne wait_dll_lock | 180 | bne wait_dll_lock |
144 | bx lr | 181 | bx lr |
145 | wait_dll_unlock: | 182 | wait_dll_unlock: |
146 | ldr r11, omap3_sdrc_dlla_status | 183 | ldr r11, omap3_sdrc_dlla_status |
147 | ldr r12, [r11] | 184 | ldr r12, [r11] |
148 | and r12, r12, #0x4 | 185 | and r12, r12, #LOCKSTATUS_MASK |
149 | cmp r12, #0x0 | 186 | cmp r12, #0x0 |
150 | bne wait_dll_unlock | 187 | bne wait_dll_unlock |
151 | bx lr | 188 | bx lr |
@@ -156,7 +193,9 @@ configure_sdrc: | |||
156 | str r1, [r11] | 193 | str r1, [r11] |
157 | ldr r11, omap3_sdrc_actim_ctrlb | 194 | ldr r11, omap3_sdrc_actim_ctrlb |
158 | str r2, [r11] | 195 | str r2, [r11] |
159 | ldr r2, [r11] @ posted-write barrier for SDRC | 196 | ldr r11, omap3_sdrc_mr_0 |
197 | str r6, [r11] | ||
198 | ldr r6, [r11] @ posted-write barrier for SDRC | ||
160 | bx lr | 199 | bx lr |
161 | 200 | ||
162 | omap3_sdrc_power: | 201 | omap3_sdrc_power: |
@@ -173,6 +212,8 @@ omap3_sdrc_actim_ctrla: | |||
173 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0) | 212 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0) |
174 | omap3_sdrc_actim_ctrlb: | 213 | omap3_sdrc_actim_ctrlb: |
175 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0) | 214 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0) |
215 | omap3_sdrc_mr_0: | ||
216 | .word OMAP34XX_SDRC_REGADDR(SDRC_MR_0) | ||
176 | omap3_sdrc_dlla_status: | 217 | omap3_sdrc_dlla_status: |
177 | .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) | 218 | .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) |
178 | omap3_sdrc_dlla_ctrl: | 219 | omap3_sdrc_dlla_ctrl: |
diff --git a/arch/arm/plat-omap/include/mach/sram.h b/arch/arm/plat-omap/include/mach/sram.h index dca7c16ae903..4d53cc59d7a3 100644 --- a/arch/arm/plat-omap/include/mach/sram.h +++ b/arch/arm/plat-omap/include/mach/sram.h | |||
@@ -24,7 +24,8 @@ extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass); | |||
24 | extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, | 24 | extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, |
25 | u32 sdrc_actim_ctrla, | 25 | u32 sdrc_actim_ctrla, |
26 | u32 sdrc_actim_ctrlb, u32 m2, | 26 | u32 sdrc_actim_ctrlb, u32 m2, |
27 | u32 unlock_dll); | 27 | u32 unlock_dll, u32 f, u32 sdrc_mr, |
28 | u32 inc); | ||
28 | 29 | ||
29 | /* Do not use these */ | 30 | /* Do not use these */ |
30 | extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl); | 31 | extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl); |
@@ -62,7 +63,8 @@ extern unsigned long omap243x_sram_reprogram_sdrc_sz; | |||
62 | extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl, | 63 | extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl, |
63 | u32 sdrc_actim_ctrla, | 64 | u32 sdrc_actim_ctrla, |
64 | u32 sdrc_actim_ctrlb, u32 m2, | 65 | u32 sdrc_actim_ctrlb, u32 m2, |
65 | u32 unlock_dll); | 66 | u32 unlock_dll, u32 f, u32 sdrc_mr, |
67 | u32 inc); | ||
66 | extern unsigned long omap3_sram_configure_core_dpll_sz; | 68 | extern unsigned long omap3_sram_configure_core_dpll_sz; |
67 | 69 | ||
68 | #endif | 70 | #endif |
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index a5b9bcd6b108..65006df3f1b7 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c | |||
@@ -371,15 +371,17 @@ static inline int omap243x_sram_init(void) | |||
371 | static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl, | 371 | static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl, |
372 | u32 sdrc_actim_ctrla, | 372 | u32 sdrc_actim_ctrla, |
373 | u32 sdrc_actim_ctrlb, | 373 | u32 sdrc_actim_ctrlb, |
374 | u32 m2, u32 unlock_dll); | 374 | u32 m2, u32 unlock_dll, |
375 | u32 f, u32 sdrc_mr, u32 inc); | ||
375 | u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla, | 376 | u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla, |
376 | u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll) | 377 | u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll, |
378 | u32 f, u32 sdrc_mr, u32 inc) | ||
377 | { | 379 | { |
378 | BUG_ON(!_omap3_sram_configure_core_dpll); | 380 | BUG_ON(!_omap3_sram_configure_core_dpll); |
379 | return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl, | 381 | return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl, |
380 | sdrc_actim_ctrla, | 382 | sdrc_actim_ctrla, |
381 | sdrc_actim_ctrlb, m2, | 383 | sdrc_actim_ctrlb, m2, |
382 | unlock_dll); | 384 | unlock_dll, f, sdrc_mr, inc); |
383 | } | 385 | } |
384 | 386 | ||
385 | /* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */ | 387 | /* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */ |