Skip to content

Commit

Permalink
[platform] Add a new supported platform, Delta-ag9032v1 (#1168)
Browse files Browse the repository at this point in the history
CPU : Intel Rangeley C2538
    Swich ASIC: Broadcom Tomahawk BCM56960
    Ports : 32x100G
    Switch SKU : Delta-ag9032v1

Signed-off-by: neal <neal.tai@deltaww.com>
  • Loading branch information
nealtai authored and jleveque committed Nov 27, 2017
1 parent 98fbddf commit 8602360
Show file tree
Hide file tree
Showing 29 changed files with 5,219 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# name lanes alias
Ethernet0 49,50,51,52 hundredGigE1/1
Ethernet4 53,54,55,56 hundredGigE1/2
Ethernet8 57,58,59,60 hundredGigE1/3
Ethernet12 61,62,63,64 hundredGigE1/4
Ethernet16 65,66,67,68 hundredGigE1/5
Ethernet20 69,70,71,72 hundredGigE1/6
Ethernet24 73,74,75,76 hundredGigE1/7
Ethernet28 77,78,79,80 hundredGigE1/8
Ethernet32 37,38,39,40 hundredGigE1/9
Ethernet36 33,34,35,36 hundredGigE1/10
Ethernet40 45,46,47,48 hundredGigE1/11
Ethernet44 41,42,43,44 hundredGigE1/12
Ethernet48 81,82,83,84 hundredGigE1/13
Ethernet52 85,86,87,88 hundredGigE1/14
Ethernet56 89,90,91,92 hundredGigE1/15
Ethernet60 93,94,95,96 hundredGigE1/16
Ethernet64 97,98,99,100 hundredGigE1/17
Ethernet68 101,102,103,104 hundredGigE1/18
Ethernet72 105,106,107,108 hundredGigE1/19
Ethernet76 109,110,111,112 hundredGigE1/20
Ethernet80 21,22,23,24 hundredGigE1/21
Ethernet84 17,18,19,20 hundredGigE1/22
Ethernet88 29,30,31,32 hundredGigE1/23
Ethernet92 25,26,27,28 hundredGigE1/24
Ethernet96 117,118,119,120 hundredGigE1/25
Ethernet100 113,114,115,116 hundredGigE1/26
Ethernet104 125,126,127,128 hundredGigE1/27
Ethernet108 121,122,123,124 hundredGigE1/28
Ethernet112 5,6,7,8 hundredGigE1/29
Ethernet116 1,2,3,4 hundredGigE1/30
Ethernet120 13,14,15,16 hundredGigE1/31
Ethernet124 9,10,11,12 hundredGigE1/32
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SAI_INIT_CONFIG_FILE=/etc/bcm/th-ag9032v1-32x100G.config.bcm
10 changes: 10 additions & 0 deletions device/delta/x86_64-delta_ag9032v1-r0/fancontrol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
INTERVAL=10
DEVPATH=hwmon1=/sys/bus/i2c/devices
DEVNAME=hwmon1=emc2305
FCTEMPS=hwmon1/2-004d/hwmon/hwmon*/temp1_input hwmon1/7-004c/hwmon/hwmon*/temp1_input hwmon1/7-004d/hwmon/hwmon*/temp1_input hwmon1/7-004e/hwmon/hwmon*/temp1_input hwmon1/30-004f/hwmon/hwmon*/temp1_input hwmon1/40-0058/temp1_input hwmon1/41-0058/temp1_input

FCFANS=hwmon1/37-002c/fan1_input hwmon1/37-002c/fan2_input hwmon1/37-002c/fan3_input hwmon1/37-002c/fan4_input hwmon1/37-002c/fan5_input hwmon1/38-002d/fan1_input hwmon1/38-002d/fan2_input hwmon1/38-002d/fan3_input hwmon1/38-002d/fan4_input hwmon1/38-002d/fan5_input
MINTEMP=20
MAXTEMP=60
MINSTART=75
MINSTOP=22
244 changes: 244 additions & 0 deletions device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
#!/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

FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//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
zero=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_TARGET[$fcvcount]=$( echo "${AFCFAN_PATH[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' )
AFCFAN_TARGET[$fcvcount]=$( echo "${AFCFAN_TARGET[$fcvcount]}" | sed 's/$/_percentage/g')
AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} )
if [ "${AFCFAN[$fcvcount]}" == 960 ]
then
AFCFAN[$fcvcount]=$zero
fi
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
{
echo ""
TEMP_HIGHEST=0
FAN_PERCENTAGE=0

for i in ${AFCTEMP_PATH[@]}; do
if (( $(cat $i) > $TEMP_HIGHEST )); then
TEMP_HIGHEST=$(cat $i);
fi;
done
TEMP_HIGHEST=$((TEMP_HIGHEST/1000))
echo "The highest temperature of thermal sensors: $TEMP_HIGHEST °C"
}

