Kirkwood: Add basic device tree support for QNAP TS219.
Subsystems (5)
PATCH 9/9 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.
--- 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 | 15 +++++ 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 | 86 +++++++++++++++++++++++++++++ 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
arch/arm/boot/dts/kirkwood-ts219-6281.dts new file +21 -0
@@ -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>; + }; + }; +};
arch/arm/boot/dts/kirkwood-ts219-6282.dts new file +21 -0
@@ -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>; + }; + }; +};
arch/arm/boot/dts/kirkwood-ts219.dtsi new file +73 -0
73 lines not on this page · raw message
arch/arm/mach-kirkwood/Kconfig +15 -0
@@ -47,6 +47,7 @@ config MACH_GURUPLUG config ARCH_KIRKWOOD_DT bool "Marvell Kirkwood Flattened Device Tree" select USE_OF + select SERIAL_OF_PLATFORM help Say 'Y' here if you want your kernel to support the Marvell Kirkwood using flattened device tree.
@@ -80,6 +81,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
arch/arm/mach-kirkwood/Makefile +1 -0
@@ -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
arch/arm/mach-kirkwood/Makefile.boot +1 -0
@@ -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
arch/arm/mach-kirkwood/board-dt.c +4 -0
@@ -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 };
arch/arm/mach-kirkwood/board-ts219.c new file +86 -0
86 lines not on this page · raw message
arch/arm/mach-kirkwood/common.h +5 -0
@@ -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 );
Signature · 1 line
1.7.10
PATCH 9/9 Kirkwood: Add basic device tree support for QNAP TS219.
Quoted 161 lines · Andrew Lunn
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.cfile.Signed-off-by Andrew Lunn <[email protected]>--- 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 | 15 +++++ 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 | 86 +++++++++++++++++++++++++++++ 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.carch/arm/boot/dts/kirkwood-ts219-6281.dts new file +21
-0@@ -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>; + }; + }; +};arch/arm/boot/dts/kirkwood-ts219-6282.dts new file +21
-0@@ -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>; + }; + }; +};arch/arm/boot/dts/kirkwood-ts219.dtsi new file +73
-0@@ -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"; + }; + }; + }; + }; +};arch/arm/mach-kirkwood/Kconfig +0
-0
arch/arm/mach-kirkwood/Kconfig config MACH_GURUPLUG · line 50
Quoted 4 lines
arch/arm/mach-kirkwood/Kconfig +1
-0@@ -47,6 +47,7 @@ config MACH_GURUPLUG config ARCH_KIRKWOOD_DT bool "Marvell Kirkwood Flattened Device Tree" select USE_OF + select SERIAL_OF_PLATFORM
Please remove as previously discussed. I'm in the process of updating kirkwood_defconfig (it will include this). Thanks.
Other than that,
thx,
Jason.
Quoted 175 lines
arch/arm/mach-kirkwood/Kconfig +14
-0help Say 'Y' here if you want your kernel to support the Marvell Kirkwood using flattened device tree.@@ -80,6 +81,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" helparch/arm/mach-kirkwood/Makefile +1
-0@@ -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.oarch/arm/mach-kirkwood/Makefile.boot +1
-0@@ -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.dtbarch/arm/mach-kirkwood/board-dt.c +4
-0@@ -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 };arch/arm/mach-kirkwood/board-ts219.c new file +86
-0@@ -0,0 +1,86 @@ +/* +* +* QNAP TS-11x/TS-21x Turbo NAS Board Setup via DT +* +* Copyright (C) 2012 Andrew Lunn <[email protected]> +* +* Based on the board file ts219-setup.c: +* +* Copyright (C) 2009 Martin Michlmayr <[email protected]> +* Copyright (C) 2008 Byron Bradley <[email protected]> +* +* 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; +} + +static int __init ts219_pci_init (void ) +{ +if (machine_is_ts219 ()) +kirkwood_pcie_init (KW_PCIE0 ); + +return 0 ; +} +subsys_initcall (ts219_pci_init);arch/arm/mach-kirkwood/common.h +5
-0@@ -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 );Signature · 1 line
1.7.10
PATCH 9/9 Kirkwood: Add basic device tree support for QNAP TS219.
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-kirkwood/Kconfig +0
-0
Quoted 8 lines
arch/arm/mach-kirkwood/Kconfig config MACH_GURUPLUG · line 50
Quoted 5 lines
arch/arm/mach-kirkwood/Kconfig +1
-0@@ -47,6 +47,7 @@ config MACH_GURUPLUG config ARCH_KIRKWOOD_DT bool "Marvell Kirkwood Flattened Device Tree" select USE_OF + select SERIAL_OF_PLATFORMPlease remove as previously discussed. I'm in the process of updating
kirkwood_defconfig(it will include this). Thanks.
No problems. I just got bitten by this too many times...
It would be good if all the DT boards where compiled all the time. We can then see build failures in kisskb.
Andrew
PATCH 9/9 Kirkwood: Add basic device tree support for QNAP TS219.
Quoted 2 lines · Andrew Lunn
It would be good if all the DT boards where compiled all the time. We can then see build failures in kisskb.
Yep, I've included this, as well as watchdog and a few others. The series will also include the s/mrvl/marvell/g conversion, and the CONFIG_ARM_PATCH_PHYS_VIRT correct answer. Which I'm still working on.
thx,
Jason.
PATCH 9/9 Kirkwood: Add basic device tree support for QNAP TS219.
In reply to Andrew LunnAm Sonntag 10 Juni 2012, 12:32:01 schrieb Andrew Lunn:
[..]
Quoted 4 lines
(quoted diff) +2
-0+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_DTarch/arm/mach-kirkwood/Kconfig +1
-0+ select ARM_APPENDED_DTB
arch/arm/mach-kirkwood/Kconfig config MACH_IB62X0_DT · line 97
Quoted 10 lines
arch/arm/mach-kirkwood/Kconfig +10
-0+ 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. +
whitespace errors above
Signature · 1 line
Michael