All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
To: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Michael Walle <michael-QKn5cuLxLXY@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
Subject: [PATCH v2 08/12] Kirkwood: Add basic device tree support for QNAP TS219.
Date: Tue,  3 Jul 2012 16:22:41 +0200	[thread overview]
Message-ID: <1341325365-21393-9-git-send-email-andrew@lunn.ch> (raw)
In-Reply-To: <1341325365-21393-1-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>

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-g2DYL2Zd6BY@public.gmane.org>
Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
---
 arch/arm/boot/dts/kirkwood-ts219-6281.dts |   21 +++++++
 arch/arm/boot/dts/kirkwood-ts219-6282.dts |   21 +++++++
 arch/arm/boot/dts/kirkwood-ts219.dtsi     |   73 ++++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig            |   14 +++++
 arch/arm/mach-kirkwood/Makefile           |    1 +
 arch/arm/mach-kirkwood/Makefile.boot      |    1 +
 arch/arm/mach-kirkwood/board-dt.c         |    4 ++
 arch/arm/mach-kirkwood/board-ts219.c      |   87 +++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h           |    5 ++
 9 files changed, 227 insertions(+)
 create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6281.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6282.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ts219.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-ts219.c

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 0000000..ccbf327
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
@@ -0,0 +1,21 @@
+/dts-v1/;
+
+/include/ "kirkwood-ts219.dtsi"
+
+/ {
+	gpio_keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		button@1 {
+			label = "USB Copy";
+			linux,code = <133>;
+			gpios = <&gpio0 15 1>;
+		};
+		button@2 {
+			label = "Reset";
+			linux,code = <0x198>;
+			gpios = <&gpio0 16 1>;
+		};
+	};
+};
\ 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 0000000..fbe9932
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
@@ -0,0 +1,21 @@
+/dts-v1/;
+
+/include/ "kirkwood-ts219.dtsi"
+
+/ {
+	gpio_keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		button@1 {
+			label = "USB Copy";
+			linux,code = <133>;
+			gpios = <&gpio1 11 1>;
+		};
+		button@2 {
+			label = "Reset";
+			linux,code = <0x198>;
+			gpios = <&gpio1 5 1>;
+		};
+	};
+};
\ 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 0000000..e0520c3
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
@@ -0,0 +1,73 @@
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "QNAP TS219 family";
+	compatible = "qnap,ts219", "mrvl,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8";
+	};
+
+	ocp@f1000000 {
+		i2c@11000 {
+			status = "okay";
+
+			s35390a: s35390a@30 {
+				compatible = "s35390a";
+				reg = <0x30>;
+			};
+		};
+		serial@12000 {
+			clock-frequency = <200000000>;
+			status = "okay";
+		};
+		serial@12100 {
+			clock-frequency = <200000000>;
+			status = "okay";
+		};
+		spi@10600 {
+			status = "okay";
+
+			m25p128@0 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				compatible = "m25p128";
+				reg = <0>;
+				spi-max-frequency = <20000000>;
+				mode = <0>;
+
+				partition@0000000 {
+					reg = <0x00000000 0x00080000>;
+					label = "U-Boot";
+				};
+
+				partition@00200000 {
+					reg = <0x00200000 0x00200000>;
+					label = "Kernel";
+				};
+
+				partition@00400000 {
+					reg = <0x00400000 0x00900000>;
+					label = "RootFS1";
+				};
+				partition@00d00000 {
+					reg = <0x00d00000 0x00300000>;
+					label = "RootFS2";
+				};
+				partition@00040000 {
+					reg = <0x00080000 0x00040000>;
+					label = "U-Boot Config";
+				};
+				partition@000c0000 {
+					reg = <0x000c0000 0x00140000>;
+					label = "NAS Config";
+				};
+			};
+		};
+	};
+};
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 199764f..089d094 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -80,6 +80,20 @@ config MACH_IB62X0_DT
 	  RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
 	  Flattened Device Tree.
 
