2 * SA11x0 Assembler Sleep/WakeUp Management Routines
4 * Copyright (c) 2001 Cliff Brake <cbrake@accelent.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License.
11 * 2001-02-06: Cliff Brake Initial code
13 * 2001-08-29: Nicolas Pitre Simplified.
15 * 2002-05-27: Nicolas Pitre Revisited, more cleanup and simplification.
16 * Storage is on the stack now.
19 #include <linux/linkage.h>
20 #include <asm/assembler.h>
21 #include <mach/hardware.h>
25 * sa1100_finish_suspend()
27 * Causes sa11x0 to enter sleep state
29 * Must be aligned to a cacheline.
32 ENTRY(sa1100_finish_suspend)
33 @ disable clock switching
34 mcr p15, 0, r1, c15, c2, 2
38 orr r4, r4, #MDREFR_K1DB2
41 @ Pre-load __loop_udelay into the I-cache
46 @ The following must all exist in a single cache line to
47 @ avoid accessing memory until this sequence is complete,
48 @ otherwise we occasionally hang.
50 @ Adjust memory timing before lowering CPU clock
53 @ delay 90us and set CPU PLL to lowest speed
54 @ fixes resume problem on high speed SA1110
63 * SA1110 SDRAM controller workaround. register values:
72 * r7 = first MDREFR value
73 * r8 = second MDREFR value
76 * r11 = third MDREFR value
78 * r13 = PMCR value (1)
86 bic r3, r3, #FMsk(MSC_RT)
87 bic r3, r3, #FMsk(MSC_RT)<<16
90 bic r4, r4, #FMsk(MSC_RT)
91 bic r4, r4, #FMsk(MSC_RT)<<16
94 bic r5, r5, #FMsk(MSC_RT)
95 bic r5, r5, #FMsk(MSC_RT)<<16
98 bic r7, r7, #0x0000FF00
99 bic r7, r7, #0x000000F0
100 orr r8, r7, #MDREFR_SLFRSH
104 bic r10, r10, #(MDCNFG_DE0+MDCNFG_DE1)
105 bic r10, r10, #(MDCNFG_DE2+MDCNFG_DE3)
107 bic r11, r8, #MDREFR_SLFRSH
108 bic r11, r11, #MDREFR_E1PIN
114 b sa1110_sdram_controller_fix
117 sa1110_sdram_controller_fix:
119 @ Step 1 clear RT field of all MSCx registers
124 @ Step 2 clear DRI field in MDREFR
127 @ Step 3 set SLFRSH bit in MDREFR
130 @ Step 4 clear DE bis in MDCNFG
133 @ Step 5 clear DRAM refresh control register
136 @ Wow, now the hardware suspend request pins can be used, that makes them functional for
137 @ about 7 ns out of the entire time that the CPU is running!
139 @ Step 6 set force sleep bit in PMCR
143 20: b 20b @ loop waiting for sleep