aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2012-05-12 08:57:59 -0400
committerAndrew Lunn <andrew@lunn.ch>2012-07-27 10:48:52 -0400
commit9eb61f473601c047a4c0c84269d0c25493e45277 (patch)
tree2d86f210620e5637f1a95ed7c633a5a10c7b4555 /arch
parent97b414e119ccc7216e29c3bd62fe1a1797f21404 (diff)
ARM: Kirkwood: Add basic device tree support for QNAP TS219.
The two different variants of QNAP TS devices, varying by SoC, put the GPIO keys on different GPIO lines. Hence we need two different DT board descriptions, which share the same board-ts219.c file. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6281.dts21
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6282.dts21
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219.dtsi74
-rw-r--r--arch/arm/mach-kirkwood/Kconfig14
-rw-r--r--arch/arm/mach-kirkwood/Makefile1
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot1
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c4
-rw-r--r--arch/arm/mach-kirkwood/board-ts219.c87
-rw-r--r--arch/arm/mach-kirkwood/common.h5
9 files changed, 228 insertions, 0 deletions
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6281.dts b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
new file mode 100644
index 000000000000..ccbf32757800
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
@@ -0,0 +1,21 @@
1/dts-v1/;
2
3/include/ "kirkwood-ts219.dtsi"
4
5/ {
6 gpio_keys {
7 compatible = "gpio-keys";
8 #address-cells = <1>;
9 #size-cells = <0>;
10 button@1 {
11 label = "USB Copy";
12 linux,code = <133>;
13 gpios = <&gpio0 15 1>;
14 };
15 button@2 {
16 label = "Reset";
17 linux,code = <0x198>;
18 gpios = <&gpio0 16 1>;
19 };
20 };
21}; \ No newline at end of file
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
new file mode 100644
index 000000000000..fbe9932161a1
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
@@ -0,0 +1,21 @@
1/dts-v1/;
2
3/include/ "kirkwood-ts219.dtsi"
4
5/ {
6 gpio_keys {
7 compatible = "gpio-keys";
8 #address-cells = <1>;
9 #size-cells = <0>;
10 button@1 {
11 label = "USB Copy";
12 linux,code = <133>;
13 gpios = <&gpio1 11 1>;
14 };
15 button@2 {
16 label = "Reset";
17 linux,code = <0x198>;
18 gpios = <&gpio1 5 1>;
19 };
20 };
21}; \ No newline at end of file
diff --git a/arch/arm/boot/dts/kirkwood-ts219.dtsi b/arch/arm/boot/dts/kirkwood-ts219.dtsi
new file mode 100644
index 000000000000..7b3f961d37d9
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
@@ -0,0 +1,74 @@
1/include/ "kirkwood.dtsi"
2
3/ {
4 model = "QNAP TS219 family";
5 compatible = "qnap,ts219", "mrvl,kirkwood";
6
7 memory {
8 device_type = "memory";
9 reg = <0x00000000 0x20000000>;
10 };
11
12 chosen {
13 bootargs = "console=ttyS0,115200n8";
14 };
15
16 ocp@f1000000 {
17 i2c@11000 {
18 status = "okay";
19 clock-frequency = <400000>;
20
21 s35390a: s35390a@30 {
22 compatible = "s35390a";
23 reg = <0x30>;
24 };
25 };
26 serial@12000 {
27 clock-frequency = <200000000>;
28 status = "okay";
29 };
30 serial@12100 {
31 clock-frequency = <200000000>;
32 status = "okay";
33 };
34 spi@10600 {
35 status = "okay";
36
37 m25p128@0 {
38 #address-cells = <1>;
39 #size-cells = <1>;
40 compatible = "m25p128";
41 reg = <0>;
42 spi-max-frequency = <20000000>;
43 mode = <0>;
44
45 partition@0000000 {
46 reg = <0x00000000 0x00080000>;
47 label = "U-Boot";
48 };
49
50 partition@00200000 {
51 reg = <0x00200000 0x00200000>;
52 label = "Kernel";
53 };
54
55 partition@00400000 {
56 reg = <0x00400000 0x00900000>;
57 label = "RootFS1";
58 };
59 partition@00d00000 {
60 reg = <0x00d00000 0x00300000>;
61 label = "RootFS2";
62 };
63 partition@00040000 {
64 reg = <0x00080000 0x00040000>;
65 label = "U-Boot Config";
66 };
67 partition@000c0000 {
68 reg = <0x000c0000 0x00140000>;
69 label = "NAS Config";
70 };
71 };
72 };
73 };
74};
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 199764fe0fb0..8e62fa745b98 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -80,6 +80,20 @@ config MACH_IB62X0_DT
80 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using 80 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
81 Flattened Device Tree. 81 Flattened Device Tree.
82 82
83config MACH_TS219_DT
84 bool "Device Tree for QNAP TS-11X, TS-21X NAS"
85 select ARCH_KIRKWOOD_DT
86 select ARM_APPENDED_DTB
87 select ARM_ATAG_DTB_COMPAT
88 help
89 Say 'Y' here if you want your kernel to support the QNAP
90 TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
91 TS-219P+ Turbo NAS devices using Fattened Device Tree.
92 There are two different Device Tree descriptions, depending
93 on if the device is based on an if the board uses the MV6281
94 or MV6282. If you have the wrong one, the buttons will not
95 work.
96
83config MACH_TS219 97config MACH_TS219
84 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" 98 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
85 help 99 help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index d2b05907b10e..8b023281ec72 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -25,3 +25,4 @@ obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o 25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o 26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o 27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
28obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 02edbdf5b065..4a1f66a020b0 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -7,3 +7,4 @@ dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb
7dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb 7dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb
8dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb 8dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb
9dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb 9dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb
10dtb-$(CONFIG_MACH_TS219_DT) += kirkwood-qnap-ts219.dtb
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 8c67c222a0c1..d0ad25036558 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -77,6 +77,9 @@ static void __init kirkwood_dt_init(void)
77 if (of_machine_is_compatible("raidsonic,ib-nas62x0")) 77 if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
78 ib62x0_init(); 78 ib62x0_init();
79 79
80 if (of_machine_is_compatible("qnap,ts219"))
81 qnap_dt_ts219_init();
82
80 of_platform_populate(NULL, kirkwood_dt_match_table, 83 of_platform_populate(NULL, kirkwood_dt_match_table,
81 kirkwood_auxdata_lookup, NULL); 84 kirkwood_auxdata_lookup, NULL);
82} 85}
@@ -87,6 +90,7 @@ static const char *kirkwood_dt_board_compat[] = {
87 "dlink,dns-325", 90 "dlink,dns-325",
88 "iom,iconnect", 91 "iom,iconnect",
89 "raidsonic,ib-nas62x0", 92 "raidsonic,ib-nas62x0",
93 "qnap,ts219",
90 NULL 94 NULL
91}; 95};
92 96
diff --git a/arch/arm/mach-kirkwood/board-ts219.c b/arch/arm/mach-kirkwood/board-ts219.c
new file mode 100644
index 000000000000..00b79eaeef53
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-ts219.c
@@ -0,0 +1,87 @@
1/*
2 *
3 * QNAP TS-11x/TS-21x Turbo NAS Board Setup via DT
4 *
5 * Copyright (C) 2012 Andrew Lunn <andrew@lunn.ch>
6 *
7 * Based on the board file ts219-setup.c:
8 *
9 * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com>
10 * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/mv643xx_eth.h>
22#include <linux/ata_platform.h>
23#include <linux/gpio_keys.h>
24#include <linux/input.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <mach/kirkwood.h>
28#include "common.h"
29#include "mpp.h"
30#include "tsx1x-common.h"
31
32static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
33 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
34};
35
36static struct mv_sata_platform_data qnap_ts219_sata_data = {
37 .n_ports = 2,
38};
39
40static unsigned int qnap_ts219_mpp_config[] __initdata = {
41 MPP0_SPI_SCn,
42 MPP1_SPI_MOSI,
43 MPP2_SPI_SCK,
44 MPP3_SPI_MISO,
45 MPP4_SATA1_ACTn,
46 MPP5_SATA0_ACTn,
47 MPP8_TW0_SDA,
48 MPP9_TW0_SCK,
49 MPP10_UART0_TXD,
50 MPP11_UART0_RXD,
51 MPP13_UART1_TXD, /* PIC controller */
52 MPP14_UART1_RXD, /* PIC controller */
53 MPP15_GPIO, /* USB Copy button (on devices with 88F6281) */
54 MPP16_GPIO, /* Reset button (on devices with 88F6281) */
55 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
56 MPP37_GPIO, /* Reset button (on devices with 88F6282) */
57 MPP43_GPIO, /* USB Copy button (on devices with 88F6282) */
58 MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */
59 0
60};
61
62void __init qnap_dt_ts219_init(void)
63{
64 u32 dev, rev;
65
66 kirkwood_mpp_conf(qnap_ts219_mpp_config);
67
68 kirkwood_pcie_id(&dev, &rev);
69 if (dev == MV88F6282_DEV_ID)
70 qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
71
72 kirkwood_ge00_init(&qnap_ts219_ge00_data);
73 kirkwood_sata_init(&qnap_ts219_sata_data);
74 kirkwood_ehci_init();
75
76 pm_power_off = qnap_tsx1x_power_off;
77}
78
79/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
80static int __init ts219_pci_init(void)
81{
82 if (machine_is_ts219())
83 kirkwood_pcie_init(KW_PCIE0);
84
85 return 0;
86}
87subsys_initcall(ts219_pci_init);
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 9248fa2c165b..e0c23245a73c 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -58,6 +58,11 @@ void dreamplug_init(void);
58#else 58#else
59static inline void dreamplug_init(void) {}; 59static inline void dreamplug_init(void) {};
60#endif 60#endif
61#ifdef CONFIG_MACH_TS219_DT
62void qnap_dt_ts219_init(void);
63#else
64static inline void qnap_dt_ts219_init(void) {};
65#endif
61 66
62#ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT 67#ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT
63void dnskw_init(void); 68void dnskw_init(void);