Skip to content

Commit

Permalink
[delta]: Enable ag5648, et-6248brb, ag9064 and fix the build error of…
Browse files Browse the repository at this point in the history
… ag5648 PSU module. (sonic-net#32)

* 1. Fixed delta ag5648 PSU modules.
2. Enable build ag5648.

Signed-off-by: neal tai <neal.tai@deltaww.com>

* 1. Modified the kernel depends for ag5648.
2. Modified platform-modules-ag5648.service for install ag5648.

Signed-off-by: neal tai <neal.tai@deltaww.com>

* Enable the ag9064.

Signed-off-by: Stanley Chi <stanley.chi@deltaww.com>

* Add Delta platform et-6248brb

Signed-off-by: neal tai <neal.tai@deltaww.com>
  • Loading branch information
StanleyCi authored and lguohan committed May 3, 2018
1 parent 05e55e9 commit 61b5a5d
Show file tree
Hide file tree
Showing 27 changed files with 3,279 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# name lanes alias index
Ethernet0 1 1000 0
Ethernet1 2 1000 1
Ethernet2 3 1000 2
Ethernet3 4 1000 3
Ethernet4 5 1000 4
Ethernet5 6 1000 5
Ethernet6 7 1000 6
Ethernet7 8 1000 7
Ethernet8 9 1000 8
Ethernet9 10 1000 9
Ethernet10 11 1000 10
Ethernet11 12 1000 11
Ethernet12 13 1000 12
Ethernet13 14 1000 13
Ethernet14 15 1000 14
Ethernet15 16 1000 15
Ethernet16 17 1000 16
Ethernet17 18 1000 17
Ethernet18 19 1000 18
Ethernet19 20 1000 19
Ethernet20 21 1000 20
Ethernet21 22 1000 21
Ethernet22 23 1000 22
Ethernet23 24 1000 23
Ethernet24 25 1000 24
Ethernet25 26 1000 25
Ethernet26 27 1000 26
Ethernet27 28 1000 27
Ethernet28 29 1000 28
Ethernet29 30 1000 29
Ethernet30 31 1000 30
Ethernet31 32 1000 31
Ethernet32 33 1000 32
Ethernet33 34 1000 33
Ethernet34 35 1000 34
Ethernet35 36 1000 35
Ethernet36 37 1000 36
Ethernet37 38 1000 37
Ethernet38 39 1000 38
Ethernet39 40 1000 39
Ethernet40 41 1000 40
Ethernet41 42 1000 41
Ethernet42 43 1000 42
Ethernet43 44 1000 43
Ethernet44 45 1000 44
Ethernet45 46 1000 45
Ethernet46 47 1000 46
Ethernet47 48 1000 47
Ethernet48 54 10000 48
Ethernet49 53 10000 49
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SAI_INIT_CONFIG_FILE=/etc/bcm/helix4-et-6248brb-48x1G+2x10G.config.bcm
12 changes: 12 additions & 0 deletions device/delta/x86_64-delta_et-6248brb-r0/fancontrol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
INTERVAL=10
DEVPATH=hwmon1=/sys/bus/i2c/devices
DEVNAME=hwmon1=adt7473
FCTEMPS=hwmon1/0-0048/hwmon/hwmon*/temp1_input hwmon1/7-0049/hwmon/hwmon*/temp1_input hwmon1/8-004a/hwmon/hwmon*/temp1_input

FCFANS=hwmon1/0-002e/fan1_input hwmon1/0-002e/fan2_input

FCTARGETS=hwmon1/0-002e/pwm1 hwmon1/0-002e/pwm2
MINTEMP=20
MAXTEMP=60
MINSTART=75
MINSTOP=22
279 changes: 279 additions & 0 deletions device/delta/x86_64-delta_et-6248brb-r0/fancontrol.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
#!/bin/bash
#
# Simple script implementing a temperature dependent fan speed control
# Supported Linux kernel versions: 2.6.5 and later
#
# Version 0.70
#
# Usage: fancontrol [CONFIGFILE]
#
# Dependencies:
# bash, egrep, sed, cut, sleep, readlink, lm_sensors :)
#
# Please send any questions, comments or success stories to
# marius.reiner@hdev.de
# Thanks!
#
# For configuration instructions and warnings please see fancontrol.txt, which
# can be found in the doc/ directory or at the website mentioned above.
#
#
# Copyright 2003 Marius Reiner <marius.reiner@hdev.de>
# Copyright (C) 2007-2009 Jean Delvare <khali@linux-fr.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
#
#

PIDFILE="/var/run/fancontrol.pid"

#DEBUG=1
MAX=255

function LoadConfig
{
local fcvcount fcv

echo "Loading configuration from $1 ..."
if [ ! -r "$1" ]
then
echo "Error: Can't read configuration file" >&2
exit 1
fi

# grep configuration from file
INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//g'`
DEVPATH=`egrep '^DEVPATH=.*$' $1 | sed -e 's/DEVPATH= *//g'`
DEVNAME=`egrep '^DEVNAME=.*$' $1 | sed -e 's/DEVNAME= *//g'`
FCTEMPS=`egrep '^FCTEMPS=.*$' $1 | sed -e 's/FCTEMPS=//g'`
MINTEMP=`egrep '^MINTEMP=.*$' $1 | sed -e 's/MINTEMP=//g'`
MAXTEMP=`egrep '^MAXTEMP=.*$' $1 | sed -e 's/MAXTEMP=//g'`
MINSTART=`egrep '^MINSTART=.*$' $1 | sed -e 's/MINSTART=//g'`
MINSTOP=`egrep '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP=//g'`
HWMON=$( echo "$DEVPATH" | sed 's/=.*$//g')
FCDEVPATH=$( echo "$DEVPATH" | sed 's/^.*=//g')
FCMINTEMP=$MINTEMP
FCMAXTEMP=$MAXTEMP
FCMINSTART=$MINSTART
FCMINSTOP=$MINSTOP
AFCTEMP_1_LOWER=(00 39 36 41 46 55)
AFCTEMP_1_UPPER=(39 39 44 49 54 150)
AFCTEMP_2_LOWER=(00 61 65 69 73 82)
AFCTEMP_2_UPPER=(63 67 71 75 79 150)
AFCTEMP_3_LOWER=(00 51 55 59 63 71)
AFCTEMP_3_UPPER=(53 57 61 65 69 150)


FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'`

FCTARGETS=`egrep '^FCTARGETS=.*$' $1 | sed -e 's/FCTARGETS=//g'`

# Check whether all mandatory settings are set
if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]]
then
echo "Some mandatory settings missing, please check your config file!" >&2
exit 1
fi
if [ "$INTERVAL" -le 0 ]
then
echo "Error in configuration file:" >&2
echo "INTERVAL must be at least 1" >&2
exit 1
fi