+config MACH_TS219_DT
+	bool "Device Tree for QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
+	select ARCH_KIRKWOOD_DT
+	select ARM_APPENDED_DTB
+	select ARM_ATAG_DTB_COMPAT
+	help
+	  Say 'Y' here if you want your kernel to support the QNAP
+	  TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
+	  TS-219P+ Turbo NAS devices using Fattened Device Tree.
+	  There are two different Device Tree descriptions, depending
+	  on if the device is based on an if the board uses the MV6281
+	  or MV6282. If you have the wrong one, the buttons will not
+	  work.
+
 config MACH_TS219
 	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
 	help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index d2b0590..0468b23 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
 obj-$(CONFIG_MACH_ICONNECT_DT)		+= board-iconnect.o
 obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT)	+= board-dnskw.o
 obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
+obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 02edbdf..4a1f66a 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
 dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb
 dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb
 dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb
+dtb-$(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 24c8fdd..b7cd6d2 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -76,6 +76,9 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
 		ib62x0_init();
 
+	if (of_machine_is_compatible("qnap,ts219"))
+		qnap_dt_ts219_init();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table,
 			     kirkwood_auxdata_lookup, NULL);
 }
@@ -86,6 +89,7 @@ static const char *kirkwood_dt_board_compat[] = {
 	"dlink,dns-325",
 	"iom,iconnect",
 	"raidsonic,ib-nas62x0",
+	"qnap,ts219",
 	NULL
 };
 
diff --git a/arch/arm/mach-kirkwood/board-ts219.c b/arch/arm/mach-kirkwood/board-ts219.c
new file mode 100644
index 0000000..00b79ea
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-ts219.c
@@ -0,0 +1,87 @@
+/*
+ *
+ * QNAP TS-11x/TS-21x Turbo NAS Board Setup via DT
+ *
+ * Copyright (C) 2012 Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
+ *
+ * Based on the board file ts219-setup.c:
+ *
+ * Copyright (C) 2009  Martin Michlmayr <tbm-R+vWnYXSFMfQT0dZR+AlfA@public.gmane.org>
+ * Copyright (C) 2008  Byron Bradley <byron.bbradley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/ata_platform.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <mach/kirkwood.h>
+#include "common.h"
+#include "mpp.h"
+#include "tsx1x-common.h"
+
+static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
+};
+
+static struct mv_sata_platform_data qnap_ts219_sata_data = {
+	.n_ports	= 2,
+};
+
+static unsigned int qnap_ts219_mpp_config[] __initdata = {
+	MPP0_SPI_SCn,
+	MPP1_SPI_MOSI,
+	MPP2_SPI_SCK,
+	MPP3_SPI_MISO,
+	MPP4_SATA1_ACTn,
+	MPP5_SATA0_ACTn,
+	MPP8_TW0_SDA,
+	MPP9_TW0_SCK,
+	MPP10_UART0_TXD,
+	MPP11_UART0_RXD,
+	MPP13_UART1_TXD,	/* PIC controller */
+	MPP14_UART1_RXD,	/* PIC controller */
+	MPP15_GPIO,		/* USB Copy button (on devices with 88F6281) */
+	MPP16_GPIO,		/* Reset button (on devices with 88F6281) */
+	MPP36_GPIO,		/* RAM: 0: 256 MB, 1: 512 MB */
+	MPP37_GPIO,		/* Reset button (on devices with 88F6282) */
+	MPP43_GPIO,		/* USB Copy button (on devices with 88F6282) */
+	MPP44_GPIO,		/* Board ID: 0: TS-11x, 1: TS-21x */
+	0
+};
+
+void __init qnap_dt_ts219_init(void)
+{
+	u32 dev, rev;
+
+	kirkwood_mpp_conf(qnap_ts219_mpp_config);
+
+	kirkwood_pcie_id(&dev, &rev);
+	if (dev == MV88F6282_DEV_ID)
+		qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
+
+	kirkwood_ge00_init(&qnap_ts219_ge00_data);
+	kirkwood_sata_init(&qnap_ts219_sata_data);
+	kirkwood_ehci_init();
+
+	pm_power_off = qnap_tsx1x_power_off;
+}
+
+/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
+static int __init ts219_pci_init(void)
+{
+	if (machine_is_ts219())
+		kirkwood_pcie_init(KW_PCIE0);
+
+	return 0;
+}
+subsys_initcall(ts219_pci_init);
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 9248fa2..e0c2324 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -58,6 +58,11 @@ void dreamplug_init(void);
 #else
 static inline void dreamplug_init(void) {};
 #endif
