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