kirkwood: add linux 3.10 support
[openwrt/staging/dedeckeh.git] / target / linux / kirkwood / patches-3.10 / 0016-arm-kirkwood-convert-db-88f6281-db-88f6282-to-the-De.patch
1 From 32f9dd19f7c859205440a8734cb6ab1295c78015 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Wed, 27 Mar 2013 18:56:40 +0100
4 Subject: [PATCH 16/29] arm: kirkwood: convert db-88f6281/db-88f6282 to the
5 Device Tree
6
7 This commit converts the Marvell DB-88F6281/DB-88F6282 board to the
8 Device Tree. In fact, the code was supporting two different boards:
9 one with the 6281 SoC variant, and one with the 6282 SoC variant. The
10 difference between the two being that the 6281 has one PCIe interface,
11 and the 6282 has two PCIe interfaces.
12
13 In order to handle that with the Device Tree, we create a
14 'kirkwood-db.dtsi' file that contains the definitions common to both
15 boards, and 'kirkwood-db-88f6281.dts' and 'kirkwood-db-88f6282.dts'
16 for the definitions specific to each board. This is similar to what is
17 done for the QNAP TS219 Kirkwood platform.
18
19 We have kept one single Kconfig option, just like it was before.
20
21 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
22 ---
23 arch/arm/boot/dts/Makefile | 2 +
24 arch/arm/boot/dts/kirkwood-db-88f6281.dts | 30 ++++++++
25 arch/arm/boot/dts/kirkwood-db-88f6282.dts | 34 +++++++++
26 arch/arm/boot/dts/kirkwood-db.dtsi | 89 +++++++++++++++++++++++
27 arch/arm/mach-kirkwood/Kconfig | 13 ++--
28 arch/arm/mach-kirkwood/Makefile | 2 +-
29 arch/arm/mach-kirkwood/board-db88f628x-bp.c | 24 +++++++
30 arch/arm/mach-kirkwood/board-dt.c | 6 ++
31 arch/arm/mach-kirkwood/common.h | 6 ++
32 arch/arm/mach-kirkwood/db88f6281-bp-setup.c | 108 ----------------------------
33 10 files changed, 199 insertions(+), 115 deletions(-)
34 create mode 100644 arch/arm/boot/dts/kirkwood-db-88f6281.dts
35 create mode 100644 arch/arm/boot/dts/kirkwood-db-88f6282.dts
36 create mode 100644 arch/arm/boot/dts/kirkwood-db.dtsi
37 create mode 100644 arch/arm/mach-kirkwood/board-db88f628x-bp.c
38 delete mode 100644 arch/arm/mach-kirkwood/db88f6281-bp-setup.c
39
40 diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
41 index f0895c5..3844ef2 100644
42 --- a/arch/arm/boot/dts/Makefile
43 +++ b/arch/arm/boot/dts/Makefile
44 @@ -64,6 +64,8 @@ dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
45 integratorcp.dtb
46 dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
47 dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
48 + kirkwood-db-88f6281.dtb \
49 + kirkwood-db-88f6282.dtb \
50 kirkwood-dns320.dtb \
51 kirkwood-dns325.dtb \
52 kirkwood-dockstar.dtb \
53 diff --git a/arch/arm/boot/dts/kirkwood-db-88f6281.dts b/arch/arm/boot/dts/kirkwood-db-88f6281.dts
54 new file mode 100644
55 index 0000000..9d777ed
56 --- /dev/null
57 +++ b/arch/arm/boot/dts/kirkwood-db-88f6281.dts
58 @@ -0,0 +1,30 @@
59 +/*
60 + * Marvell DB-88F6281-BP Development Board Setup
61 + *
62 + * Saeed Bishara <saeed@marvell.com>
63 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
64 + *
65 + * This file is licensed under the terms of the GNU General Public
66 + * License version 2. This program is licensed "as is" without any
67 + * warranty of any kind, whether express or implied.
68 + */
69 +
70 +/dts-v1/;
71 +
72 +/include/ "kirkwood-db.dtsi"
73 +/include/ "kirkwood-6281.dtsi"
74 +
75 +/ {
76 + model = "Marvell DB-88F6281-BP Development Board";
77 + compatible = "marvell,db-88f6281-bp", "marvell,kirkwood-88f6281", "marvell,kirkwood";
78 +
79 + ocp@f1000000 {
80 + pcie-controller {
81 + status = "okay";
82 +
83 + pcie@1,0 {
84 + status = "okay";
85 + };
86 + };
87 + };
88 +};
89 diff --git a/arch/arm/boot/dts/kirkwood-db-88f6282.dts b/arch/arm/boot/dts/kirkwood-db-88f6282.dts
90 new file mode 100644
91 index 0000000..f4c8528
92 --- /dev/null
93 +++ b/arch/arm/boot/dts/kirkwood-db-88f6282.dts
94 @@ -0,0 +1,34 @@
95 +/*
96 + * Marvell DB-88F6282-BP Development Board Setup
97 + *
98 + * Saeed Bishara <saeed@marvell.com>
99 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
100 + *
101 + * This file is licensed under the terms of the GNU General Public
102 + * License version 2. This program is licensed "as is" without any
103 + * warranty of any kind, whether express or implied.
104 + */
105 +
106 +/dts-v1/;
107 +
108 +/include/ "kirkwood-db.dtsi"
109 +/include/ "kirkwood-6282.dtsi"
110 +
111 +/ {
112 + model = "Marvell DB-88F6282-BP Development Board";
113 + compatible = "marvell,db-88f6282-bp", "marvell,kirkwood-88f6282", "marvell,kirkwood";
114 +
115 + ocp@f1000000 {
116 + pcie-controller {
117 + status = "okay";
118 +
119 + pcie@1,0 {
120 + status = "okay";
121 + };
122 +
123 + pcie@2,0 {
124 + status = "okay";
125 + };
126 + };
127 + };
128 +};
129 diff --git a/arch/arm/boot/dts/kirkwood-db.dtsi b/arch/arm/boot/dts/kirkwood-db.dtsi
130 new file mode 100644
131 index 0000000..c87cfb8
132 --- /dev/null
133 +++ b/arch/arm/boot/dts/kirkwood-db.dtsi
134 @@ -0,0 +1,89 @@
135 +/*
136 + * Marvell DB-{88F6281,88F6282}-BP Development Board Setup
137 + *
138 + * Saeed Bishara <saeed@marvell.com>
139 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
140 + *
141 + * This file is licensed under the terms of the GNU General Public
142 + * License version 2. This program is licensed "as is" without any
143 + * warranty of any kind, whether express or implied.
144 + *
145 + * This file contains the definitions that are common between the 6281
146 + * and 6282 variants of the Marvell Kirkwood Development Board.
147 + */
148 +
149 +/include/ "kirkwood.dtsi"
150 +
151 +/ {
152 + memory {
153 + device_type = "memory";
154 + reg = <0x00000000 0x20000000>; /* 512 MB */
155 + };
156 +
157 + chosen {
158 + bootargs = "console=ttyS0,115200n8 earlyprintk";
159 + };
160 +
161 + ocp@f1000000 {
162 + pinctrl@10000 {
163 + pmx_sdio_gpios: pmx-sdio-gpios {
164 + marvell,pins = "mpp37", "mpp38";
165 + marvell,function = "gpio";
166 + };
167 + };
168 +
169 + serial@12000 {
170 + pinctrl-0 = <&pmx_uart0>;
171 + pinctrl-names = "default";
172 + clock-frequency = <200000000>;
173 + status = "ok";
174 + };
175 +
176 + nand@3000000 {
177 + pinctrl-0 = <&pmx_nand>;
178 + pinctrl-names = "default";
179 + chip-delay = <25>;
180 + status = "okay";
181 +
182 + partition@0 {
183 + label = "uboot";
184 + reg = <0x0 0x100000>;
185 + };
186 +
187 + partition@100000 {
188 + label = "uImage";
189 + reg = <0x100000 0x400000>;
190 + };
191 +
192 + partition@500000 {
193 + label = "root";
194 + reg = <0x500000 0x1fb00000>;
195 + };
196 + };
197 +
198 + sata@80000 {
199 + nr-ports = <2>;
200 + status = "okay";
201 + };
202 +
203 + ehci@50000 {
204 + status = "okay";
205 + };
206 +
207 + mvsdio@90000 {
208 + pinctrl-0 = <&pmx_sdio_gpios>;
209 + pinctrl-names = "default";
210 + wp-gpios = <&gpio1 5 0>;
211 + cd-gpios = <&gpio1 6 0>;
212 + status = "okay";
213 + };
214 +
215 + pcie-controller {
216 + status = "okay";
217 +
218 + pcie@1,0 {
219 + status = "okay";
220 + };
221 + };
222 + };
223 +};
224 diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
225 index 267ca95..b56bd3d 100644
226 --- a/arch/arm/mach-kirkwood/Kconfig
227 +++ b/arch/arm/mach-kirkwood/Kconfig
228 @@ -8,12 +8,6 @@ config MACH_D2NET_V2
229 Say 'Y' here if you want your kernel to support the
230 LaCie d2 Network v2 NAS.
231
232 -config MACH_DB88F6281_BP
233 - bool "Marvell DB-88F6281-BP Development Board"
234 - help
235 - Say 'Y' here if you want your kernel to support the
236 - Marvell DB-88F6281-BP Development Board.
237 -
238 config MACH_DOCKSTAR
239 bool "Seagate FreeAgent DockStar"
240 help
241 @@ -153,6 +147,13 @@ config MACH_CLOUDBOX_DT
242 Say 'Y' here if you want your kernel to support the LaCie
243 CloudBox NAS, using Flattened Device Tree.
244
245 +config MACH_DB88F628X_BP_DT
246 + bool "Marvell DB-88F628x-BP Development Board (Flattened Device Tree)"
247 + help
248 + Say 'Y' here if you want your kernel to support the Marvell
249 + DB-88F6281-BP and DB-88F6282-BP Development Board (Flattened
250 + Device Tree).
251 +
252 config MACH_DLINK_KIRKWOOD_DT
253 bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
254 select ARCH_KIRKWOOD_DT
255 diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
256 index 794366e..2fdc3a7 100644
257 --- a/arch/arm/mach-kirkwood/Makefile
258 +++ b/arch/arm/mach-kirkwood/Makefile
259 @@ -1,7 +1,6 @@
260 obj-y += common.o irq.o pcie.o mpp.o
261
262 obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
263 -obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o
264 obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o
265 obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o
266 obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o
267 @@ -21,6 +20,7 @@ obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
268
269 obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
270 obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o
271 +obj-$(CONFIG_MACH_DB88F628X_BP_DT) += board-db88f628x-bp.o
272 obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
273 obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o
274 obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
275 diff --git a/arch/arm/mach-kirkwood/board-db88f628x-bp.c b/arch/arm/mach-kirkwood/board-db88f628x-bp.c
276 new file mode 100644
277 index 0000000..2f574bc
278 --- /dev/null
279 +++ b/arch/arm/mach-kirkwood/board-db88f628x-bp.c
280 @@ -0,0 +1,24 @@
281 +/*
282 + * Saeed Bishara <saeed@marvell.com>
283 + *
284 + * Marvell DB-88F628{1,2}-BP Development Board Setup
285 + *
286 + * This file is licensed under the terms of the GNU General Public
287 + * License version 2. This program is licensed "as is" without any
288 + * warranty of any kind, whether express or implied.
289 + */
290 +
291 +#include <linux/kernel.h>
292 +#include <linux/init.h>
293 +#include <linux/of.h>
294 +#include <linux/mv643xx_eth.h>
295 +#include "common.h"
296 +
297 +static struct mv643xx_eth_platform_data db88f628x_ge00_data = {
298 + .phy_addr = MV643XX_ETH_PHY_ADDR(8),
299 +};
300 +
301 +void __init db88f628x_init(void)
302 +{
303 + kirkwood_ge00_init(&db88f628x_ge00_data);
304 +}
305 diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
306 index e9647b8..f5aed1f 100644
307 --- a/arch/arm/mach-kirkwood/board-dt.c
308 +++ b/arch/arm/mach-kirkwood/board-dt.c
309 @@ -147,6 +147,10 @@ static void __init kirkwood_dt_init(void)
310 of_machine_is_compatible("lacie,netspace_v2"))
311 ns2_init();
312
313 + if (of_machine_is_compatible("marvell,db-88f6281-bp") ||
314 + of_machine_is_compatible("marvell,db-88f6282-bp"))
315 + db88f628x_init();
316 +
317 if (of_machine_is_compatible("mpl,cec4"))
318 mplcec4_init();
319
320 @@ -181,6 +185,8 @@ static const char * const kirkwood_dt_board_compat[] = {
321 "lacie,netspace_max_v2",
322 "lacie,netspace_mini_v2",
323 "lacie,netspace_v2",
324 + "marvell,db-88f6281-bp",
325 + "marvell,db-88f6282-bp",
326 "mpl,cec4",
327 "netgear,readynas-duo-v2",
328 "plathome,openblocks-a6",
329 diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
330 index 21da3b1..cbbc0b8 100644
331 --- a/arch/arm/mach-kirkwood/common.h
332 +++ b/arch/arm/mach-kirkwood/common.h
333 @@ -119,6 +119,12 @@ void km_kirkwood_init(void);
334 static inline void km_kirkwood_init(void) {};
335 #endif
336
337 +#ifdef CONFIG_MACH_DB88F628X_BP_DT
338 +void db88f628x_init(void);
339 +#else
340 +static inline void db88f628x_init(void) {};
341 +#endif
342 +
343 #ifdef CONFIG_MACH_MPLCEC4_DT
344 void mplcec4_init(void);
345 #else
346 diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
347 deleted file mode 100644
348 index 5a369fe..0000000
349 --- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
350 +++ /dev/null
351 @@ -1,108 +0,0 @@
352 -/*
353 - * arch/arm/mach-kirkwood/db88f6281-bp-setup.c
354 - *
355 - * Marvell DB-88F6281-BP Development Board Setup
356 - *
357 - * This file is licensed under the terms of the GNU General Public
358 - * License version 2. This program is licensed "as is" without any
359 - * warranty of any kind, whether express or implied.
360 - */
361 -
362 -#include <linux/kernel.h>
363 -#include <linux/init.h>
364 -#include <linux/sizes.h>
365 -#include <linux/platform_device.h>
366 -#include <linux/mtd/partitions.h>
367 -#include <linux/ata_platform.h>
368 -#include <linux/mv643xx_eth.h>
369 -#include <asm/mach-types.h>
370 -#include <asm/mach/arch.h>
371 -#include <mach/kirkwood.h>
372 -#include <linux/platform_data/mmc-mvsdio.h>
373 -#include "common.h"
374 -#include "mpp.h"
375 -
376 -static struct mtd_partition db88f6281_nand_parts[] = {
377 - {
378 - .name = "u-boot",
379 - .offset = 0,
380 - .size = SZ_1M
381 - }, {
382 - .name = "uImage",
383 - .offset = MTDPART_OFS_NXTBLK,
384 - .size = SZ_4M
385 - }, {
386 - .name = "root",
387 - .offset = MTDPART_OFS_NXTBLK,
388 - .size = MTDPART_SIZ_FULL
389 - },
390 -};
391 -
392 -static struct mv643xx_eth_platform_data db88f6281_ge00_data = {
393 - .phy_addr = MV643XX_ETH_PHY_ADDR(8),
394 -};
395 -
396 -static struct mv_sata_platform_data db88f6281_sata_data = {
397 - .n_ports = 2,
398 -};
399 -
400 -static struct mvsdio_platform_data db88f6281_mvsdio_data = {
401 - .gpio_write_protect = 37,
402 - .gpio_card_detect = 38,
403 -};
404 -
405 -static unsigned int db88f6281_mpp_config[] __initdata = {
406 - MPP0_NF_IO2,
407 - MPP1_NF_IO3,
408 - MPP2_NF_IO4,
409 - MPP3_NF_IO5,
410 - MPP4_NF_IO6,
411 - MPP5_NF_IO7,
412 - MPP18_NF_IO0,
413 - MPP19_NF_IO1,
414 - MPP37_GPIO,
415 - MPP38_GPIO,
416 - 0
417 -};
418 -
419 -static void __init db88f6281_init(void)
420 -{
421 - /*
422 - * Basic setup. Needs to be called early.
423 - */
424 - kirkwood_init();
425 - kirkwood_mpp_conf(db88f6281_mpp_config);
426 -
427 - kirkwood_nand_init(ARRAY_AND_SIZE(db88f6281_nand_parts), 25);
428 - kirkwood_ehci_init();
429 - kirkwood_ge00_init(&db88f6281_ge00_data);
430 - kirkwood_sata_init(&db88f6281_sata_data);
431 - kirkwood_uart0_init();
432 - kirkwood_sdio_init(&db88f6281_mvsdio_data);
433 -}
434 -
435 -static int __init db88f6281_pci_init(void)
436 -{
437 - if (machine_is_db88f6281_bp()) {
438 - u32 dev, rev;
439 -
440 - kirkwood_pcie_id(&dev, &rev);
441 - if (dev == MV88F6282_DEV_ID)
442 - kirkwood_pcie_init(KW_PCIE1 | KW_PCIE0);
443 - else
444 - kirkwood_pcie_init(KW_PCIE0);
445 - }
446 - return 0;
447 -}
448 -subsys_initcall(db88f6281_pci_init);
449 -
450 -MACHINE_START(DB88F6281_BP, "Marvell DB-88F6281-BP Development Board")
451 - /* Maintainer: Saeed Bishara <saeed@marvell.com> */
452 - .atag_offset = 0x100,
453 - .init_machine = db88f6281_init,
454 - .map_io = kirkwood_map_io,
455 - .init_early = kirkwood_init_early,
456 - .init_irq = kirkwood_init_irq,
457 - .init_time = kirkwood_timer_init,
458 - .restart = kirkwood_restart,
459 -MACHINE_END
460 --
461 1.8.4.rc1
462