From patchwork Sun Mar 17 20:31:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Ebalard X-Patchwork-Id: 2284401 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id ECAE03FD8C for ; Sun, 17 Mar 2013 20:35:12 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UHKEx-0007yP-3P; Sun, 17 Mar 2013 20:31:35 +0000 Received: from mic92-1-81-57-185-249.fbx.proxad.net ([81.57.185.249] helo=smtp.natisbad.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UHKEt-0007xx-0F for linux-arm-kernel@lists.infradead.org; Sun, 17 Mar 2013 20:31:32 +0000 Received: by smtp.natisbad.org (Postfix, from userid 5001) id CC90E2C0376; Sun, 17 Mar 2013 21:31:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=natisbad.org; s=mail; t=1363552281; bh=+edNADvqAqknLLjA5W5CkJ4Bfoaxm9nlVvmAbSCUv8U=; h=From:To:Cc:Subject:Date; b=Fs1/nTHU/yskh74rlMShz/BQiGfbspc8EAIaKVZMn0q44mAF9SSOlzVomw17/i443 /GBdBwbXz2DQLUnKcUxwT63F5S5TCqv0pChaRDtiwcJeD/d2QAx9a3NriSHDcRwhCT BXT0a1piR81IvNgUXl9xed3cp3FtzvKO3byKGKAk= X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on petit X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from small (localhost [127.0.0.1]) by smtp.natisbad.org (Postfix) with ESMTP id 8E6EB2C01C7; Sun, 17 Mar 2013 21:31:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=natisbad.org; s=mail; t=1363552265; bh=+edNADvqAqknLLjA5W5CkJ4Bfoaxm9nlVvmAbSCUv8U=; h=From:To:Cc:Subject:Date; b=U/SGFQ7xLPdDqsLdlmRYrIMb+H2+RY417iYteY3GGvTzvDind94yntH6lQrtYBVhC 2JWiTE7FL9BO3tCCw8bp56mYhqidSFm6BUR4pxh8FCotPYpoXfwbVG1I1IQfRnxV4z 2ZJ3q5ixTU0ogv+FPsyo3+dDV8JFPyr5XJUolqVk= X-Hashcash: 1:20:130317:jason@lakedaemon.net::3JYzQU0kztw9Z/jr:000000000000000000000000000000000000000003Wxg X-Hashcash: 1:20:130317:andrew@lunn.ch::DYNLgLP9NSalIwe7:0000kgT X-Hashcash: 1:20:130317:linux-arm-kernel@lists.infradead.org::CCcLFYWOsp4h190u:00000000000000000000000000pk+ X-Hashcash: 1:20:130317:linux@arm.linux.org.uk::mWGEDYi7TPflTkJ4:00000000000000000000000000000000000000002lm From: arno@natisbad.org (Arnaud Ebalard) To: Jason Cooper , Andrew Lunn Subject: [PATCH] ARM: kirkwood: Add support for NETGEAR ReadyNAS Duo v2 using DT X-PGP-Key-URL: http://natisbad.org/arno@natisbad.org.asc X-Fingerprint: D3A5 B68A 839B 38A5 815A 781B B77C 0748 A7AE 341B Date: Sun, 17 Mar 2013 21:31:06 +0100 Message-ID: <8738vt3h11.fsf@natisbad.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130317_163131_350111_7C062E80 X-CRM114-Status: GOOD ( 23.10 ) X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 1.0 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS Cc: , Russell King - ARM Linux , Linux ARM Kernel Mailing List X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Hi, Add support for the NETGEAR ReadyNAS Duo v2 (Hardware specs available here: http://natisbad.org/NAS/). Almost everything is supported via provided .dts. A board-readynas.c file is nonetheless required for devices not only converted (Gbit controller) and USB 3.0 controller power on. FWIW, the most noticeable lack regarding hardware support is the fan controller (GMT G762) for which nothing is currently available upstream. A previous version of the patch has been tested against 3.8.3 and the one below has been tested against current arm tree. Cheers, a+ Signed-off-by: Arnaud Ebalard --- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/kirkwood-netgear_readynas.dts | 169 +++++++++++++++++++++++ arch/arm/configs/kirkwood_defconfig | 1 + arch/arm/mach-kirkwood/Kconfig | 9 ++ arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/board-dt.c | 4 + arch/arm/mach-kirkwood/board-readynas.c | 39 ++++++ arch/arm/mach-kirkwood/common.h | 6 + 8 files changed, 230 insertions(+) create mode 100644 arch/arm/boot/dts/kirkwood-netgear_readynas.dts create mode 100644 arch/arm/mach-kirkwood/board-readynas.c diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 9c62558..99122ba 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -71,6 +71,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \ kirkwood-ns2mini.dtb \ kirkwood-nsa310.dtb \ kirkwood-topkick.dtb \ + kirkwood-netgear_readynas.dtb \ kirkwood-ts219-6281.dtb \ kirkwood-ts219-6282.dtb \ kirkwood-openblocks_a6.dtb diff --git a/arch/arm/boot/dts/kirkwood-netgear_readynas.dts b/arch/arm/boot/dts/kirkwood-netgear_readynas.dts new file mode 100644 index 0000000..d89d436 --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-netgear_readynas.dts @@ -0,0 +1,169 @@ +/dts-v1/; + +/include/ "kirkwood.dtsi" +/include/ "kirkwood-6282.dtsi" + +/ { + model = "NETGEAR ReadyNAS Duo v2"; + compatible = "netgear,readynas", "marvell,kirkwood-88f6282", "marvell,kirkwood"; + + memory { /* 256 MB */ + device_type = "memory"; + reg = <0x00000000 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200n8 earlyprintk"; + }; + + ocp@f1000000 { + pinctrl: pinctrl@10000 { + + pinctrl-0 = < &pmx_uart0 + &pmx_button_power + &pmx_button_backup + &pmx_button_power + &pmx_led_power + &pmx_led_blue_activity + &pmx_led_blue_disk1 + &pmx_led_blue_disk2 + &pmx_led_blue_backup >; + pinctrl-names = "default"; + + pmx_button_power: pmx-button-power { + marvell,pins = "mpp47"; + marvell,function = "gpio"; + }; + pmx_button_backup: pmx-button-backup { + marvell,pins = "mpp45"; + marvell,function = "gpio"; + }; + pmx_button_reset: pmx-button-reset { + marvell,pins = "mpp13"; + marvell,function = "gpio"; + }; + pmx_led_power: pmx-led-power { + marvell,pins = "mpp31"; + marvell,function = "gpio"; + }; + pmx_led_blue_activity: pmx-led-blue-activity { + marvell,pins = "mpp38"; + marvell,function = "gpio"; + }; + pmx_led_blue_disk1: pmx-led-blue-disk1 { + marvell,pins = "mpp23"; + marvell,function = "gpio"; + }; + pmx_led_blue_disk2: pmx-led-blue-disk2 { + marvell,pins = "mpp22"; + marvell,function = "gpio"; + }; + pmx_led_blue_backup: pmx-led-blue-backup { + marvell,pins = "mpp29"; + marvell,function = "gpio"; + }; + }; + + thermal@10078 { + compatible = "marvell,kirkwood-thermal"; + reg = <0x10078 0x4>; + status = "okay"; + }; + + i2c@11000 { + status = "okay"; + + rs5c372a: rs5c372a@32 { + compatible = "ricoh,rs5c372a"; + reg = <0x32>; + }; + }; + + serial@12000 { + status = "okay"; + }; + + nand@3000000 { + status = "okay"; + + partition@0 { + label = "u-boot"; + reg = <0x0000000 0x180000>; + read-only; + }; + + partition@180000 { + label = "u-boot-env"; + reg = <0x180000 0x20000>; + }; + + partition@200000 { + label = "uImage"; + reg = <0x0200000 0x600000>; + }; + + partition@800000 { + label = "minirootfs"; + reg = <0x0800000 0x1000000>; + }; + + partition@1800000 { + label = "jffs2"; + reg = <0x1800000 0x6800000>; + }; + }; + + sata@80000 { + status = "okay"; + nr-ports = <2>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_led { + label = "status:blue:power_led"; + gpios = <&gpio0 31 1>; /* GPIO 31 Active Low */ + linux,default-trigger = "default-on"; + }; + activity_led { + label = "status:blue:activity_led"; + gpios = <&gpio1 6 1>; /* GPIO 38 Active Low */ + }; + disk1_led { + label = "status:blue:disk1_led"; + gpios = <&gpio0 23 1>; /* GPIO 23 Active Low */ + }; + disk2_led { + label = "status:blue:disk2_led"; + gpios = <&gpio0 22 1>; /* GPIO 22 Active Low */ + }; + backup_led { + label = "status:blue:backup_led"; + gpios = <&gpio0 29 1>; /* GPIO 29 Active Low*/ + linux,default-trigger = "timer"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + button@1 { + label = "Power Button"; + linux,code = <116>; /* KEY_POWER */ + gpios = <&gpio1 15 1>; + }; + button@2 { + label = "Reset Button"; + linux,code = <0x198>; /* KEY_RESTART */ + gpios = <&gpio0 13 1>; + }; + button@3 { + label = "Backup Button"; + linux,code = <133>; /* KEY_COPY */ + gpios = <&gpio1 13 1>; + }; + }; +}; diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig index 13482ea..511cd7d 100644 --- a/arch/arm/configs/kirkwood_defconfig +++ b/arch/arm/configs/kirkwood_defconfig @@ -35,6 +35,7 @@ CONFIG_MACH_NETSPACE_LITE_V2_DT=y CONFIG_MACH_NETSPACE_MINI_V2_DT=y CONFIG_MACH_OPENBLOCKS_A6_DT=y CONFIG_MACH_TOPKICK_DT=y +CONFIG_MACH_READYNAS_DT=y CONFIG_MACH_TS219=y CONFIG_MACH_TS41X=y CONFIG_MACH_DOCKSTAR=y diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 7b6a64b..94df386 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig @@ -108,6 +108,15 @@ config MACH_TS219_DT or MV6282. If you have the wrong one, the buttons will not work. +config MACH_READYNAS_DT + bool "NETGEAR ReadyNAS Duo v2 (Flattened Device Tree)" + 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 + NETGEAR ReadyNAS Duo v2 using Fattened Device Tree. + config MACH_DOCKSTAR_DT bool "Seagate FreeAgent Dockstar (Flattened Device Tree)" select ARCH_KIRKWOOD_DT diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index 4cc4bee..b9108ea 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile @@ -26,6 +26,7 @@ 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 tsx1x-common.o +obj-$(CONFIG_MACH_READYNAS_DT) += board-readynas.o obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index 2e73e9d..7418e03 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c @@ -144,6 +144,9 @@ static void __init kirkwood_dt_init(void) if (of_machine_is_compatible("usi,topkick")) usi_topkick_init(); + if (of_machine_is_compatible("netgear,readynas")) + netgear_readynas_init(); + of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); } @@ -169,6 +172,7 @@ static const char * const kirkwood_dt_board_compat[] = { "plathome,openblocks-a6", "usi,topkick", "zyxel,nsa310", + "netgear,readynas", NULL }; diff --git a/arch/arm/mach-kirkwood/board-readynas.c b/arch/arm/mach-kirkwood/board-readynas.c new file mode 100644 index 0000000..1d0a6a0 --- /dev/null +++ b/arch/arm/mach-kirkwood/board-readynas.c @@ -0,0 +1,39 @@ +/* + * NETGEAR ReadyNAS Duo v2 Board setup for drivers not already + * converted to DT. + * + * Copyright (C) 2013, Arnaud EBALARD + * + * 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 +#include +#include +#include +#include +#include +#include +#include "common.h" + +static struct mv643xx_eth_platform_data netgear_readynas_ge00_data = { + .phy_addr = MV643XX_ETH_PHY_ADDR(0), +}; + +void __init netgear_readynas_init(void) +{ + u32 val; + + kirkwood_ge00_init(&netgear_readynas_ge00_data); + kirkwood_pcie_init(KW_PCIE0); + + /* USB 3.0 controller power on */ + mdelay(3000); + val = readl(GPIO_HIGH_VIRT_BASE + 0x4); + writel(val & ~(0x1 << 14), GPIO_HIGH_VIRT_BASE + 0x4); + val = readl(GPIO_HIGH_VIRT_BASE); + writel(val | (0x1 << 14), GPIO_HIGH_VIRT_BASE); +} diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index 5ed7056..ed9a4bd 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h @@ -147,6 +147,12 @@ void usi_topkick_init(void); static inline void usi_topkick_init(void) {}; #endif +#ifdef CONFIG_MACH_READYNAS_DT +void netgear_readynas_init(void); +#else +static inline void netgear_readynas_init(void) {}; +#endif + /* early init functions not converted to fdt yet */ char *kirkwood_id(void); void kirkwood_l2_init(void);