+#ifdef CONFIG_MACH_TS219_DT
+void qnap_dt_ts219_init(void);
+#else
+static inline void qnap_dt_ts219_init(void) {};
+#endif
 
 #ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT
 void dnskw_init(void);
-- 
1.7.10

WARNING: multiple messages have this Message-ID (diff)
From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 08/12] Kirkwood: Add basic device tree support for QNAP TS219.
Date: Tue,  3 Jul 2012 16:22:41 +0200	[thread overview]
Message-ID: <1341325365-21393-9-git-send-email-andrew@lunn.ch> (raw)
In-Reply-To: <1341325365-21393-1-git-send-email-andrew@lunn.ch>

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>
---
 arch/arm/boot/dts/kirkwood-ts219-6281.dts |   21 +++++++
 arch/arm/boot/dts/kirkwood-ts219-6282.dts |   21 +++++++
 arch/arm/boot/dts/kirkwood-ts219.dtsi     |   73 ++++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig            |   14 +++++
 arch/arm/mach-kirkwood/Makefile           |    1 +
 arch/arm/mach-kirkwood/Makefile.boot      |    1 +
 arch/arm/mach-kirkwood/board-dt.c         |    4 ++
 arch/arm/mach-kirkwood/board-ts219.c      |   87 +++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h           |    5 ++
 9 files changed, 227 insertions(+)
 create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6281.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ts219-6282.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ts219.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-ts219.c

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 0000000..ccbf327
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
@@ -0,0 +1,21 @@
+/dts-v1/;
+
+/include/ "kirkwood-ts219.dtsi"
+
+/ {
+	gpio_keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		button at 1 {
+			label = "USB Copy";
+			linux,code = <133>;
+			gpios = <&gpio0 15 1>;
+		};
+		button at 2 {
+			label = "Reset";
+			linux,code = <0x198>;
+			gpios = <&gpio0 16 1>;
+		};
+	};
+};
\ 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 0000000..fbe9932
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
@@ -0,0 +1,21 @@
+/dts-v1/;
+
+/include/ "kirkwood-ts219.dtsi"
+
+/ {
+	gpio_keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		button at 1 {
+			label = "USB Copy";
+			linux,code = <133>;
+			gpios = <&gpio1 11 1>;
+		};
+		button at 2 {
+			label = "Reset";
+			linux,code = <0x198>;
+			gpios = <&gpio1 5 1>;
+		};
+	};
+};
\ 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 0000000..e0520c3
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
@@ -0,0 +1,73 @@
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "QNAP TS219 family";
+	compatible = "qnap,ts219", "mrvl,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8";
+	};
+
+	ocp at f1000000 {
+		i2c at 11000 {
+			status = "okay";
+
+			s35390a: s35390a at 30 {
+				compatible = "s35390a";
+				reg = <0x30>;
+			};
+		};
+		serial at 12000 {
+			clock-frequency = <200000000>;
+			status = "okay";
+		};
+		serial at 12100 {
+			clock-frequency = <200000000>;
+			status = "okay";
+		};
+		spi at 10600 {
+			status = "okay";
+
+			m25p128 at 0 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				compatible = "m25p128";
+				reg = <0>;
+				spi-max-frequency = <20000000>;
+				mode = <0>;
+
+				partition at 0000000 {
+					reg = <0x00000000 0x00080000>;
+					label = "U-Boot";
+				};
+
+				partition at 00200000 {
+					reg = <0x00200000 0x00200000>;
+					label = "Kernel";
+				};
+
+				partition at 00400000 {
+					reg = <0x00400000 0x00900000>;
+					label = "RootFS1";
+				};
+				partition at 00d00000 {
+					reg = <0x00d00000 0x00300000>;
+					label = "RootFS2";
+				};
+				partition at 00040000 {
+					reg = <0x00080000 0x00040000>;
+					label = "U-Boot Config";
+				};
+				partition at 000c0000 {
+					reg = <0x000c0000 0x00140000>;
+					label = "NAS Config";
+				};
+			};
+		};
+	};
+};
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 199764f..089d094 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -80,6 +80,20 @@ config MACH_IB62X0_DT
 	  RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
 	  Flattened Device Tree.
 
