diff options
author | Peter De Schrijver <pdeschrijver@nvidia.com> | 2012-02-09 18:47:44 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-02-26 17:44:42 -0500 |
commit | 26fe681fdaa5c800f1f99e8181631866e50ed8a1 (patch) | |
tree | c01a0ce0b6aea397410c18f7e072953a68e373a4 /arch/arm/mach-tegra | |
parent | cec60064e4cbbd74e446b2129f640ac0ef5d034e (diff) |
ARM: tegra: functions to access the flowcontroller
Introduce some functions to write to the flowcontroller registers. The
flowcontroller controls CPU sleepstates and wakeup.
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r-- | arch/arm/mach-tegra/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/flowctrl.c | 62 | ||||
-rw-r--r-- | arch/arm/mach-tegra/flowctrl.h | 5 |
3 files changed, 68 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index e5373fb94b9a..c103008d960e 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile | |||
@@ -8,6 +8,7 @@ obj-y += timer.o | |||
8 | obj-y += pinmux.o | 8 | obj-y += pinmux.o |
9 | obj-y += fuse.o | 9 | obj-y += fuse.o |
10 | obj-y += pmc.o | 10 | obj-y += pmc.o |
11 | obj-y += flowctrl.o | ||
11 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 12 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
12 | obj-$(CONFIG_CPU_IDLE) += sleep.o | 13 | obj-$(CONFIG_CPU_IDLE) += sleep.o |
13 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o | 14 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o |
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c new file mode 100644 index 000000000000..fef66a7486ed --- /dev/null +++ b/arch/arm/mach-tegra/flowctrl.c | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/flowctrl.c | ||
3 | * | ||
4 | * functions and macros to control the flowcontroller | ||
5 | * | ||
6 | * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms and conditions of the GNU General Public License, | ||
10 | * version 2, as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | ||
20 | |||
21 | #include <linux/init.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/io.h> | ||
24 | |||
25 | #include <mach/iomap.h> | ||
26 | |||
27 | #include "flowctrl.h" | ||
28 | |||
29 | u8 flowctrl_offset_halt_cpu[] = { | ||
30 | FLOW_CTRL_HALT_CPU0_EVENTS, | ||
31 | FLOW_CTRL_HALT_CPU1_EVENTS, | ||
32 | FLOW_CTRL_HALT_CPU1_EVENTS + 8, | ||
33 | FLOW_CTRL_HALT_CPU1_EVENTS + 16, | ||
34 | }; | ||
35 | |||
36 | u8 flowctrl_offset_cpu_csr[] = { | ||
37 | FLOW_CTRL_CPU0_CSR, | ||
38 | FLOW_CTRL_CPU1_CSR, | ||
39 | FLOW_CTRL_CPU1_CSR + 8, | ||
40 | FLOW_CTRL_CPU1_CSR + 16, | ||
41 | }; | ||
42 | |||
43 | static void flowctrl_update(u8 offset, u32 value) | ||
44 | { | ||
45 | void __iomem *addr = IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + offset; | ||
46 | |||
47 | writel(value, addr); | ||
48 | |||
49 | /* ensure the update has reached the flow controller */ | ||
50 | wmb(); | ||
51 | readl_relaxed(addr); | ||
52 | } | ||
53 | |||
54 | void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value) | ||
55 | { | ||
56 | return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value); | ||
57 | } | ||
58 | |||
59 | void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value) | ||
60 | { | ||
61 | return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value); | ||
62 | } | ||
diff --git a/arch/arm/mach-tegra/flowctrl.h b/arch/arm/mach-tegra/flowctrl.h index 74c6efbe52fa..19428173855e 100644 --- a/arch/arm/mach-tegra/flowctrl.h +++ b/arch/arm/mach-tegra/flowctrl.h | |||
@@ -34,4 +34,9 @@ | |||
34 | #define FLOW_CTRL_HALT_CPU1_EVENTS 0x14 | 34 | #define FLOW_CTRL_HALT_CPU1_EVENTS 0x14 |
35 | #define FLOW_CTRL_CPU1_CSR 0x18 | 35 | #define FLOW_CTRL_CPU1_CSR 0x18 |
36 | 36 | ||
37 | #ifndef __ASSEMBLY__ | ||
38 | void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value); | ||
39 | void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value); | ||
40 | #endif | ||
41 | |||
37 | #endif | 42 | #endif |