Serial install problems on NSA310

The only way is to add official support for the nsa310s in OpenWrt, as the file that defines what GPIO pins are used as buttons and leds (the dts file) is compiled and integrated in the kernel image.

it's easier than adding support for most other devices as it is more or less a carbon copy of what was done to add NSA325, just take the dts file from other projects that support this device like bodh's Debian https://forum.doozan.com/read.php?2,12096

I could provide better directions than this if someone is interested but I'm not doing it myself as I don't have the time and device to test.

I am interested. I can try compile OpenWRT, but I don't know where I get correct dts file for NSA310S.

It's in the *.patch file (it's a text file) in the linux-5.5.1-kirkwood-tld-1-bodhi.tar.bz2 archive form the forum thread I linked above.

It might be easier than I said, there is no need to add official support, you can just compile for NSA310b and just hijack its dtb file to be for your device instead.

download the sources of OpenWrt, then open the file /openwrt/target/linux/kirkwood/files-5.4/arch/arm/boot/dts/kirkwood-nsa310b.dts (this is the dts file of the NSA 310b), delete all text and paste this text (please copy this from inside a Linux system or a text editor that is using Unix line terminator setting or it will mess up the formatting of the text) so now the dts file is correct for your device.

/* 
 * Device tree file for the Zyxel NSA 310S NAS box, hacked to disguise itself as a NSA 310b for OpenWrt
 *
 * Copyright (c) 2015-2016, bodhi <mibodhi@gmail.com>
 *
 * Based on 
 * Copyright (c) 2014, Adam Baker <linux@baker-net.org.uk>
 *
 * 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.
 *
 * Based upon the board setup file created by Peter Schildmann 
 */

/dts-v1/;

#include "kirkwood.dtsi"
#include "kirkwood-6281.dtsi"

