diff options
author | Peter De Schrijver <pdeschrijver@nvidia.com> | 2011-12-14 10:03:17 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2011-12-17 23:15:13 -0500 |
commit | c37c07ddf26910f39cdc55df54640439d3a38083 (patch) | |
tree | 8370726d13d713b156472e68b94831296c09c1a1 | |
parent | 8e4fab2c39b2db774e41553646788599cfdac9df (diff) |
arm/tegra: prepare early init for multiple tegra variants
This patch splits the early init code in a common and a tegra20 specific part.
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Colin Cross <ccross@android.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | arch/arm/mach-tegra/board-dt.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-harmony.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-paz00.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-seaboard.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-trimslice.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/common.c | 27 |
7 files changed, 34 insertions, 27 deletions
diff --git a/arch/arm/mach-tegra/board-dt.c b/arch/arm/mach-tegra/board-dt.c index c21863d6425d..ddaa037be028 100644 --- a/arch/arm/mach-tegra/board-dt.c +++ b/arch/arm/mach-tegra/board-dt.c | |||
@@ -53,17 +53,6 @@ void seaboard_pinmux_init(void); | |||
53 | void trimslice_pinmux_init(void); | 53 | void trimslice_pinmux_init(void); |
54 | void ventana_pinmux_init(void); | 54 | void ventana_pinmux_init(void); |
55 | 55 | ||
56 | static const struct of_device_id tegra_dt_irq_match[] __initconst = { | ||
57 | { .compatible = "arm,cortex-a9-gic", .data = gic_of_init }, | ||
58 | { } | ||
59 | }; | ||
60 | |||
61 | void __init tegra_dt_init_irq(void) | ||
62 | { | ||
63 | tegra_init_irq(); | ||
64 | of_irq_init(tegra_dt_irq_match); | ||
65 | } | ||
66 | |||
67 | struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { | 56 | struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { |
68 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), | 57 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), |
69 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL), | 58 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL), |
@@ -139,7 +128,7 @@ static void __init tegra_dt_init(void) | |||
139 | "Unknown platform! Pinmuxing not initialized\n"); | 128 | "Unknown platform! Pinmuxing not initialized\n"); |
140 | } | 129 | } |
141 | 130 | ||
142 | static const char * tegra_dt_board_compat[] = { | 131 | static const char *tegra20_dt_board_compat[] = { |
143 | "compulab,trimslice", | 132 | "compulab,trimslice", |
144 | "nvidia,harmony", | 133 | "nvidia,harmony", |
145 | "compal,paz00", | 134 | "compal,paz00", |
@@ -148,12 +137,12 @@ static const char * tegra_dt_board_compat[] = { | |||
148 | NULL | 137 | NULL |
149 | }; | 138 | }; |
150 | 139 | ||
151 | DT_MACHINE_START(TEGRA_DT, "nVidia Tegra (Flattened Device Tree)") | 140 | DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)") |
152 | .map_io = tegra_map_common_io, | 141 | .map_io = tegra_map_common_io, |
153 | .init_early = tegra_init_early, | 142 | .init_early = tegra20_init_early, |
154 | .init_irq = tegra_dt_init_irq, | 143 | .init_irq = tegra_dt_init_irq, |
155 | .handle_irq = gic_handle_irq, | 144 | .handle_irq = gic_handle_irq, |
156 | .timer = &tegra_timer, | 145 | .timer = &tegra_timer, |
157 | .init_machine = tegra_dt_init, | 146 | .init_machine = tegra_dt_init, |
158 | .dt_compat = tegra_dt_board_compat, | 147 | .dt_compat = tegra20_dt_board_compat, |
159 | MACHINE_END | 148 | MACHINE_END |
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c index fd190a8dc665..d60a0d45f2f7 100644 --- a/arch/arm/mach-tegra/board-harmony.c +++ b/arch/arm/mach-tegra/board-harmony.c | |||
@@ -186,7 +186,7 @@ MACHINE_START(HARMONY, "harmony") | |||
186 | .atag_offset = 0x100, | 186 | .atag_offset = 0x100, |
187 | .fixup = tegra_harmony_fixup, | 187 | .fixup = tegra_harmony_fixup, |
188 | .map_io = tegra_map_common_io, | 188 | .map_io = tegra_map_common_io, |
189 | .init_early = tegra_init_early, | 189 | .init_early = tegra20_init_early, |
190 | .init_irq = tegra_init_irq, | 190 | .init_irq = tegra_init_irq, |
191 | .handle_irq = gic_handle_irq, | 191 | .handle_irq = gic_handle_irq, |
192 | .timer = &tegra_timer, | 192 | .timer = &tegra_timer, |
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c index 0b7e1cfee70d..e68b40727e6d 100644 --- a/arch/arm/mach-tegra/board-paz00.c +++ b/arch/arm/mach-tegra/board-paz00.c | |||
@@ -189,7 +189,7 @@ MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ") | |||
189 | .atag_offset = 0x100, | 189 | .atag_offset = 0x100, |
190 | .fixup = tegra_paz00_fixup, | 190 | .fixup = tegra_paz00_fixup, |
191 | .map_io = tegra_map_common_io, | 191 | .map_io = tegra_map_common_io, |
192 | .init_early = tegra_init_early, | 192 | .init_early = tegra20_init_early, |
193 | .init_irq = tegra_init_irq, | 193 | .init_irq = tegra_init_irq, |
194 | .handle_irq = gic_handle_irq, | 194 | .handle_irq = gic_handle_irq, |
195 | .timer = &tegra_timer, | 195 | .timer = &tegra_timer, |
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c index 7328379b1356..b79f9ce9941c 100644 --- a/arch/arm/mach-tegra/board-seaboard.c +++ b/arch/arm/mach-tegra/board-seaboard.c | |||
@@ -283,7 +283,7 @@ static void __init tegra_wario_init(void) | |||
283 | MACHINE_START(SEABOARD, "seaboard") | 283 | MACHINE_START(SEABOARD, "seaboard") |
284 | .atag_offset = 0x100, | 284 | .atag_offset = 0x100, |
285 | .map_io = tegra_map_common_io, | 285 | .map_io = tegra_map_common_io, |
286 | .init_early = tegra_init_early, | 286 | .init_early = tegra20_init_early, |
287 | .init_irq = tegra_init_irq, | 287 | .init_irq = tegra_init_irq, |
288 | .handle_irq = gic_handle_irq, | 288 | .handle_irq = gic_handle_irq, |
289 | .timer = &tegra_timer, | 289 | .timer = &tegra_timer, |
@@ -293,7 +293,7 @@ MACHINE_END | |||
293 | MACHINE_START(KAEN, "kaen") | 293 | MACHINE_START(KAEN, "kaen") |
294 | .atag_offset = 0x100, | 294 | .atag_offset = 0x100, |
295 | .map_io = tegra_map_common_io, | 295 | .map_io = tegra_map_common_io, |
296 | .init_early = tegra_init_early, | 296 | .init_early = tegra20_init_early, |
297 | .init_irq = tegra_init_irq, | 297 | .init_irq = tegra_init_irq, |
298 | .handle_irq = gic_handle_irq, | 298 | .handle_irq = gic_handle_irq, |
299 | .timer = &tegra_timer, | 299 | .timer = &tegra_timer, |
@@ -303,7 +303,7 @@ MACHINE_END | |||
303 | MACHINE_START(WARIO, "wario") | 303 | MACHINE_START(WARIO, "wario") |
304 | .atag_offset = 0x100, | 304 | .atag_offset = 0x100, |
305 | .map_io = tegra_map_common_io, | 305 | .map_io = tegra_map_common_io, |
306 | .init_early = tegra_init_early, | 306 | .init_early = tegra20_init_early, |
307 | .init_irq = tegra_init_irq, | 307 | .init_irq = tegra_init_irq, |
308 | .handle_irq = gic_handle_irq, | 308 | .handle_irq = gic_handle_irq, |
309 | .timer = &tegra_timer, | 309 | .timer = &tegra_timer, |
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c index 60a36a2e0be1..4a197a20be93 100644 --- a/arch/arm/mach-tegra/board-trimslice.c +++ b/arch/arm/mach-tegra/board-trimslice.c | |||
@@ -175,7 +175,7 @@ MACHINE_START(TRIMSLICE, "trimslice") | |||
175 | .atag_offset = 0x100, | 175 | .atag_offset = 0x100, |
176 | .fixup = tegra_trimslice_fixup, | 176 | .fixup = tegra_trimslice_fixup, |
177 | .map_io = tegra_map_common_io, | 177 | .map_io = tegra_map_common_io, |
178 | .init_early = tegra_init_early, | 178 | .init_early = tegra20_init_early, |
179 | .init_irq = tegra_init_irq, | 179 | .init_irq = tegra_init_irq, |
180 | .handle_irq = gic_handle_irq, | 180 | .handle_irq = gic_handle_irq, |
181 | .timer = &tegra_timer, | 181 | .timer = &tegra_timer, |
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h index 1d14df7eb7de..fdec3ffa4455 100644 --- a/arch/arm/mach-tegra/board.h +++ b/arch/arm/mach-tegra/board.h | |||
@@ -25,9 +25,10 @@ | |||
25 | 25 | ||
26 | void tegra_assert_system_reset(char mode, const char *cmd); | 26 | void tegra_assert_system_reset(char mode, const char *cmd); |
27 | 27 | ||
28 | void __init tegra_init_early(void); | 28 | void __init tegra20_init_early(void); |
29 | void __init tegra_map_common_io(void); | 29 | void __init tegra_map_common_io(void); |
30 | void __init tegra_init_irq(void); | 30 | void __init tegra_init_irq(void); |
31 | void __init tegra_dt_init_irq(void); | ||
31 | void __init tegra_init_clock(void); | 32 | void __init tegra_init_clock(void); |
32 | int __init tegra_pcie_init(bool init_port0, bool init_port1); | 33 | int __init tegra_pcie_init(bool init_port0, bool init_port1); |
33 | 34 | ||
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 690b888be506..0fafb60497a5 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-tegra/board-harmony.c | 2 | * arch/arm/mach-tegra/common.c |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Google, Inc. | 4 | * Copyright (C) 2010 Google, Inc. |
5 | * | 5 | * |
@@ -21,8 +21,10 @@ | |||
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/of_irq.h> | ||
24 | 25 | ||
25 | #include <asm/hardware/cache-l2x0.h> | 26 | #include <asm/hardware/cache-l2x0.h> |
27 | #include <asm/hardware/gic.h> | ||
26 | 28 | ||
27 | #include <mach/iomap.h> | 29 | #include <mach/iomap.h> |
28 | #include <mach/system.h> | 30 | #include <mach/system.h> |
@@ -33,6 +35,17 @@ | |||
33 | 35 | ||
34 | void (*arch_reset)(char mode, const char *cmd) = tegra_assert_system_reset; | 36 | void (*arch_reset)(char mode, const char *cmd) = tegra_assert_system_reset; |
35 | 37 | ||
38 | static const struct of_device_id tegra_dt_irq_match[] __initconst = { | ||
39 | { .compatible = "arm,cortex-a9-gic", .data = gic_of_init }, | ||
40 | { } | ||
41 | }; | ||
42 | |||
43 | void __init tegra_dt_init_irq(void) | ||
44 | { | ||
45 | tegra_init_irq(); | ||
46 | of_irq_init(tegra_dt_irq_match); | ||
47 | } | ||
48 | |||
36 | void tegra_assert_system_reset(char mode, const char *cmd) | 49 | void tegra_assert_system_reset(char mode, const char *cmd) |
37 | { | 50 | { |
38 | void __iomem *reset = IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x04); | 51 | void __iomem *reset = IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x04); |
@@ -44,7 +57,8 @@ void tegra_assert_system_reset(char mode, const char *cmd) | |||
44 | writel_relaxed(reg, reset); | 57 | writel_relaxed(reg, reset); |
45 | } | 58 | } |
46 | 59 | ||
47 | static __initdata struct tegra_clk_init_table common_clk_init_table[] = { | 60 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC |
61 | static __initdata struct tegra_clk_init_table tegra20_clk_init_table[] = { | ||
48 | /* name parent rate enabled */ | 62 | /* name parent rate enabled */ |
49 | { "clk_m", NULL, 0, true }, | 63 | { "clk_m", NULL, 0, true }, |
50 | { "pll_p", "clk_m", 216000000, true }, | 64 | { "pll_p", "clk_m", 216000000, true }, |
@@ -60,6 +74,7 @@ static __initdata struct tegra_clk_init_table common_clk_init_table[] = { | |||
60 | { "cpu", NULL, 0, true }, | 74 | { "cpu", NULL, 0, true }, |
61 | { NULL, NULL, 0, 0}, | 75 | { NULL, NULL, 0, 0}, |
62 | }; | 76 | }; |
77 | #endif | ||
63 | 78 | ||
64 | static void __init tegra_init_cache(void) | 79 | static void __init tegra_init_cache(void) |
65 | { | 80 | { |
@@ -74,10 +89,12 @@ static void __init tegra_init_cache(void) | |||
74 | 89 | ||
75 | } | 90 | } |
76 | 91 | ||
77 | void __init tegra_init_early(void) | 92 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC |
93 | void __init tegra20_init_early(void) | ||
78 | { | 94 | { |
79 | tegra_init_fuse(); | 95 | tegra_init_fuse(); |
80 | tegra_init_clock(); | 96 | tegra2_init_clocks(); |
81 | tegra_clk_init_from_table(common_clk_init_table); | 97 | tegra_clk_init_from_table(tegra20_clk_init_table); |
82 | tegra_init_cache(); | 98 | tegra_init_cache(); |
83 | } | 99 | } |
100 | #endif | ||