+config MACH_TS219_DT
+	bool "Device Tree for QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
+	select ARCH_KIRKWOOD_DT
+	select ARM_APPENDED_DTB
+	select ARM_ATAG_DTB_COMPAT
+	help
+	  Say 'Y' here if you want your kernel to support the QNAP
+	  TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
+	  TS-219P+ Turbo NAS devices using Fattened Device Tree.
+	  There are two different Device Tree descriptions, depending
+	  on if the device is based on an if the board uses the MV6281
+	  or MV6282. If you have the wrong one, the buttons will not
+	  work.
+
 config MACH_TS219
 	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
 	help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index d2b0590..0468b23 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
 obj-$(CONFIG_MACH_ICONNECT_DT)		+= board-iconnect.o
 obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT)	+= board-dnskw.o
 obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
+obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 02edbdf..4a1f66a 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
 dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb
 dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb
 dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb
+dtb-$(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 24c8fdd..b7cd6d2 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -76,6 +76,9 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
 		ib62x0_init();
 
+	if (of_machine_is_compatible("qnap,ts219"))
+		qnap_dt_ts219_init();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table,
 			     kirkwood_auxdata_lookup, NULL);
 }
@@ -86,6 +89,7 @@ static const char *kirkwood_dt_board_compat[] = {
 	"dlink,dns-325",
 	"iom,iconnect",
 	"raidsonic,ib-nas62x0",
+	"qnap,ts219",
 	NULL
 };
 
diff --git a/arch/arm/mach-kirkwood/board-ts219.c b/arch/arm/mach-kirkwood/board-ts219.c
new file mode 100644
index 0000000..00b79ea
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-ts219.c
@@ -0,0 +1,87 @@
+/*
+ *
+ * QNAP TS-11x/TS-21x Turbo NAS Board Setup via DT
+ *
+ * Copyright (C) 2012 Andrew Lunn <andrew@lunn.ch>
+ *
+ * Based on the board file ts219-setup.c:
+ *
+ * Copyright (C) 2009  Martin Michlmayr <tbm@cyrius.com>
+ * Copyright (C) 2008  Byron Bradley <byron.bbradley@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/ata_platform.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <mach/kirkwood.h>
+#include "common.h"
+#include "mpp.h"
+#include "tsx1x-common.h"
+
+static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
+};
+
+static struct mv_sata_platform_data qnap_ts219_sata_data = {
+	.n_ports	= 2,
+};
+
+static unsigned int qnap_ts219_mpp_config[] __initdata = {
+	MPP0_SPI_SCn,
+	MPP1_SPI_MOSI,
+	MPP2_SPI_SCK,
+	MPP3_SPI_MISO,
+	MPP4_SATA1_ACTn,
+	MPP5_SATA0_ACTn,
+	MPP8_TW0_SDA,
+	MPP9_TW0_SCK,
+	MPP10_UART0_TXD,
+	MPP11_UART0_RXD,
+	MPP13_UART1_TXD,	/* PIC controller */
+	MPP14_UART1_RXD,	/* PIC controller */
+	MPP15_GPIO,		/* USB Copy button (on devices with 88F6281) */
+	MPP16_GPIO,		/* Reset button (on devices with 88F6281) */
+	MPP36_GPIO,		/* RAM: 0: 256 MB, 1: 512 MB */
+	MPP37_GPIO,		/* Reset button (on devices with 88F6282) */
+	MPP43_GPIO,		/* USB Copy button (on devices with 88F6282) */
+	MPP44_GPIO,		/* Board ID: 0: TS-11x, 1: TS-21x */
+	0
+};
+
+void __init qnap_dt_ts219_init(void)
+{
+	u32 dev, rev;
+
+	kirkwood_mpp_conf(qnap_ts219_mpp_config);
+
+	kirkwood_pcie_id(&dev, &rev);
+	if (dev == MV88F6282_DEV_ID)
+		qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
+
+	kirkwood_ge00_init(&qnap_ts219_ge00_data);
+	kirkwood_sata_init(&qnap_ts219_sata_data);
+	kirkwood_ehci_init();
+
+	pm_power_off = qnap_tsx1x_power_off;
+}
+
+/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
+static int __init ts219_pci_init(void)
+{
+	if (machine_is_ts219())
+		kirkwood_pcie_init(KW_PCIE0);
+
+	return 0;
+}
+subsys_initcall(ts219_pci_init);
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 9248fa2..e0c2324 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -58,6 +58,11 @@ void dreamplug_init(void);
 #else
 static inline void dreamplug_init(void) {};
 #endif