/ {
	model = "ZyXEL NSA310b";
	compatible = "zyxel,nsa310b", "zyxel,nsa310", "marvell,kirkwood-88f6281", "marvell,kirkwood";

	memory {
		device_type = "memory";
		reg = <0x00000000 0x10000000>;
	};

	chosen {
		bootargs = "console=ttyS0,115200";
		stdout-path = &uart0;
	};

	ocp@f1000000 {
		pinctrl: pin-controller@10000 {
			pinctrl-names = "default";

			pmx_sata0: pmx-sata0 {
				marvell,pins ; /* NA */
				marvell,function = "sata0";
			};

			pmx_sata1: pmx-sata1 {
				marvell,pins ; /* NA */
				marvell,function = "sata1";
			};

                        pmx_usb_power: pmx-usb-power {
                                marvell,pins = "mpp21"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_pwr_off: pmx-pwr-off {
                                marvell,pins = "mpp27"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_btn_reset: pmx-btn-reset {
                                marvell,pins = "mpp24"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_btn_copy: pmx-btn-copy {
                                marvell,pins = "mpp25"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_btn_power: pmx-btn-power {
                                marvell,pins = "mpp26"; /* OK */
                                marvell,function = "gpio";
                        };

			pmx_led_hdd2_green: pmx-led-hdd2-green {
				marvell,pins = "mpp34"; /* OK */
				marvell,function = "gpio";
			};

			pmx_led_hdd2_red: pmx-led-hdd2-red {
				marvell,pins = "mpp12"; /* OK */
				marvell,function = "gpio";
			};

			pmx_led_usb_green: pmx-led-usb-green {
				marvell,pins = "mpp15"; /* OK */
				marvell,function = "gpio";
			};

                        pmx_led_copy_green: pmx-led-copy-green {
                                marvell,pins = "mpp22"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_led_copy_red: pmx-led-copy-red {
                                marvell,pins = "mpp23"; /* OK */
                                marvell,function = "gpio";
                        };

			pmx_led_sys_green: pmx-led-sys-green {
				marvell,pins = "mpp28"; /* OK */
				marvell,function = "gpio";
			};

			pmx_led_sys_orange: pmx-led-sys-orange {
				marvell,pins = "mpp29"; /* OK */
				marvell,function = "gpio";
			};

			pmx_led_hdd1_green: pmx-led-hdd1-green {
				marvell,pins = "mpp16"; /* OK */
				marvell,function = "gpio";
			};

			pmx_led_hdd1_red: pmx-led-hdd1-red {
				marvell,pins = "mpp13"; /* OK */
				marvell,function = "gpio";
			};

/*
 			pmx_buzzer: pmx-buzzer {
 				marvell,pins = "mpp20";
 				marvell,function = "gpio";
 			};
*/

			pmx_pwr_sata1: pmx-pwr-sata1 {
				marvell,pins = "mpp33";
				marvell,function = "gpio";
			};
		};

                serial@12000 {
                        status = "ok";
                };

                sata@80000 {
                        status = "okay";
                        nr-ports = <2>;
                };

		rtc@10300 {
			status = "disabled";
		};

		i2c@11000 {
			status = "okay";
			ht1382: rtc@68 {
				compatible = "htk,ht1382";
				reg = <0x68>;
			};
		};
	};

	regulators {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <0>;
                pinctrl-names = "default";
		pinctrl-0 = <&pmx_usb_power &pmx_pwr_sata1>;

                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;
			enable-active-high;
                        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;
			enable-active-high;
			gpio = <&gpio1 1 GPIO_ACTIVE_HIGH>;
		};
	};

        gpio_poweroff {
                compatible = "gpio-poweroff";
                pinctrl-0 = <&pmx_pwr_off>;
                pinctrl-names = "default";
                gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
        };

        gpio_keys {
                compatible = "gpio-keys";
                #address-cells = <1>;
                #size-cells = <0>;
                pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy &pmx_btn_power>;
                pinctrl-names = "default";

                button@1 {
                        label = "Power Button";
                        linux,code = <KEY_POWER>;
                        gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
                };
                button@2 {
                        label = "Copy Button";
                        linux,code = <KEY_COPY>;
                        gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
                };
                button@3 {
                        label = "Reset Button";
                        linux,code = <KEY_RESTART>;
                        gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
                };
        };

	gpio-leds {
		compatible = "gpio-leds";
		pinctrl-0 = <&pmx_led_hdd2_green &pmx_led_hdd2_red
			     &pmx_led_usb_green
			     &pmx_led_sys_green &pmx_led_sys_orange
			     &pmx_led_copy_green &pmx_led_copy_red
			     &pmx_led_hdd1_green &pmx_led_hdd1_red>;
		pinctrl-names = "default";

		green-sys {
			label = "nsa310s:green:sys";
			gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "default-on";
		};
		orange-sys {
			label = "nsa310s:orange:sys";
			gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
		};
		green-hdd1 {
			label = "nsa310s:green:hdd1";
			gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
		};
		red-hdd1 {
			label = "nsa310s:red:hdd1";
			gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
		};
		green-hdd2 {
			label = "nsa310s:green:hdd2";
			gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
		};
		red-hdd2 {
			label = "nsa310s:red:hdd2";
			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
		};
		green-usb {
			label = "nsa310s:green:usb";
			gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
		};
		green-copy {
			label = "nsa310s:green:copy";
			gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "ide-disk";
		};
		red-copy {
			label = "nsa310s:red:copy";
			gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
		};
	};
};

&nand {
        status = "okay";
        chip-delay = <35>;

        partition@0 {
                label = "uboot";
                reg = <0x00c0000 0x0080000>;
        };
	partition@140000 {
		label = "ubi";
		reg = <0x0140000 0x7ec0000>;
         };
};

&mdio {
	status = "okay";
	ethphy0: ethernet-phy@1 {
                compatible = "marvell,88e1510";
		reg = <1>;
	};
};

&eth0 {
	status = "okay";
	ethernet0-port@0 {
		phy-handle = <&ethphy0>;
	};
};

&pciec {
	status = "okay";
};

&pcie0 {
	status = "okay";
};

Save and compile for nsa310b, and you should get an OpenWrt image that will report itself as nsa310b but will be in fact using the correct hardware settings for a nsa310S

EDIT: fixed partitions in dts file

1 Like

I try replace kirkwood-nsa310b.dts file and compile openwrt, but on device booting I have this kernel panic. Do you have any idea what to do about it?
Do you have DTS file for NSA325? I didn't find it in openWRT targets.

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.24 (fialot@fialot-VirtualBox) (gcc version 8.3.0 (OpenWrt GCC 8.3.0 r12629-6e64039a87)) #0 Mon Mar 16 23:51:48 2020
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: ZyXEL NSA310b
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64960
[    0.000000] Kernel command line: console=ttyS0,115200
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 250948K/262144K available (5162K kernel code, 178K rwdata, 1392K rodata, 1024K init, 203K bss, 11196K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] random: get_random_bytes called from start_kernel+0x2d4/0x500 with crng_init=0
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 11467562657 ns
[    0.000009] sched_clock: 32 bits at 166MHz, resolution 6ns, wraps every 12884901885ns
[    0.000040] Switching to timer-based delay loop, resolution 6ns
[    0.000130] Calibrating delay loop (skipped), value calculated using timer frequency.. 333.33 BogoMIPS (lpj=1666666)
[    0.000150] pid_max: default: 32768 minimum: 301
[    0.000372] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000393] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.001361] CPU: Testing write buffer coherency: ok
[    0.002288] Setting up static identity map for 0x100000 - 0x10003c
[    0.002595] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[    0.006483] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.006511] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.006676] pinctrl core: initialized pinctrl subsystem
[    0.007761] NET: Registered protocol family 16
[    0.008266] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.009347] cpuidle: using governor ladder
[    0.009735] Feroceon L2: Enabling L2
[    0.009778] Feroceon L2: Cache support initialised.
[    0.014213] No ATAGs?
[    0.035901] SCSI subsystem initialized
[    0.036809] usbcore: registered new interface driver usbfs
[    0.036867] usbcore: registered new interface driver hub
[    0.036926] usbcore: registered new device driver usb
[    0.039714] clocksource: Switched to clocksource orion_clocksource
[    0.040480] thermal_sys: Registered thermal governor 'step_wise'
[    0.040742] NET: Registered protocol family 2
[    0.041341] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.041375] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.041406] TCP bind hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.041439] TCP: Hash tables configured (established 2048 bind 2048)
[    0.041519] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.041542] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.041740] NET: Registered protocol family 1
[    0.041776] PCI: CLS 0 bytes, default 32
[    0.044570] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    0.051636] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.051648] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.062600] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[    0.063588] mvebu-gpio f1010140.gpio: IRQ index 3 not found
[    0.064011] mvebu-pcie mbus@f1000000:pcie@82000000: PCI host bridge to bus 0000:00
[    0.064030] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.064043] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xefffffff]
[    0.064054] pci_bus 0000:00: root bus resource [io  0x1000-0xeffff]
[    0.064168] pci 0000:00:01.0: [11ab:6281] type 01 class 0x060400
[    0.064205] pci 0000:00:01.0: reg 0x38: [mem 0x00000000-0x000007ff pref]
[    0.065667] PCI: bus0: Fast back to back transfers disabled
[    0.065683] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.067066] PCI: bus1: Fast back to back transfers enabled
[    0.067083] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.067297] pci 0000:00:01.0: BAR 6: assigned [mem 0xe0000000-0xe00007ff pref]
[    0.067312] pci 0000:00:01.0: PCI bridge to [bus 01]
[    0.067774] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.068431] printk: console [ttyS0] disabled
[    0.068517] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 26, base_baud = 10416666) is a 16550A
[    0.512732] printk: console [ttyS0] enabled
[    0.517961] sata_mv f1080000.sata: slots 32 ports 2
[    0.526371] scsi host0: sata_mv
[    0.530293] scsi host1: sata_mv
[    0.533603] ata1: SATA max UDMA/133 irq 32
[    0.537683] ata2: SATA max UDMA/133 irq 32
[    0.542270] nand: device found, Manufacturer ID: 0x92, Chip ID: 0xf1
[    0.548592] nand: Eon NAND 128MiB 3,3V 8-bit
[    0.552864] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.560420] Scanning device for bad blocks
[    0.569590] Bad eraseblock 100 at 0x000000c80000
[    0.579236] Bad eraseblock 200 at 0x000001900000
[    0.625347] 9 fixed-partitions partitions found on MTD device orion_nand
[    0.632026] Creating 9 MTD partitions on "orion_nand":
[    0.637143] 0x000000000000-0x000000100000 : "uboot"
[    0.642676] 0x000000100000-0x000000180000 : "uboot_env"
[    0.648471] 0x000000180000-0x000000200000 : "key_store"
[    0.654290] 0x000000200000-0x000000280000 : "info"
[    0.659636] 0x000000280000-0x000000c80000 : "etc"
[    0.664967] 0x000000c80000-0x000001680000 : "kernel_1"
[    0.670725] 0x000001680000-0x000004640000 : "rootfs1"
[    0.676508] 0x000004640000-0x000005040000 : "kernel_2"
[    0.682304] 0x000005040000-0x000008000000 : "rootfs2"
[    0.688600] libphy: Fixed MDIO Bus: probed
[    0.692976] libphy: orion_mdio_bus: probed
[    0.697073] [Firmware Warn]: /ocp@f1000000/mdio-bus@72004/ethernet-phy@1: Whitelisted compatible string. Please remove
[    0.713802] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[    0.722487] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address 5c:f4:ab:2f:ff:63
[    0.731250] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.737747] ehci-orion: EHCI orion driver
[    0.741920] orion-ehci f1050000.ehci: EHCI Host Controller
[    0.747414] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[    0.755188] orion-ehci f1050000.ehci: irq 30, io mem 0xf1050000
[    0.789729] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[    0.796266] hub 1-0:1.0: USB hub found
[    0.800229] hub 1-0:1.0: 1 port detected
[    0.804588] usbcore: registered new interface driver usb-storage
[    0.810700] i2c /dev entries driver
[    0.815213] watchdog: f1020300.watchdog-timer: driver supplied timeout (4294967295) out of range
[    0.823985] watchdog: f1020300.watchdog-timer: falling back to default timeout (25)
[    0.831769] orion_wdt: Initial timeout 25 sec
[    0.843943] marvell-cesa f1030000.crypto: CESA device successfully registered
[    0.852013] NET: Registered protocol family 10
[    0.858176] Segment Routing with IPv6
[    0.861932] NET: Registered protocol family 17
[    0.866395] 8021q: 802.1Q VLAN Support v1.8
[    0.874140] hctosys: unable to open rtc device (rtc0)
[    1.041022] ata1: SATA link down (SStatus 0 SControl F300)
[    1.169727] usb 1-1: new high-speed USB device number 2 using orion-ehci
[    1.222190] hub 1-1:1.0: USB hub found
[    1.226199] hub 1-1:1.0: 4 ports detected
[    1.371019] ata2: SATA link down (SStatus 0 SControl F300)
[    1.376697] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    1.384161] Please append a correct "root=" boot option; here are the available partitions:
[    1.392490] 1f00            1024 mtdblock0
[    1.392493]  (driver?)
[    1.398997] 1f01             512 mtdblock1
[    1.398999]  (driver?)
[    1.405512] 1f02             512 mtdblock2
[    1.405514]  (driver?)
[    1.412029] 1f03             512 mtdblock3
[    1.412032]  (driver?)
[    1.418541] 1f04           10240 mtdblock4
[    1.418543]  (driver?)
[    1.425056] 1f05           10240 mtdblock5
[    1.425058]  (driver?)
[    1.431573] 1f06           48896 mtdblock6
[    1.431575]  (driver?)
[    1.438083] 1f07           10240 mtdblock7
[    1.438085]  (driver?)
[    1.444609] 1f08           48896 mtdblock8
[    1.444611]  (driver?)
[    1.451128] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.459358] Rebooting in 1 seconds..