# write settings to arrays for easier use and print them
echo
echo "Common settings:"

temp_string=$FCTEMPS

let fcvcount=0
for fcv in $FCTEMPS
do
fcvcount=$((fcvcount+1))
AFCTEMP[$fcvcount]=$( echo "$temp_string" | cut -d" " -f $fcvcount )
AFCTEMP[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' )
AFCTEMP_PATH[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' )
AFCTEMP[$fcvcount]=$( cat ${AFCTEMP[$fcvcount]} )
AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 ))
done

fan_string=$FCFANS
fcvcount=0
for fcv in $FCFANS
do
fcvcount=$((fcvcount+1))
AFCFAN[$fcvcount]=$( echo "$fan_string" | cut -d" " -f $fcvcount )
AFCFAN_PATH[$fcvcount]=$( echo "${AFCFAN[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' )
AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} )
done

target_string=$FCTARGETS
fcvcount=0
for fcv in $FCTARGETS
do
fcvcount=$((fcvcount+1))
AFCTARGET[$fcvcount]=$( echo "$target_string" | cut -d" " -f $fcvcount )
AFCFAN_TARGET[$fcvcount]=$( echo "${AFCTARGET[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' )
done

}

# Check that all referenced sysfs files exist
function CheckFiles
{
local outdated=0 fcvcount tsen fan
if [ $outdated -eq 1 ]
then
echo >&2
echo "At least one referenced file is missing. Either some required kernel" >&2
echo "modules haven't been loaded, or your configuration file is outdated." >&2
echo "In the latter case, you should run pwmconfig again." >&2
fi
return $outdated
}

