[celestica]: Add dx010 gpio sysfs exported when platform modules load.

Signed-off-by: Guohan Lu <gulv@microsoft.com>
This commit is contained in:
Guohan Lu 2018-08-05 06:23:59 +00:00
parent 8e0f1f526f
commit 7d13479aed
3 changed files with 48 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# Celestica DX010 Platform modules
CEL_DX010_PLATFORM_MODULE_VERSION = 0.6
CEL_DX010_PLATFORM_MODULE_VERSION = 0.7
export CEL_DX010_PLATFORM_MODULE_VERSION

View File

@ -1,3 +1,9 @@
sonic-cel-platform-modules (0.7) unstable; urgency=low
* Add dx010 plaform gpio sysfs exported when module load.
-- Pradchaya Phucharoen <pphuchar@celestica.com> Wed, 21 Jun 2018 13:29:05 +0700
sonic-cel-platform-modules (0.6) unstable; urgency=low
* Remove unused port-mode switch script. This should be done by hwsku config script.

View File

@ -11,6 +11,24 @@
# Short-Description: Setup DX010 board.
### END INIT INFO
function export_gpio {
label=$2
gpio_num=$1
gpio_base=`( cat /sys/class/gpio/gpiochip*/base | head -1 ) 2>/dev/null`
gpio_label=`( cat /sys/class/gpio/gpiochip*/label | head -1 ) 2>/dev/null`
if [[ "X$gpio_base" == "X" ]] ||
( [[ "X$label" != "X" ]] && [[ "$label" != "$gpio_label" ]] ); then
echo "Platform driver error: No gpiochip found!"
exit 1;
fi
ionum=$((gpio_base+gpio_num))
echo $ionum > /sys/class/gpio/export
if [ $? -ne 0 ]; then
echo "Platform driver error: Cannot export gpio$ionum!"
exit 1;
fi
}
case "$1" in
start)
echo -n "Setting up board... "
@ -77,6 +95,29 @@ start)
modprobe dx010_cpld
sleep 2
# Export platform gpio sysfs
export_gpio 10 # Fan 1 present
export_gpio 11 # Fan 2 present
export_gpio 12 # Fan 3 present
export_gpio 13 # Fan 4 present
export_gpio 14 # Fan 5 present
export_gpio 22 # PSU L PWOK
export_gpio 25 # PSU R PWOK
export_gpio 27 # PSU L ABS
export_gpio 28 # PSU R ABS
export_gpio 29 # Fan 1 LED: Red
export_gpio 30 # Fan 1 LED: Yellow
export_gpio 31 # Fan 2 LED: Red
export_gpio 32 # Fan 2 LED: Yellow
export_gpio 33 # Fan 3 LED: Red
export_gpio 34 # Fan 3 LED: Yellow
export_gpio 35 # Fan 4 LED: Red
export_gpio 36 # Fan 4 LED: Yellow
export_gpio 37 # Fan 5 LED: Red
export_gpio 38 # Fan 5 LED: Yellow
# Turn off/down lpmod by defult (0 - Normal, 1 - Low Pow)
echo 0x00000000 > /sys/devices/platform/dx010_cpld/qsfp_lpmode