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
31 ENTRY(sa1100_finish_suspend)
32 @ disable clock switching
33 mcr p15, 0, r1, c15, c2, 2
35 @ Adjust memory timing before lowering CPU clock
36 @ Clock speed adjustment without changing memory timing makes
37 @ CPU hang in some cases
40 orr r1, r1, #MDREFR_K1DB2
43 @ delay 90us and set CPU PLL to lowest speed
44 @ fixes resume problem on high speed SA1110
54 * SA1110 SDRAM controller workaround. register values:
63 * r7 = first MDREFR value
64 * r8 = second MDREFR value
67 * r11 = third MDREFR value
69 * r13 = PMCR value (1)
77 bic r3, r3, #FMsk(MSC_RT)
78 bic r3, r3, #FMsk(MSC_RT)<<16
81 bic r4, r4, #FMsk(MSC_RT)
82 bic r4, r4, #FMsk(MSC_RT)<<16
85 bic r5, r5, #FMsk(MSC_RT)
86 bic r5, r5, #FMsk(MSC_RT)<<16
91 bic r7, r7, #0x0000FF00
92 bic r7, r7, #0x000000F0
93 orr r8, r7, #MDREFR_SLFRSH
97 bic r10, r10, #(MDCNFG_DE0+MDCNFG_DE1)
98 bic r10, r10, #(MDCNFG_DE2+MDCNFG_DE3)
100 bic r11, r8, #MDREFR_SLFRSH
101 bic r11, r11, #MDREFR_E1PIN
107 b sa1110_sdram_controller_fix
110 sa1110_sdram_controller_fix:
112 @ Step 1 clear RT field of all MSCx registers
117 @ Step 2 clear DRI field in MDREFR
120 @ Step 3 set SLFRSH bit in MDREFR
123 @ Step 4 clear DE bis in MDCNFG
126 @ Step 5 clear DRAM refresh control register
129 @ Wow, now the hardware suspend request pins can be used, that makes them functional for
130 @ about 7 ns out of the entire time that the CPU is running!
132 @ Step 6 set force sleep bit in PMCR
136 20: b 20b @ loop waiting for sleep