LoadConfig $1

# Detect path to sensors
if [ ! -d $DIR ]
then
echo $0: 'No sensors found! (did you load the necessary modules?)' >&2
exit 1
fi
cd $DIR

# Check for configuration change
if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ]
then
echo "Configuration is too old, please run pwmconfig again" >&2
exit 1
fi
if [ "$DIR" = "/" -a -n "$DEVPATH" ]
then
echo "Unneeded DEVPATH with absolute device paths" >&2
exit 1
fi
CheckFiles || exit 1

if [ -f "$PIDFILE" ]
then
echo "File $PIDFILE exists, is fancontrol already running?" >&2
exit 1
fi
echo $$ > "$PIDFILE"

# main function
function UpdateThermalSensors
{
fcvcount=0
for fcv in $FCTEMPS
do
fcvcount=$((fcvcount+1))
AFCTEMP[$fcvcount]=$( cat ${AFCTEMP_PATH[$fcvcount]} )
AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 ))
done
}

function UpdateThermalLevel
{
AFCTEMP_NUM=$((6-${AFCTEMP_LEVEL[$i]}))
AFCTEMP_UPPER_BUF=AFCTEMP_"$i"_UPPER["$AFCTEMP_NUM"]
AFCTEMP_LOWER_BUF=AFCTEMP_"$i"_LOWER["$AFCTEMP_NUM"]

AFCTEMP_UPPER=${!AFCTEMP_UPPER_BUF}
AFCTEMP_LOWER=${!AFCTEMP_LOWER_BUF}


if (( ("${AFCTEMP[$i]}" <= "$AFCTEMP_UPPER") && ("${AFCTEMP[$i]}" >= "$AFCTEMP_LOWER") )) ; then
FLAG=2
elif (( "${AFCTEMP[$i]}" > "$AFCTEMP_UPPER" )); then
AFCTEMP_LEVEL[$i]=$((${AFCTEMP_LEVEL[$i]} - 1))
FLAG=1
elif (( "${AFCTEMP[$i]}" < "$AFCTEMP_LOWER" )); then
AFCTEMP_LEVEL[$i]=$((${AFCTEMP_LEVEL[$i]} + 1))
FLAG=1
else
AFCTEMP_LEVEL[$i]=1
FLAG=2
fi
}

function UpdateFanSpeeds
{
#echo "num tmp lev F L H"
#Update level
for i in 1 2 3
do
#echo "----------------------"
FLAG=0
#FLAG=0 : initial flag
#FLAG=1 : update level
#FLAG=2 : final level
while [ $FLAG -ne 2 ]
do
UpdateThermalLevel
#echo " $i ${AFCTEMP[$i]} ${AFCTEMP_LEVEL[$i]} $FLAG $AFCTEMP_LOWER $AFCTEMP_UPPER "
done
done

min=${AFCTEMP_LEVEL[0]}
for j in "${AFCTEMP_LEVEL[@]}"; do
(( j < min )) && min=$j
done

if (($min == 1 || $min == 2)); then
FAN_PERCENTAGE=100
elif (($min == 3)); then
FAN_PERCENTAGE=80
elif (($min == 4)); then
FAN_PERCENTAGE=60
elif (($min == 5)); then
FAN_PERCENTAGE=40
elif (($min == 6)); then
FAN_PERCENTAGE=30
else
FAN_PERCENTAGE=100
fi
echo "The lowest level of thermal sensors: $min "
echo "Trying to set fan speed to $FAN_PERCENTAGE %"
#Set speed to fan1~fan10
FAN_PERCENTAGE=`expr $FAN_PERCENTAGE \* 255 / 100`
let fcvcount=0
for fcv in $FCFANS
do
fcvcount=$(( fcvcount + 1 ))
echo $FAN_PERCENTAGE > ${AFCFAN_TARGET[$fcvcount]}
AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} )

