kirkwood: add support for Netgear Stora (MS2000/2110) NAS

Dual-slot NAS based on Marvell Kirkwood.

Specifications:
 - Marvell 88F6281 @1GHz
 - 128Mb RAM
 - 256Mb NAND
 - 1x GbE LAN (Marvell 88E1116)
 - 1x USB 2.0
 - 2x SATA
 - PCF8563 RTC
 - LM75 sensor
 - TC654 PWM fan controller
 - Serial on J2 (115200,8n1)
 - Newer bootROM so kwboot-ing via serial is possible

Installation:

1. Serial console
 - Connect your levelshifter to the serial console
   on J2 (refer to the wiki page for pinout)
2. Update u-boot
 - Download the u-boot.kwb image for the device
 - Powercycle the NAS
 - Run "kwboot -b ./u-boot.kwb /dev/ttyUSB0 -p"
 - Connect to the serial console with minicom
 - tftp 0x0800000 netgear_stora-u-boot.kwb
 - nand erase 0x0 100000
 - nand write 0x0800000 0x0 0x100000
 - reset
3. Install OpenWrt
 - Boot up the initramfs image
 - tftpboot 0x800000 openwrt-kirkwood-netgear_stora-initramfs-uImage; bootm 0x800000
 - Download the sysupgrade image and perform sysupgrade

The fan is controlled in 3 stages by a script running every minute
from cron, measuring the CPU temperature.

Snippets taken from bodhi <mibodhi@gmail.com>

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
This commit is contained in:
Zoltan HERPAI
2022-05-05 08:47:27 +02:00
parent afd5926e37
commit 0dfc0495fc
9 changed files with 957 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ kirkwood_setup_interfaces()
iom,ix2-200|\
iptime,nas1|\
netgear,readynas-duo-v2|\
netgear,stora|\
raidsonic,ib-nas62x0|\
seagate,blackarmor-nas220|\
seagate,dockstar|\

View File

@@ -0,0 +1,22 @@
#
# Copyright (C) 2021 OpenWrt.org
#
. /lib/functions.sh
board=$(board_name)
case "$board" in
netgear,stora)
# Set fan script execution in crontab
grep -s -q fan_ctrl.sh /etc/crontabs/root && exit 0
echo "# stora fan script runs every 5 minutes" >> /etc/crontabs/root
echo "*/5 * * * * /sbin/fan_ctrl.sh" >> /etc/crontabs/root
# Execute one time after initial flash (instead of waiting 5 min for cron)
/sbin/fan_ctrl.sh
;;
esac
exit 0

View File

@@ -0,0 +1,23 @@
#!/bin/sh
CPU_TEMP=$(cut -c1-2 /sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-0048/hwmon/hwmon?/temp1_input)
CPU_LOW=45
CPU_MID=50
CPU_HIGH=55
if [ ! -e /sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-001b/hwmon/hwmon?/pwm1 ]; then
exit 0
else
FAN_CTRL=$(ls /sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-001b/hwmon/hwmon?/pwm1)
fi
if [ "$CPU_TEMP" -ge "$CPU_HIGH" ]; then
echo "255" > $FAN_CTRL
elif [ "$CPU_TEMP" -ge "$CPU_MID" ]; then
echo "100" > $FAN_CTRL
elif [ "$CPU_TEMP" -ge "$CPU_LOW" ]; then
echo "50" > $FAN_CTRL
else
echo "0" > $FAN_CTRL
fi

View File

