aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra/sleep-tegra30.S
diff options
context:
space:
mode:
authorJoseph Lo <josephl@nvidia.com>2012-10-07 20:23:57 -0400
committerStephen Warren <swarren@nvidia.com>2012-11-15 17:09:01 -0500
commit641b4ef8f1fea88803cc1ff3f34d93ba6bcd8106 (patch)
treeb520356b0fad5bd8d33b8cadddf7a9e7d2d50ad1 /arch/arm/mach-tegra/sleep-tegra30.S
parentd5db9a44229058ddfe4773aaefa5a465344d7b10 (diff)
ARM: tegra: rename the file of "sleep-tXX" to "sleep-tegraXX"
For the naming consistency under the mach-tegra, we re-name the file of "sleep-tXX" to "sleep-tegraXX" (e.g., sleep-t30 to sleep-tegra30). Signed-off-by: Joseph Lo <josephl@nvidia.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/sleep-tegra30.S')
-rw-r--r--arch/arm/mach-tegra/sleep-tegra30.S105
1 files changed, 105 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/sleep-tegra30.S b/arch/arm/mach-tegra/sleep-tegra30.S
new file mode 100644
index 000000000000..be7614b7c5cb
--- /dev/null
+++ b/arch/arm/mach-tegra/sleep-tegra30.S
@@ -0,0 +1,105 @@
1/*
2 * Copyright (c) 2012, NVIDIA Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/linkage.h>
18
19#include <asm/assembler.h>
20
21#include "sleep.h"
22#include "flowctrl.h"
23
24#define TEGRA30_POWER_HOTPLUG_SHUTDOWN (1 << 27) /* Hotplug shutdown */
25
26#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PM_SLEEP)
27/*
28 * tegra30_hotplug_shutdown(void)
29 *
30 * Powergates the current CPU.
31 * Should never return.
32 */
33ENTRY(tegra30_hotplug_shutdown)
34 /* Turn off SMP coherency */
35 exit_smp r4, r5
36
37 /* Powergate this CPU */
38 mov r0, #TEGRA30_POWER_HOTPLUG_SHUTDOWN
39 bl tegra30_cpu_shutdown
40 mov pc, lr @ should never get here
41ENDPROC(tegra30_hotplug_shutdown)
42
43/*
44 * tegra30_cpu_shutdown(unsigned long flags)
45 *
46 * Puts the current CPU in wait-for-event mode on the flow controller
47 * and powergates it -- flags (in R0) indicate the request type.
48 * Must never be called for CPU 0.
49 *
50 * corrupts r0-r4, r12
51 */
52ENTRY(tegra30_cpu_shutdown)
53 cpu_id r3
54 cmp r3, #0
55 moveq pc, lr @ Must never be called for CPU 0
56
57 ldr r12, =TEGRA_FLOW_CTRL_VIRT
58 cpu_to_csr_reg r1, r3
59 add r1, r1, r12 @ virtual CSR address for this CPU
60 cpu_to_halt_reg r2, r3
61 add r2, r2, r12 @ virtual HALT_EVENTS address for this CPU
62
63 /*
64 * Clear this CPU's "event" and "interrupt" flags and power gate
65 * it when halting but not before it is in the "WFE" state.
66 */
67 movw r12, \
68 FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG | \
69 FLOW_CTRL_CSR_ENABLE
70 mov r4, #(1 << 4)
71 orr r12, r12, r4, lsl r3
72 str r12, [r1]
73
74 /* Halt this CPU. */
75 mov r3, #0x400
76delay_1:
77 subs r3, r3, #1 @ delay as a part of wfe war.
78 bge delay_1;
79 cpsid a @ disable imprecise aborts.
80 ldr r3, [r1] @ read CSR
81 str r3, [r1] @ clear CSR
82 tst r0, #TEGRA30_POWER_HOTPLUG_SHUTDOWN
83 movne r3, #FLOW_CTRL_WAITEVENT @ For hotplug
84 str r3, [r2]
85 ldr r0, [r2]
86 b wfe_war
87
88__cpu_reset_again:
89 dsb
90 .align 5
91 wfe @ CPU should be power gated here
92wfe_war:
93 b __cpu_reset_again
94
95 /*
96 * 38 nop's, which fills reset of wfe cache line and
97 * 4 more cachelines with nop
98 */
99 .rept 38
100 nop
101 .endr
102 b . @ should never get here
103
104ENDPROC(tegra30_cpu_shutdown)
105#endif