aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/pm_slowclock.S
diff options
context:
space:
mode:
authorNicolas Ferre <nicolas.ferre@atmel.com>2010-06-21 09:59:27 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-07-09 07:31:50 -0400
commit7dca3343fc5ae5af2fa9248057cd65077a5576e1 (patch)
tree973030fa645ffe756cde695dd069768a42e52486 /arch/arm/mach-at91/pm_slowclock.S
parent5f9f0a412f16b2b849624f1b760477fb35ceff4a (diff)
ARM: 6185/1: AT91: PM: dual ram controller support
This rework allows to address tow memory controllers. AT91SAM9263 and AT91SAM9G45 family have tow SDRAM or DDR/SDRAM controllers. Power management should take care of this. This patch modify the way RAM IP header files are implemented to allow access to registers of both controllers ; it also adds some macros. We also modify the power management files to use those modified header files. Slow clock (assembly) and regular power management functions are synchronized for setting of RAM self-refresh procedure: (lpr & ~AT91_DDRSDRC_LPCB) | AT91_DDRSDRC_LPCB_SELF_REFRESH Note that AT91RM9200 is not impacted by this modification. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Andrew Victor <linux@maxim.org.za> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-at91/pm_slowclock.S')
-rw-r--r--arch/arm/mach-at91/pm_slowclock.S74
1 files changed, 54 insertions, 20 deletions
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S
index 9c5b48e68a71..b6b00a1f6125 100644
--- a/arch/arm/mach-at91/pm_slowclock.S
+++ b/arch/arm/mach-at91/pm_slowclock.S
@@ -16,10 +16,12 @@
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <mach/at91_pmc.h> 17#include <mach/at91_pmc.h>
18 18
19#ifdef CONFIG_ARCH_AT91RM9200 19#if defined(CONFIG_ARCH_AT91RM9200)
20#include <mach/at91rm9200_mc.h> 20#include <mach/at91rm9200_mc.h>
21#elif defined(CONFIG_ARCH_AT91CAP9) 21#elif defined(CONFIG_ARCH_AT91CAP9)
22#include <mach/at91cap9_ddrsdr.h> 22#include <mach/at91cap9_ddrsdr.h>
23#elif defined(CONFIG_ARCH_AT91SAM9G45)
24#include <mach/at91sam9_ddrsdr.h>
23#else 25#else
24#include <mach/at91sam9_sdramc.h> 26#include <mach/at91sam9_sdramc.h>
25#endif 27#endif
@@ -30,7 +32,6 @@
30 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; 32 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
31 * handle those cases both here and in the Suspend-To-RAM support. 33 * handle those cases both here and in the Suspend-To-RAM support.
32 */ 34 */
33#define AT91_SDRAMC AT91_SDRAMC0
34#warning Assuming EB1 SDRAM controller is *NOT* used 35#warning Assuming EB1 SDRAM controller is *NOT* used
35#endif 36#endif
36 37
@@ -113,12 +114,14 @@ ENTRY(at91_slow_clock)
113 /* 114 /*
114 * Register usage: 115 * Register usage:
115 * R1 = Base address of AT91_PMC 116 * R1 = Base address of AT91_PMC
116 * R2 = Base address of AT91_SDRAMC (or AT91_SYS on AT91RM9200) 117 * R2 = Base address of RAM Controller (SDRAM, DDRSDR, or AT91_SYS)
117 * R3 = temporary register 118 * R3 = temporary register
118 * R4 = temporary register 119 * R4 = temporary register
120 * R5 = Base address of second RAM Controller or 0 if not present
119 */ 121 */
120 ldr r1, .at91_va_base_pmc 122 ldr r1, .at91_va_base_pmc
121 ldr r2, .at91_va_base_sdramc 123 ldr r2, .at91_va_base_sdramc
124 ldr r5, .at91_va_base_ramc1
122 125
123 /* Drain write buffer */ 126 /* Drain write buffer */
124 mcr p15, 0, r0, c7, c10, 4 127 mcr p15, 0, r0, c7, c10, 4
@@ -127,20 +130,33 @@ ENTRY(at91_slow_clock)
127 /* Put SDRAM in self-refresh mode */ 130 /* Put SDRAM in self-refresh mode */
128 mov r3, #1 131 mov r3, #1
129 str r3, [r2, #AT91_SDRAMC_SRR] 132 str r3, [r2, #AT91_SDRAMC_SRR]
130#elif defined(CONFIG_ARCH_AT91CAP9) 133#elif defined(CONFIG_ARCH_AT91CAP9) \
131 /* Enable SDRAM self-refresh mode */ 134 || defined(CONFIG_ARCH_AT91SAM9G45)
132 ldr r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC]
133 str r3, .saved_sam9_lpr
134 135
135 mov r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH 136 /* prepare for DDRAM self-refresh mode */
136 str r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC] 137 ldr r3, [r2, #AT91_DDRSDRC_LPR]
138 str r3, .saved_sam9_lpr
139 bic r3, #AT91_DDRSDRC_LPCB
140 orr r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH
141
142 /* figure out if we use the second ram controller */
143 cmp r5, #0
144 ldrne r4, [r5, #AT91_DDRSDRC_LPR]
145 strne r4, .saved_sam9_lpr1
146 bicne r4, #AT91_DDRSDRC_LPCB
147 orrne r4, #AT91_DDRSDRC_LPCB_SELF_REFRESH
148
149 /* Enable DDRAM self-refresh mode */
150 str r3, [r2, #AT91_DDRSDRC_LPR]
151 strne r4, [r5, #AT91_DDRSDRC_LPR]
137#else 152#else
138 /* Enable SDRAM self-refresh mode */ 153 /* Enable SDRAM self-refresh mode */
139 ldr r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC] 154 ldr r3, [r2, #AT91_SDRAMC_LPR]
140 str r3, .saved_sam9_lpr 155 str r3, .saved_sam9_lpr
141 156
142 mov r3, #AT91_SDRAMC_LPCB_SELF_REFRESH 157 bic r3, #AT91_SDRAMC_LPCB
143 str r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC] 158 orr r3, #AT91_SDRAMC_LPCB_SELF_REFRESH
159 str r3, [r2, #AT91_SDRAMC_LPR]
144#endif 160#endif
145 161
146 /* Save Master clock setting */ 162 /* Save Master clock setting */
@@ -247,14 +263,21 @@ ENTRY(at91_slow_clock)
247 263
248#ifdef CONFIG_ARCH_AT91RM9200 264#ifdef CONFIG_ARCH_AT91RM9200
249 /* Do nothing - self-refresh is automatically disabled. */ 265 /* Do nothing - self-refresh is automatically disabled. */
250#elif defined(CONFIG_ARCH_AT91CAP9) 266#elif defined(CONFIG_ARCH_AT91CAP9) \
251 /* Restore LPR on AT91CAP9 */ 267 || defined(CONFIG_ARCH_AT91SAM9G45)
268 /* Restore LPR on AT91 with DDRAM */
252 ldr r3, .saved_sam9_lpr 269 ldr r3, .saved_sam9_lpr
253 str r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC] 270 str r3, [r2, #AT91_DDRSDRC_LPR]
271
272 /* if we use the second ram controller */
273 cmp r5, #0
274 ldrne r4, .saved_sam9_lpr1
275 strne r4, [r5, #AT91_DDRSDRC_LPR]
276
254#else 277#else
255 /* Restore LPR on AT91SAM9 */ 278 /* Restore LPR on AT91 with SDRAM */
256 ldr r3, .saved_sam9_lpr 279 ldr r3, .saved_sam9_lpr
257 str r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC] 280 str r3, [r2, #AT91_SDRAMC_LPR]
258#endif 281#endif
259 282
260 /* Restore registers, and return */ 283 /* Restore registers, and return */
@@ -273,18 +296,29 @@ ENTRY(at91_slow_clock)
273.saved_sam9_lpr: 296.saved_sam9_lpr:
274 .word 0 297 .word 0
275 298
299.saved_sam9_lpr1:
300 .word 0
301
276.at91_va_base_pmc: 302.at91_va_base_pmc:
277 .word AT91_VA_BASE_SYS + AT91_PMC 303 .word AT91_VA_BASE_SYS + AT91_PMC
278 304
279#ifdef CONFIG_ARCH_AT91RM9200 305#ifdef CONFIG_ARCH_AT91RM9200
280.at91_va_base_sdramc: 306.at91_va_base_sdramc:
281 .word AT91_VA_BASE_SYS 307 .word AT91_VA_BASE_SYS
282#elif defined(CONFIG_ARCH_AT91CAP9) 308#elif defined(CONFIG_ARCH_AT91CAP9) \
309 || defined(CONFIG_ARCH_AT91SAM9G45)
283.at91_va_base_sdramc: 310.at91_va_base_sdramc:
284 .word AT91_VA_BASE_SYS + AT91_DDRSDRC 311 .word AT91_VA_BASE_SYS + AT91_DDRSDRC0
285#else 312#else
286.at91_va_base_sdramc: 313.at91_va_base_sdramc:
287 .word AT91_VA_BASE_SYS + AT91_SDRAMC 314 .word AT91_VA_BASE_SYS + AT91_SDRAMC0
315#endif
316
317.at91_va_base_ramc1:
318#if defined(CONFIG_ARCH_AT91SAM9G45)
319 .word AT91_VA_BASE_SYS + AT91_DDRSDRC1
320#else
321 .word 0
288#endif 322#endif
289 323
290ENTRY(at91_slow_clock_sz) 324ENTRY(at91_slow_clock_sz)