diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2013-05-15 09:37:01 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2013-05-27 12:02:13 -0400 |
commit | 0d0632f523fa040b307688ae421a1debf79af2d7 (patch) | |
tree | 70acd8920e5ba356890dcad0e81dafd679419f64 /arch/arm/mach-kirkwood | |
parent | 259e234608dbc6c6a673efb5d58a1c036eb9b47a (diff) |
arm: kirkwood: convert db-88f6281/db-88f6282 to the Device Tree
This commit converts the Marvell DB-88F6281/DB-88F6282 board to the
Device Tree. In fact, the code was supporting two different boards:
one with the 6281 SoC variant, and one with the 6282 SoC variant. The
difference between the two being that the 6281 has one PCIe interface,
and the 6282 has two PCIe interfaces.
In order to handle that with the Device Tree, we create a
'kirkwood-db.dtsi' file that contains the definitions common to both
boards, and 'kirkwood-db-88f6281.dts' and 'kirkwood-db-88f6282.dts'
for the definitions specific to each board. This is similar to what is
done for the QNAP TS219 Kirkwood platform.
We have kept one single Kconfig option, just like it was before.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r-- | arch/arm/mach-kirkwood/Kconfig | 13 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-db88f628x-bp.c | 24 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-dt.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/db88f6281-bp-setup.c | 108 |
6 files changed, 44 insertions, 115 deletions
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 267ca95d4e78..b56bd3d7ece3 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig | |||
@@ -8,12 +8,6 @@ config MACH_D2NET_V2 | |||
8 | Say 'Y' here if you want your kernel to support the | 8 | Say 'Y' here if you want your kernel to support the |
9 | LaCie d2 Network v2 NAS. | 9 | LaCie d2 Network v2 NAS. |
10 | 10 | ||
11 | config MACH_DB88F6281_BP | ||
12 | bool "Marvell DB-88F6281-BP Development Board" | ||
13 | help | ||
14 | Say 'Y' here if you want your kernel to support the | ||
15 | Marvell DB-88F6281-BP Development Board. | ||
16 | |||
17 | config MACH_DOCKSTAR | 11 | config MACH_DOCKSTAR |
18 | bool "Seagate FreeAgent DockStar" | 12 | bool "Seagate FreeAgent DockStar" |
19 | help | 13 | help |
@@ -153,6 +147,13 @@ config MACH_CLOUDBOX_DT | |||
153 | Say 'Y' here if you want your kernel to support the LaCie | 147 | Say 'Y' here if you want your kernel to support the LaCie |
154 | CloudBox NAS, using Flattened Device Tree. | 148 | CloudBox NAS, using Flattened Device Tree. |
155 | 149 | ||
150 | config MACH_DB88F628X_BP_DT | ||
151 | bool "Marvell DB-88F628x-BP Development Board (Flattened Device Tree)" | ||
152 | help | ||
153 | Say 'Y' here if you want your kernel to support the Marvell | ||
154 | DB-88F6281-BP and DB-88F6282-BP Development Board (Flattened | ||
155 | Device Tree). | ||
156 | |||
156 | config MACH_DLINK_KIRKWOOD_DT | 157 | config MACH_DLINK_KIRKWOOD_DT |
157 | bool "D-Link Kirkwood-based NAS (Flattened Device Tree)" | 158 | bool "D-Link Kirkwood-based NAS (Flattened Device Tree)" |
158 | select ARCH_KIRKWOOD_DT | 159 | select ARCH_KIRKWOOD_DT |
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index 794366e7f722..2fdc3a7ad226 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile | |||
@@ -1,7 +1,6 @@ | |||
1 | obj-y += common.o irq.o pcie.o mpp.o | 1 | obj-y += common.o irq.o pcie.o mpp.o |
2 | 2 | ||
3 | obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o | 3 | obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o |
4 | obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o | ||
5 | obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o | 4 | obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o |
6 | obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o | 5 | obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o |
7 | obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o | 6 | obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o |
@@ -21,6 +20,7 @@ obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o | |||
21 | 20 | ||
22 | obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o | 21 | obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o |
23 | obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o | 22 | obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o |
23 | obj-$(CONFIG_MACH_DB88F628X_BP_DT) += board-db88f628x-bp.o | ||
24 | obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o | 24 | obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o |
25 | obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o | 25 | obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o |
26 | obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o | 26 | obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o |
diff --git a/arch/arm/mach-kirkwood/board-db88f628x-bp.c b/arch/arm/mach-kirkwood/board-db88f628x-bp.c new file mode 100644 index 000000000000..2f574bc8ed40 --- /dev/null +++ b/arch/arm/mach-kirkwood/board-db88f628x-bp.c | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Saeed Bishara <saeed@marvell.com> | ||
3 | * | ||
4 | * Marvell DB-88F628{1,2}-BP Development Board Setup | ||
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/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/of.h> | ||
14 | #include <linux/mv643xx_eth.h> | ||
15 | #include "common.h" | ||
16 | |||
17 | static struct mv643xx_eth_platform_data db88f628x_ge00_data = { | ||
18 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | ||
19 | }; | ||
20 | |||
21 | void __init db88f628x_init(void) | ||
22 | { | ||
23 | kirkwood_ge00_init(&db88f628x_ge00_data); | ||
24 | } | ||
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index e9647b80cb59..f5aed1f4b080 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
@@ -147,6 +147,10 @@ static void __init kirkwood_dt_init(void) | |||
147 | of_machine_is_compatible("lacie,netspace_v2")) | 147 | of_machine_is_compatible("lacie,netspace_v2")) |
148 | ns2_init(); | 148 | ns2_init(); |
149 | 149 | ||
150 | if (of_machine_is_compatible("marvell,db-88f6281-bp") || | ||
151 | of_machine_is_compatible("marvell,db-88f6282-bp")) | ||
152 | db88f628x_init(); | ||
153 | |||
150 | if (of_machine_is_compatible("mpl,cec4")) | 154 | if (of_machine_is_compatible("mpl,cec4")) |
151 | mplcec4_init(); | 155 | mplcec4_init(); |
152 | 156 | ||
@@ -181,6 +185,8 @@ static const char * const kirkwood_dt_board_compat[] = { | |||
181 | "lacie,netspace_max_v2", | 185 | "lacie,netspace_max_v2", |
182 | "lacie,netspace_mini_v2", | 186 | "lacie,netspace_mini_v2", |
183 | "lacie,netspace_v2", | 187 | "lacie,netspace_v2", |
188 | "marvell,db-88f6281-bp", | ||
189 | "marvell,db-88f6282-bp", | ||
184 | "mpl,cec4", | 190 | "mpl,cec4", |
185 | "netgear,readynas-duo-v2", | 191 | "netgear,readynas-duo-v2", |
186 | "plathome,openblocks-a6", | 192 | "plathome,openblocks-a6", |
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index 21da3b1ebd7b..cbbc0b80d4a1 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h | |||
@@ -119,6 +119,12 @@ void km_kirkwood_init(void); | |||
119 | static inline void km_kirkwood_init(void) {}; | 119 | static inline void km_kirkwood_init(void) {}; |
120 | #endif | 120 | #endif |
121 | 121 | ||
122 | #ifdef CONFIG_MACH_DB88F628X_BP_DT | ||
123 | void db88f628x_init(void); | ||
124 | #else | ||
125 | static inline void db88f628x_init(void) {}; | ||
126 | #endif | ||
127 | |||
122 | #ifdef CONFIG_MACH_MPLCEC4_DT | 128 | #ifdef CONFIG_MACH_MPLCEC4_DT |
123 | void mplcec4_init(void); | 129 | void mplcec4_init(void); |
124 | #else | 130 | #else |
diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c deleted file mode 100644 index 5a369fe74754..000000000000 --- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-kirkwood/db88f6281-bp-setup.c | ||
3 | * | ||
4 | * Marvell DB-88F6281-BP Development Board Setup | ||
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/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/sizes.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/mtd/partitions.h> | ||
16 | #include <linux/ata_platform.h> | ||
17 | #include <linux/mv643xx_eth.h> | ||
18 | #include <asm/mach-types.h> | ||
19 | #include <asm/mach/arch.h> | ||
20 | #include <mach/kirkwood.h> | ||
21 | #include <linux/platform_data/mmc-mvsdio.h> | ||
22 | #include "common.h" | ||
23 | #include "mpp.h" | ||
24 | |||
25 | static struct mtd_partition db88f6281_nand_parts[] = { | ||
26 | { | ||
27 | .name = "u-boot", | ||
28 | .offset = 0, | ||
29 | .size = SZ_1M | ||
30 | }, { | ||
31 | .name = "uImage", | ||
32 | .offset = MTDPART_OFS_NXTBLK, | ||
33 | .size = SZ_4M | ||
34 | }, { | ||
35 | .name = "root", | ||
36 | .offset = MTDPART_OFS_NXTBLK, | ||
37 | .size = MTDPART_SIZ_FULL | ||
38 | }, | ||
39 | }; | ||
40 | |||
41 | static struct mv643xx_eth_platform_data db88f6281_ge00_data = { | ||
42 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | ||
43 | }; | ||
44 | |||
45 | static struct mv_sata_platform_data db88f6281_sata_data = { | ||
46 | .n_ports = 2, | ||
47 | }; | ||
48 | |||
49 | static struct mvsdio_platform_data db88f6281_mvsdio_data = { | ||
50 | .gpio_write_protect = 37, | ||
51 | .gpio_card_detect = 38, | ||
52 | }; | ||
53 | |||
54 | static unsigned int db88f6281_mpp_config[] __initdata = { | ||
55 | MPP0_NF_IO2, | ||
56 | MPP1_NF_IO3, | ||
57 | MPP2_NF_IO4, | ||
58 | MPP3_NF_IO5, | ||
59 | MPP4_NF_IO6, | ||
60 | MPP5_NF_IO7, | ||
61 | MPP18_NF_IO0, | ||
62 | MPP19_NF_IO1, | ||
63 | MPP37_GPIO, | ||
64 | MPP38_GPIO, | ||
65 | 0 | ||
66 | }; | ||
67 | |||
68 | static void __init db88f6281_init(void) | ||
69 | { | ||
70 | /* | ||
71 | * Basic setup. Needs to be called early. | ||
72 | */ | ||
73 | kirkwood_init(); | ||
74 | kirkwood_mpp_conf(db88f6281_mpp_config); | ||
75 | |||
76 | kirkwood_nand_init(ARRAY_AND_SIZE(db88f6281_nand_parts), 25); | ||
77 | kirkwood_ehci_init(); | ||
78 | kirkwood_ge00_init(&db88f6281_ge00_data); | ||
79 | kirkwood_sata_init(&db88f6281_sata_data); | ||
80 | kirkwood_uart0_init(); | ||
81 | kirkwood_sdio_init(&db88f6281_mvsdio_data); | ||
82 | } | ||
83 | |||
84 | static int __init db88f6281_pci_init(void) | ||
85 | { | ||
86 | if (machine_is_db88f6281_bp()) { | ||
87 | u32 dev, rev; | ||
88 | |||
89 | kirkwood_pcie_id(&dev, &rev); | ||
90 | if (dev == MV88F6282_DEV_ID) | ||
91 | kirkwood_pcie_init(KW_PCIE1 | KW_PCIE0); | ||
92 | else | ||
93 | kirkwood_pcie_init(KW_PCIE0); | ||
94 | } | ||
95 | return 0; | ||
96 | } | ||
97 | subsys_initcall(db88f6281_pci_init); | ||
98 | |||
99 | MACHINE_START(DB88F6281_BP, "Marvell DB-88F6281-BP Development Board") | ||
100 | /* Maintainer: Saeed Bishara <saeed@marvell.com> */ | ||
101 | .atag_offset = 0x100, | ||
102 | .init_machine = db88f6281_init, | ||
103 | .map_io = kirkwood_map_io, | ||
104 | .init_early = kirkwood_init_early, | ||
105 | .init_irq = kirkwood_init_irq, | ||
106 | .init_time = kirkwood_timer_init, | ||
107 | .restart = kirkwood_restart, | ||
108 | MACHINE_END | ||