this is my mistake

[ 0.637143] 0x000000000000-0x000000100000 : "uboot"
[ 0.642676] 0x000000100000-0x000000180000 : "uboot_env"
[ 0.648471] 0x000000180000-0x000000200000 : "key_store"
[ 0.654290] 0x000000200000-0x000000280000 : "info"
[ 0.659636] 0x000000280000-0x000000c80000 : "etc"
[ 0.664967] 0x000000c80000-0x000001680000 : "kernel_1"
[ 0.670725] 0x000001680000-0x000004640000 : "rootfs1"
[ 0.676508] 0x000004640000-0x000005040000 : "kernel_2"
[ 0.682304] 0x000005040000-0x000008000000 : "rootfs2"

these are the original flash partitions and OpenWrt can't boot

Now I wrote the correct flash partitions in the dts so the kernel can find the root filesystem. I fixed the file in the post above, please copy it and try again.

Thanks, now power button works :slight_smile:
But I have another problem - if I compile last sources version, Luci not worked. Reports that it is not compatible with the used version of the kernel.
And if I switch to stable git version 19.07.2, folder /openwrt/target/linux/kirkwood/files-5.4/ is missing.
How to set up to make it work?

for 19.07 you need to delete the text in the patch file (it is a text file) openwrt/target/linux/kirkwood/patches-4.14/107-02-nsa310b.patch and replace with this


