mvebu: add support for ipTIME NAS1dual
authorSungbo Eo <mans0n@gorani.run>
Sat, 1 Jan 2022 14:47:43 +0000 (23:47 +0900)
committerSungbo Eo <mans0n@gorani.run>
Sat, 29 Jan 2022 14:50:28 +0000 (23:50 +0900)
ipTIME NAS1dual is a 1-bay NAS, based on Marvell Armada 385 SoC.

Specifications:
* SoC: 88F6820
* RAM: 2 GiB
* Flash: SPI NOR 64 MiB
* SATA: 1x 3Gb/s
* Ethernet: 2x 1GbE
* USB: 1x 3.0
* Fan: 2 speed level
* UART: J11 (115200 8N1)
  * Pinout: [3V3] (TXD) (RXD) (GND)

Installation via web interface:
1.  Flash **initramfs** image through the stock web interface.
2.  Boot into OpenWrt and perform sysupgrade with sysupgrade image.

Revert to stock firmware:
1.  Perform sysupgrade with stock image.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network
target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh
target/linux/mvebu/files/arch/arm/boot/dts/armada-385-nas1dual.dts [new file with mode: 0644]
target/linux/mvebu/image/cortexa9.mk

index 36769e8c182bc6469594500556bbe97554186110..c613a3cd603ec8c3d1de92471676cde6aa88e79f 100644 (file)
@@ -18,6 +18,9 @@ mvebu_setup_interfaces()
        cznic,turris-omnia)
                ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 lan4" "eth2"
                ;;
+       iptime,nas1dual)
+               ucidef_set_interface_lan "eth0 eth1" "dhcp"
+               ;;
        linksys,wrt1200ac|\
        linksys,wrt1900ac-v1|\
        linksys,wrt1900ac-v2|\
index 030e66e6998d0300f176832de0cb5ba872c9277f..18b978d43705ceb3059e962930364ded1dee5314 100755 (executable)
@@ -5,6 +5,8 @@
 
 RAMFS_COPY_BIN='fw_printenv fw_setenv strings'
 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
