Skip to content

Commit bfc0dfe

Browse files
StanleyCilguohan
authored andcommitted
[delta]: Enable ag5648, et-6248brb, ag9064 and fix the build error of ag5648 PSU module. (#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>
1 parent 6df4cfd commit bfc0dfe

27 files changed

Lines changed: 3279 additions & 3 deletions
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# name lanes alias index
2+
Ethernet0 1 1000 0
3+
Ethernet1 2 1000 1
4+
Ethernet2 3 1000 2
5+
Ethernet3 4 1000 3
6+
Ethernet4 5 1000 4
7+
Ethernet5 6 1000 5
8+
Ethernet6 7 1000 6
9+
Ethernet7 8 1000 7
10+
Ethernet8 9 1000 8
11+
Ethernet9 10 1000 9
12+
Ethernet10 11 1000 10
13+
Ethernet11 12 1000 11
14+
Ethernet12 13 1000 12
15+
Ethernet13 14 1000 13
16+
Ethernet14 15 1000 14
17+
Ethernet15 16 1000 15
18+
Ethernet16 17 1000 16
19+
Ethernet17 18 1000 17
20+
Ethernet18 19 1000 18
21+
Ethernet19 20 1000 19
22+
Ethernet20 21 1000 20
23+
Ethernet21 22 1000 21
24+
Ethernet22 23 1000 22
25+
Ethernet23 24 1000 23
26+
Ethernet24 25 1000 24
27+
Ethernet25 26 1000 25
28+
Ethernet26 27 1000 26
29+
Ethernet27 28 1000 27
30+
Ethernet28 29 1000 28
31+
Ethernet29 30 1000 29
32+
Ethernet30 31 1000 30
33+
Ethernet31 32 1000 31
34+
Ethernet32 33 1000 32
35+
Ethernet33 34 1000 33
36+
Ethernet34 35 1000 34
37+
Ethernet35 36 1000 35
38+
Ethernet36 37 1000 36
39+
Ethernet37 38 1000 37
40+
Ethernet38 39 1000 38
41+
Ethernet39 40 1000 39
42+
Ethernet40 41 1000 40
43+
Ethernet41 42 1000 41
44+
Ethernet42 43 1000 42
45+
Ethernet43 44 1000 43
46+
Ethernet44 45 1000 44
47+
Ethernet45 46 1000 45
48+
Ethernet46 47 1000 46
49+
Ethernet47 48 1000 47
50+
Ethernet48 54 10000 48
51+
Ethernet49 53 10000 49
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SAI_INIT_CONFIG_FILE=/etc/bcm/helix4-et-6248brb-48x1G+2x10G.config.bcm
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
INTERVAL=10
2+
DEVPATH=hwmon1=/sys/bus/i2c/devices
3+
DEVNAME=hwmon1=adt7473
4+
FCTEMPS=hwmon1/0-0048/hwmon/hwmon*/temp1_input hwmon1/7-0049/hwmon/hwmon*/temp1_input hwmon1/8-004a/hwmon/hwmon*/temp1_input
5+
6+
FCFANS=hwmon1/0-002e/fan1_input hwmon1/0-002e/fan2_input
7+
8+
FCTARGETS=hwmon1/0-002e/pwm1 hwmon1/0-002e/pwm2
9+
MINTEMP=20
10+
MAXTEMP=60
11+
MINSTART=75
12+
MINSTOP=22
Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
#!/bin/bash
2+
#
3+
# Simple script implementing a temperature dependent fan speed control
4+
# Supported Linux kernel versions: 2.6.5 and later
5+
#
6+
# Version 0.70
7+
#
8+
# Usage: fancontrol [CONFIGFILE]
9+
#
10+
# Dependencies:
11+
# bash, egrep, sed, cut, sleep, readlink, lm_sensors :)
12+
#
13+
# Please send any questions, comments or success stories to
14+
# marius.reiner@hdev.de
15+
# Thanks!
16+
#
17+
# For configuration instructions and warnings please see fancontrol.txt, which
18+
# can be found in the doc/ directory or at the website mentioned above.
19+
#
20+
#
21+
# Copyright 2003 Marius Reiner <marius.reiner@hdev.de>
22+
# Copyright (C) 2007-2009 Jean Delvare <khali@linux-fr.org>
23+
#
24+
# This program is free software; you can redistribute it and/or modify
25+
# it under the terms of the GNU General Public License as published by
26+
# the Free Software Foundation; either version 2 of the License, or
27+
# (at your option) any later version.
28+
#
29+
# This program is distributed in the hope that it will be useful,
30+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
31+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32+
# GNU General Public License for more details.
33+
#
34+
# You should have received a copy of the GNU General Public License
35+
# along with this program; if not, write to the Free Software
36+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
37+
# MA 02110-1301 USA.
38+
#
39+
#
40+
41+
PIDFILE="/var/run/fancontrol.pid"
42+
43+
#DEBUG=1
44+
MAX=255
45+
46+
function LoadConfig
47+
{
48+
local fcvcount fcv
49+
50+
echo "Loading configuration from $1 ..."
51+
if [ ! -r "$1" ]
52+
then
53+
echo "Error: Can't read configuration file" >&2
54+
exit 1
55+
fi
56+
57+
# grep configuration from file
58+
INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//g'`
59+
DEVPATH=`egrep '^DEVPATH=.*$' $1 | sed -e 's/DEVPATH= *//g'`
60+
DEVNAME=`egrep '^DEVNAME=.*$' $1 | sed -e 's/DEVNAME= *//g'`
61+
FCTEMPS=`egrep '^FCTEMPS=.*$' $1 | sed -e 's/FCTEMPS=//g'`
62+
MINTEMP=`egrep '^MINTEMP=.*$' $1 | sed -e 's/MINTEMP=//g'`
63+
MAXTEMP=`egrep '^MAXTEMP=.*$' $1 | sed -e 's/MAXTEMP=//g'`
64+
MINSTART=`egrep '^MINSTART=.*$' $1 | sed -e 's/MINSTART=//g'`
65+
MINSTOP=`egrep '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP=//g'`
66+
HWMON=$( echo "$DEVPATH" | sed 's/=.*$//g')
67+
FCDEVPATH=$( echo "$DEVPATH" | sed 's/^.*=//g')
68+
FCMINTEMP=$MINTEMP
69+
FCMAXTEMP=$MAXTEMP
70+
FCMINSTART=$MINSTART
71+
FCMINSTOP=$MINSTOP
72+
AFCTEMP_1_LOWER=(00 39 36 41 46 55)
73+
AFCTEMP_1_UPPER=(39 39 44 49 54 150)
74+
AFCTEMP_2_LOWER=(00 61 65 69 73 82)
75+
AFCTEMP_2_UPPER=(63 67 71 75 79 150)
76+
AFCTEMP_3_LOWER=(00 51 55 59 63 71)
77+
AFCTEMP_3_UPPER=(53 57 61 65 69 150)
78+
79+
80+
FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'`
81+
82+
FCTARGETS=`egrep '^FCTARGETS=.*$' $1 | sed -e 's/FCTARGETS=//g'`
83+
84+
# Check whether all mandatory settings are set
85+
if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]]
86+
then
87+
echo "Some mandatory settings missing, please check your config file!" >&2
88+
exit 1
89+
fi
90+
if [ "$INTERVAL" -le 0 ]
91+
then
92+
echo "Error in configuration file:" >&2
93+
echo "INTERVAL must be at least 1" >&2
94+
exit 1
95+
fi
96+
97+
# write settings to arrays for easier use and print them
98+
echo
99+
echo "Common settings:"
100+
101+
temp_string=$FCTEMPS
102+
103+
let fcvcount=0
104+
for fcv in $FCTEMPS
105+
do
106+
fcvcount=$((fcvcount+1))
107+
AFCTEMP[$fcvcount]=$( echo "$temp_string" | cut -d" " -f $fcvcount )
108+
AFCTEMP[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' )
109+
AFCTEMP_PATH[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' )
110+
AFCTEMP[$fcvcount]=$( cat ${AFCTEMP[$fcvcount]} )
111+
AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 ))
112+
done
113+
114+
fan_string=$FCFANS
115+
fcvcount=0
116+
for fcv in $FCFANS
117+
do
118+
fcvcount=$((fcvcount+1))
119+
AFCFAN[$fcvcount]=$( echo "$fan_string" | cut -d" " -f $fcvcount )
120+
AFCFAN_PATH[$fcvcount]=$( echo "${AFCFAN[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' )
121+
AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} )
122+
done
123+
124+
target_string=$FCTARGETS
125+
fcvcount=0
126+
for fcv in $FCTARGETS
127+
do
128+
fcvcount=$((fcvcount+1))
129+
AFCTARGET[$fcvcount]=$( echo "$target_string" | cut -d" " -f $fcvcount )
130+
AFCFAN_TARGET[$fcvcount]=$( echo "${AFCTARGET[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' )
131+
done
132+
133+
}
134+
135+
# Check that all referenced sysfs files exist
136+
function CheckFiles
137+
{
138+
local outdated=0 fcvcount tsen fan
139+
if [ $outdated -eq 1 ]
140+
then
141+
echo >&2
142+
echo "At least one referenced file is missing. Either some required kernel" >&2
143+
echo "modules haven't been loaded, or your configuration file is outdated." >&2
144+
echo "In the latter case, you should run pwmconfig again." >&2
145+
fi
146+
return $outdated
147+
}
148+
149+
LoadConfig $1
150+
151+
# Detect path to sensors
152+
if [ ! -d $DIR ]
153+
then
154+
echo $0: 'No sensors found! (did you load the necessary modules?)' >&2
155+
exit 1
156+
fi
157+
cd $DIR
158+
159+
# Check for configuration change
160+
if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ]
161+
then
162+
echo "Configuration is too old, please run pwmconfig again" >&2
163+
exit 1
164+
fi
165+
if [ "$DIR" = "/" -a -n "$DEVPATH" ]
166+
then
167+
echo "Unneeded DEVPATH with absolute device paths" >&2
168+
exit 1
169+
fi
170+
CheckFiles || exit 1
171+
172+
if [ -f "$PIDFILE" ]
173+
then
174+
echo "File $PIDFILE exists, is fancontrol already running?" >&2
175+
exit 1
176+
fi
177+
echo $$ > "$PIDFILE"
178+
179+
# main function
180+
function UpdateThermalSensors
181+
{
182+
fcvcount=0
183+
for fcv in $FCTEMPS
184+
do
185+
fcvcount=$((fcvcount+1))
186+
AFCTEMP[$fcvcount]=$( cat ${AFCTEMP_PATH[$fcvcount]} )
187+
AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 ))
188+
done
189+
}
190+
191+
function UpdateThermalLevel
192+
{
193+
AFCTEMP_NUM=$((6-${AFCTEMP_LEVEL[$i]}))
194+
AFCTEMP_UPPER_BUF=AFCTEMP_"$i"_UPPER["$AFCTEMP_NUM"]
195+
AFCTEMP_LOWER_BUF=AFCTEMP_"$i"_LOWER["$AFCTEMP_NUM"]
196+
197+
AFCTEMP_UPPER=${!AFCTEMP_UPPER_BUF}
198+
AFCTEMP_LOWER=${!AFCTEMP_LOWER_BUF}
199+
200+
201+
if (( ("${AFCTEMP[$i]}" <= "$AFCTEMP_UPPER") && ("${AFCTEMP[$i]}" >= "$AFCTEMP_LOWER") )) ; then
202+
FLAG=2
203+
elif (( "${AFCTEMP[$i]}" > "$AFCTEMP_UPPER" )); then
204+
AFCTEMP_LEVEL[$i]=$((${AFCTEMP_LEVEL[$i]} - 1))
205+
FLAG=1
206+
elif (( "${AFCTEMP[$i]}" < "$AFCTEMP_LOWER" )); then
207+
AFCTEMP_LEVEL[$i]=$((${AFCTEMP_LEVEL[$i]} + 1))
208+
FLAG=1
209+
else
210+
AFCTEMP_LEVEL[$i]=1
211+
FLAG=2
212+
fi
213+
}
214+
215+
function UpdateFanSpeeds
216+
{
217+
#echo "num tmp lev F L H"
218+
#Update level
219+
for i in 1 2 3
220+
do
221+
#echo "----------------------"
222+
FLAG=0
223+
#FLAG=0 : initial flag
224+
#FLAG=1 : update level
225+
#FLAG=2 : final level
226+
while [ $FLAG -ne 2 ]
227+
do
228+
UpdateThermalLevel
229+
#echo " $i ${AFCTEMP[$i]} ${AFCTEMP_LEVEL[$i]} $FLAG $AFCTEMP_LOWER $AFCTEMP_UPPER "
230+
done
231+
done
232+
233+
min=${AFCTEMP_LEVEL[0]}
234+
for j in "${AFCTEMP_LEVEL[@]}"; do
235+
(( j < min )) && min=$j
236+
done
237+
238+
if (($min == 1 || $min == 2)); then
239+
FAN_PERCENTAGE=100
240+
elif (($min == 3)); then
241+
FAN_PERCENTAGE=80
242+
elif (($min == 4)); then
243+
FAN_PERCENTAGE=60
244+
elif (($min == 5)); then
245+
FAN_PERCENTAGE=40
246+
elif (($min == 6)); then
247+
FAN_PERCENTAGE=30
248+
else
249+
FAN_PERCENTAGE=100
250+
fi
251+
echo "The lowest level of thermal sensors: $min "
252+
echo "Trying to set fan speed to $FAN_PERCENTAGE %"
253+
#Set speed to fan1~fan10
254+
FAN_PERCENTAGE=`expr $FAN_PERCENTAGE \* 255 / 100`
255+
let fcvcount=0
256+
for fcv in $FCFANS
257+
do
258+
fcvcount=$(( fcvcount + 1 ))
259+
echo $FAN_PERCENTAGE > ${AFCFAN_TARGET[$fcvcount]}
260+
AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} )
261+
262+
echo "FAN fan$fcvcount = ${AFCFAN[$fcvcount]} (rpm)"
263+
done
264+
265+
rm -f "$PIDFILE"
266+
}
267+
268+
# main loop calling the main function at specified intervals
269+
AFCTEMP_LEVEL=(9 4 4 4) #inttial level
270+
while true
271+
do
272+
UpdateThermalSensors
273+
UpdateFanSpeeds
274+
echo "Sleep $INTERVAL seconds ..."
275+
echo
276+
# Sleep while still handling signals
277+
sleep $INTERVAL &
278+
wait $!
279+
done
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONSOLE_PORT=0x2f8
2+
CONSOLE_DEV=1
3+
CONSOLE_SPEED=115200
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#ET_6248BRB Port_Remap
2+
# Vlan set and port enable
3+
clear c
4+
port ge en=1
5+
port hg en=1
6+
7+
# led0 port order remap
8+
m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=0 REMAP_PORT_1=1 REMAP_PORT_2=2 REMAP_PORT_3=3
9+
m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=4 REMAP_PORT_5=5 REMAP_PORT_6=6 REMAP_PORT_7=7
10+
m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=51 REMAP_PORT_9=50 REMAP_PORT_10=49 REMAP_PORT_11=48
11+
m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=47 REMAP_PORT_13=46 REMAP_PORT_14=45 REMAP_PORT_15=44
12+
m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=43 REMAP_PORT_17=42 REMAP_PORT_18=41 REMAP_PORT_19=40
13+
m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=39 REMAP_PORT_21=38 REMAP_PORT_22=37 REMAP_PORT_23=36
14+
m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=35 REMAP_PORT_25=34 REMAP_PORT_26=33 REMAP_PORT_27=32
15+
m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=31 REMAP_PORT_29=30 REMAP_PORT_30=29 REMAP_PORT_31=28
16+
m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=27 REMAP_PORT_33=26 REMAP_PORT_34=25 REMAP_PORT_35=24
17+
m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 REMAP_PORT_37=22 REMAP_PORT_38=21 REMAP_PORT_39=20
18+
m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=19 REMAP_PORT_41=18 REMAP_PORT_42=17 REMAP_PORT_43=16
19+
m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=15 REMAP_PORT_45=14 REMAP_PORT_46=13 REMAP_PORT_47=12
20+
m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=11 REMAP_PORT_49=10 REMAP_PORT_50=9 REMAP_PORT_51=8
21+
m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=7 REMAP_PORT_53=6 REMAP_PORT_54=5 REMAP_PORT_55=4
22+
m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=3 REMAP_PORT_57=2 REMAP_PORT_58=1 REMAP_PORT_59=0
23+
m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=60 REMAP_PORT_61=61 REMAP_PORT_62=62 REMAP_PORT_63=63
24+
25+
echo "ET_6248BRB LED Port Remap: Done."
26+
27+
#ET_6248BRB_LED
28+
29+
#--------------------------------------------------------------------------------------------------
30+
#LED Auto link/up
31+
32+
led stop
33+
led prog '\
34+
02 00 60 E0 02 A0 60 E2 86 E6 02 00 60 E1 06 E0\
35+
D2 30 75 28 02 00 2E E0 32 08 97 71 1F 77 44 2E\
36+
E0 32 04 97 71 3C 77 40 02 00 2E E0 32 08 97 71\
37+
33 77 44 2E E0 32 03 97 71 3C 77 40 02 02 77 44\
38+
02 04 77 44 60 E3 2E E0 32 00 32 01 B7 97 02 00\
39+
0E 00 12 E4 FE E1 50 12 E4 05 60 E5 12 E3 05 0A\
40+
02 71 67 67 9A 77 69 67 86 12 E3 05 0A 01 71 74\
41+
67 9A 77 76 67 86 06 E2 F2 01 60 E2 86 E0 06 E0\
42+
D2 34 74 0A 3A 68 06 E5 D2 00 70 96 16 E6 99 99\
43+
1A 00 71 96 77 9A 32 0F 87 57 32 0E 87 57 00 00\
44+
'
45+
led auto on
46+
led start

0 commit comments

Comments
 (0)