diff options
author | Arnd Bergmann <arnd@arndb.de> | 2013-02-28 12:19:16 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2013-02-28 12:57:06 -0500 |
commit | 48be9ac930086f7605fb4959936f568e865b2cff (patch) | |
tree | 41c22e6fd0e0341a891bc5c94c88ac7f067b3587 | |
parent | 9f86f2761117f9031c349c1c1e80d9f64820e6f6 (diff) |
ARM: Dove: split legacy and DT setup
In the beginning of DT for Dove it was reasonable to have it close to
non-DT code. With improved DT support, it became more and more difficult
to not break non-DT while changing DT code.
This patch splits up DT board setup and introduces a DOVE_LEGACY config
to allow to remove legacy code for DT-only kernels.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r-- | arch/arm/mach-dove/Kconfig | 5 | ||||
-rw-r--r-- | arch/arm/mach-dove/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/mach-dove/board-dt.c | 102 | ||||
-rw-r--r-- | arch/arm/mach-dove/common.c | 85 |
4 files changed, 110 insertions, 86 deletions
diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig index 603c5fd99e8a..aedd0baa04bf 100644 --- a/arch/arm/mach-dove/Kconfig +++ b/arch/arm/mach-dove/Kconfig | |||
@@ -2,8 +2,12 @@ if ARCH_DOVE | |||
2 | 2 | ||
3 | menu "Marvell Dove Implementations" | 3 | menu "Marvell Dove Implementations" |
4 | 4 | ||
5 | config DOVE_LEGACY | ||
6 | bool | ||
7 | |||
5 | config MACH_DOVE_DB | 8 | config MACH_DOVE_DB |
6 | bool "Marvell DB-MV88AP510 Development Board" | 9 | bool "Marvell DB-MV88AP510 Development Board" |
10 | select DOVE_LEGACY | ||
7 | select I2C_BOARDINFO | 11 | select I2C_BOARDINFO |
8 | help | 12 | help |
9 | Say 'Y' here if you want your kernel to support the | 13 | Say 'Y' here if you want your kernel to support the |
@@ -11,6 +15,7 @@ config MACH_DOVE_DB | |||
11 | 15 | ||
12 | config MACH_CM_A510 | 16 | config MACH_CM_A510 |
13 | bool "CompuLab CM-A510 Board" | 17 | bool "CompuLab CM-A510 Board" |
18 | select DOVE_LEGACY | ||
14 | help | 19 | help |
15 | Say 'Y' here if you want your kernel to support the | 20 | Say 'Y' here if you want your kernel to support the |
16 | CompuLab CM-A510 Board. | 21 | CompuLab CM-A510 Board. |
diff --git a/arch/arm/mach-dove/Makefile b/arch/arm/mach-dove/Makefile index 5e683baf96cf..3f0a858fb597 100644 --- a/arch/arm/mach-dove/Makefile +++ b/arch/arm/mach-dove/Makefile | |||
@@ -1,4 +1,6 @@ | |||
1 | obj-y += common.o addr-map.o irq.o mpp.o | 1 | obj-y += common.o addr-map.o irq.o |
2 | obj-$(CONFIG_DOVE_LEGACY) += mpp.o | ||
2 | obj-$(CONFIG_PCI) += pcie.o | 3 | obj-$(CONFIG_PCI) += pcie.o |
3 | obj-$(CONFIG_MACH_DOVE_DB) += dove-db-setup.o | 4 | obj-$(CONFIG_MACH_DOVE_DB) += dove-db-setup.o |
5 | obj-$(CONFIG_MACH_DOVE_DT) += board-dt.o | ||
4 | obj-$(CONFIG_MACH_CM_A510) += cm-a510.o | 6 | obj-$(CONFIG_MACH_CM_A510) += cm-a510.o |
diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c new file mode 100644 index 000000000000..61c2b595494a --- /dev/null +++ b/arch/arm/mach-dove/board-dt.c | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-dove/board-dt.c | ||
3 | * | ||
4 | * Marvell Dove 88AP510 System On Chip FDT Board | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include <linux/init.h> | ||
12 | #include <linux/clk-provider.h> | ||
13 | #include <linux/clk/mvebu.h> | ||
14 | #include <linux/of.h> | ||
15 | #include <linux/of_platform.h> | ||
16 | #include <linux/platform_data/usb-ehci-orion.h> | ||
17 | #include <asm/hardware/cache-tauros2.h> | ||
18 | #include <asm/mach/arch.h> | ||
19 | #include <mach/pm.h> | ||
20 | #include <plat/common.h> | ||
21 | #include <plat/irq.h> | ||
22 | #include "common.h" | ||
23 | |||
24 | /* | ||
25 | * There are still devices that doesn't even know about DT, | ||
26 | * get clock gates here and add a clock lookup. | ||
27 | */ | ||
28 | static void __init dove_legacy_clk_init(void) | ||
29 | { | ||
30 | struct device_node *np = of_find_compatible_node(NULL, NULL, | ||
31 | "marvell,dove-gating-clock"); | ||
32 | struct of_phandle_args clkspec; | ||
33 | |||
34 | clkspec.np = np; | ||
35 | clkspec.args_count = 1; | ||
36 | |||
37 | clkspec.args[0] = CLOCK_GATING_BIT_USB0; | ||
38 | orion_clkdev_add(NULL, "orion-ehci.0", | ||
39 | of_clk_get_from_provider(&clkspec)); | ||
40 | |||
41 | clkspec.args[0] = CLOCK_GATING_BIT_USB1; | ||
42 | orion_clkdev_add(NULL, "orion-ehci.1", | ||
43 | of_clk_get_from_provider(&clkspec)); | ||
44 | |||
45 | clkspec.args[0] = CLOCK_GATING_BIT_GBE; | ||
46 | orion_clkdev_add(NULL, "mv643xx_eth_port.0", | ||
47 | of_clk_get_from_provider(&clkspec)); | ||
48 | |||
49 | clkspec.args[0] = CLOCK_GATING_BIT_PCIE0; | ||
50 | orion_clkdev_add("0", "pcie", | ||
51 | of_clk_get_from_provider(&clkspec)); | ||
52 | |||
53 | clkspec.args[0] = CLOCK_GATING_BIT_PCIE1; | ||
54 | orion_clkdev_add("1", "pcie", | ||
55 | of_clk_get_from_provider(&clkspec)); | ||
56 | } | ||
57 | |||
58 | static void __init dove_of_clk_init(void) | ||
59 | { | ||
60 | mvebu_clocks_init(); | ||
61 | dove_legacy_clk_init(); | ||
62 | } | ||
63 | |||
64 | static struct mv643xx_eth_platform_data dove_dt_ge00_data = { | ||
65 | .phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT, | ||
66 | }; | ||
67 | |||
68 | static void __init dove_dt_init(void) | ||
69 | { | ||
70 | pr_info("Dove 88AP510 SoC\n"); | ||
71 | |||
72 | #ifdef CONFIG_CACHE_TAUROS2 | ||
73 | tauros2_init(0); | ||
74 | #endif | ||
75 | dove_setup_cpu_mbus(); | ||
76 | |||
77 | /* Setup root of clk tree */ | ||
78 | dove_of_clk_init(); | ||
79 | |||
80 | /* Internal devices not ported to DT yet */ | ||
81 | dove_ge00_init(&dove_dt_ge00_data); | ||
82 | dove_ehci0_init(); | ||
83 | dove_ehci1_init(); | ||
84 | dove_pcie_init(1, 1); | ||
85 | |||
86 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
87 | } | ||
88 | |||
89 | static const char * const dove_dt_board_compat[] = { | ||
90 | "marvell,dove", | ||
91 | NULL | ||
92 | }; | ||
93 | |||
94 | DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)") | ||
95 | .map_io = dove_map_io, | ||
96 | .init_early = dove_init_early, | ||
97 | .init_irq = orion_dt_init_irq, | ||
98 | .init_time = dove_timer_init, | ||
99 | .init_machine = dove_dt_init, | ||
100 | .restart = dove_restart, | ||
101 | .dt_compat = dove_dt_board_compat, | ||
102 | MACHINE_END | ||
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index ea84c535a110..c6b3b2bb50e7 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c | |||
@@ -360,88 +360,3 @@ void dove_restart(char mode, const char *cmd) | |||
360 | while (1) | 360 | while (1) |
361 | ; | 361 | ; |
362 | } | 362 | } |
363 | |||
364 | #if defined(CONFIG_MACH_DOVE_DT) | ||
365 | /* | ||
366 | * There are still devices that doesn't even know about DT, | ||
367 | * get clock gates here and add a clock lookup. | ||
368 | */ | ||
369 | static void __init dove_legacy_clk_init(void) | ||
370 | { | ||
371 | struct device_node *np = of_find_compatible_node(NULL, NULL, | ||
372 | "marvell,dove-gating-clock"); | ||
373 | struct of_phandle_args clkspec; | ||
374 | |||
375 | clkspec.np = np; | ||
376 | clkspec.args_count = 1; | ||
377 | |||
378 | clkspec.args[0] = CLOCK_GATING_BIT_USB0; | ||
379 | orion_clkdev_add(NULL, "orion-ehci.0", | ||
380 | of_clk_get_from_provider(&clkspec)); | ||
381 | |||
382 | clkspec.args[0] = CLOCK_GATING_BIT_USB1; | ||
383 | orion_clkdev_add(NULL, "orion-ehci.1", | ||
384 | of_clk_get_from_provider(&clkspec)); | ||
385 | |||
386 | clkspec.args[0] = CLOCK_GATING_BIT_GBE; | ||
387 | orion_clkdev_add(NULL, "mv643xx_eth_port.0", | ||
388 | of_clk_get_from_provider(&clkspec)); | ||
389 | |||
390 | clkspec.args[0] = CLOCK_GATING_BIT_PCIE0; | ||
391 | orion_clkdev_add("0", "pcie", | ||
392 | of_clk_get_from_provider(&clkspec)); | ||
393 | |||
394 | clkspec.args[0] = CLOCK_GATING_BIT_PCIE1; | ||
395 | orion_clkdev_add("1", "pcie", | ||
396 | of_clk_get_from_provider(&clkspec)); | ||
397 | } | ||
398 | |||
399 | static void __init dove_of_clk_init(void) | ||
400 | { | ||
401 | mvebu_clocks_init(); | ||
402 | dove_legacy_clk_init(); | ||
403 | } | ||
404 | |||
405 | static struct mv643xx_eth_platform_data dove_dt_ge00_data = { | ||
406 | .phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT, | ||
407 | }; | ||
408 | |||
409 | static void __init dove_dt_init(void) | ||
410 | { | ||
411 | pr_info("Dove 88AP510 SoC, TCLK = %d MHz.\n", | ||
412 | (dove_tclk + 499999) / 1000000); | ||
413 | |||
414 | #ifdef CONFIG_CACHE_TAUROS2 | ||
415 | tauros2_init(0); | ||
416 | #endif | ||
417 | dove_setup_cpu_mbus(); | ||
418 | |||
419 | /* Setup root of clk tree */ | ||
420 | dove_of_clk_init(); | ||
421 | |||
422 | /* Internal devices not ported to DT yet */ | ||
423 | dove_rtc_init(); | ||
424 | |||
425 | dove_ge00_init(&dove_dt_ge00_data); | ||
426 | dove_ehci0_init(); | ||
427 | dove_ehci1_init(); | ||
428 | dove_pcie_init(1, 1); | ||
429 | |||
430 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
431 | } | ||
432 | |||
433 | static const char * const dove_dt_board_compat[] = { | ||
434 | "marvell,dove", | ||
435 | NULL | ||
436 | }; | ||
437 | |||
438 | DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)") | ||
439 | .map_io = dove_map_io, | ||
440 | .init_early = dove_init_early, | ||
441 | .init_irq = orion_dt_init_irq, | ||
442 | .init_time = dove_timer_init, | ||
443 | .init_machine = dove_dt_init, | ||
444 | .restart = dove_restart, | ||
445 | .dt_compat = dove_dt_board_compat, | ||
446 | MACHINE_END | ||
447 | #endif | ||