@@ -0,0 +1,227 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Device Tree file for NETGEAR Stora (MS2000/2110)
*
* Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
* Copyright (C) 2021, Zoltan HERPAI <wigyori@uid0.hu>
*/
/dts-v1/;
#include "kirkwood.dtsi"
#include "kirkwood-6281.dtsi"
/ {
model = "NETGEAR Stora (MS2000/2110)";
compatible = "netgear,stora", "marvell,kirkwood-88f6281", "marvell,kirkwood";
memory { /* 128 MB */
device_type = "memory";
reg = <0x00000000 0x8000000>;
};
aliases {
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
chosen {
bootargs = "console=ttyS0,115200n8 earlyprintk";
stdout-path = &uart0;
};
ocp@f1000000 {
pinctrl: pin-controller@10000 {
pmx_button_power: pmx-button-power {
marvell,pins = "mpp36";
marvell,function = "gpio";
};
pmx_button_reset: pmx-button-reset {
marvell,pins = "mpp38";
marvell,function = "gpio";
};
pmx_led_blue_power: pmx-led-blue-power {
marvell,pins = "mpp31";
marvell,function = "gpio";
};
pmx_led_green_disk1: pmx-led-green-disk1 {
marvell,pins = "mpp21";
marvell,function = "gpio";
};
pmx_led_green_disk2: pmx-led-green-disk2 {
marvell,pins = "mpp20";
marvell,function = "gpio";
};
pmx_led_red_disk1: pmx-led-red-disk1 {
marvell,pins = "mpp23";
marvell,function = "gpio";
};
pmx_led_red_disk2: pmx-led-red-disk2 {
marvell,pins = "mpp22";
marvell,function = "gpio";
};
pmx_poweroff: pmx-poweroff {
marvell,pins = "mpp40";
marvell,function = "gpio";
};
pmx_fan_tacho: pmx-fan-tacho {
marvell,pins = "mpp41";
marvell,function = "gpio";
};
};
clocks {
pcf8563_clk: pcf8563-oscillator {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <2048>;
};
};
i2c@11000 {
status = "okay";
tc654@1b {
compatible = "microchip,tc654";
reg = <0x1b>;
};
lm75@48 {
compatible = "national,lm75";
reg = <0x48>;
};
pcf8563@51 {
compatible = "nxp,pcf8563";
reg = <0x51>;
};
};
serial@12000 {
status = "okay";
};
sata@80000 {
status = "okay";
phy-names = "port0", "port1";
nr-ports = <2>;
};
};
gpio-leds {
compatible = "gpio-leds";
pinctrl-0 = < &pmx_led_blue_power
&pmx_led_green_disk1 &pmx_led_green_disk2
&pmx_led_red_disk1 &pmx_led_red_disk2 >;
pinctrl-names = "default";
led_power: power {
label = "blue:power";
gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
linux,default-trigger = "default-on";
};
disk1 {
label = "green:disk1";
gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
linux,default-trigger = "ata1";
};
disk2 {
label = "green:disk2";
gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
linux,default-trigger = "ata2";
};
disk1_fail {
label = "red:disk1_fail";
gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
};
disk2_fail {
label = "red:disk2_fail";
gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
};
};
gpio-keys {
compatible = "gpio-keys";
pinctrl-0 = <&pmx_button_power &pmx_button_reset >;
pinctrl-names = "default";
power {
label = "Power Button";
linux,code = <KEY_POWER>;
gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
};
reset {
label = "Reset Button";
linux,code = <KEY_RESTART>;
gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
};
};
gpio-poweroff {
compatible = "gpio-poweroff";
pinctrl-0 = <&pmx_poweroff>;
pinctrl-names = "default";
gpios = <&gpio0 40 GPIO_ACTIVE_LOW>;
};
};
&nand {
status = "okay";
chip-delay = <40>;
partition@0 {
label = "u-boot";
reg = <0x0000000 0x0e0000>;
read-only;
};
partition@e0000 {
label = "u-boot-env";
reg = <0x0e00000 0x020000>;
};
partition@100000 {
label = "ubi";
reg = <0x0100000 0xff00000>;
};
};
&mdio {
status = "okay";
ethphy0: ethernet-phy@0 { /* Marvell 88E1318 */
compatible = "marvell,88e1116";
reg = <8>;
};
};
&eth0 {
status = "okay";
ethernet0-port@0 {
phy-handle = <&ethphy0>;
};
};
&pciec {
status = "okay";
};
&pcie0 {
status = "okay";
};

View File

@@ -271,6 +271,16 @@ define Device/netgear_readynas-duo-v2
endef
TARGET_DEVICES += netgear_readynas-duo-v2
define Device/netgear_stora
DEVICE_VENDOR := Netgear
DEVICE_MODEL := Stora (MS2000/2110)
DEVICE_DTS := kirkwood-stora
DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \
kmod-rtc-pcf8563 kmod-hwmon-lm75 kmod-hwmon-tc654 \
kmod-gpio-button-hotplug
endef
TARGET_DEVICES += netgear_stora
define Device/raidsonic_ib-nas62x0
DEVICE_VENDOR := RaidSonic
DEVICE_MODEL := ICY BOX IB-NAS62x0

View File

@@ -0,0 +1,10 @@
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -339,6 +339,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += \
kirkwood-rs411.dtb \
kirkwood-sheevaplug.dtb \
kirkwood-sheevaplug-esata.dtb \
+ kirkwood-stora.dtb \
kirkwood-t5325.dtb \
kirkwood-topkick.dtb \
kirkwood-ts219-6281.dtb \

View File

@@ -0,0 +1,10 @@
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -375,6 +375,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += \
kirkwood-rs411.dtb \
kirkwood-sheevaplug.dtb \
kirkwood-sheevaplug-esata.dtb \
+ kirkwood-stora.dtb \
kirkwood-t5325.dtb \
kirkwood-topkick.dtb \
kirkwood-ts219-6281.dtb \