+
+PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
 platform_check_image() {
diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-nas1dual.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-nas1dual.dts
new file mode 100644 (file)
index 0000000..d14ea8b
--- /dev/null
@@ -0,0 +1,318 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR MIT)
+/*
+ * Device Tree file for ipTIME NAS1dual
+ *
+ * Copyright (C) 2020 Sungbo Eo <mans0n@gorani.run>
+ *
+ * Based on armada-385-linksys.dtsi
+ * Copyright (C) 2015 Imre Kaloz <kaloz@openwrt.org>
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include "armada-385.dtsi"
+
+/ {
+       model = "ipTIME NAS1dual";
+       compatible = "iptime,nas1dual", "marvell,armada385", "marvell,armada380";
+
+       aliases {
+               led-boot = &led_ready;
+               led-failsafe = &led_ready;
+               led-running = &led_ready;
+               led-upgrade = &led_ready;
+               label-mac-device = &eth0;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8";
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x00000000 0x80000000>; /* 2GB */
+       };
+
+       soc {
+               ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
+                         MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
+                         MBUS_ID(0x09, 0x19) 0 0xf1100000 0x10000
+                         MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000
+                         MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&gpio_keys_pins>;
+
+               power {
+                       label = "Power Button";
+                       linux,input-type = <EV_SW>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
+               };
+
+               reset {
+                       label = "Reset Button";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
+               };
+
+               copy {
+                       label = "USB Copy Button";
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&gpio_leds_pins>;
+
+               led_ready: ready {
+                       label = "blue:ready";
+                       gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
+               };
+
+               hdd {
+                       label = "blue:hdd";
+                       gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "disk-activity";
+               };
+
+               usb {
+                       label = "blue:usb";
+                       gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
+                       trigger-sources = <&usb3_0_port1 &usb3_0_port2>;
+                       linux,default-trigger = "usbport";
+               };
+       };
+
+       gpio-fan {
+               compatible = "gpio-fan";
+               pinctrl-names = "default";
+               pinctrl-0 = <&gpio_fan_pins>;
+               gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>,
+                       <&gpio1 18 GPIO_ACTIVE_HIGH>;
+               /* We don't know the exact rpm, just use dummy values here. */
+               gpio-fan,speed-map = <0 0>, <1 1>, <2 2>;
+               #cooling-cells = <2>;
+       };
+
+       gpio-poweroff {
+               compatible = "gpio-poweroff";
+               gpios = <&pca9536 1 GPIO_ACTIVE_LOW>;
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sata_power_pins>;
+
+               reg_sata_power: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "sata-power";
+                       regulator-min-microvolt = <12000000>;
+                       regulator-max-microvolt = <12000000>;
+                       gpio = <&gpio1 20 GPIO_ACTIVE_LOW>;
+                       regulator-always-on;
+               };
+       };
+};
+
+&ahci0 {
+       status = "okay";
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       sata-port@0 {
+               reg = <0>;
+               target-supply = <&reg_sata_power>;
+               #thermal-sensor-cells = <0>;
+       };
+};
+
+&bm {
+       status = "okay";
+};
+
+&bm_bppi {
+       status = "okay";
+};
+
+&eth0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&ge0_rgmii_pins>;
+       status = "okay";
+       phy-handle = <&ethphy1>;
+       phy-connection-type = "rgmii-id";
+       buffer-manager = <&bm>;
+       bm,pool-long = <0>;
+       bm,pool-short = <1>;
+       nvmem-cells = <&macaddr_uboot_fffa8>;
+       nvmem-cell-names = "mac-address";
+};
+
+&eth1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&ge1_rgmii_pins>;
+       status = "okay";
+       phy-handle = <&ethphy0>;
+       phy-connection-type = "rgmii-id";
+       buffer-manager = <&bm>;
+       bm,pool-long = <2>;
+       bm,pool-short = <3>;
+       nvmem-cells = <&macaddr_uboot_fffa8>;
+       nvmem-cell-names = "mac-address";
+};
+
+&i2c0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c0_pins>;
+       status = "okay";
+
+       pca9536: gpio@41 {
+               compatible = "nxp,pca9536";
+               reg = <0x41>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               gpio-line-names = "power-led", "power-board";
+       };
+};
+
+&mdio {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mdio_pins>;
+
+       /* LED1: On - Link, Blink - Activity, Off - No Link */
+
+       ethphy0: ethernet-phy@0 {
+               reg = <0>;
+               marvell,reg-init = <3 16 0 0x1017>;
+       };
+
+       ethphy1: ethernet-phy@1 {
+               reg = <1>;
+               marvell,reg-init = <3 16 0 0x1017>;
+       };
+};
+
+&pinctrl {
+       gpio_keys_pins: gpio-keys-pins {
+               marvell,pins = "mpp24", "mpp26", "mpp48";
+               marvell,function = "gpio";
+       };
+
+       gpio_leds_pins: gpio-leds-pins {
+               marvell,pins = "mpp18", "mpp20", "mpp51";
+               marvell,function = "gpio";
+       };
+
+       gpio_fan_pins: gpio-fan-pins {
+               marvell,pins = "mpp25", "mpp50";
+               marvell,function = "gpio";
+       };
+
+       sata_power_pins: sata-power-pins {
+               marvell,pins = "mpp52";
+               marvell,function = "gpio";
+       };
+
+       uart1_pins_alt: uart-pins-1-alt {
+               marvell,pins = "mpp45", "mpp46";
+               marvell,function = "ua1";
+       };
+};
+
+&spi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&spi1_pins>;
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <40000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               reg = <0x00000000 0x00100000>;
+                               label = "u-boot";
+                               read-only;
+
+                               compatible = "nvmem-cells";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               macaddr_uboot_fffa8: macaddr@fffa8 {
+                                       reg = <0xfffa8 0x6>;
+                               };
+                       };
+
+                       partition@100000 {
+                               reg = <0x00100000 0x03ec0000>;
+                               label = "firmware";
+
+                               compatible = "fixed-partitions";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               partition@0 {
+                                       reg = <0x00000000 0x00600000>;
+                                       label = "kernel";
+                               };
+
+                               partition@600000 {
+                                       reg = <0x00600000 0x038c0000>;
+                                       label = "rootfs";
+                               };
+                       };
+
+                       partition@3fc0000 {
+                               reg = <0x03fc0000 0x00040000>;
+                               label = "config";
+                               read-only;
+                       };
+               };
+       };
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins>;
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart1_pins_alt>;
+       status = "okay";
+};
+
+&usb3_0 {
+       status = "okay";
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       usb3_0_port1: port@1 {
+               reg = <1>;
+               #trigger-source-cells = <0>;
+       };
+
+       usb3_0_port2: port@2 {
+               reg = <2>;
+               #trigger-source-cells = <0>;
+       };
+};
index 06252670abd07517a89d17fe6ac8391f036ee31c..b06c5594bd349d0d9430cad0dbc2e843f74832fe 100644 (file)
@@ -78,6 +78,20 @@ define Device/globalscale_mirabox
 endef
 TARGET_DEVICES += globalscale_mirabox
 
+define Device/iptime_nas1dual
+  DEVICE_VENDOR := ipTIME
+  DEVICE_MODEL := NAS1dual
+  DEVICE_PACKAGES := kmod-hwmon-drivetemp kmod-hwmon-gpiofan kmod-usb3
+  SOC := armada-385
+  KERNEL := kernel-bin | append-dtb | iptime-naspkg nas1dual
+  KERNEL_SIZE := 6144k
+  IMAGES := sysupgrade.bin
+  IMAGE_SIZE := 64256k
+  IMAGE/sysupgrade.bin := append-kernel | pad-to $$(KERNEL_SIZE) | \
+       append-rootfs | pad-rootfs | check-size | append-metadata
+endef
+TARGET_DEVICES += iptime_nas1dual
+
 define Device/kobol_helios4
   DEVICE_VENDOR := Kobol
   DEVICE_MODEL := Helios4