function UpdateFanSpeeds
{
if [ $TEMP_HIGHEST -lt 51 ]; then #TEMP<=50
FAN_PERCENTAGE=40
elif [ $TEMP_HIGHEST -lt 56 -a $TEMP_HIGHEST -gt 50 ]; then #50<TEMP<=55
FAN_PERCENTAGE=60
elif [ $TEMP_HIGHEST -lt 61 -a $TEMP_HIGHEST -gt 55 ]; then #55<TEMP<=60
FAN_PERCENTAGE=80
elif [ $TEMP_HIGHEST -lt 66 -a $TEMP_HIGHEST -gt 60 ]; then #60<TEMP<=65
FAN_PERCENTAGE=90
elif [ $TEMP_HIGHEST -gt 65 ]; then # 65<TEMP
FAN_PERCENTAGE=100
else
FAN_PERCENTAGE=100
fi

echo "Trying to set fan speed to $FAN_PERCENTAGE %"
#Set speed to fan1~fan10
let fcvcount=0
for fcv in $FCFANS
do
fcvcount=$(( fcvcount + 1 ))
echo $FAN_PERCENTAGE > ${AFCFAN_TARGET[$fcvcount]}
AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} )

if [ "${AFCFAN[$fcvcount]}" == 960 ]
then
AFCFAN[$fcvcount]=$zero
fi
done

if [ $TEMP_HIGHEST -lt 51 ]; then #TEMP<=50
FAN_ON_PSU_PERCENTAGE=50
elif [ $TEMP_HIGHEST -lt 100 -a $TEMP_HIGHEST -gt 50 ]; then #50<TEMP<100
FAN_ON_PSU_PERCENTAGE=100
else
echo "Unable to get thermal temperature"
FAN_ON_PSU_PERCENTAGE=100
fi
#Set speed to PSU_FAN1
#echo "0x00" > '/sys/bus/i2c/devices/4-0058/psu_select_member'
echo "$FAN_ON_PSU_PERCENTAGE" > '/sys/bus/i2c/devices/40-0058/fan1_set_percentage'
echo "PSU fan1 =$( cat '/sys/bus/i2c/devices/40-0058/fan1_input' ) (rpm)"
#Set speed to PSU_FAN2
#echo "0x20" > '/sys/bus/i2c/devices/4-0058/psu_select_member'
echo "$FAN_ON_PSU_PERCENTAGE" > '/sys/bus/i2c/devices/41-0058/fan1_set_percentage'
echo "PSU fan2 =$( cat '/sys/bus/i2c/devices/41-0058/fan1_input' ) (rpm)"

rm -f "$PIDFILE"
}
# main loop calling the main function at specified intervals
while true
do
UpdateThermalSensors
UpdateFanSpeeds
echo "Sleep $INTERVAL seconds ..."
# Sleep while still handling signals
sleep $INTERVAL &
wait $!
done
2 changes: 2 additions & 0 deletions device/delta/x86_64-delta_ag9032v1-r0/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONSOLE_PORT=0x3f8
CONSOLE_SPEED=115200
45 changes: 45 additions & 0 deletions device/delta/x86_64-delta_ag9032v1-r0/led_proc_init.soc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
s CMIC_LEDUP0_PROGRAM_RAM 0
s CMIC_LEDUP1_PROGRAM_RAM 0

