[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>
This commit is contained in:
parent
0f0e7ab7e8
commit
145aa4ff70
51
device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/port_config.ini
Executable file
51
device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/port_config.ini
Executable file
@ -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
|
@ -0,0 +1 @@
|
||||
SAI_INIT_CONFIG_FILE=/etc/bcm/helix4-et-6248brb-48x1G+2x10G.config.bcm
|
12
device/delta/x86_64-delta_et-6248brb-r0/fancontrol
Normal file
12
device/delta/x86_64-delta_et-6248brb-r0/fancontrol
Normal file
@ -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
device/delta/x86_64-delta_et-6248brb-r0/fancontrol.service
Executable file
279
device/delta/x86_64-delta_et-6248brb-r0/fancontrol.service
Executable file
@ -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
device/delta/x86_64-delta_et-6248brb-r0/installer.conf
Normal file
3
device/delta/x86_64-delta_et-6248brb-r0/installer.conf
Normal file
@ -0,0 +1,3 @@
|
||||
CONSOLE_PORT=0x2f8
|
||||
CONSOLE_DEV=1
|
||||
CONSOLE_SPEED=115200
|
46
device/delta/x86_64-delta_et-6248brb-r0/led_proc_init.soc
Normal file
46
device/delta/x86_64-delta_et-6248brb-r0/led_proc_init.soc
Normal file
@ -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
|
766
device/delta/x86_64-delta_et-6248brb-r0/minigraph.xml
Normal file
766
device/delta/x86_64-delta_et-6248brb-r0/minigraph.xml
Normal file
@ -0,0 +1,766 @@
|
||||
<DeviceMiniGraph xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Microsoft.Search.Autopilot.Evolution">
|
||||
<CpgDec>
|
||||
<IsisRouters xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
|
||||
<PeeringSessions>
|
||||
<BGPSession>
|
||||
<StartRouter>ARISTA01T1</StartRouter>
|
||||
<StartPeer>10.0.0.1</StartPeer>
|
||||
<EndRouter>sonic</EndRouter>
|
||||
<EndPeer>10.0.0.0</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>ARISTA02T1</StartRouter>
|
||||
<StartPeer>10.0.0.5</StartPeer>
|
||||
<EndRouter>sonic</EndRouter>
|
||||
<EndPeer>10.0.0.4</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>ARISTA03T1</StartRouter>
|
||||
<StartPeer>10.0.0.9</StartPeer>
|
||||
<EndRouter>sonic</EndRouter>
|
||||
<EndPeer>10.0.0.8</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>ARISTA04T1</StartRouter>
|
||||
<StartPeer>10.0.0.13</StartPeer>
|
||||
<EndRouter>sonic</EndRouter>
|
||||
<EndPeer>10.0.0.12</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>ARISTA01T1</StartRouter>
|
||||
<StartPeer>FC00::2</StartPeer>
|
||||
<EndRouter>sonic</EndRouter>
|
||||
<EndPeer>FC00::1</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>ARISTA02T1</StartRouter>
|
||||
<StartPeer>FC00::A</StartPeer>
|
||||
<EndRouter>sonic</EndRouter>
|
||||
<EndPeer>FC00::9</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>ARISTA03T1</StartRouter>
|
||||
<StartPeer>FC00::12</StartPeer>
|
||||
<EndRouter>sonic</EndRouter>
|
||||
<EndPeer>FC00::11</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>ARISTA04T1</StartRouter>
|
||||
<StartPeer>FC00::1A</StartPeer>
|
||||
<EndRouter>sonic</EndRouter>
|
||||
<EndPeer>FC00::19</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
</PeeringSessions>
|
||||
<Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:BGPRouterDeclaration>
|
||||
<a:ASN>64601</a:ASN>
|
||||
<a:Hostname>sonic</a:Hostname>
|
||||
<a:Peers>
|
||||
<BGPPeer>
|
||||
<ElementType>BGPPeer</ElementType>
|
||||
<Address>10.0.0.1</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<ElementType>BGPPeer</ElementType>
|
||||
<Address>10.0.0.5</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<ElementType>BGPPeer</ElementType>
|
||||
<Address>10.0.0.9</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<ElementType>BGPPeer</ElementType>
|
||||
<Address>10.0.0.13</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<ElementType>BGPPeer</ElementType>
|
||||
<Address>FC00::2</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<ElementType>BGPPeer</ElementType>
|
||||
<Address>FC00::A</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<ElementType>BGPPeer</ElementType>
|
||||
<Address>FC00::12</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<ElementType>BGPPeer</ElementType>
|
||||
<Address>FC00::1A</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
</a:Peers>
|
||||
<a:RouteMaps/>
|
||||
</a:BGPRouterDeclaration>
|
||||
<a:BGPRouterDeclaration>
|
||||
<a:ASN>64802</a:ASN>
|
||||
<a:Hostname>ARISTA01T1</a:Hostname>
|
||||
<a:RouteMaps/>
|
||||
</a:BGPRouterDeclaration>
|
||||
<a:BGPRouterDeclaration>
|
||||
<a:ASN>64802</a:ASN>
|
||||
<a:Hostname>ARISTA02T1</a:Hostname>
|
||||
<a:RouteMaps/>
|
||||
</a:BGPRouterDeclaration>
|
||||
<a:BGPRouterDeclaration>
|
||||
<a:ASN>64802</a:ASN>
|
||||
<a:Hostname>ARISTA03T1</a:Hostname>
|
||||
<a:RouteMaps/>
|
||||
</a:BGPRouterDeclaration>
|
||||
<a:BGPRouterDeclaration>
|
||||
<a:ASN>64802</a:ASN>
|
||||
<a:Hostname>ARISTA04T1</a:Hostname>
|
||||
<a:RouteMaps/>
|
||||
</a:BGPRouterDeclaration>
|
||||
</Routers>
|
||||
</CpgDec>
|
||||
<DpgDec>
|
||||
<DeviceDataPlaneInfo>
|
||||
<IPSecTunnels/>
|
||||
<LoopbackIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:LoopbackIPInterface>
|
||||
<Name>HostIP</Name>
|
||||
<AttachTo>Loopback0</AttachTo>
|
||||
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
|
||||
<b:IPPrefix>10.1.0.32/32</b:IPPrefix>
|
||||
</a:Prefix>
|
||||
<a:PrefixStr>10.1.0.32/32</a:PrefixStr>
|
||||
</a:LoopbackIPInterface>
|
||||
<a:LoopbackIPInterface>
|
||||
<Name>HostIP1</Name>
|
||||
<AttachTo>Loopback0</AttachTo>
|
||||
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
|
||||
<b:IPPrefix>FC00:1::32/128</b:IPPrefix>
|
||||
</a:Prefix>
|
||||
<a:PrefixStr>FC00:1::32/128</a:PrefixStr>
|
||||
</a:LoopbackIPInterface>
|
||||
</LoopbackIPInterfaces>
|
||||
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:ManagementIPInterface>
|
||||
<Name>HostIP</Name>
|
||||
<AttachTo>eth0</AttachTo>
|
||||
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
|
||||
<b:IPPrefix>10.251.0.243/23</b:IPPrefix>
|
||||
</a:Prefix>
|
||||
<a:PrefixStr>10.251.0.243/23</a:PrefixStr>
|
||||
</a:ManagementIPInterface>
|
||||
</ManagementIPInterfaces>
|
||||
<MplsInterfaces/>
|
||||
<MplsTeInterfaces/>
|
||||
<RsvpInterfaces/>
|
||||
<Hostname>sonic</Hostname>
|
||||
<PortChannelInterfaces/>
|
||||
<VlanInterfaces>
|
||||
<VlanInterface>
|
||||
<ElementType>VlanInterface</ElementType>
|
||||
<Name>Vlan2</Name>
|
||||
<AttachTo>Ethernet0;Ethernet1;Ethernet2;Ethernet3;Ethernet4;Ethernet5;Ethernet6;Ethernet7;Ethernet8;Ethernet9;Ethernet10;Ethernet11;Ethernet12;Ethernet13;Ethernet14;Ethernet15;Ethernet16;Ethernet17;Ethernet18;Ethernet19;Ethernet20;Ethernet21;Ethernet22;Ethernet23;Ethernet24;Ethernet25;Ethernet26;Ethernet27;Ethernet28;Ethernet29;Ethernet30;Ethernet31;Ethernet32;Ethernet33;Ethernet34;Ethernet35;Ethernet36;Ethernet37;Ethernet38;Ethernet39;Ethernet40;Ethernet41;Ethernet42;Ethernet43;Ethernet44;Ethernet45;Ethernet46;Ethernet47</AttachTo>
|
||||
<NoDhcpRelay>False</NoDhcpRelay>
|
||||
<StaticDHCPRelay>0.0.0.0/0</StaticDHCPRelay>
|
||||
<Type i:nil="true"/>
|
||||
<VlanID>2</VlanID>
|
||||
<Tag>2</Tag>
|
||||
<Subnets>172.0.0.0/26</Subnets>
|
||||
</VlanInterface>
|
||||
</VlanInterfaces>
|
||||
<IPInterfaces>
|
||||
<IPInterface>
|
||||
<ElementType>IPInterface</ElementType>
|
||||
<Name i:Name="true"/>
|
||||
<AttachTo>Ethernet48</AttachTo>
|
||||
<Prefix>10.0.0.0/31</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<ElementType>IPInterface</ElementType>
|
||||
<Name i:Name="true"/>
|
||||
<AttachTo>Ethernet49</AttachTo>
|
||||
<Prefix>10.0.0.4/31</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<ElementType>IPInterface</ElementType>
|
||||
<Name i:Name="true"/>
|
||||
<AttachTo>Ethernet48</AttachTo>
|
||||
<Prefix>FC00::1/126</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<ElementType>IPInterface</ElementType>
|
||||
<Name i:Name="true"/>
|
||||
<AttachTo>Ethernet49</AttachTo>
|
||||
<Prefix>FC00::9/126</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<ElementType>IPInterface</ElementType>
|
||||
<Name i:nil="true"/>
|
||||
<AttachTo>Vlan2</AttachTo>
|
||||
<Prefix>172.0.0.1/26</Prefix>
|
||||
</IPInterface>
|
||||
</IPInterfaces>
|
||||
<DataAcls/>
|
||||
<AclInterfaces/>
|
||||
<DownstreamSummaries/>
|
||||
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
|
||||
</DeviceDataPlaneInfo>
|
||||
</DpgDec>
|
||||
<PngDec>
|
||||
<DeviceInterfaceLinks>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>10000</Bandwidth>
|
||||
<EndDevice>ARISTA01T1</EndDevice>
|
||||
<EndPort>Ethernet1</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>sonic</StartDevice>
|
||||
<StartPort>Ethernet48</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>10000</Bandwidth>
|
||||
<EndDevice>ARISTA02T1</EndDevice>
|
||||
<EndPort>Ethernet1</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>sonic</StartDevice>
|
||||
<StartPort>Ethernet49</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet0</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-01</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet1</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-02</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet2</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-03</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet3</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-04</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet4</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-05</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet5</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-06</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet6</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-07</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet7</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-08</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet8</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-09</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet9</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-10</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet10</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-11</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet11</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-12</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet12</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-13</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet13</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-14</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet14</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-15</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet15</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-16</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet16</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-17</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet17</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-18</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet18</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-19</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet19</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-20</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet20</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-21</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet21</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-22</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet22</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-23</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet23</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-24</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet24</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-25</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet25</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-26</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet26</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-27</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet27</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-28</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet28</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-29</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet29</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-30</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet30</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-31</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet31</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-32</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet32</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-33</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet33</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-34</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet34</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-35</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet35</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-36</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet36</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-37</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet37</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-38</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet38</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-39</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet39</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-40</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet40</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-41</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet41</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-42</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet42</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-43</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet43</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-44</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet44</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-45</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet45</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-46</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet46</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-47</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase i:type="DeviceInterfaceLink">
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>1000</Bandwidth>
|
||||
<EndDevice>sonic</EndDevice>
|
||||
<EndPort>Ethernet47</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>server-48</StartDevice>
|
||||
<StartPort>0</StartPort>
|
||||
</DeviceLinkBase>
|
||||
</DeviceInterfaceLinks>
|
||||
<Devices>
|
||||
<Device i:type="ToRRouter">
|
||||
<Hostname>sonic</Hostname>
|
||||
<HwSku>Delta-et-6248brb</HwSku>
|
||||
<ManagementAddress xmlns:a="Microsoft.Search.Autopilot.NetMux">
|
||||
<a:IPPrefix>10.251.0.243</a:IPPrefix>
|
||||
</ManagementAddress>
|
||||
</Device>
|
||||
</Devices>
|
||||
</PngDec>
|
||||
<Hostname>sonic</Hostname>
|
||||
<HwSku>Delta-et-6248brb</HwSku>
|
||||
</DeviceMiniGraph>
|
32
device/delta/x86_64-delta_et-6248brb-r0/plugins/eeprom.py
Normal file
32
device/delta/x86_64-delta_et-6248brb-r0/plugins/eeprom.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# Mellanox
|
||||
#
|
||||
# Platform and model specific eeprom subclass, inherits from the base class,
|
||||
# and provides the followings:
|
||||
# - the eeprom format definition
|
||||
# - specific encoder/decoder if there is special need
|
||||
#############################################################################
|
||||
|
||||
try:
|
||||
import exceptions
|
||||
import binascii
|
||||
import time
|
||||
import optparse
|
||||
import warnings
|
||||
import os
|
||||
import sys
|
||||
from sonic_eeprom import eeprom_base
|
||||
from sonic_eeprom import eeprom_tlvinfo
|
||||
import subprocess
|
||||
except ImportError, e:
|
||||
raise ImportError (str(e) + "- required module not found")
|
||||
|
||||
class board(eeprom_tlvinfo.TlvInfoDecoder):
|
||||
|
||||
_TLV_INFO_MAX_LEN = 256
|
||||
|
||||
def __init__(self, name, path, cpld_root, ro):
|
||||
self.eeprom_path = "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/1-0054/eeprom"
|
||||
super(board, self).__init__(self.eeprom_path, 0, '', True)
|
55
device/delta/x86_64-delta_et-6248brb-r0/plugins/psuutil.py
Normal file
55
device/delta/x86_64-delta_et-6248brb-r0/plugins/psuutil.py
Normal file
@ -0,0 +1,55 @@
|
||||
import os.path
|
||||
|
||||
try:
|
||||
from sonic_psu.psu_base import PsuBase
|
||||
except ImportError as e:
|
||||
raise ImportError (str(e) + "- required module not found")
|
||||
|
||||
class PsuUtil(PsuBase):
|
||||
"""Platform-specific PSUutil class"""
|
||||
|
||||
def __init__(self):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
self.psu_path = "/sys/devices/platform/delta-et6248brb-gpio.0/PSU/psu{}_pg"
|
||||
self.psu_oper_status = "in1_input"
|
||||
self.psu_presence = "/sys/devices/platform/delta-et6248brb-gpio.0/PSU/psu{}_pres"
|
||||
|
||||
|
||||
def get_num_psus(self):
|
||||
"""
|
||||
Retrieves the number of PSUs available on the device
|
||||
|
||||
:return: An integer, the number of PSUs available on the device
|
||||
"""
|
||||
return 2
|
||||
|
||||
def get_psu_status(self, index):
|
||||
if index is None:
|
||||
return False
|
||||
|
||||
try:
|
||||
reg_file = open(self.psu_path.format(index))
|
||||
except IOError as e:
|
||||
print "Error: unable to open file: %s" % str(e)
|
||||
return False
|
||||
|
||||
if int(reg_file.readline()) == 1:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def get_psu_presence(self, index):
|
||||
if index is None:
|
||||
return False
|
||||
|
||||
try:
|
||||
reg_file = open(self.psu_presence.format(index))
|
||||
except IOError as e:
|
||||
print "Error: unable to open file: %s" % str(e)
|
||||
return False
|
||||
|
||||
if int(reg_file.readline()) == 0:
|
||||
return True
|
||||
|
||||
return False
|
88
device/delta/x86_64-delta_et-6248brb-r0/plugins/sfputil.py
Normal file
88
device/delta/x86_64-delta_et-6248brb-r0/plugins/sfputil.py
Normal file
@ -0,0 +1,88 @@
|
||||
# sfputil.py
|
||||
#
|
||||
# Platform-specific SFP transceiver interface for SONiC
|
||||
#
|
||||
|
||||
try:
|
||||
import time
|
||||
from sonic_sfp.sfputilbase import SfpUtilBase
|
||||
except ImportError as e:
|
||||
raise ImportError("%s - required module not found" % str(e))
|
||||
|
||||
|
||||
class SfpUtil(SfpUtilBase):
|
||||
"""Platform-specific SfpUtil class"""
|
||||
|
||||
PORT_START = 48
|
||||
PORT_END = 49
|
||||
PORTS_IN_BLOCK = 1
|
||||
|
||||
EEPROM_OFFSET = 44
|
||||
|
||||
_port_to_eeprom_mapping = {}
|
||||
|
||||
@property
|
||||
def port_start(self):
|
||||
return self.PORT_START
|
||||
|
||||
@property
|
||||
def port_end(self):
|
||||
return self.PORT_END
|
||||
|
||||
@property
|
||||
def qsfp_ports(self):
|
||||
return range(0)
|
||||
|
||||
@property
|
||||
def port_to_eeprom_mapping(self):
|
||||
return self._port_to_eeprom_mapping
|
||||
|
||||
def __init__(self):
|
||||
eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"
|
||||
|
||||
for x in range(0, self.port_end + 1):
|
||||
if x >= self.port_start and x <= self.port_end:
|
||||
self._port_to_eeprom_mapping[x] = eeprom_path.format(x - self.EEPROM_OFFSET)
|
||||
else:
|
||||
self._port_to_eeprom_mapping[x] = eeprom_path.format(x - x)
|
||||
|
||||
SfpUtilBase.__init__(self)
|
||||
|
||||
def get_presence(self, port_num):
|
||||
# Check for invalid port_num
|
||||
if port_num < self.port_start or port_num > self.port_end:
|
||||
return False
|
||||
|
||||
presence_path = "/sys/devices/platform/delta-et6248brb-gpio.0/SFP/sfp_mod_p{}"
|
||||
|
||||
try:
|
||||
reg_file = open(presence_path.format(port_num - 47))
|
||||
except IOError as e:
|
||||
print "Error: unable to open file: %s" % str(e)
|
||||
return False
|
||||
|
||||
if int(reg_file.readline()) == 0:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def get_low_power_mode(self, port_num):
|
||||
# Check for invalid port_num
|
||||
if port_num < self.port_start or port_num > self.port_end:
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
def set_low_power_mode(self, port_num, lpmode):
|
||||
# Check for invalid port_num
|
||||
if port_num < self.port_start or port_num > self.port_end:
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
def reset(self, port_num):
|
||||
# Check for invalid port_num
|
||||
if port_num < self.port_start or port_num > self.port_end:
|
||||
return False
|
||||
|
||||
return False
|
15
device/delta/x86_64-delta_et-6248brb-r0/sensors.conf
Normal file
15
device/delta/x86_64-delta_et-6248brb-r0/sensors.conf
Normal file
@ -0,0 +1,15 @@
|
||||
# libsensors configuration file for et-6248brb
|
||||
# ------------------------------------------------
|
||||
|
||||
chip "tmp75-i2c-0-48"
|
||||
label temp1 "0-0048 thermal sensor"
|
||||
chip "tmp75-i2c-7-49"
|
||||
label temp1 "7-0048 thermal sensor"
|
||||
chip "tmp75-i2c-8-4a"
|
||||
label temp1 "8-004a thermal sensor"
|
||||
|
||||
chip "adt7473-i2c-0-2e"
|
||||
label fan1 "FANTRAY 1"
|
||||
label fan2 "FANTRAY 2"
|
||||
|
||||
|
@ -25,6 +25,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \
|
||||
$(DELTA_AG9032V1_PLATFORM_MODULE) \
|
||||
$(DELTA_AG9064_PLATFORM_MODULE) \
|
||||
$(DELTA_AG5648_PLATFORM_MODULE) \
|
||||
$(DELTA_ET6248BRB_PLATFORM_MODULE) \
|
||||
$(QUANTA_IX1B_32X_PLATFORM_MODULE) \
|
||||
$(MITAC_LY1200_32X_PLATFORM_MODULE)
|
||||
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
|
||||
|
@ -3,10 +3,12 @@
|
||||
DELTA_AG9032V1_PLATFORM_MODULE_VERSION = 1.1
|
||||
DELTA_AG9064_PLATFORM_MODULE_VERSION = 1.1
|
||||
DELTA_AG5648_PLATFORM_MODULE_VERSION = 1.1
|
||||
DELTA_ET6248BRB_PLATFORM_MODULE_VERSION = 1.1
|
||||
|
||||
export DELTA_AG9032V1_PLATFORM_MODULE_VERSION
|
||||
export DELTA_AG9064_PLATFORM_MODULE_VERSION
|
||||
export DELTA_AG5648_PLATFORM_MODULE_VERSION
|
||||
export DELTA_ET6248BRB_PLATFORM_MODULE_VERSION
|
||||
|
||||
DELTA_AG9032V1_PLATFORM_MODULE = platform-modules-ag9032v1_$(DELTA_AG9032V1_PLATFORM_MODULE_VERSION)_amd64.deb
|
||||
$(DELTA_AG9032V1_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-delta
|
||||
@ -22,4 +24,8 @@ DELTA_AG5648_PLATFORM_MODULE = platform-modules-ag5648_$(DELTA_AG5648_PLATFORM_M
|
||||
$(DELTA_AG5648_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag5648-r0
|
||||
$(eval $(call add_extra_package,$(DELTA_AG9032V1_PLATFORM_MODULE),$(DELTA_AG5648_PLATFORM_MODULE)))
|
||||
|
||||
DELTA_ET6248BRB_PLATFORM_MODULE = platform-modules-et-6248brb_$(DELTA_ET6248BRB_PLATFORM_MODULE_VERSION)_amd64.deb
|
||||
$(DELTA_ET6248BRB_PLATFORM_MODULE)_PLATFORM = x86_64-delta_et-6248brb-r0
|
||||
$(eval $(call add_extra_package,$(DELTA_AG9032V1_PLATFORM_MODULE),$(DELTA_ET6248BRB_PLATFORM_MODULE)))
|
||||
|
||||
SONIC_STRETCH_DEBS += $(DELTA_AG9032V1_PLATFORM_MODULE)
|
||||
|
@ -421,7 +421,7 @@ static SENSOR_DEVICE_ATTR(temp1_input, \
|
||||
S_IRUGO, for_linear_data, NULL, PSU_TEMP1_INPUT);
|
||||
static SENSOR_DEVICE_ATTR(fan1_target, \
|
||||
S_IRUGO, for_fan_target, NULL, PSU_FAN1_FAULT);
|
||||
static SENSOR_DEVICE_ATTR(fan1_set_percentage, S_IWUGO | S_IRUGO, \
|
||||
static SENSOR_DEVICE_ATTR(fan1_set_percentage, S_IWUSR | S_IRUGO, \
|
||||
for_linear_data, set_fan_duty_cycle_input, PSU_FAN1_DUTY_CYCLE);
|
||||
static SENSOR_DEVICE_ATTR(fan1_input, \
|
||||
S_IRUGO, for_linear_data, NULL, PSU_FAN1_SPEED);
|
||||
|
@ -17,5 +17,11 @@ Description: kernel modules for platform devices such as fan, led, sfp
|
||||
|
||||
Package: platform-modules-ag5648
|
||||
Architecture: amd64
|
||||
Depends: linux-image-3.16.0-5-amd64
|
||||
Depends: linux-image-4.9.0-5-amd64
|
||||
Description: kernel modules for platform devices such as fan, led, sfp
|
||||
|
||||
Package: platform-modules-et-6248brb
|
||||
Architecture: amd64
|
||||
Depends: linux-image-4.9.0-5-amd64
|
||||
Description: kernel modules for platform devices such as fan, led, sfp
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
ag5648/scripts/ag5648_platform_init.sh usr/local/bin
|
||||
ag5648/cfg/ag5648-modules.conf etc/modules-load.d
|
||||
ag5648/scripts/led_control usr/local/bin
|
||||
systemd/platform-modules-ag5648.service lib/systemd/system
|
||||
|
@ -0,0 +1,80 @@
|
||||
#!/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 et-6248brb board.
|
||||
### END INIT INFO
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Setting up board... "
|
||||
depmod -a
|
||||
rmmod i2c-i801
|
||||
rmmod i2c-ismt
|
||||
modprobe i2c-dev
|
||||
modprobe i2c-i801
|
||||
modprobe i2c-ismt
|
||||
modprobe i2c-mux-pca954x
|
||||
modprobe i2c-mux-gpio
|
||||
modprobe dni_gpio
|
||||
modprobe delta_et-6248brb_platform
|
||||
|
||||
if [ `uname -a | awk '{print $3}'` = "4.9.0-5-amd64" ]; then
|
||||
echo "453" > "/sys/class/gpio/export"
|
||||
echo "454" > "/sys/class/gpio/export"
|
||||
echo "455" > "/sys/class/gpio/export"
|
||||
echo "485" > "/sys/class/gpio/export"
|
||||
echo "489" > "/sys/class/gpio/export"
|
||||
echo "494" > "/sys/class/gpio/export"
|
||||
echo "out" > "/sys/class/gpio/gpio453/direction"
|
||||
echo "out" > "/sys/class/gpio/gpio454/direction"
|
||||
echo "out" > "/sys/class/gpio/gpio455/direction"
|
||||
echo "out" > "/sys/class/gpio/gpio485/direction"
|
||||
echo "out" > "/sys/class/gpio/gpio489/direction"
|
||||
echo "out" > "/sys/class/gpio/gpio494/direction"
|
||||
else
|
||||
echo "197" > "/sys/class/gpio/export"
|
||||
echo "198" > "/sys/class/gpio/export"
|
||||
echo "199" > "/sys/class/gpio/export"
|
||||
echo "229" > "/sys/class/gpio/export"
|
||||
echo "233" > "/sys/class/gpio/export"
|
||||
echo "238" > "/sys/class/gpio/export"
|
||||
echo "out" > "/sys/class/gpio/gpio197/direction"
|
||||
echo "out" > "/sys/class/gpio/gpio198/direction"
|
||||
echo "out" > "/sys/class/gpio/gpio199/direction"
|
||||
echo "out" > "/sys/class/gpio/gpio229/direction"
|
||||
echo "out" > "/sys/class/gpio/gpio233/direction"
|
||||
echo "out" > "/sys/class/gpio/gpio238/direction"
|
||||
fi
|
||||
|
||||
/usr/local/bin/et-6248brb_platform_init.sh
|
||||
|
||||
sleep 1
|
||||
echo "Ethernet48" > "/sys/bus/i2c/devices/4-0050/port_name"
|
||||
echo "Ethernet49" > "/sys/bus/i2c/devices/5-0050/port_name"
|
||||
|
||||
echo "done."
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo "done."
|
||||
|
||||
;;
|
||||
|
||||
force-reload|restart)
|
||||
echo "Not supported"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: /etc/init.d/platform-modules-et-6248brb.init {start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
@ -0,0 +1,4 @@
|
||||
et-6248brb/scripts/et-6248brb_platform_init.sh usr/local/bin
|
||||
et-6248brb/cfg/et-6248brb-modules.conf etc/modules-load.d
|
||||
et-6248brb/scripts/led_status.sh usr/local/bin
|
||||
systemd/platform-modules-et-6248brb.service lib/systemd/system
|
@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra
|
||||
KVERSION ?= $(shell uname -r)
|
||||
KERNEL_SRC := /lib/modules/$(KVERSION)
|
||||
MOD_SRC_DIR:= $(shell pwd)
|
||||
MODULE_DIRS:= ag9032v1
|
||||
MODULE_DIRS:= ag9032v1 ag9064 ag5648 et-6248brb
|
||||
|
||||
%:
|
||||
dh $@ --with=systemd
|
||||
|
@ -0,0 +1,13 @@
|
||||
# /etc/modules: kernel modules to load at boot time.
|
||||
#
|
||||
# This file contains the names of kernel modules that should be loaded
|
||||
# at boot time, one per line. Lines beginning with "#" are ignored.
|
||||
|
||||
i2c-i801
|
||||
i2c-isch
|
||||
i2c-ismt
|
||||
i2c-dev
|
||||
i2c-mux
|
||||
i2c-smbus
|
||||
i2c-mux-gpio
|
||||
i2c-mux-pca954x
|
@ -0,0 +1,2 @@
|
||||
obj-m := delta_et-6248brb_platform.o dni_gpio.o
|
||||
|
@ -0,0 +1,918 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c/pca954x.h>
|
||||
#include <linux/platform_data/pca953x.h>
|
||||
|
||||
#include <linux/i2c-mux.h>
|
||||
#include <linux/i2c-mux-gpio.h>
|
||||
#include <linux/i2c/sff-8436.h>
|
||||
#include <linux/hwmon.h>
|
||||
#include <linux/hwmon-sysfs.h>
|
||||
|
||||
#define OPTOE_INFO(data) \
|
||||
.type = "optoe2", .addr = 0x50
|
||||
|
||||
#define et6248brb_i2c_device_num(NUM){ \
|
||||
.name = "delta-et6248brb-i2c-device", \
|
||||
.id = NUM, \
|
||||
.dev = { \
|
||||
.platform_data = &et6248brb_i2c_device_platform_data[NUM], \
|
||||
.release = device_release, \
|
||||
}, \
|
||||
}
|
||||
|
||||
#define et6248brb_gpio_num(NUM){ \
|
||||
.name = "delta-et6248brb-gpio", \
|
||||
.id = NUM, \
|
||||
.dev = { \
|
||||
.platform_data = &et6248brb_gpio_device_platform_data[NUM], \
|
||||
.release = device_release, \
|
||||
}, \
|
||||
}
|
||||
|
||||
#define PCA9555_A 0x20
|
||||
#define PCA9555_B 0x21
|
||||
#define PCA9555_C 0x23
|
||||
|
||||
static struct kobject *kobj_gpio;
|
||||
static struct kobject *kobj_psu;
|
||||
static struct kobject *kobj_fan;
|
||||
static struct kobject *kobj_sfp;
|
||||
static struct kobject *kobj_others;
|
||||
|
||||
/*Define struct to get client of i2c_new_deivce */
|
||||
struct i2c_client * i2c_client_9547;
|
||||
|
||||
enum{
|
||||
BUS0 = 0,
|
||||
BUS1,
|
||||
BUS2,
|
||||
BUS3,
|
||||
BUS4,
|
||||
BUS5,
|
||||
BUS6,
|
||||
BUS7,
|
||||
BUS8,
|
||||
BUS9,
|
||||
BUS10,
|
||||
};
|
||||
|
||||
/*---------------- I2C device - start ------------- */
|
||||
static void device_release(struct device *dev)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
struct i2c_device_platform_data {
|
||||
int parent;
|
||||
struct i2c_board_info info;
|
||||
struct i2c_client *client;
|
||||
};
|
||||
/* pca9547 - add 8 bus */
|
||||
static struct pca954x_platform_mode pca954x_mode[] = {
|
||||
{ .adap_id = 2,
|
||||
.deselect_on_exit = 1,
|
||||
},
|
||||
{ .adap_id = 3,
|
||||
.deselect_on_exit = 1,
|
||||
},
|
||||
{ .adap_id = 4,
|
||||
.deselect_on_exit = 1,
|
||||
},
|
||||
{ .adap_id = 5,
|
||||
.deselect_on_exit = 1,
|
||||
},
|
||||
{ .adap_id = 6,
|
||||
.deselect_on_exit = 1,
|
||||
},
|
||||
{ .adap_id = 7,
|
||||
.deselect_on_exit = 1,
|
||||
},
|
||||
{ .adap_id = 8,
|
||||
.deselect_on_exit = 1,
|
||||
},
|
||||
{ .adap_id = 9,
|
||||
.deselect_on_exit = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct pca954x_platform_data pca954x_data = {
|
||||
.modes = pca954x_mode,
|
||||
.num_modes = ARRAY_SIZE(pca954x_mode),
|
||||
};
|
||||
|
||||
static struct i2c_board_info __initdata i2c_info_pca9547[] =
|
||||
{
|
||||
{
|
||||
I2C_BOARD_INFO("pca9547", 0x71),
|
||||
.platform_data = &pca954x_data,
|
||||
},
|
||||
};
|
||||
|
||||
static struct i2c_device_platform_data et6248brb_i2c_device_platform_data[] = {
|
||||
{
|
||||
/* FAN controller (0x2e) */
|
||||
.parent = 0,
|
||||
.info = { I2C_BOARD_INFO("adt7473", 0x2e) },
|
||||
.client = NULL,
|
||||
},
|
||||
{
|
||||
/* tmp75 (0x48) */
|
||||
.parent = 0,
|
||||
.info = { I2C_BOARD_INFO("tmp75", 0x48) },
|
||||
.client = NULL,
|
||||
},
|
||||
{
|
||||
/* EEPROM (0x54) */
|
||||
.parent = 1,
|
||||
.info = { I2C_BOARD_INFO("24c08", 0x54) },
|
||||
.client = NULL,
|
||||
},
|
||||
{
|
||||
/* sfp 1 (0x50) */
|
||||
.parent = 4,
|
||||
.info = { OPTOE_INFO() },
|
||||
.client = NULL,
|
||||
},
|
||||
{
|
||||
/* sfp 2 (0x50) */
|
||||
.parent = 5,
|
||||
.info = { OPTOE_INFO() },
|
||||
.client = NULL,
|
||||
},
|
||||
{
|
||||
/* tmp75 (0x49) */
|
||||
.parent = 7,
|
||||
.info = { I2C_BOARD_INFO("tmp75", 0x49) },
|
||||
.client = NULL,
|
||||
},
|
||||
{
|
||||
/* tmp75 (0x4a) */
|
||||
.parent = 8,
|
||||
.info = { I2C_BOARD_INFO("tmp75", 0x4a) },
|
||||
.client = NULL,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device et6248brb_i2c_device[] = {
|
||||
et6248brb_i2c_device_num(0),
|
||||
et6248brb_i2c_device_num(1),
|
||||
et6248brb_i2c_device_num(2),
|
||||
et6248brb_i2c_device_num(3),
|
||||
et6248brb_i2c_device_num(4),
|
||||
et6248brb_i2c_device_num(5),
|
||||
et6248brb_i2c_device_num(6),
|
||||
};
|
||||
|
||||
/*---------------- I2C device - end ------------- */
|
||||
/*---------------- I2C driver - start ------------- */
|
||||
static int __init i2c_device_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct i2c_device_platform_data *pdata;
|
||||
struct i2c_adapter *parent;
|
||||
|
||||
pdata = pdev->dev.platform_data;
|
||||
if (!pdata) {
|
||||
dev_err(&pdev->dev, "Missing platform data\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
parent = i2c_get_adapter(pdata->parent);
|
||||
if (!parent) {
|
||||
dev_err(&pdev->dev, "Parent adapter (%d) not found\n",
|
||||
pdata->parent);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
pdata->client = i2c_new_device(parent, &pdata->info);
|
||||
if (!pdata->client) {
|
||||
dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n",
|
||||
pdata->info.type, pdata->parent);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __exit i2c_deivce_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct i2c_adapter *parent;
|
||||
struct i2c_device_platform_data *pdata;
|
||||
|
||||
pdata = pdev->dev.platform_data;
|
||||
if (!pdata) {
|
||||
dev_err(&pdev->dev, "Missing platform data\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (pdata->client) {
|
||||
parent = (pdata->client)->adapter;
|
||||
i2c_unregister_device(pdata->client);
|
||||
i2c_put_adapter(parent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
static struct platform_driver i2c_device_driver = {
|
||||
.probe = i2c_device_probe,
|
||||
.remove = __exit_p(i2c_deivce_remove),
|
||||
.driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "delta-et6248brb-i2c-device",
|
||||
}
|
||||
};
|
||||
/*---------------- I2C driver - end ------------- */
|
||||
|
||||
/*---------------- gpio device - start ----------- */
|
||||
static struct pca953x_platform_data pca9555_data_0 = {
|
||||
.gpio_base = 200,
|
||||
};
|
||||
static struct pca953x_platform_data pca9555_data_1 = {
|
||||
.gpio_base = 216,
|
||||
};
|
||||
static struct pca953x_platform_data pca9555_data_2 = {
|
||||
.gpio_base = 232,
|
||||
};
|
||||
|
||||
static struct i2c_board_info __initdata i2c_info_pca9555[] =
|
||||
{
|
||||
{
|
||||
I2C_BOARD_INFO("pca9555", 0x20),
|
||||
.platform_data = &pca9555_data_0,
|
||||
},
|
||||
{
|
||||
I2C_BOARD_INFO("pca9555", 0x21),
|
||||
.platform_data = &pca9555_data_1,
|
||||
},
|
||||
{
|
||||
I2C_BOARD_INFO("pca9555", 0x23),
|
||||
.platform_data = &pca9555_data_2,
|
||||
},
|
||||
};
|
||||
|
||||
static struct i2c_device_platform_data et6248brb_gpio_device_platform_data[] = {
|
||||
{
|
||||
/* GPIO expander A (0x20) */
|
||||
.parent = 0,
|
||||
.info = { I2C_BOARD_INFO("pca9555", 0x20) },
|
||||
.client = NULL,
|
||||
},
|
||||
{
|
||||
/* GPIO expander B (0x21) */
|
||||
.parent = 0,
|
||||
.info = { I2C_BOARD_INFO("pca9555", 0x21) },
|
||||
.client = NULL,
|
||||
},
|
||||
{
|
||||
/* GPIO expander C (0x23) */
|
||||
.parent = 0,
|
||||
.info = { I2C_BOARD_INFO("pca9555", 0x23) },
|
||||
.client = NULL,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device et6248brb_gpio_device[] = {
|
||||
et6248brb_gpio_num(0),
|
||||
et6248brb_gpio_num(1),
|
||||
et6248brb_gpio_num(2),
|
||||
};
|
||||
|
||||
static struct gpio_attribute_data {
|
||||
uint8_t bus;
|
||||
uint8_t addr;
|
||||
uint8_t reg;
|
||||
uint8_t mask;
|
||||
char note[150];
|
||||
};
|
||||
|
||||
enum gpio_attributes {
|
||||
PSU1_SMB_ALERT,
|
||||
PSU2_SMB_ALERT,
|
||||
EEPROM_WP,
|
||||
FAN1_LED_AG,
|
||||
FAN2_LED_AG,
|
||||
D_FAN_ALERT,
|
||||
PSU1_PRES,
|
||||
PSU2_PRES,
|
||||
FAN_EEPROM_WP,
|
||||
D_FAN_M_PRESENT2,
|
||||
D_FAN_M_PRESENT1,
|
||||
PSU1_PG,
|
||||
PSU2_PG,
|
||||
BCM54282_INT,
|
||||
SFP_MOD_P1,
|
||||
SFP_RXLOS_P1,
|
||||
SFP_MOD_P2,
|
||||
SFP_RXLOS_P2,
|
||||
SFP_TX_FAULT_P1,
|
||||
SFP_TX_FAULT_P2,
|
||||
SFP_TX_DIS_P1,
|
||||
SFP_TX_DIS_P2,
|
||||
OOB_BCM54616S_INT,
|
||||
};
|
||||
|
||||
static struct gpio_attribute_data attribute_data[] = {
|
||||
//PCA9555_A
|
||||
[PSU1_SMB_ALERT] = {
|
||||
.bus = BUS0, .addr = PCA9555_A,
|
||||
.reg = 0x00, .mask = 1 << 0,
|
||||
.note = "0=PSU1 interrupt is occurr\n1=PSU1 interrupt is NOT occurr"
|
||||
},
|
||||
[PSU2_SMB_ALERT] = {
|
||||
.bus = BUS0, .addr = PCA9555_A,
|
||||
.reg = 0x00, .mask = 1 << 3,
|
||||
.note = "0=PSU2 interrupt is occurr\n1=PSU2 interrupt is NOT occurr"
|
||||
},
|
||||
[EEPROM_WP] = {
|
||||
.bus = BUS0, .addr = PCA9555_A,
|
||||
.reg = 0x03, .mask = 1 << 3,
|
||||
.note = "0=SYS eeprom write protect is disable\n1=SYS eeprom write protect is enable and can not be programmed"
|
||||
|
||||
},
|
||||
[FAN1_LED_AG] = {
|
||||
.bus = BUS0, .addr = PCA9555_A,
|
||||
.reg = 0x03, .mask = 0x30,
|
||||
.note = "00=LED off or FAN tray1 is not present\n01=LED Red,FAN tray1 fail\n10=LED Green,FAN tray1 is present\n11=reserved"
|
||||
},
|
||||
[FAN2_LED_AG] = {
|
||||
.bus = BUS0, .addr = PCA9555_A,
|
||||
.reg = 0x03, .mask = 0xc0,
|
||||
.note = "00=LED off or FAN tray1 is not present\n01=LED Red,FAN tray1 fail\n10=LED Green,FAN tray1 is present\n11=reserved"
|
||||
},
|
||||
//PCA9555_B
|
||||
[D_FAN_ALERT] = {
|
||||
.bus = BUS0, .addr = PCA9555_B,
|
||||
.reg = 0x00, .mask = 1 << 0,
|
||||
.note ="0=FAN is NOT issue the alram\n1=FAN issue the alarm"
|
||||
|
||||
},
|
||||
[PSU1_PRES] = {
|
||||
.bus = BUS0, .addr = PCA9555_B,
|
||||
.reg = 0x00, .mask = 1 << 2,
|
||||
.note ="0=PSU1 is present\n1=PSU1 is NOT present"
|
||||
},
|
||||
[PSU2_PRES] = {
|
||||
.bus = BUS0, .addr = PCA9555_B,
|
||||
.reg = 0x00, .mask = 1 << 3,
|
||||
.note ="0=PSU2 is present\n1=PSU2 is NOT present"
|
||||
},
|
||||
[FAN_EEPROM_WP] = {
|
||||
.bus = BUS0, .addr = PCA9555_B,
|
||||
.reg = 0x01, .mask = 1 << 1,
|
||||
.note ="0=FAN eeprom write protect is disable\n1=FAN eeprom write protect is enable and can not be programmed"
|
||||
},
|
||||
[D_FAN_M_PRESENT2] = {
|
||||
.bus = BUS0, .addr = PCA9555_B,
|
||||
.reg = 0x01, .mask = 1 << 2,
|
||||
.note ="0=FAN2 module is present\n1=FAN2 module is NOT present"
|
||||
},
|
||||
[D_FAN_M_PRESENT1] = {
|
||||
.bus = BUS0, .addr = PCA9555_B,
|
||||
.reg = 0x01, .mask = 1 << 3,
|
||||
.note ="0=FAN1 moduel is present\n1=FAN1 module is NOT present"
|
||||
},
|
||||
[PSU1_PG] = {
|
||||
.bus = BUS0, .addr = PCA9555_B,
|
||||
.reg = 0x01, .mask = 1 << 4,
|
||||
.note ="0=PSU1 is FAIL or not present\n1=PSU1 is GOOD"
|
||||
},
|
||||
[PSU2_PG] = {
|
||||
.bus = BUS0, .addr = PCA9555_B,
|
||||
.reg = 0x01, .mask = 1 << 5,
|
||||
.note ="0=PSU2 is FAIL or not present\n1=PSU2 is GOOD"
|
||||
},
|
||||
[BCM54282_INT] = {
|
||||
.bus = BUS0, .addr = PCA9555_B,
|
||||
.reg = 0x01, .mask = 1 << 6,
|
||||
.note ="0=BCM54282 PHY interrupt occurrs\n1=BCM54282 PHY interrupt is not occurrs"
|
||||
},
|
||||
//PCA9555_C
|
||||
[SFP_MOD_P1] = {
|
||||
.bus = BUS0, .addr = PCA9555_C,
|
||||
.reg = 0x00, .mask = 1 << 0,
|
||||
.note ="0=SFP1 transceiver is present\n1=SFP1 transceiver is NOT present"
|
||||
},
|
||||
[SFP_RXLOS_P1] = {
|
||||
.bus = BUS0, .addr = PCA9555_C,
|
||||
.reg = 0x00, .mask = 1 << 1,
|
||||
.note ="0=SFP1 transceiver is NOT asserted Loss of signal\n1=SFP1 transceiver is asserted Loss of signal"
|
||||
},
|
||||
[SFP_MOD_P2] = {
|
||||
.bus = BUS0, .addr = PCA9555_C,
|
||||
.reg = 0x00, .mask = 1 << 2,
|
||||
.note ="0=SFP1 transceiver is present\n1=SFP1 transceiver is NOT present"
|
||||
},
|
||||
[SFP_RXLOS_P2] = {
|
||||
.bus = BUS0, .addr = PCA9555_C,
|
||||
.reg = 0x00, .mask = 1 << 3,
|
||||
.note ="0=SFP1 transceiver is NOT asserted Loss of signal\n1=SFP1 transceiver is asserted Loss of signal"
|
||||
},
|
||||
[SFP_TX_FAULT_P1] = {
|
||||
.bus = BUS0, .addr = PCA9555_C,
|
||||
.reg = 0x00, .mask = 1 << 4,
|
||||
.note ="0=SFP1 transceiver is NOT asserted TXFAULT signal\n1=SFP1 transceiver is asserted TXFAULT signal"
|
||||
},
|
||||
[SFP_TX_FAULT_P2] = {
|
||||
.bus = BUS0, .addr = PCA9555_C,
|
||||
.reg = 0x00, .mask = 1 << 5,
|
||||
.note ="0=SFP1 transceiver is NOT asserted TXFAULT signal\n1=SFP1 transceiver is asserted TXFAULT signal"
|
||||
},
|
||||
[SFP_TX_DIS_P1] = {
|
||||
.bus = BUS0, .addr = PCA9555_C,
|
||||
.reg = 0x02, .mask = 1 << 6,
|
||||
.note ="0=SFP1 transceiver is turn ON\n1=SFP1 transceiver is turn OFF"
|
||||
},
|
||||
[SFP_TX_DIS_P2] = {
|
||||
.bus = BUS0, .addr = PCA9555_C,
|
||||
.reg = 0x02, .mask = 1 << 7,
|
||||
.note ="0=SFP2 transceiver is turn ON\n1=SFP2 transceiver is turn OFF"
|
||||
},
|
||||
[OOB_BCM54616S_INT] = {
|
||||
.bus = BUS0, .addr = PCA9555_C,
|
||||
.reg = 0x01, .mask = 1 << 3,
|
||||
.note ="0=BCM54616S PHY interrupt occurrs\n1=BCM54616S PHY interrupt is not occurrs"
|
||||
},
|
||||
};
|
||||
|
||||
unsigned char dni_log2 (unsigned char num){
|
||||
unsigned char num_log2 = 0;
|
||||
while(num > 0){
|
||||
num = num >> 1;
|
||||
num_log2 += 1;
|
||||
}
|
||||
return num_log2 -1;
|
||||
}
|
||||
|
||||
void set_direction(struct i2c_device_platform_data *pdata, unsigned char reg, unsigned char mask){
|
||||
|
||||
int value;
|
||||
int read_only;
|
||||
unsigned char mask_out;
|
||||
unsigned char set_data;
|
||||
|
||||
read_only = 1; //Configuration:GPI
|
||||
if (reg > 0x1){
|
||||
reg = reg - 0x02;
|
||||
read_only = 0; //Configuration:GPO
|
||||
}
|
||||
|
||||
value = i2c_smbus_read_byte_data(pdata->client, reg + 0x06);
|
||||
mask_out = value & ~(mask);
|
||||
|
||||
if(read_only){
|
||||
set_data = mask_out | mask;
|
||||
}
|
||||
else{
|
||||
set_data = mask_out;
|
||||
}
|
||||
|
||||
i2c_smbus_write_byte_data(pdata->client, reg + 0x06, set_data);
|
||||
return;
|
||||
}
|
||||
|
||||
static ssize_t get_gpio_reg(struct device *dev, struct device_attribute *dev_attr, char *buf)
|
||||
{
|
||||
int ret;
|
||||
int mask;
|
||||
int value;
|
||||
char note[150];
|
||||
unsigned char pca9555_num;
|
||||
unsigned char reg;
|
||||
struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr);
|
||||
struct device *i2cdev = kobj_to_dev(kobj_gpio);
|
||||
struct i2c_device_platform_data *pdata = i2cdev->platform_data;
|
||||
|
||||
switch(attribute_data[attr->index].addr){
|
||||
case PCA9555_A:
|
||||
pca9555_num = 0;
|
||||
break;
|
||||
case PCA9555_B:
|
||||
pca9555_num = 1;
|
||||
break;
|
||||
case PCA9555_C:
|
||||
pca9555_num = 2;
|
||||
break;
|
||||
default:
|
||||
return sprintf(buf, "attribute address error");
|
||||
}
|
||||
|
||||
set_direction(&pdata[pca9555_num], attribute_data[attr->index].reg, attribute_data[attr->index].mask);
|
||||
|
||||
switch (attr->index) {
|
||||
case PSU1_SMB_ALERT ... OOB_BCM54616S_INT:
|
||||
reg = attribute_data[attr->index].reg;
|
||||
mask = attribute_data[attr->index].mask;
|
||||
value = i2c_smbus_read_byte_data(pdata[pca9555_num].client, reg);
|
||||
sprintf(note, "\n%s\n",attribute_data[attr->index].note);
|
||||
value = (value & mask);
|
||||
break;
|
||||
default:
|
||||
return sprintf(buf, "%d not found", attr->index);
|
||||
}
|
||||
|
||||
switch (mask) {
|
||||
case 0xFF:
|
||||
return sprintf(buf, "0x%02x%s", value, note);
|
||||
case 0x0F:
|
||||
return sprintf(buf, "0x%01x%s", value, note);
|
||||
case 0xF0:
|
||||
value = value >> 4;
|
||||
return sprintf(buf, "0x%01x%s", value, note);
|
||||
case 0xC0:
|
||||
value = value >> 6;
|
||||
return sprintf(buf, "0x%01x%s", value, note);
|
||||
case 0x30:
|
||||
value = value >> 4;
|
||||
return sprintf(buf, "0x%01x%s", value, note);
|
||||
default :
|
||||
value = value >> dni_log2(mask);
|
||||
return sprintf(buf, "%d%s", value, note);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ssize_t set_gpio_reg(struct device *dev, struct device_attribute *dev_attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
int err;
|
||||
int value;
|
||||
unsigned long set_data;
|
||||
unsigned char set_reg;
|
||||
unsigned char mask;
|
||||
unsigned char mask_out;
|
||||
unsigned char pca9555_num;
|
||||
struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr);
|
||||
struct device *i2cdev = kobj_to_dev(kobj_gpio);
|
||||
struct i2c_device_platform_data *pdata = i2cdev->platform_data;
|
||||
|
||||
err = kstrtoul(buf, 0, &set_data);
|
||||
if (err){
|
||||
return err;
|
||||
}
|
||||
|
||||
if (set_data > 0xff){
|
||||
printk(KERN_ALERT "address out of range (0x00-0xFF)\n");
|
||||
return count;
|
||||
}
|
||||
|
||||
switch(attribute_data[attr->index].addr){
|
||||
case PCA9555_A:
|
||||
pca9555_num = 0;
|
||||
break;
|
||||
case PCA9555_B:
|
||||
pca9555_num = 1;
|
||||
break;
|
||||
case PCA9555_C:
|
||||
pca9555_num = 2;
|
||||
break;
|
||||
default:
|
||||
return sprintf(buf, "attribute address error");
|
||||
}
|
||||
|
||||
set_direction(&pdata[pca9555_num], attribute_data[attr->index].reg, attribute_data[attr->index].mask);
|
||||
|
||||
switch (attr->index) {
|
||||
case PSU1_SMB_ALERT ... OOB_BCM54616S_INT:
|
||||
set_reg = attribute_data[attr->index].reg;
|
||||
mask = attribute_data[attr->index].mask;
|
||||
value = i2c_smbus_read_byte_data(pdata[pca9555_num].client, set_reg);
|
||||
mask_out = value & ~(mask);
|
||||
break;
|
||||
default:
|
||||
return sprintf(buf, "%d not found", attr->index);
|
||||
}
|
||||
|
||||
switch (mask) {
|
||||
case 0xFF:
|
||||
set_data = mask_out | (set_data & mask);
|
||||
break;
|
||||
case 0x0F:
|
||||
set_data = mask_out | (set_data & mask);
|
||||
break;
|
||||
case 0xF0:
|
||||
set_data = set_data << 4;
|
||||
set_data = mask_out | (set_data & mask);
|
||||
break;
|
||||
case 0xC0:
|
||||
set_data = set_data << 6;
|
||||
set_data = mask_out | (set_data & mask);
|
||||
break;
|
||||
case 0x30:
|
||||
set_data = set_data << 4;
|
||||
set_data = mask_out | (set_data & mask);
|
||||
break;
|
||||
default :
|
||||
set_data = mask_out | (set_data << dni_log2(mask) );
|
||||
}
|
||||
|
||||
i2c_smbus_write_byte_data(pdata[pca9555_num].client, set_reg, set_data);
|
||||
return count;
|
||||
}
|
||||
static SENSOR_DEVICE_ATTR(psu1_smb_alert, S_IRUGO, get_gpio_reg, NULL, PSU1_SMB_ALERT);
|
||||
static SENSOR_DEVICE_ATTR(psu2_smb_alert, S_IRUGO, get_gpio_reg, NULL, PSU2_SMB_ALERT);
|
||||
static SENSOR_DEVICE_ATTR(eeprom_wp, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, EEPROM_WP);
|
||||
static SENSOR_DEVICE_ATTR(fan1_led_ag, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, FAN1_LED_AG);
|
||||
static SENSOR_DEVICE_ATTR(fan2_led_ag, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, FAN2_LED_AG);
|
||||
static SENSOR_DEVICE_ATTR(d_fan_alert, S_IRUGO, get_gpio_reg, NULL, D_FAN_ALERT);
|
||||
static SENSOR_DEVICE_ATTR(psu1_pres, S_IRUGO, get_gpio_reg, NULL, PSU1_PRES);
|
||||
static SENSOR_DEVICE_ATTR(psu2_pres, S_IRUGO, get_gpio_reg, NULL, PSU2_PRES);
|
||||
static SENSOR_DEVICE_ATTR(fan_eeprom_wp, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, FAN_EEPROM_WP);
|
||||
static SENSOR_DEVICE_ATTR(d_fan_m_present2, S_IRUGO, get_gpio_reg, NULL, D_FAN_M_PRESENT2);
|
||||
static SENSOR_DEVICE_ATTR(d_fan_m_present1, S_IRUGO, get_gpio_reg, NULL, D_FAN_M_PRESENT1);
|
||||
static SENSOR_DEVICE_ATTR(psu1_pg, S_IRUGO, get_gpio_reg, NULL, PSU1_PG);
|
||||
static SENSOR_DEVICE_ATTR(psu2_pg, S_IRUGO, get_gpio_reg, NULL, PSU2_PG);
|
||||
static SENSOR_DEVICE_ATTR(bcm54282_int, S_IRUGO, get_gpio_reg, NULL, BCM54282_INT);
|
||||
|
||||
static SENSOR_DEVICE_ATTR(sfp_mod_p1, S_IRUGO, get_gpio_reg, NULL, SFP_MOD_P1);
|
||||
static SENSOR_DEVICE_ATTR(sfp_rxlos_p1, S_IRUGO, get_gpio_reg, NULL, SFP_RXLOS_P1);
|
||||
static SENSOR_DEVICE_ATTR(sfp_mod_p2, S_IRUGO, get_gpio_reg, NULL, SFP_MOD_P2);
|
||||
static SENSOR_DEVICE_ATTR(sfp_rxlos_p2, S_IRUGO, get_gpio_reg, NULL, SFP_RXLOS_P2);
|
||||
static SENSOR_DEVICE_ATTR(sfp_tx_fault_p1, S_IRUGO, get_gpio_reg, NULL, SFP_TX_FAULT_P1);
|
||||
static SENSOR_DEVICE_ATTR(sfp_tx_fault_p2, S_IRUGO , get_gpio_reg, NULL, SFP_TX_FAULT_P2);
|
||||
static SENSOR_DEVICE_ATTR(sfp_tx_dis_p1, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, SFP_TX_DIS_P1);
|
||||
static SENSOR_DEVICE_ATTR(sfp_tx_dis_p2, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, SFP_TX_DIS_P2);
|
||||
static SENSOR_DEVICE_ATTR(oob_bcm54616s_int, S_IRUGO, get_gpio_reg, NULL, OOB_BCM54616S_INT);
|
||||
|
||||
static struct attribute *et6248brb_psu_attrs[] = {
|
||||
&sensor_dev_attr_psu1_smb_alert.dev_attr.attr,
|
||||
&sensor_dev_attr_psu2_smb_alert.dev_attr.attr,
|
||||
&sensor_dev_attr_psu1_pres.dev_attr.attr,
|
||||
&sensor_dev_attr_psu2_pres.dev_attr.attr,
|
||||
&sensor_dev_attr_psu1_pg.dev_attr.attr,
|
||||
&sensor_dev_attr_psu2_pg.dev_attr.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct attribute *et6248brb_fan_attrs[] = {
|
||||
&sensor_dev_attr_fan1_led_ag.dev_attr.attr,
|
||||
&sensor_dev_attr_fan2_led_ag.dev_attr.attr,
|
||||
&sensor_dev_attr_d_fan_alert.dev_attr.attr,
|
||||
&sensor_dev_attr_fan_eeprom_wp.dev_attr.attr,
|
||||
&sensor_dev_attr_d_fan_m_present1.dev_attr.attr,
|
||||
&sensor_dev_attr_d_fan_m_present2.dev_attr.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct attribute *et6248brb_sfp_attrs[] = {
|
||||
&sensor_dev_attr_sfp_mod_p1.dev_attr.attr,
|
||||
&sensor_dev_attr_sfp_rxlos_p1.dev_attr.attr,
|
||||
&sensor_dev_attr_sfp_mod_p2.dev_attr.attr,
|
||||
&sensor_dev_attr_sfp_rxlos_p2.dev_attr.attr,
|
||||
&sensor_dev_attr_sfp_tx_fault_p1.dev_attr.attr,
|
||||
&sensor_dev_attr_sfp_tx_fault_p2.dev_attr.attr,
|
||||
&sensor_dev_attr_sfp_tx_dis_p1.dev_attr.attr,
|
||||
&sensor_dev_attr_sfp_tx_dis_p2.dev_attr.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct attribute *et6248brb_others_attrs[] = {
|
||||
&sensor_dev_attr_eeprom_wp.dev_attr.attr,
|
||||
&sensor_dev_attr_bcm54282_int.dev_attr.attr,
|
||||
&sensor_dev_attr_oob_bcm54616s_int.dev_attr.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct attribute_group et6248brb_psu_attr_grp = {
|
||||
.attrs = et6248brb_psu_attrs,
|
||||
};
|
||||
|
||||
static struct attribute_group et6248brb_fan_attr_grp = {
|
||||
.attrs = et6248brb_fan_attrs,
|
||||
|
||||
};
|
||||
static struct attribute_group et6248brb_sfp_attr_grp = {
|
||||
.attrs = et6248brb_sfp_attrs,
|
||||
};
|
||||
|
||||
static struct attribute_group et6248brb_others_attr_grp = {
|
||||
.attrs = et6248brb_others_attrs,
|
||||
};
|
||||
/*---------------- gpio device - end ------------- */
|
||||
|
||||
/*---------------- gpio driver - start ----------- */
|
||||
static int __init gpio_device_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct i2c_device_platform_data *pdata;
|
||||
struct i2c_adapter *parent;
|
||||
int ret;
|
||||
|
||||
pdata = pdev->dev.platform_data;
|
||||
if (!pdata) {
|
||||
dev_err(&pdev->dev, "Missing platform data\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
parent = i2c_get_adapter(pdata->parent);
|
||||
if (!parent) {
|
||||
dev_err(&pdev->dev, "Parent adapter (%d) not found\n",
|
||||
pdata->parent);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
pdata->client = i2c_new_device(parent, &pdata->info);
|
||||
if (!pdata->client) {
|
||||
dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n",
|
||||
pdata->info.type, pdata->parent);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if(pdata->info.addr == PCA9555_A){
|
||||
kobj_gpio = &pdev->dev.kobj;
|
||||
kobj_psu = kobject_create_and_add("PSU", &pdev->dev.kobj);
|
||||
if (!kobj_psu){
|
||||
printk(KERN_WARNING "Fail to create 'PSU' directory");
|
||||
goto error;
|
||||
}
|
||||
|
||||
kobj_fan = kobject_create_and_add("FAN", &pdev->dev.kobj);
|
||||
if (!kobj_fan){
|
||||
printk(KERN_WARNING "Fail to create 'FAN' directory");
|
||||
goto error;
|
||||
}
|
||||
|
||||
kobj_sfp = kobject_create_and_add("SFP", &pdev->dev.kobj);
|
||||
if (!kobj_sfp){
|
||||
printk(KERN_WARNING "Fail to create 'SFP' directory");
|
||||
goto error;
|
||||
}
|
||||
kobj_others = kobject_create_and_add("Others", &pdev->dev.kobj);
|
||||
if (!kobj_others){
|
||||
printk(KERN_WARNING "Fail to create 'Others' directory");
|
||||
goto error;
|
||||
}
|
||||
ret = sysfs_create_group(kobj_psu, &et6248brb_psu_attr_grp);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "Fail to create 'psu' attribute group");
|
||||
goto error;
|
||||
}
|
||||
ret = sysfs_create_group(kobj_fan, &et6248brb_fan_attr_grp);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "Fail to create 'fan' attribute group");
|
||||
goto error;
|
||||
}
|
||||
ret = sysfs_create_group(kobj_sfp, &et6248brb_sfp_attr_grp);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "Fail to create 'sfp' attribute group");
|
||||
goto error;
|
||||
}
|
||||
ret = sysfs_create_group(kobj_others, &et6248brb_others_attr_grp);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "Fail to create 'others' attribute group");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
error:
|
||||
kobject_put(kobj_gpio);
|
||||
kobject_put(kobj_psu);
|
||||
kobject_put(kobj_fan);
|
||||
kobject_put(kobj_sfp);
|
||||
kobject_put(kobj_others);
|
||||
i2c_unregister_device(pdata->client);
|
||||
i2c_put_adapter(parent);
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static int __exit gpio_deivce_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct i2c_adapter *parent;
|
||||
struct i2c_device_platform_data *pdata;
|
||||
|
||||
pdata = pdev->dev.platform_data;
|
||||
if (!pdata) {
|
||||
dev_err(&pdev->dev, "Missing platform data\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (!pdata) {
|
||||
dev_err(&pdev->dev, "Missing platform data\n");
|
||||
}
|
||||
else if(pdata->info.addr == PCA9555_A){
|
||||
sysfs_remove_group(kobj_gpio, &et6248brb_psu_attr_grp);
|
||||
sysfs_remove_group(kobj_fan, &et6248brb_fan_attr_grp);
|
||||
sysfs_remove_group(kobj_sfp, &et6248brb_sfp_attr_grp);
|
||||
sysfs_remove_group(kobj_others, &et6248brb_others_attr_grp);
|
||||
kobject_put(kobj_gpio);
|
||||
kobject_put(kobj_fan);
|
||||
kobject_put(kobj_psu);
|
||||
kobject_put(kobj_sfp);
|
||||
kobject_put(kobj_others);
|
||||
}
|
||||
|
||||
if (pdata->client) {
|
||||
if (!parent) {
|
||||
parent = (pdata->client)->adapter;
|
||||
}
|
||||
i2c_unregister_device(pdata->client);
|
||||
}
|
||||
|
||||
i2c_put_adapter(parent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver gpio_device_driver = {
|
||||
.probe = gpio_device_probe,
|
||||
.remove = __exit_p(gpio_deivce_remove),
|
||||
.driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "delta-et6248brb-gpio",
|
||||
}
|
||||
};
|
||||
/*---------------- gpio driver - end ------------- */
|
||||
|
||||
/*---------------- module initialization ------------- */
|
||||
static int __init delta_et6248brb_platform_init(void)
|
||||
{
|
||||
struct i2c_adapter *adapter;
|
||||
|
||||
int ret, i = 0, j = 0;
|
||||
printk("et6248brb_platform module initialization\n");
|
||||
|
||||
//Use pca9547 in i2c_mux_pca954x.c
|
||||
adapter = i2c_get_adapter(BUS1);
|
||||
i2c_client_9547 = i2c_new_device(adapter, &i2c_info_pca9547[0]);
|
||||
i2c_put_adapter(adapter);
|
||||
|
||||
// register the i2c devices
|
||||
ret = platform_driver_register(&i2c_device_driver);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "Fail to register i2c device driver\n");
|
||||
goto error_i2c_device_driver;
|
||||
}
|
||||
|
||||
// register the i2c devices
|
||||
ret = platform_driver_register(&gpio_device_driver);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "Fail to register i2c device driver\n");
|
||||
goto error_gpio_device_driver;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(et6248brb_i2c_device); i++)
|
||||
{
|
||||
ret = platform_device_register(&et6248brb_i2c_device[i]);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "Fail to create i2c device %d\n", i);
|
||||
goto error_et6248brb_i2c_device;
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE(et6248brb_gpio_device); j++)
|
||||
{
|
||||
ret = platform_device_register(&et6248brb_gpio_device[j]);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "Fail to create i2c device %d\n", j);
|
||||
goto error_et6248brb_gpio_device;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
error_et6248brb_gpio_device:
|
||||
j--;
|
||||
for (; j >= 0; j--) {
|
||||
platform_device_unregister(&et6248brb_gpio_device[j]);
|
||||
}
|
||||
error_et6248brb_i2c_device:
|
||||
i--;
|
||||
for (; i >= 0; i--) {
|
||||
platform_device_unregister(&et6248brb_i2c_device[i]);
|
||||
}
|
||||
platform_driver_unregister(&gpio_device_driver);
|
||||
error_gpio_device_driver:
|
||||
platform_driver_unregister(&i2c_device_driver);
|
||||
error_i2c_device_driver:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void __exit delta_et6248brb_platform_exit(void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for ( i = 0; i < ARRAY_SIZE(et6248brb_i2c_device); i++ ) {
|
||||
platform_device_unregister(&et6248brb_i2c_device[i]);
|
||||
}
|
||||
|
||||
for ( i = 0; i < ARRAY_SIZE(et6248brb_gpio_device); i++ ) {
|
||||
platform_device_unregister(&et6248brb_gpio_device[i]);
|
||||
}
|
||||
platform_driver_unregister(&i2c_device_driver);
|
||||
platform_driver_unregister(&gpio_device_driver);
|
||||
i2c_unregister_device(i2c_client_9547);
|
||||
}
|
||||
|
||||
module_init(delta_et6248brb_platform_init);
|
||||
module_exit(delta_et6248brb_platform_exit);
|
||||
|
||||
MODULE_DESCRIPTION("DNI et6248brb Platform Support");
|
||||
MODULE_AUTHOR("Jacky Liu <jacky.js.liu@deltaww.com>");
|
||||
MODULE_LICENSE("GPL");
|
@ -0,0 +1,695 @@
|
||||
/*
|
||||
* Intel ICH6-10, Series 5 and 6, Atom C2000 (Avoton/Rangeley) GPIO driver
|
||||
*
|
||||
* Copyright (C) 2010 Extreme Engineering Solutions.
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
|
||||
#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
|
||||
#include <linux/ioport.h>
|
||||
#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/lpc_ich.h>
|
||||
|
||||
#define DRV_NAME "gpio_ich"
|
||||
|
||||
/*
|
||||
* GPIO register offsets in GPIO I/O space.
|
||||
* Each chunk of 32 GPIOs is manipulated via its own USE_SELx, IO_SELx, and
|
||||
* LVLx registers. Logic in the read/write functions takes a register and
|
||||
* an absolute bit number and determines the proper register offset and bit
|
||||
* number in that register. For example, to read the value of GPIO bit 50
|
||||
* the code would access offset ichx_regs[2(=GPIO_LVL)][1(=50/32)],
|
||||
* bit 18 (50%32).
|
||||
*/
|
||||
enum GPIO_REG {
|
||||
GPIO_USE_SEL = 0,
|
||||
GPIO_IO_SEL,
|
||||
GPIO_LVL,
|
||||
GPO_BLINK
|
||||
};
|
||||
|
||||
static const u8 ichx_regs[4][3] = {
|
||||
{0x00, 0x30, 0x40}, /* USE_SEL[1-3] offsets */
|
||||
{0x04, 0x34, 0x44}, /* IO_SEL[1-3] offsets */
|
||||
{0x0c, 0x38, 0x48}, /* LVL[1-3] offsets */
|
||||
{0x18, 0x18, 0x18}, /* BLINK offset */
|
||||
};
|
||||
|
||||
static const u8 ichx_reglen[3] = {
|
||||
0x30, 0x10, 0x10,
|
||||
};
|
||||
|
||||
static const u8 avoton_regs[4][3] = {
|
||||
{0x00, 0x80, 0x00},
|
||||
{0x04, 0x84, 0x00},
|
||||
{0x08, 0x88, 0x00},
|
||||
};
|
||||
|
||||
static const u8 avoton_reglen[3] = {
|
||||
0x10, 0x10, 0x00,
|
||||
};
|
||||
|
||||
#define ICHX_WRITE(val, reg, base_res) outl(val, (reg) + (base_res)->start)
|
||||
#define ICHX_READ(reg, base_res) inl((reg) + (base_res)->start)
|
||||
|
||||
struct ichx_desc {
|
||||
/* Max GPIO pins the chipset can have */
|
||||
uint ngpio;
|
||||
|
||||
/* chipset registers */
|
||||
const u8 (*regs)[3];
|
||||
const u8 *reglen;
|
||||
|
||||
/* GPO_BLINK is available on this chipset */
|
||||
bool have_blink;
|
||||
|
||||
/* Whether the chipset has GPIO in GPE0_STS in the PM IO region */
|
||||
bool uses_gpe0;
|
||||
|
||||
/* USE_SEL is bogus on some chipsets, eg 3100 */
|
||||
u32 use_sel_ignore[3];
|
||||
|
||||
/* Some chipsets have quirks, let these use their own request/get */
|
||||
int (*request)(struct gpio_chip *chip, unsigned offset);
|
||||
int (*get)(struct gpio_chip *chip, unsigned offset);
|
||||
|
||||
/*
|
||||
* Some chipsets don't let reading output values on GPIO_LVL register
|
||||
* this option allows driver caching written output values
|
||||
*/
|
||||
bool use_outlvl_cache;
|
||||
};
|
||||
|
||||
static struct {
|
||||
spinlock_t lock;
|
||||
struct platform_device *dev;
|
||||
struct gpio_chip chip;
|
||||
struct resource *gpio_base; /* GPIO IO base */
|
||||
struct resource *pm_base; /* Power Mangagment IO base */
|
||||
struct ichx_desc *desc; /* Pointer to chipset-specific description */
|
||||
u32 orig_gpio_ctrl; /* Orig CTRL value, used to restore on exit */
|
||||
u8 use_gpio; /* Which GPIO groups are usable */
|
||||
int outlvl_cache[3]; /* cached output values */
|
||||
} ichx_priv;
|
||||
|
||||
static int modparam_gpiobase = -1; /* dynamic */
|
||||
module_param_named(gpiobase, modparam_gpiobase, int, 0444);
|
||||
MODULE_PARM_DESC(gpiobase, "The GPIO number base. -1 means dynamic, "
|
||||
"which is the default.");
|
||||
|
||||
static int ichx_write_bit(int reg, unsigned nr, int val, int verify)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 data, tmp;
|
||||
int reg_nr = nr / 32;
|
||||
int bit = nr & 0x1f;
|
||||
int ret = 0;
|
||||
|
||||
spin_lock_irqsave(&ichx_priv.lock, flags);
|
||||
|
||||
if (reg == GPIO_LVL && ichx_priv.desc->use_outlvl_cache)
|
||||
{
|
||||
data = ichx_priv.outlvl_cache[reg_nr];
|
||||
}
|
||||
else
|
||||
{
|
||||
data = ICHX_READ(ichx_priv.desc->regs[reg][reg_nr],
|
||||
ichx_priv.gpio_base);
|
||||
}
|
||||
if (val)
|
||||
data |= 1 << bit;
|
||||
else
|
||||
data &= ~(1 << bit);
|
||||
|
||||
ICHX_WRITE(data, ichx_priv.desc->regs[reg][reg_nr],
|
||||
ichx_priv.gpio_base);
|
||||
if (reg == GPIO_LVL && ichx_priv.desc->use_outlvl_cache)
|
||||
ichx_priv.outlvl_cache[reg_nr] = data;
|
||||
|
||||
tmp = ICHX_READ(ichx_priv.desc->regs[reg][reg_nr],
|
||||
ichx_priv.gpio_base);
|
||||
if (verify && data != tmp)
|
||||
ret = -EPERM;
|
||||
|
||||
spin_unlock_irqrestore(&ichx_priv.lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ichx_read_bit(int reg, unsigned nr)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 data;
|
||||
int reg_nr = nr / 32;
|
||||
int bit = nr & 0x1f;
|
||||
|
||||
spin_lock_irqsave(&ichx_priv.lock, flags);
|
||||
|
||||
data = ICHX_READ(ichx_priv.desc->regs[reg][reg_nr],
|
||||
ichx_priv.gpio_base);
|
||||
|
||||
if (reg == GPIO_LVL && ichx_priv.desc->use_outlvl_cache)
|
||||
data = ichx_priv.outlvl_cache[reg_nr] | data;
|
||||
|
||||
spin_unlock_irqrestore(&ichx_priv.lock, flags);
|
||||
|
||||
return data & (1 << bit) ? 1 : 0;
|
||||
}
|
||||
|
||||
static bool ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr)
|
||||
{
|
||||
return !!(ichx_priv.use_gpio & (1 << (nr / 32)));
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
|
||||
#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
|
||||
static int ichx_gpio_get_direction(struct gpio_chip *gpio, unsigned nr)
|
||||
{
|
||||
return ichx_read_bit(GPIO_IO_SEL, nr) ? GPIOF_DIR_IN : GPIOF_DIR_OUT;
|
||||
}
|
||||
#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
|
||||
|
||||
static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr)
|
||||
{
|
||||
/*
|
||||
* Try setting pin as an input and verify it worked since many pins
|
||||
* are output-only.
|
||||
*/
|
||||
if (ichx_write_bit(GPIO_IO_SEL, nr, 1, 1))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ichx_gpio_direction_output(struct gpio_chip *gpio, unsigned nr,
|
||||
int val)
|
||||
{
|
||||
/* Disable blink hardware which is available for GPIOs from 0 to 31. */
|
||||
if (nr < 32 && ichx_priv.desc->have_blink)
|
||||
ichx_write_bit(GPO_BLINK, nr, 0, 0);
|
||||
|
||||
/* Set GPIO output value. */
|
||||
ichx_write_bit(GPIO_LVL, nr, val, 0);
|
||||
|
||||
/*
|
||||
* Try setting pin as an output and verify it worked since many pins
|
||||
* are input-only.
|
||||
*/
|
||||
if (ichx_write_bit(GPIO_IO_SEL, nr, 0, 1))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ichx_gpio_get(struct gpio_chip *chip, unsigned nr)
|
||||
{
|
||||
return ichx_read_bit(GPIO_LVL, nr);
|
||||
}
|
||||
|
||||
static int ich6_gpio_get(struct gpio_chip *chip, unsigned nr)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 data;
|
||||
|
||||
/*
|
||||
* GPI 0 - 15 need to be read from the power management registers on
|
||||
* a ICH6/3100 bridge.
|
||||
*/
|
||||
if (nr < 16) {
|
||||
if (!ichx_priv.pm_base)
|
||||
return -ENXIO;
|
||||
|
||||
spin_lock_irqsave(&ichx_priv.lock, flags);
|
||||
|
||||
/* GPI 0 - 15 are latched, write 1 to clear*/
|
||||
ICHX_WRITE(1 << (16 + nr), 0, ichx_priv.pm_base);
|
||||
data = ICHX_READ(0, ichx_priv.pm_base);
|
||||
|
||||
spin_unlock_irqrestore(&ichx_priv.lock, flags);
|
||||
|
||||
return (data >> 16) & (1 << nr) ? 1 : 0;
|
||||
} else {
|
||||
return ichx_gpio_get(chip, nr);
|
||||
}
|
||||
}
|
||||
|
||||
static int ichx_gpio_request(struct gpio_chip *chip, unsigned nr)
|
||||
{
|
||||
if (!ichx_gpio_check_available(chip, nr))
|
||||
return -ENXIO;
|
||||
|
||||
/*
|
||||
* Note we assume the BIOS properly set a bridge's USE value. Some
|
||||
* chips (eg Intel 3100) have bogus USE values though, so first see if
|
||||
* the chipset's USE value can be trusted for this specific bit.
|
||||
* If it can't be trusted, assume that the pin can be used as a GPIO.
|
||||
*/
|
||||
if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f)))
|
||||
return 0;
|
||||
|
||||
return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV;
|
||||
}
|
||||
|
||||
static int ich6_gpio_request(struct gpio_chip *chip, unsigned nr)
|
||||
{
|
||||
/*
|
||||
* Fixups for bits 16 and 17 are necessary on the Intel ICH6/3100
|
||||
* bridge as they are controlled by USE register bits 0 and 1. See
|
||||
* "Table 704 GPIO_USE_SEL1 register" in the i3100 datasheet for
|
||||
* additional info.
|
||||
*/
|
||||
if (nr == 16 || nr == 17)
|
||||
nr -= 16;
|
||||
|
||||
return ichx_gpio_request(chip, nr);
|
||||
}
|
||||
|
||||
static void ichx_gpio_set(struct gpio_chip *chip, unsigned nr, int val)
|
||||
{
|
||||
ichx_write_bit(GPIO_LVL, nr, val, 0);
|
||||
}
|
||||
|
||||
static void ichx_gpiolib_setup(struct gpio_chip *chip)
|
||||
{
|
||||
chip->owner = THIS_MODULE;
|
||||
chip->label = DRV_NAME;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
|
||||
chip->dev = &ichx_priv.dev->dev;
|
||||
#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
|
||||
chip->parent = &ichx_priv.dev->dev;
|
||||
chip->get_direction = ichx_gpio_get_direction;
|
||||
#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
|
||||
|
||||
/* Allow chip-specific overrides of request()/get() */
|
||||
chip->request = ichx_priv.desc->request ?
|
||||
ichx_priv.desc->request : ichx_gpio_request;
|
||||
chip->get = ichx_priv.desc->get ?
|
||||
ichx_priv.desc->get : ichx_gpio_get;
|
||||
|
||||
chip->set = ichx_gpio_set;
|
||||
chip->direction_input = ichx_gpio_direction_input;
|
||||
chip->direction_output = ichx_gpio_direction_output;
|
||||
chip->base = modparam_gpiobase;
|
||||
chip->ngpio = ichx_priv.desc->ngpio;
|
||||
chip->can_sleep = false;
|
||||
chip->dbg_show = NULL;
|
||||
}
|
||||
|
||||
/* ICH6-based, 631xesb-based */
|
||||
static struct ichx_desc ich6_desc = {
|
||||
/* Bridges using the ICH6 controller need fixups for GPIO 0 - 17 */
|
||||
.request = ich6_gpio_request,
|
||||
.get = ich6_gpio_get,
|
||||
|
||||
/* GPIO 0-15 are read in the GPE0_STS PM register */
|
||||
.uses_gpe0 = true,
|
||||
|
||||
.ngpio = 50,
|
||||
.have_blink = true,
|
||||
.regs = ichx_regs,
|
||||
.reglen = ichx_reglen,
|
||||
};
|
||||
|
||||
/* Intel 3100 */
|
||||
static struct ichx_desc i3100_desc = {
|
||||
/*
|
||||
* Bits 16,17, 20 of USE_SEL and bit 16 of USE_SEL2 always read 0 on
|
||||
* the Intel 3100. See "Table 712. GPIO Summary Table" of 3100
|
||||
* Datasheet for more info.
|
||||
*/
|
||||
.use_sel_ignore = {0x00130000, 0x00010000, 0x0},
|
||||
|
||||
/* The 3100 needs fixups for GPIO 0 - 17 */
|
||||
.request = ich6_gpio_request,
|
||||
.get = ich6_gpio_get,
|
||||
|
||||
/* GPIO 0-15 are read in the GPE0_STS PM register */
|
||||
.uses_gpe0 = true,
|
||||
|
||||
.ngpio = 50,
|
||||
.regs = ichx_regs,
|
||||
.reglen = ichx_reglen,
|
||||
};
|
||||
|
||||
/* ICH7 and ICH8-based */
|
||||
static struct ichx_desc ich7_desc = {
|
||||
.ngpio = 50,
|
||||
.have_blink = true,
|
||||
.regs = ichx_regs,
|
||||
.reglen = ichx_reglen,
|
||||
};
|
||||
|
||||
/* ICH9-based */
|
||||
static struct ichx_desc ich9_desc = {
|
||||
.ngpio = 61,
|
||||
.have_blink = true,
|
||||
.regs = ichx_regs,
|
||||
.reglen = ichx_reglen,
|
||||
};
|
||||
|
||||
/* ICH10-based - Consumer/corporate versions have different amount of GPIO */
|
||||
static struct ichx_desc ich10_cons_desc = {
|
||||
.ngpio = 61,
|
||||
.have_blink = true,
|
||||
.regs = ichx_regs,
|
||||
.reglen = ichx_reglen,
|
||||
};
|
||||
static struct ichx_desc ich10_corp_desc = {
|
||||
.ngpio = 72,
|
||||
.have_blink = true,
|
||||
.regs = ichx_regs,
|
||||
.reglen = ichx_reglen,
|
||||
};
|
||||
|
||||
/* Intel 5 series, 6 series, 3400 series, and C200 series */
|
||||
static struct ichx_desc intel5_desc = {
|
||||
.ngpio = 76,
|
||||
.regs = ichx_regs,
|
||||
.reglen = ichx_reglen,
|
||||
};
|
||||
|
||||
/* Avoton */
|
||||
static struct ichx_desc avoton_desc = {
|
||||
/* Avoton has only 59 GPIOs, but we assume the first set of register
|
||||
* (Core) has 32 instead of 31 to keep gpio-ich compliance
|
||||
*/
|
||||
.ngpio = 60,
|
||||
.regs = avoton_regs,
|
||||
.reglen = avoton_reglen,
|
||||
.use_outlvl_cache = true,
|
||||
};
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
|
||||
static int ichx_gpio_request_regions(struct resource *res_base,
|
||||
const char *name, u8 use_gpio)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!res_base || !res_base->start || !res_base->end)
|
||||
return -ENODEV;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ichx_priv.desc->regs[0]); i++) {
|
||||
if (!(use_gpio & (1 << i)))
|
||||
continue;
|
||||
if (!request_region(
|
||||
res_base->start + ichx_priv.desc->regs[0][i],
|
||||
ichx_priv.desc->reglen[i], name))
|
||||
goto request_err;
|
||||
}
|
||||
return 0;
|
||||
|
||||
request_err:
|
||||
/* Clean up: release already requested regions, if any */
|
||||
for (i--; i >= 0; i--) {
|
||||
if (!(use_gpio & (1 << i)))
|
||||
continue;
|
||||
release_region(res_base->start + ichx_priv.desc->regs[0][i],
|
||||
ichx_priv.desc->reglen[i]);
|
||||
}
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
static void ichx_gpio_release_regions(struct resource *res_base, u8 use_gpio)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ichx_priv.desc->regs[0]); i++) {
|
||||
if (!(use_gpio & (1 << i)))
|
||||
continue;
|
||||
release_region(res_base->start + ichx_priv.desc->regs[0][i],
|
||||
ichx_priv.desc->reglen[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static int ichx_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res_base, *res_pm;
|
||||
int err;
|
||||
struct lpc_ich_info *ich_info = dev_get_platdata(&pdev->dev);
|
||||
|
||||
if (!ich_info)
|
||||
return -ENODEV;
|
||||
|
||||
ichx_priv.dev = pdev;
|
||||
|
||||
switch (ich_info->gpio_version) {
|
||||
case ICH_I3100_GPIO:
|
||||
ichx_priv.desc = &i3100_desc;
|
||||
break;
|
||||
case ICH_V5_GPIO:
|
||||
ichx_priv.desc = &intel5_desc;
|
||||
break;
|
||||
case ICH_V6_GPIO:
|
||||
ichx_priv.desc = &ich6_desc;
|
||||
break;
|
||||
case ICH_V7_GPIO:
|
||||
ichx_priv.desc = &ich7_desc;
|
||||
break;
|
||||
case ICH_V9_GPIO:
|
||||
ichx_priv.desc = &ich9_desc;
|
||||
break;
|
||||
case ICH_V10CORP_GPIO:
|
||||
ichx_priv.desc = &ich10_corp_desc;
|
||||
break;
|
||||
case ICH_V10CONS_GPIO:
|
||||
ichx_priv.desc = &ich10_cons_desc;
|
||||
break;
|
||||
case AVOTON_GPIO:
|
||||
ichx_priv.desc = &avoton_desc;
|
||||
ichx_priv.outlvl_cache[0] = 0x06; /*core output values*/
|
||||
ichx_priv.outlvl_cache[1] = 0x7c0008; /*sus output values*/
|
||||
ichx_priv.outlvl_cache[2] = 0x0; /*no used*/
|
||||
|
||||
break;
|
||||
default:
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
spin_lock_init(&ichx_priv.lock);
|
||||
res_base = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPIO);
|
||||
ichx_priv.use_gpio = ich_info->use_gpio;
|
||||
err = ichx_gpio_request_regions(res_base, pdev->name,
|
||||
ichx_priv.use_gpio);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ichx_priv.gpio_base = res_base;
|
||||
|
||||
/*
|
||||
* If necessary, determine the I/O address of ACPI/power management
|
||||
* registers which are needed to read the the GPE0 register for GPI pins
|
||||
* 0 - 15 on some chipsets.
|
||||
*/
|
||||
if (!ichx_priv.desc->uses_gpe0)
|
||||
goto init;
|
||||
|
||||
res_pm = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPE0);
|
||||
if (!res_pm) {
|
||||
pr_warn("ACPI BAR is unavailable, GPI 0 - 15 unavailable\n");
|
||||
goto init;
|
||||
}
|
||||
|
||||
if (!request_region(res_pm->start, resource_size(res_pm),
|
||||
pdev->name)) {
|
||||
pr_warn("ACPI BAR is busy, GPI 0 - 15 unavailable\n");
|
||||
goto init;
|
||||
}
|
||||
|
||||
ichx_priv.pm_base = res_pm;
|
||||
|
||||
init:
|
||||
ichx_gpiolib_setup(&ichx_priv.chip);
|
||||
err = gpiochip_add(&ichx_priv.chip);
|
||||
if (err) {
|
||||
pr_err("Failed to register GPIOs\n");
|
||||
goto add_err;
|
||||
}
|
||||
|
||||
pr_info("GPIO from %d to %d on %s\n", ichx_priv.chip.base,
|
||||
ichx_priv.chip.base + ichx_priv.chip.ngpio - 1, DRV_NAME);
|
||||
|
||||
return 0;
|
||||
|
||||
add_err:
|
||||
ichx_gpio_release_regions(ichx_priv.gpio_base, ichx_priv.use_gpio);
|
||||
if (ichx_priv.pm_base)
|
||||
release_region(ichx_priv.pm_base->start,
|
||||
resource_size(ichx_priv.pm_base));
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ichx_gpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = gpiochip_remove(&ichx_priv.chip);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "%s failed, %d\n",
|
||||
"gpiochip_remove()", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
ichx_gpio_release_regions(ichx_priv.gpio_base, ichx_priv.use_gpio);
|
||||
if (ichx_priv.pm_base)
|
||||
release_region(ichx_priv.pm_base->start,
|
||||
resource_size(ichx_priv.pm_base));
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
|
||||
static int ichx_gpio_request_regions(struct device *dev,
|
||||
struct resource *res_base, const char *name, u8 use_gpio)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!res_base || !res_base->start || !res_base->end)
|
||||
return -ENODEV;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ichx_priv.desc->regs[0]); i++) {
|
||||
if (!(use_gpio & (1 << i)))
|
||||
continue;
|
||||
if (!devm_request_region(dev,
|
||||
res_base->start + ichx_priv.desc->regs[0][i],
|
||||
ichx_priv.desc->reglen[i], name))
|
||||
return -EBUSY;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ichx_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res_base, *res_pm;
|
||||
int err;
|
||||
struct lpc_ich_info *ich_info = dev_get_platdata(&pdev->dev);
|
||||
|
||||
if (!ich_info)
|
||||
return -ENODEV;
|
||||
|
||||
ichx_priv.dev = pdev;
|
||||
|
||||
switch (ich_info->gpio_version) {
|
||||
case ICH_I3100_GPIO:
|
||||
ichx_priv.desc = &i3100_desc;
|
||||
break;
|
||||
case ICH_V5_GPIO:
|
||||
ichx_priv.desc = &intel5_desc;
|
||||
break;
|
||||
case ICH_V6_GPIO:
|
||||
ichx_priv.desc = &ich6_desc;
|
||||
break;
|
||||
case ICH_V7_GPIO:
|
||||
ichx_priv.desc = &ich7_desc;
|
||||
break;
|
||||
case ICH_V9_GPIO:
|
||||
ichx_priv.desc = &ich9_desc;
|
||||
break;
|
||||
case ICH_V10CORP_GPIO:
|
||||
ichx_priv.desc = &ich10_corp_desc;
|
||||
break;
|
||||
case ICH_V10CONS_GPIO:
|
||||
ichx_priv.desc = &ich10_cons_desc;
|
||||
break;
|
||||
case AVOTON_GPIO:
|
||||
ichx_priv.desc = &avoton_desc;
|
||||
ichx_priv.outlvl_cache[0] = 0x06; /*core output values*/
|
||||
ichx_priv.outlvl_cache[1] = 0x7c0008; /*sus output values*/
|
||||
ichx_priv.outlvl_cache[2] = 0x0; /*no used*/
|
||||
break;
|
||||
default:
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
spin_lock_init(&ichx_priv.lock);
|
||||
res_base = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPIO);
|
||||
ichx_priv.use_gpio = ich_info->use_gpio;
|
||||
err = ichx_gpio_request_regions(&pdev->dev, res_base, pdev->name,
|
||||
ichx_priv.use_gpio);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ichx_priv.gpio_base = res_base;
|
||||
|
||||
/*
|
||||
* If necessary, determine the I/O address of ACPI/power management
|
||||
* registers which are needed to read the the GPE0 register for GPI pins
|
||||
* 0 - 15 on some chipsets.
|
||||
*/
|
||||
if (!ichx_priv.desc->uses_gpe0)
|
||||
goto init;
|
||||
|
||||
res_pm = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPE0);
|
||||
if (!res_pm) {
|
||||
pr_warn("ACPI BAR is unavailable, GPI 0 - 15 unavailable\n");
|
||||
goto init;
|
||||
}
|
||||
|
||||
if (!devm_request_region(&pdev->dev, res_pm->start,
|
||||
resource_size(res_pm), pdev->name)) {
|
||||
pr_warn("ACPI BAR is busy, GPI 0 - 15 unavailable\n");
|
||||
goto init;
|
||||
}
|
||||
|
||||
ichx_priv.pm_base = res_pm;
|
||||
|
||||
init:
|
||||
ichx_gpiolib_setup(&ichx_priv.chip);
|
||||
err = gpiochip_add_data(&ichx_priv.chip, NULL);
|
||||
if (err) {
|
||||
pr_err("Failed to register GPIOs\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
pr_info("GPIO from %d to %d on %s\n", ichx_priv.chip.base,
|
||||
ichx_priv.chip.base + ichx_priv.chip.ngpio - 1, DRV_NAME);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ichx_gpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
gpiochip_remove(&ichx_priv.chip);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
|
||||
|
||||
static struct platform_driver ichx_gpio_driver = {
|
||||
.driver = {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
|
||||
.owner = THIS_MODULE,
|
||||
#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
|
||||
#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
|
||||
.name = DRV_NAME,
|
||||
},
|
||||
.probe = ichx_gpio_probe,
|
||||
.remove = ichx_gpio_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(ichx_gpio_driver);
|
||||
|
||||
MODULE_AUTHOR("Johnson Lu <JOHNSON.LU@deltaww.com>");
|
||||
MODULE_DESCRIPTION("GPIO interface for Intel ICH series");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("platform:"DRV_NAME);
|
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
#platform init script for Delta et-6248brb
|
||||
|
||||
#fan speed monitol start
|
||||
/usr/share/sonic/device/x86_64-delta_et-6248brb-r0/fancontrol.service /usr/share/sonic/device/x86_64-delta_et-6248brb-r0/fancontrol &
|
||||
sh /usr/local/bin/led_status.sh &
|
||||
|
||||
|
||||
exit 0
|
||||
|
@ -0,0 +1,165 @@
|
||||
#!/bin/bash
|
||||
|
||||
FAN1_EEPROM="-y 0 0x55 0x0a"
|
||||
FAN2_EEPROM="-y 0 0x56 0x0a"
|
||||
FAN1_RPM="/sys/bus/i2c/devices/0-002e/fan1_input"
|
||||
FAN2_RPM="/sys/bus/i2c/devices/0-002e/fan2_input"
|
||||
FAN_TRAY1_LED="/sys/devices/platform/delta-et6248brb-gpio.0/FAN/fan1_led_ag"
|
||||
FAN_TRAY2_LED="/sys/devices/platform/delta-et6248brb-gpio.0/FAN/fan2_led_ag"
|
||||
|
||||
if [ `uname -a | awk '{print $3}'` = "4.9.0-5-amd64" ]; then
|
||||
SYS_LED_G="/sys/class/gpio/gpio453/value"
|
||||
SYS_LED_R="/sys/class/gpio/gpio454/value"
|
||||
PWR_LED_G="/sys/class/gpio/gpio455/value"
|
||||
PWR_LED_R="/sys/class/gpio/gpio489/value"
|
||||
FAN_LED_G="/sys/class/gpio/gpio485/value"
|
||||
FAN_LED_R="/sys/class/gpio/gpio494/value"
|
||||
else
|
||||
SYS_LED_G="/sys/class/gpio/gpio197/value"
|
||||
SYS_LED_R="/sys/class/gpio/gpio198/value"
|
||||
PWR_LED_G="/sys/class/gpio/gpio199/value"
|
||||
PWR_LED_R="/sys/class/gpio/gpio233/value"
|
||||
FAN_LED_G="/sys/class/gpio/gpio229/value"
|
||||
FAN_LED_R="/sys/class/gpio/gpio238/value"
|
||||
fi
|
||||
|
||||
PSU1_EEPROM="-y 2 0x50 0x00"
|
||||
PSU2_EEPROM="-y 3 0x51 0x00"
|
||||
PSU1_PG="/sys/devices/platform/delta-et6248brb-gpio.0/PSU/psu1_pg"
|
||||
PSU2_PG="/sys/devices/platform/delta-et6248brb-gpio.0/PSU/psu2_pg"
|
||||
|
||||
catfaneeprom(){
|
||||
fan_eeprom_num=0
|
||||
i2cget $FAN1_EEPROM > /dev/null 2>&1
|
||||
if [ "`echo $?`" -eq "0" ]; then
|
||||
fan_eeprom_num=$((fan_eeprom_num+1))
|
||||
elif [ "`echo $?`" -ne "0" ]; then
|
||||
fan_eeprom_num=$((fan_eeprom_num))
|
||||
fi
|
||||
|
||||
i2cget $FAN2_EEPROM > /dev/null 2>&1
|
||||
if [ "`echo $?`" -eq "0" ]; then
|
||||
fan_eeprom_num=$((fan_eeprom_num+1))
|
||||
elif [ "`echo $?`" -ne "0" ]; then
|
||||
fan_eeprom_num=$((fan_eeprom_num_num))
|
||||
fi
|
||||
}
|
||||
|
||||
catfanspeed(){
|
||||
|
||||
fan_rpm_normal_num=0
|
||||
fan1_rpm_normal_num=0
|
||||
fan1_rpm=`cat $FAN1_RPM`
|
||||
|
||||
if [ "${fan1_rpm}" -ne "960" ] && [ "${fan1_rpm}" -ne "0" ]; then
|
||||
fan1_rpm_normal_num=$((fan1_rpm_normal_num+1))
|
||||
elif [ "${fan1_rpm}" -eq "960" ] || [ "${fan1_rpm}" -eq "0" ]; then
|
||||
fan1_rpm_normal_num=$((fan1_rpm_normal_num))
|
||||
fi
|
||||
|
||||
fan2_rpm_normal_num=0
|
||||
fan2_rpm=`cat $FAN2_RPM`
|
||||
|
||||
if [ "${fan2_rpm}" -ne "960" ] && [ "${fan2_rpm}" -ne "0" ]; then
|
||||
fan2_rpm_normal_num=$((fan2_rpm_normal_num+1))
|
||||
elif [ "${fan2_rpm}" -eq "960" ] || [ "${fan2_rpm}" -eq "0" ]; then
|
||||
fan2_rpm_normal_num=$((fan2_rpm_normal_num))
|
||||
fi
|
||||
|
||||
fan_rpm_normal_num=$((fan1_rpm_normal_num+fan2_rpm_normal_num))
|
||||
}
|
||||
|
||||
setfanled(){
|
||||
if [ "${fan_eeprom_num}" -eq "2" ] && [ "${fan_rpm_normal_num}" -eq "2" ]; then
|
||||
echo "1" > $FAN_LED_G
|
||||
echo "0" > $FAN_LED_R
|
||||
elif [ "${fan_eeprom_num}" -lt "2" ] || [ "${fan_rpm_normal_num}" -lt "2" ]; then
|
||||
echo "1" > $FAN_LED_R
|
||||
echo "0" > $FAN_LED_G
|
||||
fi
|
||||
}
|
||||
|
||||
setfantrayled(){
|
||||
if [ "${fan1_rpm_normal_num}" -eq "1" ]; then
|
||||
echo "0x02" > $FAN_TRAY1_LED
|
||||
else
|
||||
echo "0x01" > $FAN_TRAY1_LED
|
||||
fi
|
||||
|
||||
if [ "${fan2_rpm_normal_num}" -eq "1" ]; then
|
||||
echo "0x02" > $FAN_TRAY2_LED
|
||||
else
|
||||
echo "0x01" > $FAN_TRAY2_LED
|
||||
fi
|
||||
}
|
||||
|
||||
catpsueeprom(){
|
||||
psu_eeprom_num=0
|
||||
i2cget $PSU1_EEPROM > /dev/null 2>&1
|
||||
if [ "`echo $?`" -eq "0" ]; then
|
||||
psu_eeprom_num=$((psu_eeprom_num+1))
|
||||
elif [ "`echo $?`" -ne "0" ]; then
|
||||
psu_eeprom_num=$((psu_eeprom_num))
|
||||
fi
|
||||
|
||||
i2cget $PSU2_EEPROM > /dev/null 2>&1
|
||||
if [ "`echo $?`" -eq "0" ]; then
|
||||
psu_eeprom_num=$((psu_eeprom_num+1))
|
||||
elif [ "`echo $?`" -ne "0" ]; then
|
||||
psu_eeprom_num=$((psu_eeprom_num))
|
||||
fi
|
||||
}
|
||||
|
||||
catpsupowergood(){
|
||||
|
||||
psu_normal_num=0
|
||||
psu1_normal_num=0
|
||||
psu1_good=`cat $PSU1_PG | head -n 1`
|
||||
|
||||
if [ "${psu1_good}" -eq "1" ]; then
|
||||
psu1_normal_num=$((psu1_normal_num+1))
|
||||
elif [ "${psu1_good}" -eq "0" ]; then
|
||||
psu1_normal_num=$((psu1_normal_num))
|
||||
fi
|
||||
|
||||
psu2_normal_num=0
|
||||
psu2_good=`cat $PSU2_PG | head -n 1`
|
||||
|
||||
if [ "${psu2_good}" -eq "1" ]; then
|
||||
psu2_normal_num=$((psu2_normal_num+1))
|
||||
elif [ "${psu2_good}" -eq "0" ]; then
|
||||
psu2_normal_num=$((psu2_normal_num))
|
||||
fi
|
||||
|
||||
psu_normal_num=$((psu1_normal_num+psu2_normal_num))
|
||||
}
|
||||
|
||||
setpsuled(){
|
||||
if [ "${psu_eeprom_num}" -eq "2" ] && [ "${psu_normal_num}" -eq "2" ]; then
|
||||
echo "1" > $PWR_LED_G
|
||||
echo "0" > $PWR_LED_R
|
||||
elif [ "${psu_eeprom_num}" -lt "2" ] || [ "${psu_normal_num}" -lt "2" ]; then
|
||||
echo "1" > $PWR_LED_R
|
||||
echo "0" > $PWR_LED_G
|
||||
fi
|
||||
}
|
||||
|
||||
platformstatus(){
|
||||
echo "1" > $SYS_LED_G
|
||||
echo "0" > $SYS_LED_R
|
||||
catfaneeprom
|
||||
catfanspeed
|
||||
setfanled
|
||||
setfantrayled
|
||||
|
||||
catpsueeprom
|
||||
catpsupowergood
|
||||
setpsuled
|
||||
}
|
||||
|
||||
while true
|
||||
do
|
||||
platformstatus
|
||||
sleep 1
|
||||
done
|
||||
|
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Delta ag5648 Platform modules
|
||||
After=local-fs.target
|
||||
Before=pmon.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=-/etc/init.d/platform-modules-ag5648 start
|
||||
ExecStop=-/etc/init.d/platform-modules-ag5648 stop
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Delta et-6248brb Platform modules
|
||||
After=local-fs.target
|
||||
Before=pmon.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=-/etc/init.d/platform-modules-et-6248brb start
|
||||
ExecStop=-/etc/init.d/platform-modules-et-6248brb stop
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user