diff options
Diffstat (limited to 'arch/mips/alchemy/common/sleeper.S')
-rw-r--r-- | arch/mips/alchemy/common/sleeper.S | 118 |
1 files changed, 68 insertions, 50 deletions
diff --git a/arch/mips/alchemy/common/sleeper.S b/arch/mips/alchemy/common/sleeper.S index 3006e270c8bc..4f4b16741d12 100644 --- a/arch/mips/alchemy/common/sleeper.S +++ b/arch/mips/alchemy/common/sleeper.S | |||
@@ -15,16 +15,17 @@ | |||
15 | #include <asm/regdef.h> | 15 | #include <asm/regdef.h> |
16 | #include <asm/stackframe.h> | 16 | #include <asm/stackframe.h> |
17 | 17 | ||
18 | .extern __flush_cache_all | ||
19 | |||
18 | .text | 20 | .text |
19 | .set macro | 21 | .set noreorder |
20 | .set noat | 22 | .set noat |
21 | .align 5 | 23 | .align 5 |
22 | 24 | ||
23 | /* Save all of the processor general registers and go to sleep. | 25 | /* Save all of the processor general registers and go to sleep. |
24 | * A wakeup condition will get us back here to restore the registers. | 26 | * A wakeup condition will get us back here to restore the registers. |
25 | */ | 27 | */ |
26 | LEAF(save_and_sleep) | 28 | LEAF(au1xxx_save_and_sleep) |
27 | |||
28 | subu sp, PT_SIZE | 29 | subu sp, PT_SIZE |
29 | sw $1, PT_R1(sp) | 30 | sw $1, PT_R1(sp) |
30 | sw $2, PT_R2(sp) | 31 | sw $2, PT_R2(sp) |
@@ -33,14 +34,6 @@ LEAF(save_and_sleep) | |||
33 | sw $5, PT_R5(sp) | 34 | sw $5, PT_R5(sp) |
34 | sw $6, PT_R6(sp) | 35 | sw $6, PT_R6(sp) |
35 | sw $7, PT_R7(sp) | 36 | sw $7, PT_R7(sp) |
36 | sw $8, PT_R8(sp) | ||
37 | sw $9, PT_R9(sp) | ||
38 | sw $10, PT_R10(sp) | ||
39 | sw $11, PT_R11(sp) | ||
40 | sw $12, PT_R12(sp) | ||
41 | sw $13, PT_R13(sp) | ||
42 | sw $14, PT_R14(sp) | ||
43 | sw $15, PT_R15(sp) | ||
44 | sw $16, PT_R16(sp) | 37 | sw $16, PT_R16(sp) |
45 | sw $17, PT_R17(sp) | 38 | sw $17, PT_R17(sp) |
46 | sw $18, PT_R18(sp) | 39 | sw $18, PT_R18(sp) |
@@ -49,12 +42,9 @@ LEAF(save_and_sleep) | |||
49 | sw $21, PT_R21(sp) | 42 | sw $21, PT_R21(sp) |
50 | sw $22, PT_R22(sp) | 43 | sw $22, PT_R22(sp) |
51 | sw $23, PT_R23(sp) | 44 | sw $23, PT_R23(sp) |
52 | sw $24, PT_R24(sp) | ||
53 | sw $25, PT_R25(sp) | ||
54 | sw $26, PT_R26(sp) | 45 | sw $26, PT_R26(sp) |
55 | sw $27, PT_R27(sp) | 46 | sw $27, PT_R27(sp) |
56 | sw $28, PT_R28(sp) | 47 | sw $28, PT_R28(sp) |
57 | sw $29, PT_R29(sp) | ||
58 | sw $30, PT_R30(sp) | 48 | sw $30, PT_R30(sp) |
59 | sw $31, PT_R31(sp) | 49 | sw $31, PT_R31(sp) |
60 | mfc0 k0, CP0_STATUS | 50 | mfc0 k0, CP0_STATUS |
@@ -66,20 +56,26 @@ LEAF(save_and_sleep) | |||
66 | mfc0 k0, CP0_CONFIG | 56 | mfc0 k0, CP0_CONFIG |
67 | sw k0, 0x14(sp) | 57 | sw k0, 0x14(sp) |
68 | 58 | ||
59 | /* flush caches to make sure context is in memory */ | ||
60 | la t1, __flush_cache_all | ||
61 | lw t0, 0(t1) | ||
62 | jalr t0 | ||
63 | nop | ||
64 | |||
69 | /* Now set up the scratch registers so the boot rom will | 65 | /* Now set up the scratch registers so the boot rom will |
70 | * return to this point upon wakeup. | 66 | * return to this point upon wakeup. |
67 | * sys_scratch0 : SP | ||
68 | * sys_scratch1 : RA | ||
71 | */ | 69 | */ |
72 | la k0, 1f | 70 | lui t3, 0xb190 /* sys_xxx */ |
73 | lui k1, 0xb190 | 71 | sw sp, 0x0018(t3) |
74 | ori k1, 0x18 | 72 | la k0, 3f /* resume path */ |
75 | sw sp, 0(k1) | 73 | sw k0, 0x001c(t3) |
76 | ori k1, 0x1c | ||
77 | sw k0, 0(k1) | ||
78 | 74 | ||
79 | /* Put SDRAM into self refresh. Preload instructions into cache, | 75 | /* Put SDRAM into self refresh: Preload instructions into cache, |
80 | * issue a precharge, then auto refresh, then sleep commands to it. | 76 | * issue a precharge, auto/self refresh, then sleep commands to it. |
81 | */ | 77 | */ |
82 | la t0, sdsleep | 78 | la t0, 1f |
83 | .set mips3 | 79 | .set mips3 |
84 | cache 0x14, 0(t0) | 80 | cache 0x14, 0(t0) |
85 | cache 0x14, 32(t0) | 81 | cache 0x14, 32(t0) |
@@ -87,24 +83,57 @@ LEAF(save_and_sleep) | |||
87 | cache 0x14, 96(t0) | 83 | cache 0x14, 96(t0) |
88 | .set mips0 | 84 | .set mips0 |
89 | 85 | ||
90 | sdsleep: | 86 | 1: lui a0, 0xb400 /* mem_xxx */ |
91 | lui k0, 0xb400 | 87 | #if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100) || \ |
92 | sw zero, 0x001c(k0) /* Precharge */ | 88 | defined(CONFIG_SOC_AU1500) |
93 | sw zero, 0x0020(k0) /* Auto refresh */ | 89 | sw zero, 0x001c(a0) /* Precharge */ |
94 | sw zero, 0x0030(k0) /* SDRAM sleep */ | 90 | sync |
91 | sw zero, 0x0020(a0) /* Auto Refresh */ | ||
92 | sync | ||
93 | sw zero, 0x0030(a0) /* Sleep */ | ||
94 | sync | ||
95 | #endif | ||
96 | |||
97 | #if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) | ||
98 | sw zero, 0x08c0(a0) /* Precharge */ | ||
95 | sync | 99 | sync |
100 | sw zero, 0x08d0(a0) /* Self Refresh */ | ||
101 | sync | ||
102 | |||
103 | /* wait for sdram to enter self-refresh mode */ | ||
104 | lui t0, 0x0100 | ||
105 | 2: lw t1, 0x0850(a0) /* mem_sdstat */ | ||
106 | and t2, t1, t0 | ||
107 | beq t2, zero, 2b | ||
108 | nop | ||
96 | 109 | ||
97 | lui k1, 0xb190 | 110 | /* disable SDRAM clocks */ |
98 | sw zero, 0x0078(k1) /* get ready to sleep */ | 111 | lui t0, 0xcfff |
112 | ori t0, t0, 0xffff | ||
113 | lw t1, 0x0840(a0) /* mem_sdconfiga */ | ||
114 | and t1, t0, t1 /* clear CE[1:0] */ | ||
115 | sw t1, 0x0840(a0) /* mem_sdconfiga */ | ||
99 | sync | 116 | sync |
100 | sw zero, 0x007c(k1) /* Put processor to sleep */ | 117 | #endif |
118 | |||
119 | /* put power supply and processor to sleep */ | ||
120 | sw zero, 0x0078(t3) /* sys_slppwr */ | ||
121 | sync | ||
122 | sw zero, 0x007c(t3) /* sys_sleep */ | ||
101 | sync | 123 | sync |
124 | nop | ||
125 | nop | ||
126 | nop | ||
127 | nop | ||
128 | nop | ||
129 | nop | ||
130 | nop | ||
131 | nop | ||
102 | 132 | ||
103 | /* This is where we return upon wakeup. | 133 | /* This is where we return upon wakeup. |
104 | * Reload all of the registers and return. | 134 | * Reload all of the registers and return. |
105 | */ | 135 | */ |
106 | 1: nop | 136 | 3: lw k0, 0x20(sp) |
107 | lw k0, 0x20(sp) | ||
108 | mtc0 k0, CP0_STATUS | 137 | mtc0 k0, CP0_STATUS |
109 | lw k0, 0x1c(sp) | 138 | lw k0, 0x1c(sp) |
110 | mtc0 k0, CP0_CONTEXT | 139 | mtc0 k0, CP0_CONTEXT |
@@ -113,10 +142,11 @@ sdsleep: | |||
113 | lw k0, 0x14(sp) | 142 | lw k0, 0x14(sp) |
114 | mtc0 k0, CP0_CONFIG | 143 | mtc0 k0, CP0_CONFIG |
115 | 144 | ||
116 | /* We need to catch the ealry Alchemy SOCs with | 145 | /* We need to catch the early Alchemy SOCs with |
117 | * the write-only Config[OD] bit and set it back to one... | 146 | * the write-only Config[OD] bit and set it back to one... |
118 | */ | 147 | */ |
119 | jal au1x00_fixup_config_od | 148 | jal au1x00_fixup_config_od |
149 | nop | ||
120 | lw $1, PT_R1(sp) | 150 | lw $1, PT_R1(sp) |
121 | lw $2, PT_R2(sp) | 151 | lw $2, PT_R2(sp) |
122 | lw $3, PT_R3(sp) | 152 | lw $3, PT_R3(sp) |
@@ -124,14 +154,6 @@ sdsleep: | |||
124 | lw $5, PT_R5(sp) | 154 | lw $5, PT_R5(sp) |
125 | lw $6, PT_R6(sp) | 155 | lw $6, PT_R6(sp) |
126 | lw $7, PT_R7(sp) | 156 | lw $7, PT_R7(sp) |
127 | lw $8, PT_R8(sp) | ||
128 | lw $9, PT_R9(sp) | ||
129 | lw $10, PT_R10(sp) | ||
130 | lw $11, PT_R11(sp) | ||
131 | lw $12, PT_R12(sp) | ||
132 | lw $13, PT_R13(sp) | ||
133 | lw $14, PT_R14(sp) | ||
134 | lw $15, PT_R15(sp) | ||
135 | lw $16, PT_R16(sp) | 157 | lw $16, PT_R16(sp) |
136 | lw $17, PT_R17(sp) | 158 | lw $17, PT_R17(sp) |
137 | lw $18, PT_R18(sp) | 159 | lw $18, PT_R18(sp) |
@@ -140,15 +162,11 @@ sdsleep: | |||
140 | lw $21, PT_R21(sp) | 162 | lw $21, PT_R21(sp) |
141 | lw $22, PT_R22(sp) | 163 | lw $22, PT_R22(sp) |
142 | lw $23, PT_R23(sp) | 164 | lw $23, PT_R23(sp) |
143 | lw $24, PT_R24(sp) | ||
144 | lw $25, PT_R25(sp) | ||
145 | lw $26, PT_R26(sp) | 165 | lw $26, PT_R26(sp) |
146 | lw $27, PT_R27(sp) | 166 | lw $27, PT_R27(sp) |
147 | lw $28, PT_R28(sp) | 167 | lw $28, PT_R28(sp) |
148 | lw $29, PT_R29(sp) | ||
149 | lw $30, PT_R30(sp) | 168 | lw $30, PT_R30(sp) |
150 | lw $31, PT_R31(sp) | 169 | lw $31, PT_R31(sp) |
151 | addiu sp, PT_SIZE | ||
152 | |||
153 | jr ra | 170 | jr ra |
154 | END(save_and_sleep) | 171 | addiu sp, PT_SIZE |
172 | END(au1xxx_save_and_sleep) | ||