led 0 stop
led 0 prog 02 00 60 E0 86 ED 2E E0 32 08 97 02 00 0E 00 60 E3 2E E0 32 00 32 01 B7 97 02 00 0E 00 12 E7 50 86 E0 86 E0 86 E0 86 E0 16 E7 61 EB 06 E3 67 4E 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 06 E0 D2 40 74 06 3A C0 D2 01 74 66 06 EB D2 00 70 62 16 ED 99 99 1A 00 71 62 77 66 32 0F 87 57 32 0E 87 57
led 0 auto on
led 0 start
m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=31 REMAP_PORT_1=30 REMAP_PORT_2=29 REMAP_PORT_3=28
m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=27 REMAP_PORT_5=26 REMAP_PORT_6=25 REMAP_PORT_7=24
m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=23 REMAP_PORT_9=22 REMAP_PORT_10=21 REMAP_PORT_11=20
m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=19 REMAP_PORT_13=18 REMAP_PORT_14=17 REMAP_PORT_15=16
m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=15 REMAP_PORT_17=14 REMAP_PORT_18=13 REMAP_PORT_19=12
m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 REMAP_PORT_21=10 REMAP_PORT_22=9 REMAP_PORT_23=8
m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=7 REMAP_PORT_25=6 REMAP_PORT_26=5 REMAP_PORT_27=4
m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=3 REMAP_PORT_29=2 REMAP_PORT_30=1 REMAP_PORT_31=0
m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 REMAP_PORT_33=62 REMAP_PORT_34=61 REMAP_PORT_35=60
m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=59 REMAP_PORT_37=58 REMAP_PORT_38=57 REMAP_PORT_39=56
m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=55 REMAP_PORT_41=54 REMAP_PORT_42=53 REMAP_PORT_43=52
m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=51 REMAP_PORT_45=50 REMAP_PORT_46=49 REMAP_PORT_47=48
m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=47 REMAP_PORT_49=46 REMAP_PORT_50=45 REMAP_PORT_51=44
m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=43 REMAP_PORT_53=42 REMAP_PORT_54=41 REMAP_PORT_55=40
m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=39 REMAP_PORT_57=38 REMAP_PORT_58=37 REMAP_PORT_59=36
m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=35 REMAP_PORT_61=34 REMAP_PORT_62=33 REMAP_PORT_63=32

led 1 stop
led 1 prog 02 00 60 E0 86 ED 2E E0 32 08 97 02 00 0E 00 60 E3 2E E0 32 00 32 01 B7 97 02 00 0E 00 12 E7 50 86 E0 86 E0 86 E0 86 E0 16 E7 61 EB 06 E3 67 4E 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 06 E0 D2 40 74 06 3A C0 D2 01 74 66 06 EB D2 00 70 62 16 ED 99 99 1A 00 71 62 77 66 32 0F 87 57 32 0E 87 57
led 1 auto on
led 1 start
m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=3 REMAP_PORT_1=2 REMAP_PORT_2=1 REMAP_PORT_3=0
m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=7 REMAP_PORT_5=6 REMAP_PORT_6=5 REMAP_PORT_7=4
m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=11 REMAP_PORT_9=10 REMAP_PORT_10=9 REMAP_PORT_11=8
m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=15 REMAP_PORT_13=14 REMAP_PORT_14=13 REMAP_PORT_15=12
m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=19 REMAP_PORT_17=18 REMAP_PORT_18=17 REMAP_PORT_19=16
m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=23 REMAP_PORT_21=22 REMAP_PORT_22=21 REMAP_PORT_23=20
m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=27 REMAP_PORT_25=26 REMAP_PORT_26=25 REMAP_PORT_27=24
m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=31 REMAP_PORT_29=30 REMAP_PORT_30=29 REMAP_PORT_31=28
m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=35 REMAP_PORT_33=34 REMAP_PORT_34=33 REMAP_PORT_35=32
m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=39 REMAP_PORT_37=38 REMAP_PORT_38=37 REMAP_PORT_39=36
m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=43 REMAP_PORT_41=42 REMAP_PORT_42=41 REMAP_PORT_43=40
m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=47 REMAP_PORT_45=46 REMAP_PORT_46=45 REMAP_PORT_47=44
m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 REMAP_PORT_49=50 REMAP_PORT_50=49 REMAP_PORT_51=48
m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 REMAP_PORT_53=54 REMAP_PORT_54=53 REMAP_PORT_55=52
m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 REMAP_PORT_57=58 REMAP_PORT_58=57 REMAP_PORT_59=56
m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=62 REMAP_PORT_62=61 REMAP_PORT_63=60

Loading

0 comments on commit 8602360

Please sign in to comment.