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