From 4383c13aee8963ee93ca1950e7f0ea5a35309ab4 Mon Sep 17 00:00:00 2001 From: Alberto Bursi Date: Mon, 6 Feb 2017 11:40:52 +0100 Subject: [PATCH] kirkwood: add ZyXEL NSA325 device This patch add ZyXEL NSA325 2-Bay Media Server The ZyXEL NSA325 device is a Kirkwood based NAS: - SoC: Marvell 88F6702 1600Mhz - SDRAM memory: 512MB DDR2 400Mhz - Gigabit ethernet: Marvell Alaska - Flash memory: 128MB - 1 Power button - 1 Power LED (blue) - 5 Status LED (green/red) - 1 Copy/Sync button - 1 Reset button - 2 SATA II ports (internal) - 2 USB 2.0 ports (back) - 1 USB 3.0 port (front) - Fan (fixed speed) - hardware watchdog in a mcu Basically a bigger, more powerful version of NSA310, installation is the same as they share the same flash layout. A notable difference is that there is a hardware watchdog in a mcu on the board, which is disabled by default in the LEDE u-boot. The watchdog is also disabled with a GPIO activation through raw register change when kwbooting or it would reset the board before the new uboot was transferred. Signed-off-by: Alberto Bursi Signed-off-by: Felix Fietkau [remove dead code] --- .../kirkwood/base-files/etc/board.d/01_leds | 3 + .../base-files/etc/board.d/02_network | 2 +- .../linux/kirkwood/base-files/lib/kirkwood.sh | 4 + target/linux/kirkwood/image/Makefile | 9 +- .../kirkwood/patches-4.4/194-nsa325.patch | 238 ++++++++++++++++++ 5 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 target/linux/kirkwood/patches-4.4/194-nsa325.patch diff --git a/target/linux/kirkwood/base-files/etc/board.d/01_leds b/target/linux/kirkwood/base-files/etc/board.d/01_leds index 4518fc4b64..e6da9fd49a 100755 --- a/target/linux/kirkwood/base-files/etc/board.d/01_leds +++ b/target/linux/kirkwood/base-files/etc/board.d/01_leds @@ -41,6 +41,9 @@ case "$board" in "nsa310b") ucidef_set_led_default "health" "health" "nsa310:green:sys" "1" ;; +"nsa325") + ucidef_set_led_default "health" "health" "nsa325:green:sys" "1" + ;; "sheevaplug" | \ "sheevaplug-esata") ucidef_set_led_timer "health" "health" "sheevaplug:blue:health" "200" "800" diff --git a/target/linux/kirkwood/base-files/etc/board.d/02_network b/target/linux/kirkwood/base-files/etc/board.d/02_network index b5406b0e37..b82086ec3e 100755 --- a/target/linux/kirkwood/base-files/etc/board.d/02_network +++ b/target/linux/kirkwood/base-files/etc/board.d/02_network @@ -30,7 +30,7 @@ case "$board" in ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" "6@eth1" ;; -"nsa310b") +"nsa310b"|"nsa325") ucidef_set_interface_lan "eth0" "dhcp" ucidef_set_interface_macaddr "lan" $( mtd_get_mac_ascii uboot_env ethaddr ) ;; diff --git a/target/linux/kirkwood/base-files/lib/kirkwood.sh b/target/linux/kirkwood/base-files/lib/kirkwood.sh index f0efec4994..2c7d7baf4b 100755 --- a/target/linux/kirkwood/base-files/lib/kirkwood.sh +++ b/target/linux/kirkwood/base-files/lib/kirkwood.sh @@ -65,6 +65,10 @@ kirkwood_board_detect() { name="nsa310s" ;; + "ZyXEL NSA325") + name="nsa325" + ;; + *) name="generic" ;; diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile index ece7c1adf6..141505e002 100644 --- a/target/linux/kirkwood/image/Makefile +++ b/target/linux/kirkwood/image/Makefile @@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk KERNEL_LOADADDR:=0x8000 -TARGET_DEVICES = linksys-audi linksys-viper dockstar goflexnet goflexhome iconnect pogo_e02 ib62x0 nsa310b +TARGET_DEVICES = linksys-audi linksys-viper dockstar goflexnet goflexhome iconnect pogo_e02 ib62x0 nsa310b nsa325 UBI_OPTS := -m 2048 -p 128KiB -s 512 UBIFS_OPTS := -m 2048 -e 126KiB -c 4096 @@ -87,6 +87,13 @@ $(Device/dockstar) DEVICE_PACKAGES := kmod-r8169 kmod-gpio-button-hotplug kmod-hwmon-lm85 endef +define Device/nsa325 +$(Device/dockstar) + DEVICE_TITLE := ZyXEL NSA325 (v1 and v2) + DEVICE_DTS := kirkwood-nsa325 + DEVICE_PACKAGES := kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3 +endef + define Device/pogo_e02 $(Device/dockstar) DEVICE_TITLE := Cloud Engines Pogoplug E02 diff --git a/target/linux/kirkwood/patches-4.4/194-nsa325.patch b/target/linux/kirkwood/patches-4.4/194-nsa325.patch new file mode 100644 index 0000000000..8e5cd7759e --- /dev/null +++ b/target/linux/kirkwood/patches-4.4/194-nsa325.patch @@ -0,0 +1,238 @@ +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -205,6 +205,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += \ + kirkwood-nsa310a.dtb \ + kirkwood-nsa310b.dtb \ + kirkwood-nsa310s.dtb \ ++ kirkwood-nsa325.dtb \ + kirkwood-openblocks_a6.dtb \ + kirkwood-openblocks_a7.dtb \ + kirkwood-openrd-base.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/kirkwood-nsa325.dts +@@ -0,0 +1,225 @@ ++/* ++ * Device tree file for Zyxel NSA325 and NSA325v2 NAS ++ */ ++/dts-v1/; ++#include "kirkwood-nsa3x0-common.dtsi" ++ ++/ { ++ model = "ZyXEL NSA325"; ++ compatible = "zyxel,nsa325", "marvell,kirkwood-88f6282", "marvell,kirkwood"; ++ ++ memory { ++ device_type = "memory"; ++ reg = <0x00000000 0x20000000>; ++ }; ++ ++ chosen { ++ bootargs = "console=ttyS0,115200"; ++ stdout-path = &uart0; ++ }; ++ ++ mbus { ++ pcie-controller { ++ status = "okay"; ++ ++ pcie@1,0 { ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ ocp@f1000000 { ++ pinctrl: pin-controller@10000 { ++ pinctrl-names = "default"; ++ ++ pmx_led_sata2_green: pmx-led-sata2-green { ++ marvell,pins = "mpp12"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_led_sata2_red: pmx-led-sata2-red { ++ marvell,pins = "mpp13"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_mcu_data: pmx-mcu-data { ++ marvell,pins = "mpp14"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_led_usb_green: pmx-led-usb-green { ++ marvell,pins = "mpp15"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_mcu_clk: pmx-mcu-clk { ++ marvell,pins = "mpp16"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_mcu_act: pmx-mcu-act { ++ marvell,pins = "mpp17"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_usb_power_off: pmx-usb-power-off { ++ marvell,pins = "mpp21"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_led_sys_green: pmx-led-sys-green { ++ marvell,pins = "mpp28"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_led_sys_orange: pmx-led-sys-orange { ++ marvell,pins = "mpp29"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_led_sata1_green: pmx-led-sata1-green { ++ marvell,pins = "mpp41"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_led_sata1_red: pmx-led-sata1-red { ++ marvell,pins = "mpp42"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_beeper: pmx-beeper { ++ marvell,pins = "mpp44"; ++ marvell,function = "gpio"; ++ }; ++ ++ pmx_pwr_sata1: pmx-pwr-sata1 { ++ marvell,pins = "mpp47"; ++ marvell,function = "gpio"; ++ }; ++ ++ }; ++ ++ /* This board uses the pcf8563 RTC instead of the SoC RTC */ ++ rtc@10300 { ++ status = "disabled"; ++ }; ++ ++ i2c@11000 { ++ status = "okay"; ++ ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ }; ++ }; ++ ++ }; ++ ++ gpio-leds { ++ compatible = "gpio-leds"; ++ pinctrl-0 = <&pmx_led_sata1_green &pmx_led_sata1_red ++ &pmx_led_sata2_green &pmx_led_sata2_red ++ &pmx_led_sys_green &pmx_led_sys_orange ++ &pmx_led_copy_green &pmx_led_copy_red ++ &pmx_led_usb_green>; ++ pinctrl-names = "default"; ++ ++ green-sata2 { ++ label = "nsa325:green:sata2"; ++ gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "ide-disk2"; ++ }; ++ ++ red-sata2 { ++ label = "nsa325:red:sata2"; ++ gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ green-usb { ++ label = "nsa325:green:usb"; ++ gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "usb-host"; ++ }; ++ ++ green-sys { ++ label = "nsa325:green:sys"; ++ gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "default-on"; ++ }; ++ ++ orange-sys { ++ label = "nsa325:orange:sys"; ++ gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "cpu0"; ++ }; ++ ++ green-copy { ++ label = "nsa325:green:copy"; ++ gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ red-copy { ++ label = "nsa325:red:copy"; ++ gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ green-sata1 { ++ label = "nsa325:green:sata1"; ++ gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "ide-disk1"; ++ }; ++ ++ red-sata1 { ++ label = "nsa325:red:sata1"; ++ gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ regulators { ++ compatible = "simple-bus"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-0 = <&pmx_usb_power_off &pmx_pwr_sata1>; ++ pinctrl-names = "default"; ++ ++ usb_power: regulator@1 { ++ compatible = "regulator-fixed"; ++ reg = <1>; ++ regulator-name = "USB Power"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ enable-active-high; ++ gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ sata1_power: regulator@2 { ++ compatible = "regulator-fixed"; ++ reg = <2>; ++ regulator-name = "SATA Power"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ enable-active-high; ++ gpio = <&gpio1 15 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++}; ++ ++&mdio { ++ status = "okay"; ++ ++ ethphy0: ethernet-phy@1 { ++ reg = <1>; ++ }; ++}; ++ ++ð0 { ++ status = "okay"; ++ ++ ethernet0-port@0 { ++ phy-handle = <ðphy0>; ++ }; ++}; -- 2.30.2