aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2014-09-25 11:53:39 -0400
committerArnd Bergmann <arnd@arndb.de>2014-09-25 11:53:39 -0400
commit14b62fb0159a77989708370ca8c8ba5db55c1dab (patch)
treeebac8083a32c738074797e0a6ae50e5ffe41eb83 /arch
parente36087998a3b01f3c6c93fa9465e40103f427315 (diff)
parentd37aba521379203b740a2929e6e6f6bd2485f5d7 (diff)
Merge tag 'tegra-for-3.18-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra into next/soc
Pull "ARM: tegra: core SoC code changes for 3.18" from Stephen Warren: the primary change here gets its address information from DT rather than iomap.h. This removes one more user of iomap.h, and will help allow the code to move to a location that can be shared between arch/arm and arch/arm64. An unused header file was also removed. Signed-off-by: Arnd Bergmann <arnd@arndb.de> * tag 'tegra-for-3.18-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra: ARM: tegra: remove unused tegra_emc.h ARM: tegra: Initialize flow controller from DT of: Add NVIDIA Tegra flow controller bindings
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-tegra/flowctrl.c44
-rw-r--r--arch/arm/mach-tegra/flowctrl.h2
-rw-r--r--arch/arm/mach-tegra/tegra.c2
3 files changed, 41 insertions, 7 deletions
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c
index ec55d1de1b55..475e783992fd 100644
--- a/arch/arm/mach-tegra/flowctrl.c
+++ b/arch/arm/mach-tegra/flowctrl.c
@@ -22,11 +22,12 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/of.h>
26#include <linux/of_address.h>
25 27
26#include <soc/tegra/fuse.h> 28#include <soc/tegra/fuse.h>
27 29
28#include "flowctrl.h" 30#include "flowctrl.h"
29#include "iomap.h"
30 31
31static u8 flowctrl_offset_halt_cpu[] = { 32static u8 flowctrl_offset_halt_cpu[] = {
32 FLOW_CTRL_HALT_CPU0_EVENTS, 33 FLOW_CTRL_HALT_CPU0_EVENTS,
@@ -42,23 +43,22 @@ static u8 flowctrl_offset_cpu_csr[] = {
42 FLOW_CTRL_CPU1_CSR + 16, 43 FLOW_CTRL_CPU1_CSR + 16,
43}; 44};
44 45
46static void __iomem *tegra_flowctrl_base;
47
45static void flowctrl_update(u8 offset, u32 value) 48static void flowctrl_update(u8 offset, u32 value)
46{ 49{
47 void __iomem *addr = IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + offset; 50 writel(value, tegra_flowctrl_base + offset);
48
49 writel(value, addr);
50 51
51 /* ensure the update has reached the flow controller */ 52 /* ensure the update has reached the flow controller */
52 wmb(); 53 wmb();
53 readl_relaxed(addr); 54 readl_relaxed(tegra_flowctrl_base + offset);
54} 55}
55 56
56u32 flowctrl_read_cpu_csr(unsigned int cpuid) 57u32 flowctrl_read_cpu_csr(unsigned int cpuid)
57{ 58{
58 u8 offset = flowctrl_offset_cpu_csr[cpuid]; 59 u8 offset = flowctrl_offset_cpu_csr[cpuid];
59 void __iomem *addr = IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + offset;
60 60
61 return readl(addr); 61 return readl(tegra_flowctrl_base + offset);
62} 62}
63 63
64void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value) 64void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value)
@@ -139,3 +139,33 @@ void flowctrl_cpu_suspend_exit(unsigned int cpuid)
139 reg |= FLOW_CTRL_CSR_EVENT_FLAG; /* clear event */ 139 reg |= FLOW_CTRL_CSR_EVENT_FLAG; /* clear event */
140 flowctrl_write_cpu_csr(cpuid, reg); 140 flowctrl_write_cpu_csr(cpuid, reg);
141} 141}
142
143static const struct of_device_id matches[] __initconst = {
144 { .compatible = "nvidia,tegra124-flowctrl" },
145 { .compatible = "nvidia,tegra114-flowctrl" },
146 { .compatible = "nvidia,tegra30-flowctrl" },
147 { .compatible = "nvidia,tegra20-flowctrl" },
148 { }
149};
150
151void __init tegra_flowctrl_init(void)
152{
153 /* hardcoded fallback if device tree node is missing */
154 unsigned long base = 0x60007000;
155 unsigned long size = SZ_4K;
156 struct device_node *np;
157
158 np = of_find_matching_node(NULL, matches);
159 if (np) {
160 struct resource res;
161
162 if (of_address_to_resource(np, 0, &res) == 0) {
163 size = resource_size(&res);
164 base = res.start;
165 }
166
167 of_node_put(np);
168 }
169
170 tegra_flowctrl_base = ioremap_nocache(base, size);
171}
diff --git a/arch/arm/mach-tegra/flowctrl.h b/arch/arm/mach-tegra/flowctrl.h
index c89aac60a143..73a9c5016c1a 100644
--- a/arch/arm/mach-tegra/flowctrl.h
+++ b/arch/arm/mach-tegra/flowctrl.h
@@ -59,6 +59,8 @@ void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value);
59 59
60void flowctrl_cpu_suspend_enter(unsigned int cpuid); 60void flowctrl_cpu_suspend_enter(unsigned int cpuid);
61void flowctrl_cpu_suspend_exit(unsigned int cpuid); 61void flowctrl_cpu_suspend_exit(unsigned int cpuid);
62
63void tegra_flowctrl_init(void);
62#endif 64#endif
63 65
64#endif 66#endif
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 5ef5173dec83..ef016af1c9e7 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -48,6 +48,7 @@
48#include "board.h" 48#include "board.h"
49#include "common.h" 49#include "common.h"
50#include "cpuidle.h" 50#include "cpuidle.h"
51#include "flowctrl.h"
51#include "iomap.h" 52#include "iomap.h"
52#include "irq.h" 53#include "irq.h"
53#include "pm.h" 54#include "pm.h"
@@ -74,6 +75,7 @@ static void __init tegra_init_early(void)
74{ 75{
75 of_register_trusted_foundations(); 76 of_register_trusted_foundations();
76 tegra_cpu_reset_handler_init(); 77 tegra_cpu_reset_handler_init();
78 tegra_flowctrl_init();
77} 79}
78 80
79static void __init tegra_dt_init_irq(void) 81static void __init tegra_dt_init_irq(void)