aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2009-06-19 21:08:28 -0400
committerpaul <paul@twilight.(none)>2009-06-19 21:09:32 -0400
commitdf14e4747aa58126a508ae26661c73d83127c831 (patch)
treedafd2616963c0f0a033ca4f7e7d19f13ed113844
parent4267b5d15269ea6b26736a2ccd4c213e63e547ab (diff)
OMAP3 SRAM: convert SRAM code to use macros rather than magic numbers
Convert omap3_sram_configure_core_dpll() to use macros rather than magic numbers. Signed-off-by: Paul Walmsley <paul@pwsan.com>
-rw-r--r--arch/arm/mach-omap2/sram34xx.S53
1 files changed, 38 insertions, 15 deletions
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S
index 37a1e1fc0ab6..16eb4efa8b74 100644
--- a/arch/arm/mach-omap2/sram34xx.S
+++ b/arch/arm/mach-omap2/sram34xx.S
@@ -36,6 +36,29 @@
36 36
37 .text 37 .text
38 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 DLLIDLE_MASK 0x4
45
46/* SDRC_DLLA_STATUS bit settings */
47#define LOCKSTATUS_MASK 0x4
48
49/* SDRC_POWER bit settings */
50#define SRFRONIDLEREQ_MASK 0x40
51#define PWDENA_MASK 0x4
52
53/* CM_IDLEST1_CORE bit settings */
54#define ST_SDRC_MASK 0x2
55
56/* CM_ICLKEN1_CORE bit settings */
57#define EN_SDRC_MASK 0x2
58
59/* CM_CLKSEL1_PLL bit settings */
60#define CORE_DPLL_CLKOUT_DIV_SHIFT 0x1b
61
39/* 62/*
40 * omap3_sram_configure_core_dpll - change DPLL3 M2 divider 63 * omap3_sram_configure_core_dpll - change DPLL3 M2 divider
41 * r0 = new SDRC_RFR_CTRL register contents 64 * r0 = new SDRC_RFR_CTRL register contents
@@ -57,13 +80,13 @@ ENTRY(omap3_sram_configure_core_dpll)
57 dsb @ flush buffered writes to interconnect 80 dsb @ flush buffered writes to interconnect
58 cmp r3, #0x2 @ if increasing SDRC clk rate, 81 cmp r3, #0x2 @ if increasing SDRC clk rate,
59 blne configure_sdrc @ program the SDRC regs early (for RFR) 82 blne configure_sdrc @ program the SDRC regs early (for RFR)
60 cmp r4, #0x1 @ set the intended DLL state 83 cmp r4, #SDRC_UNLOCK_DLL @ set the intended DLL state
61 bleq unlock_dll 84 bleq unlock_dll
62 blne lock_dll 85 blne lock_dll
63 bl sdram_in_selfrefresh @ put SDRAM in self refresh, idle SDRC 86 bl sdram_in_selfrefresh @ put SDRAM in self refresh, idle SDRC
64 bl configure_core_dpll @ change the DPLL3 M2 divider 87 bl configure_core_dpll @ change the DPLL3 M2 divider
65 bl enable_sdrc @ take SDRC out of idle 88 bl enable_sdrc @ take SDRC out of idle
66 cmp r4, #0x1 @ wait for DLL status to change 89 cmp r4, #SDRC_UNLOCK_DLL @ wait for DLL status to change
67 bleq wait_dll_unlock 90 bleq wait_dll_unlock
68 blne wait_dll_lock 91 blne wait_dll_lock
69 cmp r3, #0x1 @ if increasing SDRC clk rate, 92 cmp r3, #0x1 @ if increasing SDRC clk rate,
@@ -78,33 +101,33 @@ return_to_sdram:
78unlock_dll: 101unlock_dll:
79 ldr r11, omap3_sdrc_dlla_ctrl 102 ldr r11, omap3_sdrc_dlla_ctrl
80 ldr r12, [r11] 103 ldr r12, [r11]
81 orr r12, r12, #0x4 104 orr r12, r12, #DLLIDLE_MASK
82 str r12, [r11] @ (no OCP barrier needed) 105 str r12, [r11] @ (no OCP barrier needed)
83 bx lr 106 bx lr
84lock_dll: 107lock_dll:
85 ldr r11, omap3_sdrc_dlla_ctrl 108 ldr r11, omap3_sdrc_dlla_ctrl
86 ldr r12, [r11] 109 ldr r12, [r11]
87 bic r12, r12, #0x4 110 bic r12, r12, #DLLIDLE_MASK
88 str r12, [r11] @ (no OCP barrier needed) 111 str r12, [r11] @ (no OCP barrier needed)
89 bx lr 112 bx lr
90sdram_in_selfrefresh: 113sdram_in_selfrefresh:
91 ldr r11, omap3_sdrc_power @ read the SDRC_POWER register 114 ldr r11, omap3_sdrc_power @ read the SDRC_POWER register
92 ldr r12, [r11] @ read the contents of SDRC_POWER 115 ldr r12, [r11] @ read the contents of SDRC_POWER
93 mov r9, r12 @ keep a copy of SDRC_POWER bits 116 mov r9, r12 @ keep a copy of SDRC_POWER bits
94 orr r12, r12, #0x40 @ enable self refresh on idle req 117 orr r12, r12, #SRFRONIDLEREQ_MASK @ enable self refresh on idle
95 bic r12, r12, #0x4 @ clear PWDENA 118 bic r12, r12, #PWDENA_MASK @ clear PWDENA
96 str r12, [r11] @ write back to SDRC_POWER register 119 str r12, [r11] @ write back to SDRC_POWER register
97 ldr r12, [r11] @ posted-write barrier for SDRC 120 ldr r12, [r11] @ posted-write barrier for SDRC
98idle_sdrc: 121idle_sdrc:
99 ldr r11, omap3_cm_iclken1_core @ read the CM_ICLKEN1_CORE reg 122 ldr r11, omap3_cm_iclken1_core @ read the CM_ICLKEN1_CORE reg
100 ldr r12, [r11] 123 ldr r12, [r11]
101 bic r12, r12, #0x2 @ disable iclk bit for SDRC 124 bic r12, r12, #EN_SDRC_MASK @ disable iclk bit for SDRC
102 str r12, [r11] 125 str r12, [r11]
103wait_sdrc_idle: 126wait_sdrc_idle:
104 ldr r11, omap3_cm_idlest1_core 127 ldr r11, omap3_cm_idlest1_core
105 ldr r12, [r11] 128 ldr r12, [r11]
106 and r12, r12, #0x2 @ check for SDRC idle 129 and r12, r12, #ST_SDRC_MASK @ check for SDRC idle
107 cmp r12, #2 130 cmp r12, #ST_SDRC_MASK
108 bne wait_sdrc_idle 131 bne wait_sdrc_idle
109 bx lr 132 bx lr
110configure_core_dpll: 133configure_core_dpll:
@@ -112,7 +135,7 @@ configure_core_dpll:
112 ldr r12, [r11] 135 ldr r12, [r11]
113 ldr r10, core_m2_mask_val @ modify m2 for core dpll 136 ldr r10, core_m2_mask_val @ modify m2 for core dpll
114 and r12, r12, r10 137 and r12, r12, r10
115 orr r12, r12, r3, lsl #0x1B @ r3 contains the M2 val 138 orr r12, r12, r3, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT
116 str r12, [r11] 139 str r12, [r11]
117 ldr r12, [r11] @ posted-write barrier for CM 140 ldr r12, [r11] @ posted-write barrier for CM
118 bx lr 141 bx lr
@@ -123,12 +146,12 @@ wait_clk_stable:
123enable_sdrc: 146enable_sdrc:
124 ldr r11, omap3_cm_iclken1_core 147 ldr r11, omap3_cm_iclken1_core
125 ldr r12, [r11] 148 ldr r12, [r11]
126 orr r12, r12, #0x2 @ enable iclk bit for SDRC 149 orr r12, r12, #EN_SDRC_MASK @ enable iclk bit for SDRC
127 str r12, [r11] 150 str r12, [r11]
128wait_sdrc_idle1: 151wait_sdrc_idle1:
129 ldr r11, omap3_cm_idlest1_core 152 ldr r11, omap3_cm_idlest1_core
130 ldr r12, [r11] 153 ldr r12, [r11]
131 and r12, r12, #0x2 154 and r12, r12, #ST_SDRC_MASK
132 cmp r12, #0 155 cmp r12, #0
133 bne wait_sdrc_idle1 156 bne wait_sdrc_idle1
134restore_sdrc_power_val: 157restore_sdrc_power_val:
@@ -138,14 +161,14 @@ restore_sdrc_power_val:
138wait_dll_lock: 161wait_dll_lock:
139 ldr r11, omap3_sdrc_dlla_status 162 ldr r11, omap3_sdrc_dlla_status
140 ldr r12, [r11] 163 ldr r12, [r11]
141 and r12, r12, #0x4 164 and r12, r12, #LOCKSTATUS_MASK
142 cmp r12, #0x4 165 cmp r12, #LOCKSTATUS_MASK
143 bne wait_dll_lock 166 bne wait_dll_lock
144 bx lr 167 bx lr
145wait_dll_unlock: 168wait_dll_unlock:
146 ldr r11, omap3_sdrc_dlla_status 169 ldr r11, omap3_sdrc_dlla_status
147 ldr r12, [r11] 170 ldr r12, [r11]
148 and r12, r12, #0x4 171 and r12, r12, #LOCKSTATUS_MASK
149 cmp r12, #0x0 172 cmp r12, #0x0
150 bne wait_dll_unlock 173 bne wait_dll_unlock
151 bx lr 174 bx lr