+#ifdef CONFIG_MACH_TS219_DT
+void qnap_dt_ts219_init(void);
+#else
+static inline void qnap_dt_ts219_init(void) {};
+#endif
 
 #ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT
 void dnskw_init(void);
-- 
1.7.10

  parent reply	other threads:[~2012-07-03 14:22 UTC|newest]

Thread overview: 130+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03 14:22 [PATCH v2 00/12] IRQ, GPIO SPI, I2C, etc DTC support Andrew Lunn
2012-07-03 14:22 ` Andrew Lunn
     [not found] ` <1341325365-21393-1-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
2012-07-03 14:22   ` [PATCH v2 01/12] ARM: Orion: DT support for IRQ and GPIO Controllers Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
2012-07-05  8:15     ` Andrew Lunn
     [not found]     ` <1341325365-21393-2-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
2012-07-05  9:02       ` Thomas Petazzoni
2012-07-05  9:02         ` Thomas Petazzoni
2012-07-05  9:48         ` Andrew Lunn
2012-07-05  9:48           ` Andrew Lunn
2012-07-05 10:11           ` Arnaud Patard
2012-07-05 10:11             ` Arnaud Patard (Rtp)
     [not found]             ` <87sjd6ikkj.fsf-0gaJ4kiyQU6khWr4QmshqB2eb7JE58TQ@public.gmane.org>
2012-07-05 10:20               ` Thomas Petazzoni
2012-07-05 10:20                 ` Thomas Petazzoni
2012-07-05 10:38                 ` Arnaud Patard
2012-07-05 10:38                   ` Arnaud Patard (Rtp)
     [not found]                   ` <87liiyijb8.fsf-0gaJ4kiyQU6khWr4QmshqB2eb7JE58TQ@public.gmane.org>
2012-07-05 11:42                     ` Thomas Petazzoni
2012-07-05 11:42                       ` Thomas Petazzoni
2012-07-05 11:48                       ` Andrew Lunn
2012-07-05 11:48                         ` Andrew Lunn
     [not found]                         ` <20120705114815.GT17534-g2DYL2Zd6BY@public.gmane.org>
2012-07-05 12:09                           ` Sebastian Hesselbarth
2012-07-05 12:09                             ` Sebastian Hesselbarth
     [not found]           ` <20120705094824.GO17534-g2DYL2Zd6BY@public.gmane.org>
2012-07-05 10:10             ` Thomas Petazzoni
2012-07-05 10:10               ` Thomas Petazzoni
2012-07-05 10:25               ` Andrew Lunn
2012-07-05 10:25                 ` Andrew Lunn
2012-07-05 12:58             ` Thomas Petazzoni
2012-07-05 12:58               ` Thomas Petazzoni
2012-07-05 13:15               ` Andrew Lunn
2012-07-05 13:15                 ` Andrew Lunn
     [not found]                 ` <20120705131522.GW17534-g2DYL2Zd6BY@public.gmane.org>
2012-07-05 13:28                   ` Thomas Petazzoni
2012-07-05 13:28                     ` Thomas Petazzoni
2012-07-05 13:33                     ` Andrew Lunn
2012-07-05 13:36                       ` Thomas Petazzoni
2012-07-05 12:25       ` Arnd Bergmann
2012-07-05 12:25         ` Arnd Bergmann
     [not found]         ` <201207051225.55390.arnd-r2nGTMty4D4@public.gmane.org>
2012-07-05 13:08           ` Andrew Lunn
2012-07-05 13:08             ` Andrew Lunn
     [not found]             ` <20120705130819.GV17534-g2DYL2Zd6BY@public.gmane.org>
