1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#include <linux/linkage.h>
18
19#include <asm/assembler.h>
20#include <asm/asm-offsets.h>
21
22#include "fuse.h"
23#include "sleep.h"
24#include "flowctrl.h"
25
26#define TEGRA30_POWER_HOTPLUG_SHUTDOWN (1 << 27)
27
28
29
30
31
32
33
34
35ENTRY(tegra30_hotplug_shutdown)
36
37 mov r0,
38 bl tegra30_cpu_shutdown
39 mov pc, lr @ should never get here
40ENDPROC(tegra30_hotplug_shutdown)
41
42
43
44
45
46
47
48
49
50
51ENTRY(tegra30_cpu_shutdown)
52 cpu_id r3
53 tegra_get_soc_id TEGRA_APB_MISC_VIRT, r10
54 cmp r10,
55 bne _no_cpu0_chk @ It's not Tegra30
56
57 cmp r3,
58 moveq pc, lr @ Must never be called for CPU 0
59_no_cpu0_chk:
60
61 ldr r12, =TEGRA_FLOW_CTRL_VIRT
62 cpu_to_csr_reg r1, r3
63 add r1, r1, r12 @ virtual CSR address for this CPU
64 cpu_to_halt_reg r2, r3
65 add r2, r2, r12 @ virtual HALT_EVENTS address for this CPU
66
67
68
69
70
71 movw r12, \
72 FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG | \
73 FLOW_CTRL_CSR_ENABLE
74 cmp r10,
75 moveq r4,
76 movne r4,
77 ARM( orr r12, r12, r4, lsl r3 )
78 THUMB( lsl r4, r4, r3 )
79 THUMB( orr r12, r12, r4 )
80 str r12, [r1]
81
82
83 mov r3,
84delay_1:
85 subs r3, r3,
86 bge delay_1;
87 cpsid a @ disable imprecise aborts.
88 ldr r3, [r1] @ read CSR
89 str r3, [r1] @ clear CSR
90
91 tst r0,
92 beq flow_ctrl_setting_for_lp2
93
94
95 mov r3,
96 b flow_ctrl_done
97flow_ctrl_setting_for_lp2:
98
99 cmp r10,
100 moveq r3,
101 movne r3,
102flow_ctrl_done:
103 cmp r10,
104 str r3, [r2]
105 ldr r0, [r2]
106 b wfe_war
107
108__cpu_reset_again:
109 dsb
110 .align 5
111 wfeeq @ CPU should be power gated here
112 wfine
113wfe_war:
114 b __cpu_reset_again
115
116
117
118
119
120 .rept 38
121 nop
122 .endr
123 b . @ should never get here
124
125ENDPROC(tegra30_cpu_shutdown)
126#endif
127
128#ifdef CONFIG_PM_SLEEP
129
130
131
132
133
134ENTRY(tegra30_sleep_cpu_secondary_finish)
135 mov r7, lr
136
137
138 bl tegra_disable_clean_inv_dcache
139
140
141 mov r0,
142 bl tegra30_cpu_shutdown
143 mov r0,
144 mov pc, r7
145ENDPROC(tegra30_sleep_cpu_secondary_finish)
146
147
148
149
150
151
152ENTRY(tegra30_tear_down_cpu)
153 mov32 r6, TEGRA_FLOW_CTRL_BASE
154
155 b tegra30_enter_sleep
156ENDPROC(tegra30_tear_down_cpu)
157
158
159
160
161
162
163
164
165
166tegra30_enter_sleep:
167 cpu_id r1
168
169 cpu_to_csr_reg r2, r1
170 ldr r0, [r6, r2]
171 orr r0, r0,
172 orr r0, r0,
173 str r0, [r6, r2]
174
175 mov r0,
176 orr r0, r0,
177 cpu_to_halt_reg r2, r1
178 str r0, [r6, r2]
179 dsb
180 ldr r0, [r6, r2]
181
182halted:
183 isb
184 dsb
185 wfi
186
187
188 b halted
189
190#endif
191