summaryrefslogtreecommitdiffstats
path: root/target/linux/kirkwood
diff options
context:
space:
mode:
authorPawel Dembicki <paweldembicki@gmail.com>2020-05-02 15:33:14 +0200
committerPetr Štetiar <ynezz@true.cz>2020-07-08 16:07:05 +0200
commitd2c3131b3fcc55d9c26abdb7cd3c32d3827c10ed (patch)
treec0e5d99b494bfefde60173800e98d93c5fa2784d /target/linux/kirkwood
parent4c2e475842fa4d1c2f1d8508d526fefac1a2948c (diff)
downloadopenwrt-d2c3131b3fcc55d9c26abdb7cd3c32d3827c10ed.tar.gz
openwrt-d2c3131b3fcc55d9c26abdb7cd3c32d3827c10ed.tar.bz2
openwrt-d2c3131b3fcc55d9c26abdb7cd3c32d3827c10ed.zip
kirkwood: add support for Zyxel NSA310S
Zyxel NSA310S is a NAS based on Marvell kirkwood SoC. Specification: - Processor Marvell 88F6702 1 GHz - 256MB RAM - 128MB NAND - 1x GBE LAN port (PHY: Marvell 88E1318) - 2x USB 2.0 - 1x SATA - 3x button - 7x leds - serial on J1 connector (115200 8N1) (GND-NOPIN-RX-TX-VCC) Known issues: - no kernel module for RTC. [*] - buzzer (connected to MPP43) need to be drived by 1kHz signal - no kernel module for internal MCU connected via I2C[**] [*] Karoly Pocsi made simple, unofficial driver for HT1382. It can be found here: https://www.madadmin.com/zyxel-nsa320s-es-debian-linux-4-resz/ [**] Karoly Pocsi found how CPU talk with MCU: It is possible to query the MCU-controlled fan speed and temperature: i2cget -y 0x0 0x0a 0x07 i2cget -y 0x0 0x0a 0x08 The first value (0x07) is the temperature in ° C, the second (0x08) is the time in milliseconds to complete one fan revolution (rpm = 60,000 / value). Info translated from: https://www.madadmin.com/zyxel-nsa320s-es-debian-linux-4-resz/ Installation: TFTP: 1. Run serial console and go to u-boot. 2. Copy u-boot via tftp and write to NAND: => mw 0x0800000 0xffff 0x100000 => nand erase 0x0 100000 => setenv ipaddr 192.168.1.2 => setenv serverip 192.168.1.4 => tftp 0x0800000 nsa310s-u-boot.kwb => nand write 0x0800000 0x0 0x100000 => reset 3. Run new u-Boot, repair bootcmd and restore MAC address from sticker => setenv ethaddr AA:BB:CC:DD:EE:FF => saveenv 4. Copy and run initramfs image => setenv ipaddr 192.168.1.2 => setenv serverip 192.168.1.4 => tftpboot zyxel_nsa310s-initramfs-uImage => bootm 0x800000 5. Download sysupgrade image and perform sysupgrade USB: 1. Prepare usb fat32 drive with u-boot.kwb and initramfs image. Stick it to USB 2.0 port. 2. Run serial console and go to u-boot. 3. Copy u-boot from usb and write to NAND: => mw 0x0800000 0xffff 0x100000 => nand erase 0x0 100000 => usb start => fatload usb 0 0x0800000 u-boot.kwb => nand write 0x0800000 0x0 0x100000 => reset 4. Run new u-Boot, repair bootcmd and restore MAC address from sticker => setenv ethaddr AA:BB:CC:DD:EE:FF => saveenv 5. Copy and run initramfs image: => usb start => fatload usb 0 0x0800000 initramfs-uImage => bootm 0x800000 6. Download sysupgrade image and perform sysupgrade. Based on work ThBexx <thomas.beckler@hotmail.com> DTS based on dropped support in 0ebdf0c. Tested-by: Lech Perczak <lech.perczak@gmail.com> Reviewed-by: Lech Perczak <lech.perczak@gmail.com> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> [NSA310s -> NSA310S in DEVICE_MODEL] Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'target/linux/kirkwood')
-rwxr-xr-xtarget/linux/kirkwood/base-files/etc/board.d/02_network3
-rw-r--r--target/linux/kirkwood/config-5.41
-rw-r--r--target/linux/kirkwood/files-5.4/arch/arm/boot/dts/kirkwood-nsa310s.dts271
-rw-r--r--target/linux/kirkwood/image/Makefile8
4 files changed, 282 insertions, 1 deletions
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 df01b0bb1b..a86c57117d 100755
--- a/target/linux/kirkwood/base-files/etc/board.d/02_network
+++ b/target/linux/kirkwood/base-files/etc/board.d/02_network
@@ -21,7 +21,8 @@ case "$board" in
"raidsonic,ib-nas62x0"|\
"seagate,dockstar"|\
"seagate,goflexhome"|\
-"seagate,goflexnet")
+"seagate,goflexnet"|\
+"zyxel,nsa310s")
ucidef_set_interface_lan "eth0" "dhcp"
;;
"linksys,audi"|\
diff --git a/target/linux/kirkwood/config-5.4 b/target/linux/kirkwood/config-5.4
index 6b68649d74..5529bf89df 100644
--- a/target/linux/kirkwood/config-5.4
+++ b/target/linux/kirkwood/config-5.4
@@ -212,6 +212,7 @@ CONFIG_LZO_DECOMPRESS=y
CONFIG_MACH_KIRKWOOD=y
CONFIG_MACH_MVEBU_ANY=y
CONFIG_MANGLE_BOOTARGS=y
+CONFIG_MARVELL_PHY=y
CONFIG_MDIO_BUS=y
CONFIG_MDIO_DEVICE=y
CONFIG_MEMFD_CREATE=y
diff --git a/target/linux/kirkwood/files-5.4/arch/arm/boot/dts/kirkwood-nsa310s.dts b/target/linux/kirkwood/files-5.4/arch/arm/boot/dts/kirkwood-nsa310s.dts
new file mode 100644
index 0000000000..fe892ffdc2
--- /dev/null
+++ b/target/linux/kirkwood/files-5.4/arch/arm/boot/dts/kirkwood-nsa310s.dts
@@ -0,0 +1,271 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+ model = "ZyXEL NSA310S";
+ compatible = "zyxel,nsa310s", "marvell,kirkwood-88f6702", "marvell,kirkwood";
+
+ aliases {
+ led-boot = &led_green_sys;
+ led-failsafe = &led_red_sys;
+ led-running = &led_green_sys;
+ led-upgrade = &led_red_sys;
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <0x00000000 0x10000000>;
+ };
+
+ chosen {
+ bootargs = "console=ttyS0,115200n8 earlyprintk";
+ stdout-path = &uart0;
+ };
+
+ ocp@f1000000 {
+ pinctrl: pin-controller@10000 {
+ pinctrl-names = "default";
+
+ pmx_usb_power: pmx-usb-power {
+ marvell,pins = "mpp21";
+ marvell,function = "gpio";
+ };
+
+ pmx_pwr_off: pmx-pwr-off {
+ marvell,pins = "mpp27";
+ marvell,function = "gpio";
+ };
+
+ pmx_btn_reset: pmx-btn-reset {
+ marvell,pins = "mpp24";
+ marvell,function = "gpio";
+ };
+
+ pmx_btn_copy: pmx-btn-copy {
+ marvell,pins = "mpp25";
+ marvell,function = "gpio";
+ };
+
+ pmx_btn_power: pmx-btn-power {
+ marvell,pins = "mpp26";
+ marvell,function = "gpio";
+ };
+
+ pmx_led_usb_green: pmx-led-usb-green {
+ marvell,pins = "mpp15";
+ marvell,function = "gpio";
+ };
+
+ pmx_led_copy_green: pmx-led-copy-green {
+ marvell,pins = "mpp22";
+ marvell,function = "gpio";
+ };
+
+ pmx_led_copy_red: pmx-led-copy-red {
+ marvell,pins = "mpp23";
+ marvell,function = "gpio";
+ };
+
+ pmx_led_sys_green: pmx-led-sys-green {
+ marvell,pins = "mpp28";
+ marvell,function = "gpio";
+ };
+
+ pmx_led_sys_red: pmx-led-sys-red {
+ marvell,pins = "mpp29";
+ marvell,function = "gpio";
+ };
+
+ pmx_led_hdd1_green: pmx-led-hdd1-green {
+ marvell,pins = "mpp16";
+ marvell,function = "gpio";
+ };
+
+ pmx_led_hdd1_red: pmx-led-hdd1-red {
+ marvell,pins = "mpp13";
+ marvell,function = "gpio";
+ };
+
+ pmx_pwr_sata1: pmx-pwr-sata1 {
+ marvell,pins = "mpp33";
+ marvell,function = "gpio";
+ };
+
+ };
+
+ i2c@11000 {
+ status = "okay";
+
+ rtc@68 {
+ compatible = "htk,ht1382";
+ reg = <0x68>;
+ };
+ };
+
+ serial@12000 {
+ status = "okay";
+ };
+ };
+
+ regulators {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-0 = <&pmx_usb_power &pmx_pwr_sata1>;
+ pinctrl-names = "default";
+
+ usb0_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;
+ gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
+ };
+
+ sata1_power: regulator@2 {
+ compatible = "regulator-fixed";
+ reg = <2>;
+ regulator-name = "SATA1 Power";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ regulator-always-on;
+ regulator-boot-on;
+ gpio = <&gpio1 1 GPIO_ACTIVE_HIGH>;
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy &pmx_btn_power>;
+ pinctrl-names = "default";
+
+ power {
+ label = "Power Button";
+ linux,code = <KEY_POWER>;
+ gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
+ };
+
+ copy {
+ label = "Copy Button";
+ linux,code = <KEY_COPY>;
+ gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
+ };
+
+ reset {
+ label = "Reset Button";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_green_sys: green-sys {
+ label = "nsa310s:green:sys";
+ gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "default-on";
+ };
+
+ led_red_sys: red-sys {
+ label = "nsa310s:red:sys";
+ gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
+ };
+
+ green-hdd1 {
+ label = "nsa310s:green:hdd1";
+ gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "ata1";
+ };
+
+ red-hdd1 {
+ label = "nsa310s:red:hdd1";
+ gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
+ };
+
+ green-usb {
+ label = "nsa310s:green:usb";
+ gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "usb-host";
+ };
+
+ green-copy {
+ label = "nsa310s:green:copy";
+ gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
+ };
+
+ red-copy {
+ label = "nsa310s:red:copy";
+ gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
+ };
+ };
+
+ gpio_poweroff {
+ compatible = "gpio-poweroff";
+ pinctrl-0 = <&pmx_pwr_off>;
+ pinctrl-names = "default";
+ gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
+ };
+};
+
+
+&eth0 {
+ status = "okay";
+
+ ethernet0-port@0 {
+ phy-handle = <&ethphy0>;
+ };
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-phy@1 {
+ reg = <1>;
+ phy-mode = "rgmii-id";
+ marvell,reg-init = <0x1 0x16 0x0 0x3>,
+ <0x1 0x10 0x0 0x1017>,
+ <0x1 0x11 0x0 0x4408>,
+ <0x1 0x16 0x0 0x0>;
+ };
+};
+
+&nand {
+ status = "okay";
+ chip-delay = <35>;
+
+ partition@0 {
+ label = "uboot";
+ reg = <0x0000000 0x00c0000>;
+ read-only;
+ };
+ partition@c0000 {
+ label = "uboot_env";
+ reg = <0x00c0000 0x0080000>;
+ };
+ partition@140000 {
+ label = "ubi";
+ reg = <0x0140000 0x7ec0000>;
+ };
+};
+
+&pciec {
+ status = "okay";
+};
+
+&pcie0 {
+ status = "okay";
+};
+
+&sata {
+ status = "okay";
+ nr-ports = <1>;
+};
diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile
index 87e0627a63..8cc69195b4 100644
--- a/target/linux/kirkwood/image/Makefile
+++ b/target/linux/kirkwood/image/Makefile
@@ -148,6 +148,14 @@ define Device/zyxel_nsa310b
endef
TARGET_DEVICES += zyxel_nsa310b
+define Device/zyxel_nsa310s
+ DEVICE_VENDOR := ZyXEL
+ DEVICE_MODEL := NSA310S
+ DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-gpio-button-hotplug
+ DEVICE_DTS := kirkwood-nsa310s
+endef
+TARGET_DEVICES += zyxel_nsa310s
+
define Device/zyxel_nsa325
DEVICE_VENDOR := ZyXEL
DEVICE_MODEL := NSA325