2012-07-05 13:47               ` Arnd Bergmann
2012-07-05 13:47                 ` Arnd Bergmann
     [not found]                 ` <201207051347.38887.arnd-r2nGTMty4D4@public.gmane.org>
2012-07-05 13:54                   ` Andrew Lunn
2012-07-05 13:54                     ` Andrew Lunn
     [not found]                     ` <20120705135449.GZ17534-g2DYL2Zd6BY@public.gmane.org>
2012-07-05 15:47                       ` Arnd Bergmann
2012-07-05 15:47                         ` Arnd Bergmann
2012-07-05 14:14               ` Sebastian Hesselbarth
2012-07-05 14:14                 ` Sebastian Hesselbarth
     [not found]                 ` <4FF5A15A.8070309-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2012-07-05 14:43                   ` Andrew Lunn
2012-07-05 14:43                     ` Andrew Lunn
2012-07-05 14:54                   ` Arnd Bergmann
2012-07-05 14:54                     ` Arnd Bergmann
     [not found]                     ` <201207051454.24475.arnd-r2nGTMty4D4@public.gmane.org>
2012-07-05 15:51                       ` Sebastian Hesselbarth
2012-07-05 15:51                         ` Sebastian Hesselbarth
     [not found]                         ` <4FF5B7F9.9020507-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2012-07-05 16:30                           ` Arnaud Patard
2012-07-05 16:30                             ` Arnaud Patard (Rtp)
2012-07-05 16:16                       ` Andrew Lunn
2012-07-05 16:16                         ` Andrew Lunn
     [not found]                         ` <20120705161600.GA28860-g2DYL2Zd6BY@public.gmane.org>
2012-07-06 20:08                           ` Arnd Bergmann
2012-07-06 20:08                             ` Arnd Bergmann
     [not found]                             ` <201207062008.23952.arnd-r2nGTMty4D4@public.gmane.org>
2012-07-06 21:00                               ` Andrew Lunn
2012-07-06 21:00                                 ` Andrew Lunn
     [not found]                                 ` <20120706210009.GC11470-g2DYL2Zd6BY@public.gmane.org>
2012-07-07  0:24                                   ` Where to put a large bootloader-supplied device tree on ARM ? Mitch Bradley
2012-07-07  0:24                                     ` Mitch Bradley
     [not found]                                     ` <4FF781D8.3040206-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2012-07-07  1:23                                       ` David VomLehn (dvomlehn)
2012-07-07  1:23                                         ` David VomLehn (dvomlehn)
     [not found]                                         ` <2966DB01BC317A4DA23684BA0F653415013701-WE/xwOPrfQKHONfmNwMhBaBKnGwkPULj@public.gmane.org>
2012-07-07  1:59                                           ` Mitch Bradley
2012-07-07  1:59                                             ` Mitch Bradley
     [not found]                                             ` <4FF7980E.7050705-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2012-07-09  4:30                                               ` Nicolas Pitre
2012-07-09  4:30                                                 ` Nicolas Pitre
     [not found]                                                 ` <alpine.LFD.2.02.1207090015270.31100-QuJgVwGFrdf/9pzu0YdTqQ@public.gmane.org>
2012-07-12  6:52                                                   ` Mitch Bradley
2012-07-12  6:52                                                     ` Mitch Bradley
     [not found]                                                     ` <4FFE743B.6080504-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2012-07-12 18:16                                                       ` Nicolas Pitre
