aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-tegra/Makefile1
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra20.c3
-rw-r--r--arch/arm/mach-tegra/platsmp.c2
-rw-r--r--arch/arm/mach-tegra/pm.c2
-rw-r--r--arch/arm/mach-tegra/reset-handler.S2
-rw-r--r--arch/arm/mach-tegra/sleep-tegra20.S3
-rw-r--r--arch/arm/mach-tegra/sleep-tegra30.S2
-rw-r--r--arch/arm/mach-tegra/tegra.c2
-rw-r--r--drivers/soc/tegra/Kconfig7
-rw-r--r--drivers/soc/tegra/Makefile1
-rw-r--r--drivers/soc/tegra/flowctrl.c (renamed from arch/arm/mach-tegra/flowctrl.c)26
-rw-r--r--include/soc/tegra/flowctrl.h (renamed from arch/arm/mach-tegra/flowctrl.h)32
12 files changed, 61 insertions, 22 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index fffad2426ee4..3b33f0bb78ae 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -2,7 +2,6 @@ asflags-y += -march=armv7-a
2 2
3obj-y += io.o 3obj-y += io.o
4obj-y += irq.o 4obj-y += irq.o
5obj-y += flowctrl.o
6obj-y += pm.o 5obj-y += pm.o
7obj-y += reset.o 6obj-y += reset.o
8obj-y += reset-handler.o 7obj-y += reset-handler.o
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
index afcee04f2616..76e4c83cd5c8 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra20.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra20.c
@@ -26,12 +26,13 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/module.h> 27#include <linux/module.h>
28 28
29#include <soc/tegra/flowctrl.h>
30
29#include <asm/cpuidle.h> 31#include <asm/cpuidle.h>
30#include <asm/smp_plat.h> 32#include <asm/smp_plat.h>
31#include <asm/suspend.h> 33#include <asm/suspend.h>
32 34
33#include "cpuidle.h" 35#include "cpuidle.h"
34#include "flowctrl.h"
35#include "iomap.h" 36#include "iomap.h"
36#include "irq.h" 37#include "irq.h"
37#include "pm.h" 38#include "pm.h"
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 75620ae73913..b5a2afe99101 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -21,6 +21,7 @@
21#include <linux/jiffies.h> 21#include <linux/jiffies.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23 23
24#include <soc/tegra/flowctrl.h>
24#include <soc/tegra/fuse.h> 25#include <soc/tegra/fuse.h>
25#include <soc/tegra/pmc.h> 26#include <soc/tegra/pmc.h>
26 27
@@ -30,7 +31,6 @@
30#include <asm/smp_scu.h> 31#include <asm/smp_scu.h>
31 32
32#include "common.h" 33#include "common.h"
33#include "flowctrl.h"
34#include "iomap.h" 34#include "iomap.h"
35#include "reset.h" 35#include "reset.h"
36 36
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index b0f48a3946fa..1ad5719779b0 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -27,6 +27,7 @@
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/suspend.h> 28#include <linux/suspend.h>
29 29
30#include <soc/tegra/flowctrl.h>
30#include <soc/tegra/fuse.h> 31#include <soc/tegra/fuse.h>
31#include <soc/tegra/pm.h> 32#include <soc/tegra/pm.h>
32#include <soc/tegra/pmc.h> 33#include <soc/tegra/pmc.h>
@@ -38,7 +39,6 @@
38#include <asm/suspend.h> 39#include <asm/suspend.h>
39#include <asm/tlbflush.h> 40#include <asm/tlbflush.h>
40 41
41#include "flowctrl.h"
42#include "iomap.h" 42#include "iomap.h"
43#include "pm.h" 43#include "pm.h"
44#include "reset.h" 44#include "reset.h"
diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S
index e3070fdab80b..805f306fa6f7 100644
--- a/arch/arm/mach-tegra/reset-handler.S
+++ b/arch/arm/mach-tegra/reset-handler.S
@@ -17,12 +17,12 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/linkage.h> 18#include <linux/linkage.h>
19 19
20#include <soc/tegra/flowctrl.h>
20#include <soc/tegra/fuse.h> 21#include <soc/tegra/fuse.h>
21 22
22#include <asm/asm-offsets.h> 23#include <asm/asm-offsets.h>
23#include <asm/cache.h> 24#include <asm/cache.h>
24 25
25#include "flowctrl.h"
26#include "iomap.h" 26#include "iomap.h"
27#include "reset.h" 27#include "reset.h"
28#include "sleep.h" 28#include "sleep.h"
diff --git a/arch/arm/mach-tegra/sleep-tegra20.S b/arch/arm/mach-tegra/sleep-tegra20.S
index f5d19667484e..5c8e638ee51a 100644
--- a/arch/arm/mach-tegra/sleep-tegra20.S
+++ b/arch/arm/mach-tegra/sleep-tegra20.S
@@ -20,6 +20,8 @@
20 20
21#include <linux/linkage.h> 21#include <linux/linkage.h>
22 22
23#include <soc/tegra/flowctrl.h>
24
23#include <asm/assembler.h> 25#include <asm/assembler.h>
24#include <asm/proc-fns.h> 26#include <asm/proc-fns.h>
25#include <asm/cp15.h> 27#include <asm/cp15.h>
@@ -27,7 +29,6 @@
27 29
28#include "irammap.h" 30#include "irammap.h"
29#include "sleep.h" 31#include "sleep.h"
30#include "flowctrl.h"
31 32
32#define EMC_CFG 0xc 33#define EMC_CFG 0xc
33#define EMC_ADR_CFG 0x10 34#define EMC_ADR_CFG 0x10
diff --git a/arch/arm/mach-tegra/sleep-tegra30.S b/arch/arm/mach-tegra/sleep-tegra30.S
index 16e5ff03383c..dd4a67dabd91 100644
--- a/arch/arm/mach-tegra/sleep-tegra30.S
+++ b/arch/arm/mach-tegra/sleep-tegra30.S
@@ -16,13 +16,13 @@
16 16
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18 18
19#include <soc/tegra/flowctrl.h>
19#include <soc/tegra/fuse.h> 20#include <soc/tegra/fuse.h>
20 21
21#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
22#include <asm/assembler.h> 23#include <asm/assembler.h>
23#include <asm/cache.h> 24#include <asm/cache.h>
24 25
25#include "flowctrl.h"
26#include "irammap.h" 26#include "irammap.h"
27#include "sleep.h" 27#include "sleep.h"
28 28
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index e01cbca196b5..649e9e8c7bcc 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -48,7 +48,6 @@
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"
52#include "iomap.h" 51#include "iomap.h"
53#include "irq.h" 52#include "irq.h"
54#include "pm.h" 53#include "pm.h"
@@ -75,7 +74,6 @@ static void __init tegra_init_early(void)
75{ 74{
76 of_register_trusted_foundations(); 75 of_register_trusted_foundations();
77 tegra_cpu_reset_handler_init(); 76 tegra_cpu_reset_handler_init();
78 tegra_flowctrl_init();
79} 77}
80 78
81static void __init tegra_dt_init_irq(void) 79static void __init tegra_dt_init_irq(void)
diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig
index 208d6edb3fdb..c7e8ddfb574e 100644
--- a/drivers/soc/tegra/Kconfig
+++ b/drivers/soc/tegra/Kconfig
@@ -12,6 +12,7 @@ config ARCH_TEGRA_2x_SOC
12 select PINCTRL_TEGRA20 12 select PINCTRL_TEGRA20
13 select PL310_ERRATA_727915 if CACHE_L2X0 13 select PL310_ERRATA_727915 if CACHE_L2X0
14 select PL310_ERRATA_769419 if CACHE_L2X0 14 select PL310_ERRATA_769419 if CACHE_L2X0
15 select SOC_TEGRA_FLOWCTRL
15 select SOC_TEGRA_PMC 16 select SOC_TEGRA_PMC
16 select TEGRA_TIMER 17 select TEGRA_TIMER
17 help 18 help
@@ -24,6 +25,7 @@ config ARCH_TEGRA_3x_SOC
24 select ARM_ERRATA_764369 if SMP 25 select ARM_ERRATA_764369 if SMP
25 select PINCTRL_TEGRA30 26 select PINCTRL_TEGRA30
26 select PL310_ERRATA_769419 if CACHE_L2X0 27 select PL310_ERRATA_769419 if CACHE_L2X0
28 select SOC_TEGRA_FLOWCTRL
27 select SOC_TEGRA_PMC 29 select SOC_TEGRA_PMC
28 select TEGRA_TIMER 30 select TEGRA_TIMER
29 help 31 help
@@ -35,6 +37,7 @@ config ARCH_TEGRA_114_SOC
35 select ARM_ERRATA_798181 if SMP 37 select ARM_ERRATA_798181 if SMP
36 select HAVE_ARM_ARCH_TIMER 38 select HAVE_ARM_ARCH_TIMER
37 select PINCTRL_TEGRA114 39 select PINCTRL_TEGRA114
40 select SOC_TEGRA_FLOWCTRL
38 select SOC_TEGRA_PMC 41 select SOC_TEGRA_PMC
39 select TEGRA_TIMER 42 select TEGRA_TIMER
40 help 43 help
@@ -45,6 +48,7 @@ config ARCH_TEGRA_124_SOC
45 bool "Enable support for Tegra124 family" 48 bool "Enable support for Tegra124 family"
46 select HAVE_ARM_ARCH_TIMER 49 select HAVE_ARM_ARCH_TIMER
47 select PINCTRL_TEGRA124 50 select PINCTRL_TEGRA124
51 select SOC_TEGRA_FLOWCTRL
48 select SOC_TEGRA_PMC 52 select SOC_TEGRA_PMC
49 select TEGRA_TIMER 53 select TEGRA_TIMER
50 help 54 help
@@ -101,6 +105,9 @@ config ARCH_TEGRA_186_SOC
101endif 105endif
102endif 106endif
103 107
108config SOC_TEGRA_FLOWCTRL
109 bool
110
104config SOC_TEGRA_PMC 111config SOC_TEGRA_PMC
105 bool 112 bool
106 113
diff --git a/drivers/soc/tegra/Makefile b/drivers/soc/tegra/Makefile
index b4425e4319ff..4f81dd55e5d1 100644
--- a/drivers/soc/tegra/Makefile
+++ b/drivers/soc/tegra/Makefile
@@ -1,5 +1,6 @@
1obj-y += fuse/ 1obj-y += fuse/
2 2
3obj-y += common.o 3obj-y += common.o
4obj-$(CONFIG_SOC_TEGRA_FLOWCTRL) += flowctrl.o
4obj-$(CONFIG_SOC_TEGRA_PMC) += pmc.o 5obj-$(CONFIG_SOC_TEGRA_PMC) += pmc.o
5obj-$(CONFIG_SOC_TEGRA_PMC_TEGRA186) += pmc-tegra186.o 6obj-$(CONFIG_SOC_TEGRA_PMC_TEGRA186) += pmc-tegra186.o
diff --git a/arch/arm/mach-tegra/flowctrl.c b/drivers/soc/tegra/flowctrl.c
index 475e783992fd..3a5a1cb9ae90 100644
--- a/arch/arm/mach-tegra/flowctrl.c
+++ b/drivers/soc/tegra/flowctrl.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/arm/mach-tegra/flowctrl.c 2 * drivers/soc/tegra/flowctrl.c
3 * 3 *
4 * functions and macros to control the flowcontroller 4 * Functions and macros to control the flowcontroller
5 * 5 *
6 * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved. 6 * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
7 * 7 *
@@ -25,10 +25,10 @@
25#include <linux/of.h> 25#include <linux/of.h>
26#include <linux/of_address.h> 26#include <linux/of_address.h>
27 27
28#include <soc/tegra/common.h>
29#include <soc/tegra/flowctrl.h>
28#include <soc/tegra/fuse.h> 30#include <soc/tegra/fuse.h>
29 31
30#include "flowctrl.h"
31
32static u8 flowctrl_offset_halt_cpu[] = { 32static u8 flowctrl_offset_halt_cpu[] = {
33 FLOW_CTRL_HALT_CPU0_EVENTS, 33 FLOW_CTRL_HALT_CPU0_EVENTS,
34 FLOW_CTRL_HALT_CPU1_EVENTS, 34 FLOW_CTRL_HALT_CPU1_EVENTS,
@@ -47,6 +47,10 @@ static void __iomem *tegra_flowctrl_base;
47 47
48static void flowctrl_update(u8 offset, u32 value) 48static void flowctrl_update(u8 offset, u32 value)
49{ 49{
50 if (WARN_ONCE(!tegra_flowctrl_base,
51 "Tegra flowctrl not initialised!\n"))
52 return;
53
50 writel(value, tegra_flowctrl_base + offset); 54 writel(value, tegra_flowctrl_base + offset);
51 55
52 /* ensure the update has reached the flow controller */ 56 /* ensure the update has reached the flow controller */
@@ -58,6 +62,10 @@ u32 flowctrl_read_cpu_csr(unsigned int cpuid)
58{ 62{
59 u8 offset = flowctrl_offset_cpu_csr[cpuid]; 63 u8 offset = flowctrl_offset_cpu_csr[cpuid];
60 64
65 if (WARN_ONCE(!tegra_flowctrl_base,
66 "Tegra flowctrl not initialised!\n"))
67 return 0;
68
61 return readl(tegra_flowctrl_base + offset); 69 return readl(tegra_flowctrl_base + offset);
62} 70}
63 71
@@ -148,13 +156,16 @@ static const struct of_device_id matches[] __initconst = {
148 { } 156 { }
149}; 157};
150 158
151void __init tegra_flowctrl_init(void) 159static int __init tegra_flowctrl_init(void)
152{ 160{
153 /* hardcoded fallback if device tree node is missing */ 161 /* hardcoded fallback if device tree node is missing */
154 unsigned long base = 0x60007000; 162 unsigned long base = 0x60007000;
155 unsigned long size = SZ_4K; 163 unsigned long size = SZ_4K;
156 struct device_node *np; 164 struct device_node *np;
157 165
166 if (!soc_is_tegra())
167 return 0;
168
158 np = of_find_matching_node(NULL, matches); 169 np = of_find_matching_node(NULL, matches);
159 if (np) { 170 if (np) {
160 struct resource res; 171 struct resource res;
@@ -168,4 +179,9 @@ void __init tegra_flowctrl_init(void)
168 } 179 }
169 180
170 tegra_flowctrl_base = ioremap_nocache(base, size); 181 tegra_flowctrl_base = ioremap_nocache(base, size);
182 if (!tegra_flowctrl_base)
183 return -ENXIO;
184
185 return 0;
171} 186}
187early_initcall(tegra_flowctrl_init);
diff --git a/arch/arm/mach-tegra/flowctrl.h b/include/soc/tegra/flowctrl.h
index 73a9c5016c1a..8f86aea4024b 100644
--- a/arch/arm/mach-tegra/flowctrl.h
+++ b/include/soc/tegra/flowctrl.h
@@ -1,7 +1,5 @@
1/* 1/*
2 * arch/arm/mach-tegra/flowctrl.h 2 * Functions and macros to control the flowcontroller
3 *
4 * functions and macros to control the flowcontroller
5 * 3 *
6 * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved. 4 * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
7 * 5 *
@@ -18,8 +16,8 @@
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */ 17 */
20 18
21#ifndef __MACH_TEGRA_FLOWCTRL_H 19#ifndef __SOC_TEGRA_FLOWCTRL_H__
22#define __MACH_TEGRA_FLOWCTRL_H 20#define __SOC_TEGRA_FLOWCTRL_H__
23 21
24#define FLOW_CTRL_HALT_CPU0_EVENTS 0x0 22#define FLOW_CTRL_HALT_CPU0_EVENTS 0x0
25#define FLOW_CTRL_WAITEVENT (2 << 29) 23#define FLOW_CTRL_WAITEVENT (2 << 29)
@@ -53,14 +51,32 @@
53#define TEGRA30_FLOW_CTRL_CSR_WFI_BITMAP (0xF << 8) 51#define TEGRA30_FLOW_CTRL_CSR_WFI_BITMAP (0xF << 8)
54 52
55#ifndef __ASSEMBLY__ 53#ifndef __ASSEMBLY__
54#ifdef CONFIG_SOC_TEGRA_FLOWCTRL
56u32 flowctrl_read_cpu_csr(unsigned int cpuid); 55u32 flowctrl_read_cpu_csr(unsigned int cpuid);
57void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value); 56void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value);
58void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value); 57void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value);
59 58
60void flowctrl_cpu_suspend_enter(unsigned int cpuid); 59void flowctrl_cpu_suspend_enter(unsigned int cpuid);
61void flowctrl_cpu_suspend_exit(unsigned int cpuid); 60void flowctrl_cpu_suspend_exit(unsigned int cpuid);
61#else
62static inline u32 flowctrl_read_cpu_csr(unsigned int cpuid)
63{
64 return 0;
65}
66
67static inline void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value)
68{
69}
70
71static inline void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value) {}
62 72
63void tegra_flowctrl_init(void); 73static inline void flowctrl_cpu_suspend_enter(unsigned int cpuid)
64#endif 74{
75}
65 76
66#endif 77static inline void flowctrl_cpu_suspend_exit(unsigned int cpuid)
78{
79}
80#endif /* CONFIG_SOC_TEGRA_FLOWCTRL */
81#endif /* __ASSEMBLY */
82#endif /* __SOC_TEGRA_FLOWCTRL_H__ */