aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/idle_e500.S
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2008-06-18 17:26:52 -0400
committerKumar Gala <galak@kernel.crashing.org>2008-06-26 02:48:56 -0400
commitfc4033b2f8b1482022bff3d05505a1b1631bb6de (patch)
treec84b275968011911d8c96acebe89aa2dd92323bf /arch/powerpc/kernel/idle_e500.S
parent3dfa8773674e16f95f70a0e631e80c69390d04d7 (diff)
powerpc/85xx: add DOZE/NAP support for e500 core
The e500 core enter DOZE/NAP power-saving modes when the core go to cpu_idle routine. The power management default running mode is DOZE, If the user echo 1 > /proc/sys/kernel/powersave-nap the system will change to NAP running mode. Signed-off-by: Dave Liu <daveliu@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/idle_e500.S')
-rw-r--r--arch/powerpc/kernel/idle_e500.S84
1 files changed, 84 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/idle_e500.S b/arch/powerpc/kernel/idle_e500.S
new file mode 100644
index 000000000000..267adec2491b
--- /dev/null
+++ b/arch/powerpc/kernel/idle_e500.S
@@ -0,0 +1,84 @@
1/*
2 * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved.
3 * Dave Liu <daveliu@freescale.com>
4 * copy from idle_6xx.S and modify for e500 based processor,
5 * implement the power_save function in idle.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
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 rlwinm r3,r1,0,0,31-THREAD_SHIFT /* current thread_info */
25 lwz r4,TI_LOCAL_FLAGS(r3) /* set napping bit */
26 ori r4,r4,_TLF_NAPPING /* so when we take an exception */
27 stw r4,TI_LOCAL_FLAGS(r3) /* it will return to our caller */
28
29 /* Check if we can nap or doze, put HID0 mask in r3 */
30 lis r3,0
31BEGIN_FTR_SECTION
32 lis r3,HID0_DOZE@h
33END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
34
35BEGIN_FTR_SECTION
36 /* Now check if user enabled NAP mode */
37 lis r4,powersave_nap@ha
38 lwz r4,powersave_nap@l(r4)
39 cmpwi 0,r4,0
40 beq 1f
41 stwu r1,-16(r1)
42 mflr r0
43 stw r0,20(r1)
44 bl flush_dcache_L1
45 lwz r0,20(r1)
46 addi r1,r1,16
47 mtlr r0
48 lis r3,HID0_NAP@h
49END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
501:
51 /* Go to NAP or DOZE now */
52 mfspr r4,SPRN_HID0
53 rlwinm r4,r4,0,~(HID0_DOZE|HID0_NAP|HID0_SLEEP)
54 or r4,r4,r3
55 isync
56 mtspr SPRN_HID0,r4
57 isync
58
59 mfmsr r7
60 oris r7,r7,MSR_WE@h
61 ori r7,r7,MSR_EE
62 msync
63 mtmsr r7
64 isync
652: b 2b
66
67/*
68 * Return from NAP/DOZE mode, restore some CPU specific registers,
69 * r2 containing physical address of current.
70 * r11 points to the exception frame (physical address).
71 * We have to preserve r10.
72 */
73_GLOBAL(power_save_ppc32_restore)
74 lwz r9,_LINK(r11) /* interrupted in e500_idle */
75 stw r9,_NIP(r11) /* make it do a blr */
76
77#ifdef CONFIG_SMP
78 mfspr r12,SPRN_SPRG3
79 lwz r11,TI_CPU(r12) /* get cpu number * 4 */
80 slwi r11,r11,2
81#else
82 li r11,0
83#endif
84 b transfer_to_handler_cont