diff options
author | Magnus Damm <damm@igel.co.jp> | 2009-08-14 22:53:42 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-08-14 23:58:50 -0400 |
commit | 237674e050ae8ea40a432412df6c15d60b7ae8a6 (patch) | |
tree | bfd871566047c1e33870e753444a7b7db2257a38 | |
parent | 9747e78b304b44d6fb73e2c8071406d55aa8bb75 (diff) |
sh: sh7724 ddr self-refresh changes
This patch updates the SuperH Mobile sleep assembly code with
support for DBSC memory controller found in the sh7724 processor.
Without this fix the memory hooked up to the sh7724 processor
will never enter self-refresh mode before suspending to ram. The
effect of this is that the memory contents most likeley will be
lost upon resume which may or may not be what you want.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/kernel/cpu/shmobile/sleep.S | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/arch/sh/kernel/cpu/shmobile/sleep.S b/arch/sh/kernel/cpu/shmobile/sleep.S index 5d888ef53d82..baf2d7d46b05 100644 --- a/arch/sh/kernel/cpu/shmobile/sleep.S +++ b/arch/sh/kernel/cpu/shmobile/sleep.S | |||
@@ -26,8 +26,30 @@ ENTRY(sh_mobile_standby) | |||
26 | 26 | ||
27 | tst #SUSP_SH_SF, r0 | 27 | tst #SUSP_SH_SF, r0 |
28 | bt skip_set_sf | 28 | bt skip_set_sf |
29 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 | ||
30 | /* DBSC: put memory in self-refresh mode */ | ||
29 | 31 | ||
30 | /* SDRAM: disable power down and put in self-refresh mode */ | 32 | mov.l dben_reg, r4 |
33 | mov.l dben_data0, r1 | ||
34 | mov.l r1, @r4 | ||
35 | |||
36 | mov.l dbrfpdn0_reg, r4 | ||
37 | mov.l dbrfpdn0_data0, r1 | ||
38 | mov.l r1, @r4 | ||
39 | |||
40 | mov.l dbcmdcnt_reg, r4 | ||
41 | mov.l dbcmdcnt_data0, r1 | ||
42 | mov.l r1, @r4 | ||
43 | |||
44 | mov.l dbcmdcnt_reg, r4 | ||
45 | mov.l dbcmdcnt_data1, r1 | ||
46 | mov.l r1, @r4 | ||
47 | |||
48 | mov.l dbrfpdn0_reg, r4 | ||
49 | mov.l dbrfpdn0_data1, r1 | ||
50 | mov.l r1, @r4 | ||
51 | #else | ||
52 | /* SBSC: disable power down and put in self-refresh mode */ | ||
31 | mov.l 1f, r4 | 53 | mov.l 1f, r4 |
32 | mov.l 2f, r1 | 54 | mov.l 2f, r1 |
33 | mov.l @r4, r2 | 55 | mov.l @r4, r2 |
@@ -35,6 +57,7 @@ ENTRY(sh_mobile_standby) | |||
35 | mov.l 3f, r3 | 57 | mov.l 3f, r3 |
36 | and r3, r2 | 58 | and r3, r2 |
37 | mov.l r2, @r4 | 59 | mov.l r2, @r4 |
60 | #endif | ||
38 | 61 | ||
39 | skip_set_sf: | 62 | skip_set_sf: |
40 | tst #SUSP_SH_SLEEP, r0 | 63 | tst #SUSP_SH_SLEEP, r0 |
@@ -84,7 +107,36 @@ done_sleep: | |||
84 | tst #SUSP_SH_SF, r0 | 107 | tst #SUSP_SH_SF, r0 |
85 | bt skip_restore_sf | 108 | bt skip_restore_sf |
86 | 109 | ||
87 | /* SDRAM: set auto-refresh mode */ | 110 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 |
111 | /* DBSC: put memory in auto-refresh mode */ | ||
112 | |||
113 | mov.l dbrfpdn0_reg, r4 | ||
114 | mov.l dbrfpdn0_data0, r1 | ||
115 | mov.l r1, @r4 | ||
116 | |||
117 | /* sleep 140 ns */ | ||
118 | nop | ||
119 | nop | ||
120 | nop | ||
121 | nop | ||
122 | |||
123 | mov.l dbcmdcnt_reg, r4 | ||
124 | mov.l dbcmdcnt_data0, r1 | ||
125 | mov.l r1, @r4 | ||
126 | |||
127 | mov.l dbcmdcnt_reg, r4 | ||
128 | mov.l dbcmdcnt_data1, r1 | ||
129 | mov.l r1, @r4 | ||
130 | |||
131 | mov.l dben_reg, r4 | ||
132 | mov.l dben_data1, r1 | ||
133 | mov.l r1, @r4 | ||
134 | |||
135 | mov.l dbrfpdn0_reg, r4 | ||
136 | mov.l dbrfpdn0_data2, r1 | ||
137 | mov.l r1, @r4 | ||
138 | #else | ||
139 | /* SBSC: set auto-refresh mode */ | ||
88 | mov.l 1f, r4 | 140 | mov.l 1f, r4 |
89 | mov.l @r4, r2 | 141 | mov.l @r4, r2 |
90 | mov.l 4f, r3 | 142 | mov.l 4f, r3 |
@@ -98,15 +150,29 @@ done_sleep: | |||
98 | add r4, r3 | 150 | add r4, r3 |
99 | or r2, r3 | 151 | or r2, r3 |
100 | mov.l r3, @r1 | 152 | mov.l r3, @r1 |
153 | #endif | ||
101 | skip_restore_sf: | 154 | skip_restore_sf: |
102 | rts | 155 | rts |
103 | nop | 156 | nop |
104 | 157 | ||
105 | .balign 4 | 158 | .balign 4 |
159 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 | ||
160 | dben_reg: .long 0xfd000010 /* DBEN */ | ||
161 | dben_data0: .long 0 | ||
162 | dben_data1: .long 1 | ||
163 | dbrfpdn0_reg: .long 0xfd000040 /* DBRFPDN0 */ | ||
164 | dbrfpdn0_data0: .long 0 | ||
165 | dbrfpdn0_data1: .long 1 | ||
166 | dbrfpdn0_data2: .long 0x00010000 | ||
167 | dbcmdcnt_reg: .long 0xfd000014 /* DBCMDCNT */ | ||
168 | dbcmdcnt_data0: .long 2 | ||
169 | dbcmdcnt_data1: .long 4 | ||
170 | #else | ||
106 | 1: .long 0xfe400008 /* SDCR0 */ | 171 | 1: .long 0xfe400008 /* SDCR0 */ |
107 | 2: .long 0x00000400 | 172 | 2: .long 0x00000400 |
108 | 3: .long 0xffff7fff | 173 | 3: .long 0xffff7fff |
109 | 4: .long 0xfffffbff | 174 | 4: .long 0xfffffbff |
175 | #endif | ||
110 | 5: .long 0xa4150020 /* STBCR */ | 176 | 5: .long 0xa4150020 /* STBCR */ |
111 | 6: .long 0xfe40001c /* RTCOR */ | 177 | 6: .long 0xfe40001c /* RTCOR */ |
112 | 7: .long 0xfe400018 /* RTCNT */ | 178 | 7: .long 0xfe400018 /* RTCNT */ |