1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#include <linux/threads.h>
17#include <asm/reg.h>
18#include <asm/page.h>
19#include <asm/cputable.h>
20#include <asm/thread_info.h>
21#include <asm/ppc_asm.h>
22#include <asm/asm-offsets.h>
23
24 .text
25
26
27
28
29
30
31
32_GLOBAL(init_idle_6xx)
33BEGIN_FTR_SECTION
34 mfspr r4,SPRN_HID0
35 rlwinm r4,r4,0,10,8
36 mtspr SPRN_HID0, r4
37 b 1f
38END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
39 blr
401:
41 slwi r5,r24,2
42 add r5,r5,r3
43BEGIN_FTR_SECTION
44 mfspr r4,SPRN_MSSCR0
45 addis r6,r5, nap_save_msscr0@ha
46 stw r4,nap_save_msscr0@l(r6)
47END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
48BEGIN_FTR_SECTION
49 mfspr r4,SPRN_HID1
50 addis r6,r5,nap_save_hid1@ha
51 stw r4,nap_save_hid1@l(r6)
52END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
53 blr
54
55
56
57
58
59
60_GLOBAL(ppc6xx_idle)
61
62
63 lis r3, 0
64BEGIN_FTR_SECTION
65 lis r3,HID0_DOZE@h
66END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
67BEGIN_FTR_SECTION
68
69
70
71 lis r4,cur_cpu_spec@ha
72 lwz r4,cur_cpu_spec@l(r4)
73 lwz r4,CPU_SPEC_FEATURES(r4)
74 andi. r0,r4,CPU_FTR_CAN_NAP
75 beq 1f
76
77 lis r4,powersave_nap@ha
78 lwz r4,powersave_nap@l(r4)
79 cmpwi 0,r4,0
80 beq 1f
81 lis r3,HID0_NAP@h
821:
83END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
84 cmpwi 0,r3,0
85 beqlr
86
87
88 andis. r0,r3,HID0_NAP@h
89 beq 2f
90BEGIN_FTR_SECTION
91
92
93
94
95
96
97 mfspr r4,SPRN_MSSCR0
98 rlwinm r4,r4,0,0,29
99 sync
100 mtspr SPRN_MSSCR0,r4
101 sync
102 isync
103 lis r4,KERNELBASE@h
104 dcbf 0,r4
105 dcbf 0,r4
106 dcbf 0,r4
107 dcbf 0,r4
108END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
1092:
110BEGIN_FTR_SECTION
111
112 lis r4,powersave_lowspeed@ha
113 lwz r4,powersave_lowspeed@l(r4)
114 cmpwi 0,r4,0
115 beq 1f
116 mfspr r4,SPRN_HID1
117 oris r4,r4,0x0001
118 mtspr SPRN_HID1,r4
1191:
120END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
121
122
123 mfspr r4,SPRN_HID0
124 lis r5,(HID0_NAP|HID0_SLEEP)@h
125BEGIN_FTR_SECTION
126 oris r5,r5,HID0_DOZE@h
127END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
128 andc r4,r4,r5
129 or r4,r4,r3
130BEGIN_FTR_SECTION
131 oris r4,r4,HID0_DPM@h
132END_FTR_SECTION_IFCLR(CPU_FTR_NO_DPM)
133 mtspr SPRN_HID0,r4
134BEGIN_FTR_SECTION
135 DSSALL
136 sync
137END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
138 CURRENT_THREAD_INFO(r9, r1)
139 lwz r8,TI_LOCAL_FLAGS(r9)
140 ori r8,r8,_TLF_NAPPING
141 stw r8,TI_LOCAL_FLAGS(r9)
142 mfmsr r7
143 ori r7,r7,MSR_EE
144 oris r7,r7,MSR_POW@h
1451: sync
146 mtmsr r7
147 isync
148 b 1b
149
150
151
152
153
154
155
156_GLOBAL(power_save_ppc32_restore)
157 lwz r9,_LINK(r11)
158 stw r9,_NIP(r11)
159
160#ifdef CONFIG_SMP
161 CURRENT_THREAD_INFO(r12, r11)
162 lwz r11,TI_CPU(r12)
163 slwi r11,r11,2
164#else
165 li r11,0
166#endif
167
168
169
170BEGIN_FTR_SECTION
171 mfspr r9,SPRN_HID0
172 andis. r9,r9,HID0_NAP@h
173 beq 1f
174 addis r9,r11,(nap_save_msscr0-KERNELBASE)@ha
175 lwz r9,nap_save_msscr0@l(r9)
176 mtspr SPRN_MSSCR0, r9
177 sync
178 isync
1791:
180END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
181BEGIN_FTR_SECTION
182 addis r9,r11,(nap_save_hid1-KERNELBASE)@ha
183 lwz r9,nap_save_hid1@l(r9)
184 mtspr SPRN_HID1, r9
185END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
186 b transfer_to_handler_cont
187
188 .data
189
190_GLOBAL(nap_save_msscr0)
191 .space 4*NR_CPUS
192
193_GLOBAL(nap_save_hid1)
194 .space 4*NR_CPUS
195
196_GLOBAL(powersave_lowspeed)
197 .long 0
198