sonic-buildimage/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.init
Guohan Lu 9047edc38e [platform]: move dell platform modules into buildimage repo
Signed-off-by: Guohan Lu <gulv@microsoft.com>
2018-08-13 10:39:07 +00:00

100 lines
3.2 KiB
Bash
Executable File

#!/bin/bash
### BEGIN INIT INFO
# Provides: setup-board
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Setup S6000 board.
### END INIT INFO
add_i2c_devices() {
echo 24c02 0x50 > /sys/class/i2c-adapter/i2c-1/new_device
echo 24c02 0x51 > /sys/class/i2c-adapter/i2c-1/new_device
echo dni_dps460 0x58 > /sys/class/i2c-adapter/i2c-1/new_device
echo dni_dps460 0x59 > /sys/class/i2c-adapter/i2c-1/new_device
echo jc42 0x18 > /sys/class/i2c-adapter/i2c-10/new_device
echo emc1403 0x4d > /sys/class/i2c-adapter/i2c-10/new_device
echo spd 0x50 > /sys/class/i2c-adapter/i2c-10/new_device
echo 24c02 0x53 > /sys/class/i2c-adapter/i2c-10/new_device
echo max6620 0x29 > /sys/class/i2c-adapter/i2c-11/new_device
echo max6620 0x2a > /sys/class/i2c-adapter/i2c-11/new_device
echo ltc4215 0x40 > /sys/class/i2c-adapter/i2c-11/new_device
echo ltc4215 0x42 > /sys/class/i2c-adapter/i2c-11/new_device
echo tmp75 0x4c > /sys/class/i2c-adapter/i2c-11/new_device
echo tmp75 0x4d > /sys/class/i2c-adapter/i2c-11/new_device
echo tmp75 0x4e > /sys/class/i2c-adapter/i2c-11/new_device
echo 24c02 0x51 > /sys/class/i2c-adapter/i2c-11/new_device
echo 24c02 0x52 > /sys/class/i2c-adapter/i2c-11/new_device
echo 24c02 0x53 > /sys/class/i2c-adapter/i2c-11/new_device
for i in `seq 0 31`; do
echo sff8436 0x50 > /sys/class/i2c-adapter/i2c-$((20+i))/new_device
done
}
remove_i2c_devices() {
echo 0x50 > /sys/class/i2c-adapter/i2c-1/delete_device
echo 0x51 > /sys/class/i2c-adapter/i2c-1/delete_device
echo 0x58 > /sys/class/i2c-adapter/i2c-1/delete_device
echo 0x59 > /sys/class/i2c-adapter/i2c-1/delete_device
echo 0x18 > /sys/class/i2c-adapter/i2c-10/delete_device
echo 0x4d > /sys/class/i2c-adapter/i2c-10/delete_device
echo 0x50 > /sys/class/i2c-adapter/i2c-10/delete_device
echo 0x53 > /sys/class/i2c-adapter/i2c-10/delete_device
echo 0x29 > /sys/class/i2c-adapter/i2c-11/delete_device
echo 0x2a > /sys/class/i2c-adapter/i2c-11/delete_device
echo 0x40 > /sys/class/i2c-adapter/i2c-11/delete_device
echo 0x42 > /sys/class/i2c-adapter/i2c-11/delete_device
echo 0x4c > /sys/class/i2c-adapter/i2c-11/delete_device
echo 0x4d > /sys/class/i2c-adapter/i2c-11/delete_device
echo 0x4e > /sys/class/i2c-adapter/i2c-11/delete_device
echo 0x51 > /sys/class/i2c-adapter/i2c-11/delete_device
echo 0x52 > /sys/class/i2c-adapter/i2c-11/delete_device
echo 0x53 > /sys/class/i2c-adapter/i2c-11/delete_device
for i in `seq 0 31`; do
echo 0x50 > /sys/class/i2c-adapter/i2c-$((20+i))/delete_device
done
}
case "$1" in
start)
echo -n "Setting up board... "
depmod -a
modprobe i2c_mux_gpio
modprobe dell_s6000_platform
add_i2c_devices
/usr/local/bin/set-fan-speed 15000
/usr/local/bin/reset-qsfp
echo "done."
;;
stop)
echo "done."
remove_i2c_devices
rmmod dell_s6000_platform
rmmod i2c_mux_gpio
;;
force-reload|restart)
echo "Not supported"
;;
*)
echo "Usage: /etc/init.d/platform-modules-s6000.init {start|stop}"
exit 1
;;
esac
exit 0