2012-07-12 18:16                                                         ` Nicolas Pitre
2012-07-12 20:34                                                     ` Rob Herring
2012-07-12 20:34                                                       ` [U-Boot] " Rob Herring
2012-07-12 20:34                                                       ` Rob Herring
2012-07-12 21:38                                                       ` Albert ARIBAUD
2012-07-12 21:38                                                         ` [U-Boot] " Albert ARIBAUD
2012-07-12 21:38                                                         ` Albert ARIBAUD
2012-07-12 21:47                                                         ` Wolfgang Denk
2012-07-12 21:47                                                           ` [U-Boot] " Wolfgang Denk
2012-07-12 21:47                                                           ` Wolfgang Denk
2012-07-13  1:28                                                           ` Rob Herring
2012-07-13  1:28                                                             ` [U-Boot] " Rob Herring
2012-07-13  1:28                                                             ` Rob Herring
     [not found]                                                             ` <4FFF79B6.6040508-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-13  6:45                                                               ` Albert ARIBAUD
2012-07-13  6:45                                                                 ` Albert ARIBAUD
2012-07-13  6:45                                                                 ` Albert ARIBAUD
2012-07-05 18:36                       ` [PATCH v2 01/12] ARM: Orion: DT support for IRQ and GPIO Controllers Mitch Bradley
2012-07-05 18:36                         ` Mitch Bradley
2012-07-03 14:22   ` [PATCH v2 02/12] SPI: Refactor spi-orion to use SPI framework queue Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
2012-07-03 14:22   ` [PATCH v2 03/12] spi-orion: remove uneeded spi_info Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
2012-07-03 14:22   ` [PATCH v2 04/12] spi-orion: add device tree binding Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
2012-07-03 14:22   ` [PATCH v2 05/12] ARM: kirkwood: use devicetree for orion-spi Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
2012-07-03 14:22   ` [PATCH v2 06/12] ARM: kirkwood: use devicetree for SPI on dreamplug Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
2012-07-03 14:22   ` [PATCH v2 07/12] I2C: MV64XXX: Add Device Tree support Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
     [not found]     ` <1341325365-21393-8-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
2012-07-03 15:59       ` Florian Fainelli
2012-07-03 15:59         ` Florian Fainelli
2012-07-03 16:58         ` Andrew Lunn
2012-07-03 16:58           ` Andrew Lunn
     [not found]           ` <20120703165839.GA1519-g2DYL2Zd6BY@public.gmane.org>
2012-07-04 19:49             ` Florian Fainelli
2012-07-04 19:49               ` Florian Fainelli
2012-07-05  6:52               ` Andrew Lunn
2012-07-05  6:52                 ` Andrew Lunn
2012-07-03 14:22   ` Andrew Lunn [this message]
2012-07-03 14:22     ` [PATCH v2 08/12] Kirkwood: Add basic device tree support for QNAP TS219 Andrew Lunn
     [not found]     ` <1341325365-21393-9-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
2012-07-03 15:47       ` Florian Fainelli
2012-07-03 15:47         ` Florian Fainelli
2012-07-03 17:09         ` Andrew Lunn
2012-07-03 17:09           ` Andrew Lunn
2012-07-03 14:22   ` [PATCH v2 09/12] ARM: Kirkwood: DTify the watchdog timer Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
2012-07-03 14:22   ` [PATCH v2 10/12] ATA: sata_mv: Add device tree support Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
2012-07-03 14:22   ` [PATCH v2 11/12] ARM: Kirkwood: Use DT to configure SATA device Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
     [not found]     ` <1341325365-21393-12-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
2012-07-03 14:52       ` Josh Coombs
2012-07-03 14:52         ` Josh Coombs
     [not found]         ` <CAMW5Ufa2bsYs9VD2g9hJWKpcQNcZt+WXCA1ohYoHeLk9SambSg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-03 15:32           ` Andrew Lunn
2012-07-03 15:32             ` Andrew Lunn
2012-07-03 14:22   ` [PATCH v2 12/12] Crypto: CESA: Add support for DT based instantiation Andrew Lunn
2012-07-03 14:22     ` Andrew Lunn
     [not found]     ` <1341325365-21393-13-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
2012-07-03 15:50       ` Florian Fainelli
2012-07-03 15:50         ` Florian Fainelli
2012-07-03 17:03         ` Andrew Lunn
2012-07-03 17:03           ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341325365-21393-9-git-send-email-andrew@lunn.ch \
    --to=andrew-g2dyl2zd6by@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=michael-QKn5cuLxLXY@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.