kirkwood: add nsa310b dtb, a zyxel nsa310 variant

add support to a nsa310 variant with red/green usb led
and lm85 temp/fan controller

Signed-off-by: Alberto Bursi <alberto.bursi@outlook.it>

NOTE: this patch can be upstreamed as-is, LEDE-specific
		nand partitions are set in another patch

--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -268,6 +268,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += \
 	kirkwood-ns2mini.dtb \
 	kirkwood-nsa310.dtb \
 	kirkwood-nsa310a.dtb \
+	kirkwood-nsa310b.dtb \
 	kirkwood-nsa320.dtb \
 	kirkwood-nsa325.dtb \
 	kirkwood-openblocks_a6.dtb \
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-nsa310b.dts
@@ -0,0 +1,303 @@
+/* 
+ * Device tree file for the Zyxel NSA 310S NAS box, hacked to disguise itself as a NSA 310b for OpenWrt
+ *
+ * Copyright (c) 2015-2016, bodhi <mibodhi@gmail.com>
+ *
+ * Based on 
+ * Copyright (c) 2014, Adam Baker <linux@baker-net.org.uk>
+ *
+ * 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.
+ *
+ * Based upon the board setup file created by Peter Schildmann 
+ */
+
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+	model = "ZyXEL NSA310b";
+	compatible = "zyxel,nsa310b", "zyxel,nsa310", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+		stdout-path = &uart0;
+	};
+
+	ocp@f1000000 {
+		pinctrl: pin-controller@10000 {
+			pinctrl-names = "default";
+
+			pmx_sata0: pmx-sata0 {
+				marvell,pins ; /* NA */
+				marvell,function = "sata0";
+			};
+
+			pmx_sata1: pmx-sata1 {
+				marvell,pins ; /* NA */
+				marvell,function = "sata1";
+			};
+
+                        pmx_usb_power: pmx-usb-power {
+                                marvell,pins = "mpp21"; /* OK */
+                                marvell,function = "gpio";
+                        };
+
+                        pmx_pwr_off: pmx-pwr-off {
+                                marvell,pins = "mpp27"; /* OK */
+                                marvell,function = "gpio";
+                        };
+
+                        pmx_btn_reset: pmx-btn-reset {
+                                marvell,pins = "mpp24"; /* OK */
+                                marvell,function = "gpio";
+                        };
+
+                        pmx_btn_copy: pmx-btn-copy {
+                                marvell,pins = "mpp25"; /* OK */
+                                marvell,function = "gpio";
+                        };
+
+                        pmx_btn_power: pmx-btn-power {
+                                marvell,pins = "mpp26"; /* OK */
+                                marvell,function = "gpio";
+                        };
+
+			pmx_led_hdd2_green: pmx-led-hdd2-green {
+				marvell,pins = "mpp34"; /* OK */
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd2_red: pmx-led-hdd2-red {
+				marvell,pins = "mpp12"; /* OK */
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_green: pmx-led-usb-green {
+				marvell,pins = "mpp15"; /* OK */
+				marvell,function = "gpio";
+			};
+
+                        pmx_led_copy_green: pmx-led-copy-green {
+                                marvell,pins = "mpp22"; /* OK */
+                                marvell,function = "gpio";
+                        };
+
+                        pmx_led_copy_red: pmx-led-copy-red {
+                                marvell,pins = "mpp23"; /* OK */
+                                marvell,function = "gpio";
+                        };
+
+			pmx_led_sys_green: pmx-led-sys-green {
+				marvell,pins = "mpp28"; /* OK */
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_orange: pmx-led-sys-orange {
+				marvell,pins = "mpp29"; /* OK */
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd1_green: pmx-led-hdd1-green {
+				marvell,pins = "mpp16"; /* OK */
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd1_red: pmx-led-hdd1-red {
+				marvell,pins = "mpp13"; /* OK */
+				marvell,function = "gpio";
+			};
+
+/*
+ 			pmx_buzzer: pmx-buzzer {
+ 				marvell,pins = "mpp20";
+ 				marvell,function = "gpio";
+ 			};
+*/
+
+			pmx_pwr_sata1: pmx-pwr-sata1 {
+				marvell,pins = "mpp33";
+				marvell,function = "gpio";
+			};
+		};
+
+                serial@12000 {
+                        status = "ok";
+                };
+
+                sata@80000 {
+                        status = "okay";
+                        nr-ports = <2>;
+                };
+
+		rtc@10300 {
+			status = "disabled";
+		};
+
+		i2c@11000 {
+			status = "okay";
+			ht1382: rtc@68 {
+				compatible = "htk,ht1382";
+				reg = <0x68>;
+			};
+		};
+	};
+
+	regulators {
+                compatible = "simple-bus";
+                #address-cells = <1>;
+                #size-cells = <0>;
+                pinctrl-names = "default";
+		pinctrl-0 = <&pmx_usb_power &pmx_pwr_sata1>;
+
+                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;
+			enable-active-high;
+                        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;
+			enable-active-high;
+			gpio = <&gpio1 1 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
+        gpio_poweroff {
+                compatible = "gpio-poweroff";
+                pinctrl-0 = <&pmx_pwr_off>;
+                pinctrl-names = "default";
+                gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
+        };
+
+        gpio_keys {
+                compatible = "gpio-keys";
+                #address-cells = <1>;
+                #size-cells = <0>;
+                pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy &pmx_btn_power>;
+                pinctrl-names = "default";
+
+                button@1 {
+                        label = "Power Button";
+                        linux,code = <KEY_POWER>;
+                        gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
+                };
+                button@2 {
+                        label = "Copy Button";
+                        linux,code = <KEY_COPY>;
+                        gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
+                };
+                button@3 {
+                        label = "Reset Button";
+                        linux,code = <KEY_RESTART>;
+                        gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
+                };
+        };
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		pinctrl-0 = <&pmx_led_hdd2_green &pmx_led_hdd2_red
+			     &pmx_led_usb_green
+			     &pmx_led_sys_green &pmx_led_sys_orange
+			     &pmx_led_copy_green &pmx_led_copy_red
+			     &pmx_led_hdd1_green &pmx_led_hdd1_red>;
+		pinctrl-names = "default";
+
+		green-sys {
+			label = "nsa310s:green:sys";
+			gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
+                        linux,default-trigger = "default-on";
+		};
+		orange-sys {
+			label = "nsa310s:orange:sys";
+			gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
+		};
+		green-hdd1 {
+			label = "nsa310s:green:hdd1";
+			gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+		};
+		red-hdd1 {
+			label = "nsa310s:red:hdd1";
+			gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
+		};
+		green-hdd2 {
+			label = "nsa310s:green:hdd2";
+			gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+		};
+		red-hdd2 {
+			label = "nsa310s:red:hdd2";
+			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+		};
+		green-usb {
+			label = "nsa310s:green:usb";
+			gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
+		};
+		green-copy {
+			label = "nsa310s:green:copy";
+			gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "ide-disk";
+		};
+		red-copy {
+			label = "nsa310s:red:copy";
+			gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&nand {
+        status = "okay";
+        chip-delay = <35>;
+
+        partition@0 {
+                label = "uboot";
+                reg = <0x00c0000 0x0080000>;
+        };
+	partition@140000 {
+		label = "ubi";
+		reg = <0x0140000 0x7ec0000>;
+         };
+};
+
+&mdio {
+	status = "okay";
+	ethphy0: ethernet-phy@1 {
+                compatible = "marvell,88e1510";
+		reg = <1>;
+	};
+};
+
+&eth0 {
+	status = "okay";
+	ethernet0-port@0 {
+		phy-handle = <&ethphy0>;
+	};
+};
+
+&pciec {
+	status = "okay";
+};
+
+&pcie0 {
+	status = "okay";
+};
1 Like

Thanks. I compile OpenWrt 19.07.2 and power button and Luci works now.
I have only problem with install any kmod packages, it show this messages:

The installed version of package *kernel* is not compatible, require 4.14.171-1-d96562fc… while 4.14.171-1-149e6200… is installed

Would it be possible add NSA310s to official OpenWRT support?
Or should I just upload somewhere a compiled image if someone wanted to use it?

1 Like

This is normal, the kernel in your device was not compiled by the official build bots so it can't know if the kmods from the repositories will be OK for it.

If you want to install kmods, select them when you are compiling the firmware from the make menuconfig interface. You can also select all other packages you want too and create a single larger image with all you need built-in, and not need to install any package after you update the firmware.

As I said, it's possible and relatively easy (just check the commits where I or others added new kirkwood devices), but I don't have the time to do that.

it seems the original issue in this thread was fixed in master/snapshot, and there is a PR waiting to be merged for OpenWrt 19.07 https://github.com/openwrt/openwrt/pull/2933

Anyone that had issues can try again.

@fialot: I did a first shot for an official support of ZyXEL NSA310s. Would you contribute and do/test changes on your hardware, as neither @bobafetthotmail nor myself have a NSA310s at home?

Hello,

I would like to install openwrt on my old 310 (without any letter). I have problem with USB - someday when i try to plug in my printer usb cable, something happen (i dont how exactly what and how), and now my usb doesn't work and USB LED on front panel after system boot lights always on red. When i connect to it via serial ports and boot system I get:

usb 1-1: new high speed USB device using ehci_marvell and address 2
usb 1-1: device descriptor read/64, error -71
....
usb 1-1: device descriptor read/64, error -71
In hub_port_init, and number is 0, retry 1, port 1 .....
usb 1-1: new high speed USB device using ehci_marvell and address 4
usb 1-1: device not accepting address 4, error -71
In hub_port_init, and number is 0, retry 2, port 1 .....
usb 1-1: new high speed USB device using ehci_marvell and address 5
usb 1-1: device not accepting address 5, error -71
In hub_port_init, and number is 0, retry 3, port 1 .....
hub 1-0:1.0: unable to enumerate USB device on port 1

First time usb start command:

NSA310>> usb start
(Re)start USB...
USB:   scanning bus for devices... 
      USB device not responding, giving up (status=20)
2 USB Device(s) found
       scanning bus for storage devices... 0 Storage Device(s) found

Second time:


NSA310>> usb start
(Re)start USB...
USB:   scanning bus for devices... 1 USB Device(s) found
       scanning bus for storage devices... 0 Storage Device(s) found

Can I fix in any way my USB?

The major question is: Can I install openwrt without access to USB, but via tftp? Anyone use this method with success? There is any chance that USB will work on openwrt, or it is hardware problem?

I wanna to switch on openwrt, because of smbv1 on nas and problems that i have to access files on nas via my linux desktop.

What version of uboot do you have ?
NSA310 is new enough so you can recover it easily with "kwboot" tool and serial (and a linux PC), see here.
http://forum.doozan.com/read.php?3,7852,7852

This is the command that should work in your case

./kwboot -t -B 115200 /dev/ttyUSB0 -b u-boot.kwb -p

Then you need to flash the uboot as you tried before.
kwboot only loads u-boot in RAM.

Here is output of serial:

U-Boot 1.1.4 (Feb 22 2011 - 10:31:35) Marvell version: 3.4.19

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CFEE0

Soc: 88F6281 A1 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz 

md ff00003c shows 121, so i think i can use it.

I read this topic and try workaround describe by bobafetthotmail

Following by https://openwrt.org/toh/zyxel/nsa310b in flash section, I change usb to ide. I download proper uboot file for my 310. Everything in terminal looks like in tutorial:

NSA310>> ide reset

Reset IDE: 
Marvell Serial ATA Adapter
Integrated Sata device found
[0 0 0]: Enable DMA mode (6)
  Device 0 @ 0 0:
Model: CT120BX300SSD1                           Firm: M2CR010  Ser#: 1743E10589E1        
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 114473.4 MB = 111.7 GB (234441648 x 512)
NSA310>> fatload ide 0 0x1000000 uboot.kwb
reading uboot.kwb

524288 bytes read
NSA310>> nand erase 0x0 0x100000

NAND erase: device 0 offset 0x0, size 0x100000
Erasing at 0xe0000 -- 100% complete.
OK
NSA310>> nand write 0x1000000 0x00000 0x100000

NAND write: device 0 offset 0x0, size 0x100000
 1048576 bytes written: OK
NSA310>> reset

But after reset only leds light orange, and serial is blank... Did I brick my 310? I tried:

But have only error:

$ sudo ./kwboot -t -B 115200 /dev/ttyUSB0 -b u-boot.kwb -p
Sending boot message. Please reboot the target...|
Sending boot image...
  0 % [+xmodem: Bad message

So now its trash?

kwboot should work, but you may need to try a few times, and from true power off state.

Disconnect power from nsa310, press power button for 5 seconds (to make sure everything is discharged and power is off),

then sending kwboot command from console and see that the bar is spinning
then connecting power and then power up the nsa310 with button.

Also since you say that the USB was killed, please make sure there is no short circuit in the USB port , check that both ports (front and back) contacts look fine, if it is still shorted it can be a problem for kwboot (and in general can cause other problems)

You are genius! 310 starts boot. So whats now? What I did wrong?

Note that I'm starting from stock V4.70(AFK.3)

U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:54:15 -0700)
ZyXEL NSA310 1-Bay Power Media Server 


SoC:   Kirkwood 88F6281_A1
DRAM:  256 MiB
WARNING: Caches not enabled
NAND:  128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   egiga0
PHY reset timed out
MV88E1318 PHY initialized on egiga0
Hit any key to stop autoboot:  0 
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... EHCI timed out on TD - token=0x80008c80
EHCI timed out on TD - token=0x80a88
unable to get device descriptor (error=-1) retry: 5
EHCI timed out on TD - token=0x80008c80
EHCI timed out on TD - token=0x80a88
unable to get device descriptor (error=-1) retry: 4
EHCI timed out on TD - token=0x80008c80
EHCI timed out on TD - token=0x80a88
unable to get device descriptor (error=-1) retry: 3
EHCI timed out on TD - token=0x80008c80
EHCI timed out on TD - token=0x80a88
unable to get device descriptor (error=-1) retry: 2
EHCI timed out on TD - token=0x80008c80
EHCI timed out on TD - token=0x80a88
unable to get device descriptor (error=-1) retry: 1
EHCI timed out on TD - token=0x80008c80
EHCI timed out on TD - token=0x80a88
unable to get device descriptor (error=-1) retry: 0
1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

Reset IDE: ide_preinit failed
## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0
loading envs from usb 0 ...
** Bad device usb 0 **

no IDE devices available
running scan_disk ...
Scan device usb
device usb 0:1
** Bad device usb 0 **
device usb 1:1
** Bad device usb 1 **
device usb 2:1
** Bad device usb 2 **
device usb 3:1
** Bad device usb 3 **
Scan device ide

Reset IDE: ide_preinit failed
device ide 0:1
** Bad device ide 0 **
device ide 1:1
** Bad device ide 1 **
device ide 2:1
** Bad device ide 2 **
device ide 3:1
** Bad device ide 3 **
loading uImage ...
** Bad device usb 0 **
loading uInitrd ...
** Bad device usb 0 **
loading DTB /boot/dts/kirkwood-nsa310.dtb ...
** Bad device usb 0 **
Unknown command 'bootm0x800000' - try 'help'
resetting ...


The commands you posted seem correct. Maybe you used the wrong uboot file? You must use the same uboot.kwb that works with kwboot.

If you use the uboot from OpenWrt it's faster to install OpenWrt (as it is already configured to boot openWrt), but as the warnings in the OpenWrt NSA310 page say you need to take the uboot from snapshot download folders, here https://downloads.openwrt.org/snapshots/targets/kirkwood/generic/u-boot-nsa310/

The uboot you posted now is bodhi's uboot. If you install that, you will need to change some configuration to boot OpenWrt too, but it can also boot Debian Linux (from bodhi's forum).

Does not matter. Everything will be erased.

The commands you posted seem correct. Maybe you used the wrong uboot file? You must use the same uboot.kwb that works with kwboot.

anyway, since you are using kwboot, if the tutorial still does not work, you can try differently

setenv mtdparts 'mtdparts=orion_nand:0x00c0000(uboot)
nand erase uboot
nand write 0x1000000 uboot
reset

If you use the uboot from OpenWrt it's faster to install OpenWrt (as it is already configured to boot openWrt), but as the warnings in the OpenWrt NSA310 page say you need to take the uboot from snapshot download folders, here https://downloads.openwrt.org/snapshots/targets/kirkwood/generic/u-boot-nsa310/

The uboot you posted now is bodhi's uboot. If you install that, you will need to change some configuration to boot OpenWrt too, as in the tutorial on the wiki.

Does not matter what firmware you start with. Everything will be erased and replaced.

Im boot now from u-boot you point me. but there isnt ide command...

I tried use tftp (connected directly 310 and laptop (manjaro system)) but:

NSA310> setenv ethaddr xx:xx:xx:xx:xx:xx
NSA310> setenv ipaddr 192.168.11.222    
NSA310> setenv serverip 192.168.11.200  
NSA310> tftp 0x1000000 u-boot.kwb       
Using egiga0 device
TFTP from server 192.168.11.200; our IP address is 192.168.11.222
Filename 'u-boot.kwb'.
Load address: 0x1000000
Loading: *
ARP Retry count exceeded; starting again
NSA310>

I dont know, why i can use it. Do you have any idea how i can put u-boot/bin on nas?

possible commands:

NSA310> help     
?         - alias for 'help'
base      - print or set address offset
bdinfo    - print Board Info structure
boot      - boot default, i.e., run 'bootcmd'
bootd     - boot default, i.e., run 'bootcmd'
bootelf   - Boot from an ELF image in memory
bootm     - boot application image from memory
bootp     - boot image via network using BOOTP/TFTP protocol
bootvx    - Boot vxWorks from an ELF image
bootz     - boot Linux zImage image from memory
chpart    - change active partition
cmp       - memory compare
coninfo   - print console devices and information
cp        - memory copy
crc32     - checksum calculation
date      - get/set/reset date & time
dhcp      - boot image via network using DHCP/TFTP protocol
dns       - lookup the IP of a hostname
echo      - echo args to console
editenv   - edit environment variable
env       - environment handling commands
ext2load  - load binary file from a Ext2 filesystem
ext2ls    - list files in a directory (default /)
ext4load  - load binary file from a Ext4 filesystem
ext4ls    - list files in a directory (default /)
ext4size  - determine a file's size
fatinfo   - print information about filesystem
fatload   - load binary file from a dos filesystem
fatls     - list files in a directory (default /)
fatsize   - determine a file's size
fdt       - flattened device tree utility commands
fsinfo    - print information about filesystems
fsload    - load binary file from a filesystem image
fsls      - list files in a directory (default /)
go        - start application at address 'addr'
help      - print command description/usage
iminfo    - print header information for application image
imxtract  - extract a part of a multi-image
itest     - return true/false on integer compare
loadb     - load binary file over serial line (kermit mode)
loads     - load S-Record file over serial line
loadx     - load binary file over serial line (xmodem mode)
loady     - load binary file over serial line (ymodem mode)
loop      - infinite loop on address range
md        - memory display
mii       - MII utility commands
mm        - memory modify (auto-incrementing address)
mtdparts  - define flash/nand partitions
mw        - memory write (fill)
nand      - NAND sub-system
nboot     - boot from NAND device
nfs       - boot image via network using NFS protocol
nm        - memory modify (constant address)
ping      - send ICMP ECHO_REQUEST to network host
printenv  - print environment variables
reset     - Perform RESET of the CPU
run       - run commands in an environment variable
saveenv   - save environment variables to persistent storage
setenv    - set environment variables
setexpr   - set environment variable as the result of eval expression
sleep     - delay execution for some time
sntp      - synchronize RTC via network
source    - run script from memory
tftpboot  - boot image via network using TFTP protocol
ubi       - ubi commands
ubifsload - load file from an UBIFS filesystem
ubifsls   - list files in a directory
ubifsmount- mount UBIFS volume
ubifsumount- unmount UBIFS volume
usb       - USB sub-system
usbboot   - boot from USB device
version   - print monitor, compiler and linker version