echo "FAN fan$fcvcount = ${AFCFAN[$fcvcount]} (rpm)"
done

rm -f "$PIDFILE"
}

# main loop calling the main function at specified intervals
AFCTEMP_LEVEL=(9 4 4 4) #inttial level
while true
do
UpdateThermalSensors
UpdateFanSpeeds
echo "Sleep $INTERVAL seconds ..."
echo
# Sleep while still handling signals
sleep $INTERVAL &
wait $!
done
3 changes: 3 additions & 0 deletions device/delta/x86_64-delta_et-6248brb-r0/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONSOLE_PORT=0x2f8
CONSOLE_DEV=1
CONSOLE_SPEED=115200
46 changes: 46 additions & 0 deletions device/delta/x86_64-delta_et-6248brb-r0/led_proc_init.soc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ET_6248BRB Port_Remap
# Vlan set and port enable
clear c
port ge en=1
port hg en=1

# led0 port order remap
m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=0 REMAP_PORT_1=1 REMAP_PORT_2=2 REMAP_PORT_3=3
m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=4 REMAP_PORT_5=5 REMAP_PORT_6=6 REMAP_PORT_7=7
m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=51 REMAP_PORT_9=50 REMAP_PORT_10=49 REMAP_PORT_11=48
m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=47 REMAP_PORT_13=46 REMAP_PORT_14=45 REMAP_PORT_15=44
m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=43 REMAP_PORT_17=42 REMAP_PORT_18=41 REMAP_PORT_19=40
m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=39 REMAP_PORT_21=38 REMAP_PORT_22=37 REMAP_PORT_23=36
m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=35 REMAP_PORT_25=34 REMAP_PORT_26=33 REMAP_PORT_27=32
m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=31 REMAP_PORT_29=30 REMAP_PORT_30=29 REMAP_PORT_31=28
m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=27 REMAP_PORT_33=26 REMAP_PORT_34=25 REMAP_PORT_35=24
m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 REMAP_PORT_37=22 REMAP_PORT_38=21 REMAP_PORT_39=20
m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=19 REMAP_PORT_41=18 REMAP_PORT_42=17 REMAP_PORT_43=16
m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=15 REMAP_PORT_45=14 REMAP_PORT_46=13 REMAP_PORT_47=12
m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=11 REMAP_PORT_49=10 REMAP_PORT_50=9 REMAP_PORT_51=8
m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=7 REMAP_PORT_53=6 REMAP_PORT_54=5 REMAP_PORT_55=4
m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=3 REMAP_PORT_57=2 REMAP_PORT_58=1 REMAP_PORT_59=0
m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=60 REMAP_PORT_61=61 REMAP_PORT_62=62 REMAP_PORT_63=63

echo "ET_6248BRB LED Port Remap: Done."

#ET_6248BRB_LED

#--------------------------------------------------------------------------------------------------
#LED Auto link/up

led stop
led prog '\
02 00 60 E0 02 A0 60 E2 86 E6 02 00 60 E1 06 E0\
D2 30 75 28 02 00 2E E0 32 08 97 71 1F 77 44 2E\
E0 32 04 97 71 3C 77 40 02 00 2E E0 32 08 97 71\
33 77 44 2E E0 32 03 97 71 3C 77 40 02 02 77 44\
02 04 77 44 60 E3 2E E0 32 00 32 01 B7 97 02 00\
0E 00 12 E4 FE E1 50 12 E4 05 60 E5 12 E3 05 0A\
02 71 67 67 9A 77 69 67 86 12 E3 05 0A 01 71 74\
67 9A 77 76 67 86 06 E2 F2 01 60 E2 86 E0 06 E0\
D2 34 74 0A 3A 68 06 E5 D2 00 70 96 16 E6 99 99\
1A 00 71 96 77 9A 32 0F 87 57 32 0E 87 57 00 00\
'
led auto on
led start
Loading

0 comments on commit 61b5a5d

Please sign in to comment.