0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <linux/threads.h>
0013 #include <asm/reg.h>
0014 #include <asm/page.h>
0015 #include <asm/cputable.h>
0016 #include <asm/thread_info.h>
0017 #include <asm/ppc_asm.h>
0018 #include <asm/asm-offsets.h>
0019 #include <asm/feature-fixups.h>
0020
0021 .text
0022
0023
0024
0025
0026
0027
0028
0029 _GLOBAL(init_idle_6xx)
0030 BEGIN_FTR_SECTION
0031 mfspr r4,SPRN_HID0
0032 rlwinm r4,r4,0,10,8
0033 mtspr SPRN_HID0, r4
0034 b 1f
0035 END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
0036 blr
0037 1:
0038 slwi r5,r24,2
0039 add r5,r5,r3
0040 BEGIN_FTR_SECTION
0041 mfspr r4,SPRN_MSSCR0
0042 addis r6,r5, nap_save_msscr0@ha
0043 stw r4,nap_save_msscr0@l(r6)
0044 END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
0045 BEGIN_FTR_SECTION
0046 mfspr r4,SPRN_HID1
0047 addis r6,r5,nap_save_hid1@ha
0048 stw r4,nap_save_hid1@l(r6)
0049 END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
0050 blr
0051
0052
0053
0054
0055
0056
0057 _GLOBAL(ppc6xx_idle)
0058
0059
0060 lis r3, 0
0061 BEGIN_FTR_SECTION
0062 lis r3,HID0_DOZE@h
0063 END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
0064 BEGIN_FTR_SECTION
0065
0066
0067
0068 lis r4,cur_cpu_spec@ha
0069 lwz r4,cur_cpu_spec@l(r4)
0070 lwz r4,CPU_SPEC_FEATURES(r4)
0071 andi. r0,r4,CPU_FTR_CAN_NAP
0072 beq 1f
0073
0074 lis r4,powersave_nap@ha
0075 lwz r4,powersave_nap@l(r4)
0076 cmpwi 0,r4,0
0077 beq 1f
0078 lis r3,HID0_NAP@h
0079 1:
0080 END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
0081 cmpwi 0,r3,0
0082 beqlr
0083
0084
0085 andis. r0,r3,HID0_NAP@h
0086 beq 2f
0087 BEGIN_FTR_SECTION
0088
0089
0090
0091
0092
0093
0094 mfspr r4,SPRN_MSSCR0
0095 rlwinm r4,r4,0,0,29
0096 sync
0097 mtspr SPRN_MSSCR0,r4
0098 sync
0099 isync
0100 lis r4,KERNELBASE@h
0101 dcbf 0,r4
0102 dcbf 0,r4
0103 dcbf 0,r4
0104 dcbf 0,r4
0105 END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
0106 2:
0107 BEGIN_FTR_SECTION
0108
0109 lis r4,powersave_lowspeed@ha
0110 lwz r4,powersave_lowspeed@l(r4)
0111 cmpwi 0,r4,0
0112 beq 1f
0113 mfspr r4,SPRN_HID1
0114 oris r4,r4,0x0001
0115 mtspr SPRN_HID1,r4
0116 1:
0117 END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
0118
0119
0120 mfspr r4,SPRN_HID0
0121 lis r5,(HID0_NAP|HID0_SLEEP)@h
0122 BEGIN_FTR_SECTION
0123 oris r5,r5,HID0_DOZE@h
0124 END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
0125 andc r4,r4,r5
0126 or r4,r4,r3
0127 BEGIN_FTR_SECTION
0128 oris r4,r4,HID0_DPM@h
0129 END_FTR_SECTION_IFCLR(CPU_FTR_NO_DPM)
0130 mtspr SPRN_HID0,r4
0131 BEGIN_FTR_SECTION
0132 PPC_DSSALL
0133 sync
0134 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
0135 lwz r8,TI_LOCAL_FLAGS(r2)
0136 ori r8,r8,_TLF_NAPPING
0137 stw r8,TI_LOCAL_FLAGS(r2)
0138 mfmsr r7
0139 ori r7,r7,MSR_EE
0140 oris r7,r7,MSR_POW@h
0141 1: sync
0142 mtmsr r7
0143 isync
0144 b 1b
0145
0146
0147
0148
0149
0150 _GLOBAL(power_save_ppc32_restore)
0151 lwz r9,_LINK(r11)
0152 stw r9,_NIP(r11)
0153
0154 #ifdef CONFIG_SMP
0155 lwz r11,TASK_CPU(r2)
0156 slwi r11,r11,2
0157 #else
0158 li r11,0
0159 #endif
0160
0161
0162
0163 BEGIN_FTR_SECTION
0164 mfspr r9,SPRN_HID0
0165 andis. r9,r9,HID0_NAP@h
0166 beq 1f
0167 addis r9, r11, nap_save_msscr0@ha
0168 lwz r9,nap_save_msscr0@l(r9)
0169 mtspr SPRN_MSSCR0, r9
0170 sync
0171 isync
0172 1:
0173 END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
0174 BEGIN_FTR_SECTION
0175 addis r9, r11, nap_save_hid1@ha
0176 lwz r9,nap_save_hid1@l(r9)
0177 mtspr SPRN_HID1, r9
0178 END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
0179 blr
0180 _ASM_NOKPROBE_SYMBOL(power_save_ppc32_restore)
0181
0182 .data
0183
0184 _GLOBAL(nap_save_msscr0)
0185 .space 4*NR_CPUS
0186
0187 _GLOBAL(nap_save_hid1)
0188 .space 4*NR_CPUS
0189
0190 _GLOBAL(powersave_lowspeed)
0191 .long 0