diff options
Diffstat (limited to 'arch/arm/mach-omap2/sram34xx.S')
-rw-r--r-- | arch/arm/mach-omap2/sram34xx.S | 137 |
1 files changed, 107 insertions, 30 deletions
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S index f41f8d96ddba..3aef7448b2a5 100644 --- a/arch/arm/mach-omap2/sram34xx.S +++ b/arch/arm/mach-omap2/sram34xx.S | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | .text | 37 | .text |
38 | 38 | ||
39 | /* r4 parameters */ | 39 | /* r1 parameters */ |
40 | #define SDRC_NO_UNLOCK_DLL 0x0 | 40 | #define SDRC_NO_UNLOCK_DLL 0x0 |
41 | #define SDRC_UNLOCK_DLL 0x1 | 41 | #define SDRC_UNLOCK_DLL 0x1 |
42 | 42 | ||
@@ -71,40 +71,71 @@ | |||
71 | 71 | ||
72 | /* | 72 | /* |
73 | * omap3_sram_configure_core_dpll - change DPLL3 M2 divider | 73 | * omap3_sram_configure_core_dpll - change DPLL3 M2 divider |
74 | * r0 = new SDRC_RFR_CTRL register contents | 74 | * |
75 | * r1 = new SDRC_ACTIM_CTRLA register contents | 75 | * Params passed in registers: |
76 | * r2 = new SDRC_ACTIM_CTRLB register contents | 76 | * r0 = new M2 divider setting (only 1 and 2 supported right now) |
77 | * r3 = new M2 divider setting (only 1 and 2 supported right now) | 77 | * r1 = unlock SDRC DLL? (1 = yes, 0 = no). Only unlock DLL for |
78 | * r4 = unlock SDRC DLL? (1 = yes, 0 = no). Only unlock DLL for | ||
79 | * SDRC rates < 83MHz | 78 | * SDRC rates < 83MHz |
80 | * r5 = number of MPU cycles to wait for SDRC to stabilize after | 79 | * r2 = number of MPU cycles to wait for SDRC to stabilize after |
81 | * reprogramming the SDRC when switching to a slower MPU speed | 80 | * reprogramming the SDRC when switching to a slower MPU speed |
82 | * r6 = new SDRC_MR_0 register value | 81 | * r3 = increasing SDRC rate? (1 = yes, 0 = no) |
83 | * r7 = increasing SDRC rate? (1 = yes, 0 = no) | 82 | * |
83 | * Params passed via the stack. The needed params will be copied in SRAM | ||
84 | * before use by the code in SRAM (SDRAM is not accessible during SDRC | ||
85 | * reconfiguration): | ||
86 | * new SDRC_RFR_CTRL_0 register contents | ||
87 | * new SDRC_ACTIM_CTRL_A_0 register contents | ||
88 | * new SDRC_ACTIM_CTRL_B_0 register contents | ||
89 | * new SDRC_MR_0 register value | ||
90 | * new SDRC_RFR_CTRL_1 register contents | ||
91 | * new SDRC_ACTIM_CTRL_A_1 register contents | ||
92 | * new SDRC_ACTIM_CTRL_B_1 register contents | ||
93 | * new SDRC_MR_1 register value | ||
84 | * | 94 | * |
95 | * If the param SDRC_RFR_CTRL_1 is 0, the parameters | ||
96 | * are not programmed into the SDRC CS1 registers | ||
85 | */ | 97 | */ |
86 | ENTRY(omap3_sram_configure_core_dpll) | 98 | ENTRY(omap3_sram_configure_core_dpll) |
87 | stmfd sp!, {r1-r12, lr} @ store regs to stack | 99 | stmfd sp!, {r1-r12, lr} @ store regs to stack |
88 | ldr r4, [sp, #52] @ pull extra args off the stack | 100 | |
89 | ldr r5, [sp, #56] @ load extra args from the stack | 101 | @ pull the extra args off the stack |
90 | ldr r6, [sp, #60] @ load extra args from the stack | 102 | @ and store them in SRAM |
91 | ldr r7, [sp, #64] @ load extra args from the stack | 103 | ldr r4, [sp, #52] |
104 | str r4, omap_sdrc_rfr_ctrl_0_val | ||
105 | ldr r4, [sp, #56] | ||
106 | str r4, omap_sdrc_actim_ctrl_a_0_val | ||
107 | ldr r4, [sp, #60] | ||
108 | str r4, omap_sdrc_actim_ctrl_b_0_val | ||
109 | ldr r4, [sp, #64] | ||
110 | str r4, omap_sdrc_mr_0_val | ||
111 | ldr r4, [sp, #68] | ||
112 | str r4, omap_sdrc_rfr_ctrl_1_val | ||
113 | cmp r4, #0 @ if SDRC_RFR_CTRL_1 is 0, | ||
114 | beq skip_cs1_params @ do not use cs1 params | ||
115 | ldr r4, [sp, #72] | ||
116 | str r4, omap_sdrc_actim_ctrl_a_1_val | ||
117 | ldr r4, [sp, #76] | ||
118 | str r4, omap_sdrc_actim_ctrl_b_1_val | ||
119 | ldr r4, [sp, #80] | ||
120 | str r4, omap_sdrc_mr_1_val | ||
121 | skip_cs1_params: | ||
92 | dsb @ flush buffered writes to interconnect | 122 | dsb @ flush buffered writes to interconnect |
93 | cmp r7, #1 @ if increasing SDRC clk rate, | 123 | |
124 | cmp r3, #1 @ if increasing SDRC clk rate, | ||
94 | bleq configure_sdrc @ program the SDRC regs early (for RFR) | 125 | bleq configure_sdrc @ program the SDRC regs early (for RFR) |
95 | cmp r4, #SDRC_UNLOCK_DLL @ set the intended DLL state | 126 | cmp r1, #SDRC_UNLOCK_DLL @ set the intended DLL state |
96 | bleq unlock_dll | 127 | bleq unlock_dll |
97 | blne lock_dll | 128 | blne lock_dll |
98 | bl sdram_in_selfrefresh @ put SDRAM in self refresh, idle SDRC | 129 | bl sdram_in_selfrefresh @ put SDRAM in self refresh, idle SDRC |
99 | bl configure_core_dpll @ change the DPLL3 M2 divider | 130 | bl configure_core_dpll @ change the DPLL3 M2 divider |
100 | bl enable_sdrc @ take SDRC out of idle | 131 | bl enable_sdrc @ take SDRC out of idle |
101 | cmp r4, #SDRC_UNLOCK_DLL @ wait for DLL status to change | 132 | cmp r1, #SDRC_UNLOCK_DLL @ wait for DLL status to change |
102 | bleq wait_dll_unlock | 133 | bleq wait_dll_unlock |
103 | blne wait_dll_lock | 134 | blne wait_dll_lock |
104 | cmp r7, #1 @ if increasing SDRC clk rate, | 135 | cmp r3, #1 @ if increasing SDRC clk rate, |
105 | beq return_to_sdram @ return to SDRAM code, otherwise, | 136 | beq return_to_sdram @ return to SDRAM code, otherwise, |
106 | bl configure_sdrc @ reprogram SDRC regs now | 137 | bl configure_sdrc @ reprogram SDRC regs now |
107 | mov r12, r5 | 138 | mov r12, r2 |
108 | bl wait_clk_stable @ wait for SDRC to stabilize | 139 | bl wait_clk_stable @ wait for SDRC to stabilize |
109 | return_to_sdram: | 140 | return_to_sdram: |
110 | isb @ prevent speculative exec past here | 141 | isb @ prevent speculative exec past here |
@@ -149,7 +180,7 @@ configure_core_dpll: | |||
149 | ldr r12, [r11] | 180 | ldr r12, [r11] |
150 | ldr r10, core_m2_mask_val @ modify m2 for core dpll | 181 | ldr r10, core_m2_mask_val @ modify m2 for core dpll |
151 | and r12, r12, r10 | 182 | and r12, r12, r10 |
152 | orr r12, r12, r3, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT | 183 | orr r12, r12, r0, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT |
153 | str r12, [r11] | 184 | str r12, [r11] |
154 | ldr r12, [r11] @ posted-write barrier for CM | 185 | ldr r12, [r11] @ posted-write barrier for CM |
155 | bx lr | 186 | bx lr |
@@ -187,15 +218,34 @@ wait_dll_unlock: | |||
187 | bne wait_dll_unlock | 218 | bne wait_dll_unlock |
188 | bx lr | 219 | bx lr |
189 | configure_sdrc: | 220 | configure_sdrc: |
190 | ldr r11, omap3_sdrc_rfr_ctrl | 221 | ldr r12, omap_sdrc_rfr_ctrl_0_val @ fetch value from SRAM |
191 | str r0, [r11] | 222 | ldr r11, omap3_sdrc_rfr_ctrl_0 @ fetch addr from SRAM |
192 | ldr r11, omap3_sdrc_actim_ctrla | 223 | str r12, [r11] @ store |
193 | str r1, [r11] | 224 | ldr r12, omap_sdrc_actim_ctrl_a_0_val |
194 | ldr r11, omap3_sdrc_actim_ctrlb | 225 | ldr r11, omap3_sdrc_actim_ctrl_a_0 |
195 | str r2, [r11] | 226 | str r12, [r11] |
227 | ldr r12, omap_sdrc_actim_ctrl_b_0_val | ||
228 | ldr r11, omap3_sdrc_actim_ctrl_b_0 | ||
229 | str r12, [r11] | ||
230 | ldr r12, omap_sdrc_mr_0_val | ||
196 | ldr r11, omap3_sdrc_mr_0 | 231 | ldr r11, omap3_sdrc_mr_0 |
197 | str r6, [r11] | 232 | str r12, [r11] |
198 | ldr r6, [r11] @ posted-write barrier for SDRC | 233 | ldr r12, omap_sdrc_rfr_ctrl_1_val |
234 | cmp r12, #0 @ if SDRC_RFR_CTRL_1 is 0, | ||
235 | beq skip_cs1_prog @ do not program cs1 params | ||
236 | ldr r11, omap3_sdrc_rfr_ctrl_1 | ||
237 | str r12, [r11] | ||
238 | ldr r12, omap_sdrc_actim_ctrl_a_1_val | ||
239 | ldr r11, omap3_sdrc_actim_ctrl_a_1 | ||
240 | str r12, [r11] | ||
241 | ldr r12, omap_sdrc_actim_ctrl_b_1_val | ||
242 | ldr r11, omap3_sdrc_actim_ctrl_b_1 | ||
243 | str r12, [r11] | ||
244 | ldr r12, omap_sdrc_mr_1_val | ||
245 | ldr r11, omap3_sdrc_mr_1 | ||
246 | str r12, [r11] | ||
247 | skip_cs1_prog: | ||
248 | ldr r12, [r11] @ posted-write barrier for SDRC | ||
199 | bx lr | 249 | bx lr |
200 | 250 | ||
201 | omap3_sdrc_power: | 251 | omap3_sdrc_power: |
@@ -206,14 +256,40 @@ omap3_cm_idlest1_core: | |||
206 | .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST) | 256 | .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST) |
207 | omap3_cm_iclken1_core: | 257 | omap3_cm_iclken1_core: |
208 | .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1) | 258 | .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1) |
209 | omap3_sdrc_rfr_ctrl: | 259 | |
260 | omap3_sdrc_rfr_ctrl_0: | ||
210 | .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0) | 261 | .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0) |
211 | omap3_sdrc_actim_ctrla: | 262 | omap3_sdrc_rfr_ctrl_1: |
263 | .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_1) | ||
264 | omap3_sdrc_actim_ctrl_a_0: | ||
212 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0) | 265 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0) |
213 | omap3_sdrc_actim_ctrlb: | 266 | omap3_sdrc_actim_ctrl_a_1: |
267 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_1) | ||
268 | omap3_sdrc_actim_ctrl_b_0: | ||
214 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0) | 269 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0) |
270 | omap3_sdrc_actim_ctrl_b_1: | ||
271 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_1) | ||
215 | omap3_sdrc_mr_0: | 272 | omap3_sdrc_mr_0: |
216 | .word OMAP34XX_SDRC_REGADDR(SDRC_MR_0) | 273 | .word OMAP34XX_SDRC_REGADDR(SDRC_MR_0) |
274 | omap3_sdrc_mr_1: | ||
275 | .word OMAP34XX_SDRC_REGADDR(SDRC_MR_1) | ||
276 | omap_sdrc_rfr_ctrl_0_val: | ||
277 | .word 0xDEADBEEF | ||
278 | omap_sdrc_rfr_ctrl_1_val: | ||
279 | .word 0xDEADBEEF | ||
280 | omap_sdrc_actim_ctrl_a_0_val: | ||
281 | .word 0xDEADBEEF | ||
282 | omap_sdrc_actim_ctrl_a_1_val: | ||
283 | .word 0xDEADBEEF | ||
284 | omap_sdrc_actim_ctrl_b_0_val: | ||
285 | .word 0xDEADBEEF | ||
286 | omap_sdrc_actim_ctrl_b_1_val: | ||
287 | .word 0xDEADBEEF | ||
288 | omap_sdrc_mr_0_val: | ||
289 | .word 0xDEADBEEF | ||
290 | omap_sdrc_mr_1_val: | ||
291 | .word 0xDEADBEEF | ||
292 | |||
217 | omap3_sdrc_dlla_status: | 293 | omap3_sdrc_dlla_status: |
218 | .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) | 294 | .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) |
219 | omap3_sdrc_dlla_ctrl: | 295 | omap3_sdrc_dlla_ctrl: |
@@ -223,3 +299,4 @@ core_m2_mask_val: | |||
223 | 299 | ||
224 | ENTRY(omap3_sram_configure_core_dpll_sz) | 300 | ENTRY(omap3_sram_configure_core_dpll_sz) |
225 | .word . - omap3_sram_configure_core_dpll | 301 | .word . - omap3_sram_configure_core_dpll |
302 | |||