2 * arch/sh/kernel/cpu/sh4a/sleep-sh_mobile.S
4 * Sleep mode and Standby modes support for SuperH Mobile
6 * Copyright (C) 2009 Magnus Damm
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
13 #include <linux/sys.h>
14 #include <linux/errno.h>
15 #include <linux/linkage.h>
16 #include <asm/asm-offsets.h>
17 #include <asm/suspend.h>
20 * Kernel mode register usage, see entry.S:
29 /* manage self-refresh and enter standby mode.
30 * this code will be copied to on-chip memory and executed from there.
34 ENTRY(sh_mobile_standby)
36 /* save original vbr */
41 /* point vbr to our on-chip memory page */
44 /* save return address */
58 /* put mode flags in r0 */
63 #ifdef CONFIG_CPU_SUBTYPE_SH7724
64 /* DBSC: put memory in self-refresh mode */
69 mov.l dbrfpdn0_reg, r4
70 mov.l dbrfpdn0_data0, r1
73 mov.l dbcmdcnt_reg, r4
74 mov.l dbcmdcnt_data0, r1
77 mov.l dbcmdcnt_reg, r4
78 mov.l dbcmdcnt_data1, r1
81 mov.l dbrfpdn0_reg, r4
82 mov.l dbrfpdn0_data1, r1
85 /* SBSC: disable power down and put in self-refresh mode */
96 tst #SUSP_SH_STANDBY, r0
99 /* set mode to "software standby mode" */
104 tst #SUSP_SH_RSTANDBY, r0
107 /* set mode to "r-standby mode" */
112 tst #SUSP_SH_USTANDBY, r0
115 /* set mode to "u-standby mode" */
121 /* set mode to "sleep mode" */
125 /* setup and enter selected standby mode */
134 /* setup spc with return address to c code */
142 /* setup ssr with saved sr */
150 /* reset standby mode to sleep mode */
158 #ifdef CONFIG_CPU_SUBTYPE_SH7724
159 /* DBSC: put memory in auto-refresh mode */
160 mov.l dbrfpdn0_reg, k4
161 mov.l dbrfpdn0_data0, k1
164 nop /* sleep 140 ns */
169 mov.l dbcmdcnt_reg, k4
170 mov.l dbcmdcnt_data0, k1
173 mov.l dbcmdcnt_reg, k4
174 mov.l dbcmdcnt_data1, k1
181 mov.l dbrfpdn0_reg, k4
182 mov.l dbrfpdn0_data2, k1
185 /* SBSC: set auto-refresh mode */
201 /* jump to vbr vector */
213 offset_vbr: .long 0x600
214 #ifdef CONFIG_CPU_SUBTYPE_SH7724
215 dben_reg: .long 0xfd000010 /* DBEN */
218 dbrfpdn0_reg: .long 0xfd000040 /* DBRFPDN0 */
219 dbrfpdn0_data0: .long 0
220 dbrfpdn0_data1: .long 1
221 dbrfpdn0_data2: .long 0x00010000
222 dbcmdcnt_reg: .long 0xfd000014 /* DBCMDCNT */
223 dbcmdcnt_data0: .long 2
224 dbcmdcnt_data1: .long 4
226 1: .long 0xfe400008 /* SDCR0 */
231 5: .long 0xa4150020 /* STBCR */
232 6: .long 0xfe40001c /* RTCOR */
233 7: .long 0xfe400018 /* RTCNT */
237 /* interrupt vector @ 0x600 */
238 .balign 0x400,0,0x400
240 .balign 0x200,0,0x200
243 sh_mobile_standby_end:
245 ENTRY(sh_mobile_standby_size)
246 .long sh_mobile_standby_end - sh_mobile_standby