diff options
Diffstat (limited to 'arch/sh/kernel/cpu/shmobile/sleep.S')
-rw-r--r-- | arch/sh/kernel/cpu/shmobile/sleep.S | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/arch/sh/kernel/cpu/shmobile/sleep.S b/arch/sh/kernel/cpu/shmobile/sleep.S new file mode 100644 index 000000000000..5d888ef53d82 --- /dev/null +++ b/arch/sh/kernel/cpu/shmobile/sleep.S | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * arch/sh/kernel/cpu/sh4a/sleep-sh_mobile.S | ||
3 | * | ||
4 | * Sleep mode and Standby modes support for SuperH Mobile | ||
5 | * | ||
6 | * Copyright (C) 2009 Magnus Damm | ||
7 | * | ||
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 | ||
10 | * for more details. | ||
11 | */ | ||
12 | |||
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> | ||
18 | |||
19 | /* manage self-refresh and enter standby mode. | ||
20 | * this code will be copied to on-chip memory and executed from there. | ||
21 | */ | ||
22 | |||
23 | .balign 4096,0,4096 | ||
24 | ENTRY(sh_mobile_standby) | ||
25 | mov r4, r0 | ||
26 | |||
27 | tst #SUSP_SH_SF, r0 | ||
28 | bt skip_set_sf | ||
29 | |||
30 | /* SDRAM: disable power down and put in self-refresh mode */ | ||
31 | mov.l 1f, r4 | ||
32 | mov.l 2f, r1 | ||
33 | mov.l @r4, r2 | ||
34 | or r1, r2 | ||
35 | mov.l 3f, r3 | ||
36 | and r3, r2 | ||
37 | mov.l r2, @r4 | ||
38 | |||
39 | skip_set_sf: | ||
40 | tst #SUSP_SH_SLEEP, r0 | ||
41 | bt test_standby | ||
42 | |||
43 | /* set mode to "sleep mode" */ | ||
44 | bra do_sleep | ||
45 | mov #0x00, r1 | ||
46 | |||
47 | test_standby: | ||
48 | tst #SUSP_SH_STANDBY, r0 | ||
49 | bt test_rstandby | ||
50 | |||
51 | /* set mode to "software standby mode" */ | ||
52 | bra do_sleep | ||
53 | mov #0x80, r1 | ||
54 | |||
55 | test_rstandby: | ||
56 | tst #SUSP_SH_RSTANDBY, r0 | ||
57 | bt test_ustandby | ||
58 | |||
59 | /* set mode to "r-standby mode" */ | ||
60 | bra do_sleep | ||
61 | mov #0x20, r1 | ||
62 | |||
63 | test_ustandby: | ||
64 | tst #SUSP_SH_USTANDBY, r0 | ||
65 | bt done_sleep | ||
66 | |||
67 | /* set mode to "u-standby mode" */ | ||
68 | mov #0x10, r1 | ||
69 | |||
70 | /* fall-through */ | ||
71 | |||
72 | do_sleep: | ||
73 | /* setup and enter selected standby mode */ | ||
74 | mov.l 5f, r4 | ||
75 | mov.l r1, @r4 | ||
76 | sleep | ||
77 | |||
78 | done_sleep: | ||
79 | /* reset standby mode to sleep mode */ | ||
80 | mov.l 5f, r4 | ||
81 | mov #0x00, r1 | ||
82 | mov.l r1, @r4 | ||
83 | |||
84 | tst #SUSP_SH_SF, r0 | ||
85 | bt skip_restore_sf | ||
86 | |||
87 | /* SDRAM: set auto-refresh mode */ | ||
88 | mov.l 1f, r4 | ||
89 | mov.l @r4, r2 | ||
90 | mov.l 4f, r3 | ||
91 | and r3, r2 | ||
92 | mov.l r2, @r4 | ||
93 | mov.l 6f, r4 | ||
94 | mov.l 7f, r1 | ||
95 | mov.l 8f, r2 | ||
96 | mov.l @r4, r3 | ||
97 | mov #-1, r4 | ||
98 | add r4, r3 | ||
99 | or r2, r3 | ||
100 | mov.l r3, @r1 | ||
101 | skip_restore_sf: | ||
102 | rts | ||
103 | nop | ||
104 | |||
105 | .balign 4 | ||
106 | 1: .long 0xfe400008 /* SDCR0 */ | ||
107 | 2: .long 0x00000400 | ||
108 | 3: .long 0xffff7fff | ||
109 | 4: .long 0xfffffbff | ||
110 | 5: .long 0xa4150020 /* STBCR */ | ||
111 | 6: .long 0xfe40001c /* RTCOR */ | ||
112 | 7: .long 0xfe400018 /* RTCNT */ | ||
113 | 8: .long 0xa55a0000 | ||
114 | |||
115 | /* interrupt vector @ 0x600 */ | ||
116 | .balign 0x400,0,0x400 | ||
117 | .long 0xdeadbeef | ||
118 | .balign 0x200,0,0x200 | ||
119 | /* sh7722 will end up here in sleep mode */ | ||
120 | rte | ||
121 | nop | ||
122 | sh_mobile_standby_end: | ||
123 | |||
124 | ENTRY(sh_mobile_standby_size) | ||
125 | .long sh_mobile_standby_end - sh_mobile_standby | ||