1
2
3
4
5
6
7
8
9
10
11
12
13#include <linux/threads.h>
14#include <asm/reg.h>
15#include <asm/page.h>
16#include <asm/cputable.h>
17#include <asm/thread_info.h>
18#include <asm/ppc_asm.h>
19#include <asm/asm-offsets.h>
20
21 .text
22
23_GLOBAL(e500_idle)
24 CURRENT_THREAD_INFO(r3, r1)
25 lwz r4,TI_LOCAL_FLAGS(r3)
26 ori r4,r4,_TLF_NAPPING
27 stw r4,TI_LOCAL_FLAGS(r3)
28
29#ifdef CONFIG_PPC_E500MC
30 wrteei 1
311: wait
32
33
34
35
36
37
38 b 1b
39#else
40
41 lis r3,0
42BEGIN_FTR_SECTION
43 lis r3,HID0_DOZE@h
44END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
45
46BEGIN_FTR_SECTION
47
48 lis r4,powersave_nap@ha
49 lwz r4,powersave_nap@l(r4)
50 cmpwi 0,r4,0
51 beq 1f
52 stwu r1,-16(r1)
53 mflr r0
54 stw r0,20(r1)
55 bl flush_dcache_L1
56 lwz r0,20(r1)
57 addi r1,r1,16
58 mtlr r0
59 lis r3,HID0_NAP@h
60END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
61BEGIN_FTR_SECTION
62 msync
63 li r7,L2CSR0_L2FL@l
64 mtspr SPRN_L2CSR0,r7
652:
66 mfspr r7,SPRN_L2CSR0
67 andi. r4,r7,L2CSR0_L2FL@l
68 bne 2b
69END_FTR_SECTION_IFSET(CPU_FTR_L2CSR|CPU_FTR_CAN_NAP)
701:
71
72 mfspr r4,SPRN_HID0
73 rlwinm r4,r4,0,~(HID0_DOZE|HID0_NAP|HID0_SLEEP)
74 or r4,r4,r3
75 isync
76 mtspr SPRN_HID0,r4
77 isync
78
79 mfmsr r7
80 oris r7,r7,MSR_WE@h
81 ori r7,r7,MSR_EE
82 msync
83 mtmsr r7
84 isync
852: b 2b
86#endif
87
88
89
90
91
92
93
94_GLOBAL(power_save_ppc32_restore)
95 lwz r9,_LINK(r11)
96 stw r9,_NIP(r11)
97
98#ifdef CONFIG_SMP
99 CURRENT_THREAD_INFO(r12, r1)
100 lwz r11,TI_CPU(r12)
101 slwi r11,r11,2
102#else
103 li r11,0
104#endif
105
106 b transfer_to_handler_cont
107