From 3843c641d83b621e07f03753a5617ab27e55e262 Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Mon, 16 Aug 2021 17:42:56 +0200 Subject: kirkwood: add support for Ctera C200 V1 NAS 2-Bay NAS - maximum two 3.5" Harddisks Hardware: - SoC: Marvell 88F6281-A1 ARMv5TE Processor 1.2GHz - Ram: 512MB (4x Nanya NT5TU128M8GE-AC) - NAND Flash: 256MB (Samsung 216 K9F2G08U0C) - Lan: 1x GBE (Marvell 88E1116R-NNC1) - Storage: 2x SATA HDD 3.5" Slot - USB: 2x USB 2.0 port - Console: Internal J3 connector (1: Vcc, 2: Rx, 3: Tx, 4: GND) - LEDs: 13x GPIO controlled - Buttons: 2x GPIO controlled Known issues: - Buzzer is unused due lack of proper driver Installation: - Apply factory initramfs image via stock web-gui. - Do sysupgrade to make installation complete. Back to stock: - OpenWrt rootfs partition use unused space after stock firmware. - Full revert is possible. - Login via ssh and run: ctera_c200-v1_back_to_factory Signed-off-by: Pawel Dembicki Reviewed-by: Sungbo Eo [apply sorting to device recipe] Signed-off-by: Sungbo Eo --- .../kirkwood/base-files/etc/board.d/02_network | 1 + .../base-files/etc/init.d/hwmon_fancontrol | 7 ++++++ .../kirkwood/base-files/lib/upgrade/platform.sh | 13 +++++++++- .../base-files/sbin/ctera_c200-v1_back_to_factory | 28 ++++++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 target/linux/kirkwood/base-files/sbin/ctera_c200-v1_back_to_factory (limited to 'target/linux/kirkwood/base-files') 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 694bcaecce..c98e30adcb 100644 --- a/target/linux/kirkwood/base-files/etc/board.d/02_network +++ b/target/linux/kirkwood/base-files/etc/board.d/02_network @@ -18,6 +18,7 @@ cisco,on100) ;; cloudengines,pogoe02|\ cloudengines,pogoplugv4|\ +ctera,c200-v1|\ globalscale,sheevaplug|\ iom,iconnect-1.1|\ iom,ix2-200|\ diff --git a/target/linux/kirkwood/base-files/etc/init.d/hwmon_fancontrol b/target/linux/kirkwood/base-files/etc/init.d/hwmon_fancontrol index 334a2a08ef..ec85b56ca1 100755 --- a/target/linux/kirkwood/base-files/etc/init.d/hwmon_fancontrol +++ b/target/linux/kirkwood/base-files/etc/init.d/hwmon_fancontrol @@ -7,6 +7,13 @@ boot() { # for more information, please read https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface case $(board_name) in + ctera,c200-v1) + path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-004c/hwmon/hwmon0' + + # It should be related to hdd temerature instead lm63 temp + echo 1 > "$path_to_hwmon/pwm1_enable" + echo 128 > "$path_to_hwmon/pwm1" + ;; iom,ix2-200) path_to_hwmon='/sys/class/hwmon/hwmon0' echo 2 > "$path_to_hwmon/pwm1_enable" # fan is on pwm1 diff --git a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh index 8ff1709f2c..3f84df2808 100644 --- a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh +++ b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh @@ -1,4 +1,4 @@ -RAMFS_COPY_BIN='fw_printenv fw_setenv' +RAMFS_COPY_BIN='fw_printenv fw_setenv strings' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' REQUIRE_IMAGE_METADATA=1 @@ -11,6 +11,17 @@ platform_do_upgrade() { local board="$(board_name)" case "$board" in + ctera,c200-v1) + part=$(find_mtd_part "active_bank") + + if [ -n "$part" ]; then + CI_KERNPART="$(strings $part | grep bank)" + nand_do_upgrade "$1" + else + echo "active_bank partition missed!" + return 1 + fi + ;; linksys,e4200-v2|\ linksys,ea3500|\ linksys,ea4500) diff --git a/target/linux/kirkwood/base-files/sbin/ctera_c200-v1_back_to_factory b/target/linux/kirkwood/base-files/sbin/ctera_c200-v1_back_to_factory new file mode 100755 index 0000000000..bb922d4d75 --- /dev/null +++ b/target/linux/kirkwood/base-files/sbin/ctera_c200-v1_back_to_factory @@ -0,0 +1,28 @@ +#!/bin/sh + +. /lib/functions.sh + +case $(board_name) in +ctera,c200-v1) + part=$(find_mtd_part "active_bank") + + if [ -n "$part" ]; then + active_bank="$(strings $part | grep bank)" + + if [ $active_bank = "bank1" ]; then + echo "bank2" > /tmp/change_bank + else + echo "bank1" > /tmp/change_bank + fi + + mtd write /tmp/change_bank active_bank + reboot + else + echo "active_bank partition missed!" + return 1 + fi + ;; +*) + echo "Unsupported hardware." + ;; +esac -- cgit v1.2.3