openwrt/target/linux/kirkwood/base-files/etc/init.d/hwmon_fancontrol
Pawel Dembicki 4e46ae1f69 kirkwood: add support for NETGEAR ReadyNAS Duo v2
NETGEAR ReadyNAS Duo v2 is a NAS based on Marvell kirkwood SoC.

Specification:
 - Processor Marvell 88F6282 (1.6 GHz)
 - 256MB RAM
 - 128MB NAND
 - 1x GBE LAN port (PHY: Marvell 88E1318)
 - 1x USB 2.0
 - 2x USB 3.0
 - 2x SATA
 - 3x button
 - 5x leds
 - serial on J5 connector accessible from rear panel
   (115200 8N1) (VCC,TX,RX,GND) (3V3 LOGIC!)

Installation by USB + serial:
  - Copy initramfs image to fat32 usb drive
  - Connect pendrive to USB 2.0 front socket
  - Connect serial console
  - Stop booting in u-boot
  - Do:
	usb reset
        setenv bootargs 'console=ttyS0,115200n8 earlyprintk'
        setenv bootcmd 'nand read.e 0x1200000 0x200000 0x600000;bootm 0x1200000'
        saveenv
	fatload usb 0:1 0x1200000 openwrt-kirkwood-netgear_readynas-duo-v2-initramfs-uImage
	bootm 0x1200000
  - copy sysupgrade image via ssh.
  - run sysupgrade

Installation by TFTP + serial:
  - Setup TFTP server and copy initramfs image
  - Connect serial console
  - Stop booting in u-boot
  - Do:
	setenv bootargs 'console=ttyS0,115200n8 earlyprintk'
	setenv bootcmd 'nand read.e 0x1200000 0x200000 0x600000;bootm 0x1200000'
	saveenv
	setenv serverip 192.168.1.1
	setenv ipaddr 192.168.1.2
	tftpboot 0x1200000 openwrt-kirkwood-netgear_readynas-duo-v2-initramfs-uImage
	bootm 0x1200000
  - copy sysupgrade image via ssh.
  - run sysupgrade

Known issues:
  - Power button and PHY INTn pin are connected to the same GPIO. It
    causes that every network restart button is pressed in system.
    As workaround, button is used as regular BTN_1.

For more info please look at file:
RND_5.3.13_WW.src/u-boot/board/mv_feroceon/mv_hal/usibootup/usibootup.c
from Netgear GPL sources.

Tested-by: Raylynn Knight <rayknight@me.com>
Tested-by: Lech Perczak <lech.perczak@gmail.com>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
2021-12-29 20:35:57 +01:00

60 lines
2.4 KiB
Bash
Executable File

#!/bin/sh /etc/rc.common
START=98
boot() {
# configuring onboard temp/fan controller to run the fan on its own
# 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
;;
netgear,readynas-duo-v2)
path_to_hwmon='/sys/class/hwmon/hwmon0'
echo 1200 > "$path_to_hwmon/fan1_target" # set target rpm
;;
seagate,blackarmor-nas220)
path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0'
# adt7476 fan control chip. 3 temp sensors. Set to 1/4 speed at 35C and max speed at 48C.
echo 7 > "$path_to_hwmon/pwm1_auto_channels_temp"
echo 64 > "$path_to_hwmon/pwm1_auto_point1_pwm"
echo 255 > "$path_to_hwmon/pwm1_auto_point2_pwm"
echo 35000 > "$path_to_hwmon/temp1_auto_point1_temp"
echo 48000 > "$path_to_hwmon/temp1_auto_point2_temp"
echo 35000 > "$path_to_hwmon/temp2_auto_point1_temp"
echo 48000 > "$path_to_hwmon/temp2_auto_point2_temp"
echo 35000 > "$path_to_hwmon/temp3_auto_point1_temp"
echo 48000 > "$path_to_hwmon/temp3_auto_point2_temp"
echo 2 > "$path_to_hwmon/pwm1_enable"
;;
zyxel,nsa310b)
path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0'
# use the max. value of (temp1) OR (temp2) OR (temp3) as an input
# for the PWM of the cooling fan
echo 123 > "$path_to_hwmon/pwm1_auto_channels"
# Temperature sensor #1 placed on mainboard
echo 30000 > "$path_to_hwmon/temp1_auto_temp_min"
echo 49600 > "$path_to_hwmon/temp1_auto_temp_max"
# Temperature sensor #2 placed on mainboard
# range: 0 to 127000 in steps of 1000 [millicelsius]
echo 30000 > "$path_to_hwmon/temp2_auto_temp_min"
# range: 0 to 127000 in steps of ???? [millicelsius]
echo 49600 > "$path_to_hwmon/temp2_auto_temp_max"
# Temperature sensor #3 placed close to a chipset
# range: 0 to 60000 in steps of 1000 [millicelsius]
echo 23000 > "$path_to_hwmon/temp3_auto_temp_min"
# pre-defined steps: 103000, 122000, 143300, 170000 in [millicelsius]
echo 103000 > "$path_to_hwmon/temp3_auto_temp_max"
;;
esac
}