[Nephos]: Add Porsch project with Nephos (#2224)

This commit is contained in:
Peter5Lin 2018-11-10 06:01:43 +08:00 committed by Shuotian Cheng
parent e5af5d7d1b
commit e07d563aa2
27 changed files with 5454 additions and 2 deletions

View File

@ -0,0 +1,3 @@
CONSOLE_PORT=0x2f8
CONSOLE_DEV=1
CONSOLE_SPEED=115200

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python
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/bus/i2c/devices/4-0054/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,92 @@
#
# psuutil.py
# Platform-specific PSU status interface for SONiC
#
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"""
SYSFS_PSU_DIR = "/sys/bus/i2c/devices/7-0075"
def __init__(self):
PsuBase.__init__(self)
# Get sysfs attribute
def get_attr_value(self, attr_path):
retval = 'ERR'
if (not os.path.isfile(attr_path)):
return retval
try:
with open(attr_path, 'r') as fd:
retval = fd.read()
except Exception as error:
logging.error("Unable to open ", attr_path, " file !")
retval = retval.rstrip('\r\n')
fd.close()
return retval
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
"""
MAX_PSUS = 2
return MAX_PSUS
def get_psu_status(self, index):
"""
Retrieves the oprational status of power supply unit (PSU) defined
by index <index>
:param index: An integer, index of the PSU of which to query status
:return: Boolean, True if PSU is operating properly, False if PSU is\
faulty
"""
status = 0
attr_file = 'psu_'+str(index)+'_status'
attr_path = self.SYSFS_PSU_DIR +'/' + attr_file
attr_value = self.get_attr_value(attr_path)
if (attr_value != 'ERR'):
attr_value = int(attr_value, 16)
# Check for PSU status
if (attr_value == 1):
status = 1
return status
def get_psu_presence(self, index):
"""
Retrieves the presence status of power supply unit (PSU) defined
by index <index>
:param index: An integer, index of the PSU of which to query status
:return: Boolean, True if PSU is plugged, False if not
"""
status = 0
attr_file = 'psu_'+str(index)+'_present'
attr_path = self.SYSFS_PSU_DIR +'/' + attr_file
attr_value = self.get_attr_value(attr_path)
if (attr_value != 'ERR'):
attr_value = int(attr_value, 16)
# Check for PSU presence
if (attr_value == 0):
status = 1
return status

View File

@ -0,0 +1,238 @@
#!/usr/bin/env python
try:
import os
import re
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
class SfpUtil(SfpUtilBase):
"""Platform specific sfputil class"""
port_start = 0
port_end = 53
ports_in_block = 54
cplda_sfp_num = 24
cpldb_sfp_num = 12
cpldc_sfp_num = 18
port_to_eeprom_mapping = {}
port_to_i2c_mapping = {}
sfp_ports = range(0, ports_in_block)
qsfp_ports = range(ports_in_block - 6, ports_in_block)
def __init__(self):
for x in range(self.port_start, self.port_end + 1):
if x < self.cpldb_sfp_num:
self.port_to_i2c_mapping.update({x:7})
elif x < self.cplda_sfp_num + self.cpldb_sfp_num:
self.port_to_i2c_mapping.update({x:6})
else:
self.port_to_i2c_mapping.update({x:8})
for x in range(self.port_start, self.port_end+1):
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp'+str(x+1)+'_eeprom'
port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x])
self.port_to_eeprom_mapping[x] = port_eeprom_path
SfpUtilBase.__init__(self)
def get_presence(self, port_num):
if port_num < self.port_start or port_num > self.port_end:
return False
if port_num < self.cpldb_sfp_num:
presence_path = '/sys/bus/i2c/devices/7-0075/sfp'+str(port_num+1)+'_present'
elif port_num < self.cpldb_sfp_num + self.cplda_sfp_num:
presence_path = '/sys/bus/i2c/devices/6-0074/sfp'+str(port_num+1)+'_present'
else:
presence_path = '/sys/bus/i2c/devices/8-0076/sfp'+str(port_num+1)+'_present'
try:
file = open(presence_path)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
value = int(file.readline().rstrip())
file.close()
if value == 0:
return True
return False
def get_low_power_mode(self, port_num):
if port_num not in self.qsfp_ports:
return False
lowpower_path = '/sys/bus/i2c/devices/8-0076/sfp'+str(port_num+1)+'_lowpower'
try:
file = open(lowpower_path)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
value = int(file.readline().rstrip())
file.close()
if value == 1:
return True
return False
def set_low_power_mode(self, port_num, lpmode):
if port_num not in self.qsfp_ports:
return False
lowpower_path = '/sys/bus/i2c/devices/8-0076/sfp'+str(port_num+1)+'_lowpower'
# LPMode is active high; set or clear the bit accordingly
if lpmode is True:
value = 1
else:
value = 0
try:
file = open(lowpower_path, "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
file.seek(0)
file.write(str(value))
file.close()
return True
def reset(self, port_num):
if port_num not in self.qsfp_ports:
return False
reset_path = '/sys/bus/i2c/devices/8-0076/sfp'+str(port_num+1)+'_reset'
try:
file = open(reset_path, "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
file.seek(0)
file.write(str(2))
file.close()
# Sleep 1 second to allow it to settle
time.sleep(1)
try:
file = open(reset_path, "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
file.seek(0)
file.write(str(1))
file.close()
return True
def read_porttab_mappings(self, porttabfile):
logical = []
logical_to_bcm = {}
logical_to_physical = {}
physical_to_logical = {}
last_fp_port_index = 0
last_portname = ""
first = 1
port_pos_in_file = 0
parse_fmt_port_config_ini = False
try:
f = open(porttabfile)
except:
raise
parse_fmt_port_config_ini = (os.path.basename(porttabfile) == "port_config.ini")
# Read the porttab file and generate dicts
# with mapping for future reference.
# XXX: move the porttab
# parsing stuff to a separate module, or reuse
# if something already exists
for line in f:
line.strip()
if re.search("^#", line) is not None:
continue
# Parsing logic for 'port_config.ini' file
if (parse_fmt_port_config_ini):
# bcm_port is not explicitly listed in port_config.ini format
# Currently we assume ports are listed in numerical order according to bcm_port
# so we use the port's position in the file (zero-based) as bcm_port
portname = line.split()[0]
bcm_port = str(port_pos_in_file)
if len(line.split()) >= 4:
fp_port_index = int(line.split()[3])
else:
fp_port_index = portname.split("Ethernet").pop()
fp_port_index = int(fp_port_index.split("s").pop(0))/4
else: # Parsing logic for older 'portmap.ini' file
(portname, bcm_port) = line.split("=")[1].split(",")[:2]
fp_port_index = portname.split("Ethernet").pop()
fp_port_index = int(fp_port_index.split("s").pop(0))/4
if ((len(self.sfp_ports) > 0) and (fp_port_index not in self.sfp_ports)):
continue
if first == 1:
# Initialize last_[physical|logical]_port
# to the first valid port
last_fp_port_index = fp_port_index
last_portname = portname
first = 0
logical.append(portname)
logical_to_bcm[portname] = "xe" + bcm_port
logical_to_physical[portname] = [fp_port_index]
if physical_to_logical.get(fp_port_index) is None:
physical_to_logical[fp_port_index] = [portname]
else:
physical_to_logical[fp_port_index].append(
portname)
if (fp_port_index - last_fp_port_index) > 1:
# last port was a gang port
for p in range(last_fp_port_index+1, fp_port_index):
logical_to_physical[last_portname].append(p)
if physical_to_logical.get(p) is None:
physical_to_logical[p] = [last_portname]
else:
physical_to_logical[p].append(last_portname)
last_fp_port_index = fp_port_index
last_portname = portname
port_pos_in_file += 1
self.logical = logical
self.logical_to_bcm = logical_to_bcm
self.logical_to_physical = logical_to_physical
self.physical_to_logical = physical_to_logical
"""
print "logical: " + self.logical
print "logical to bcm: " + self.logical_to_bcm
print "logical to physical: " + self.logical_to_physical
print "physical to logical: " + self.physical_to_logical
"""

View File

@ -0,0 +1,55 @@
#name lanes alias index speed
Ethernet0 8 Ethernet1/1 0 10000
Ethernet1 9 Ethernet2/1 1 10000
Ethernet2 10 Ethernet3/1 2 10000
Ethernet3 11 Ethernet4/1 3 10000
Ethernet4 12 Ethernet5/1 4 10000
Ethernet5 13 Ethernet6/1 5 10000
Ethernet6 14 Ethernet7/1 6 10000
Ethernet7 15 Ethernet8/1 7 10000
Ethernet8 16 Ethernet9/1 8 10000
Ethernet9 17 Ethernet10/1 9 10000
Ethernet10 18 Ethernet11/1 10 10000
Ethernet11 19 Ethernet12/1 11 10000
Ethernet12 20 Ethernet13/1 12 10000
Ethernet13 21 Ethernet14/1 13 10000
Ethernet14 22 Ethernet15/1 14 10000
Ethernet15 23 Ethernet16/1 15 10000
Ethernet16 32 Ethernet17/1 16 10000
Ethernet17 33 Ethernet18/1 17 10000
Ethernet18 34 Ethernet19/1 18 10000
Ethernet19 35 Ethernet20/1 19 10000
Ethernet20 40 Ethernet21/1 20 10000
Ethernet21 41 Ethernet22/1 21 10000
Ethernet22 42 Ethernet23/1 22 10000
Ethernet23 43 Ethernet24/1 23 10000
Ethernet24 48 Ethernet25/1 24 10000
Ethernet25 49 Ethernet26/1 25 10000
Ethernet26 50 Ethernet27/1 26 10000
Ethernet27 51 Ethernet28/1 27 10000
Ethernet28 56 Ethernet29/1 28 10000
Ethernet29 57 Ethernet30/1 29 10000
Ethernet30 58 Ethernet31/1 30 10000
Ethernet31 59 Ethernet32/1 31 10000
Ethernet32 64 Ethernet33/1 32 10000
Ethernet33 65 Ethernet34/1 33 10000
Ethernet34 66 Ethernet35/1 34 10000
Ethernet35 67 Ethernet36/1 35 10000
Ethernet36 68 Ethernet37/1 36 10000
Ethernet37 69 Ethernet38/1 37 10000
Ethernet38 70 Ethernet39/1 38 10000
Ethernet39 71 Ethernet40/1 39 10000
Ethernet40 72 Ethernet41/1 40 10000
Ethernet41 73 Ethernet42/1 41 10000
Ethernet42 74 Ethernet43/1 42 10000
Ethernet43 75 Ethernet44/1 43 10000
Ethernet44 76 Ethernet45/1 44 10000
Ethernet45 77 Ethernet46/1 45 10000
Ethernet46 78 Ethernet47/1 46 10000
Ethernet47 79 Ethernet48/1 47 10000
Ethernet48 80,81,82,83 Ethernet49/1 48 100000
Ethernet49 84,85,86,87 Ethernet50/1 49 100000
Ethernet50 104,105,106,107 Ethernet51/1 50 100000
Ethernet51 108,109,110,111 Ethernet52/1 51 100000
Ethernet52 112,113,114,115 Ethernet53/1 52 100000
Ethernet53 116,117,118,119 Ethernet54/1 53 100000

View File

@ -0,0 +1,2 @@
SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/tau-porsche.cfg
SAI_DSH_CONFIG_FILE=/usr/share/sonic/hwsku/tau-porsche.dsh

View File

@ -0,0 +1,497 @@
init start stage unit=0 low-level
init set port-map unit=0 port=0 eth-macro=2 lane=0 max-speed=10g active=true
init set port-map unit=0 port=1 eth-macro=2 lane=1 max-speed=10g active=true
init set port-map unit=0 port=2 eth-macro=2 lane=2 max-speed=10g active=true
init set port-map unit=0 port=3 eth-macro=2 lane=3 max-speed=10g active=true
init set port-map unit=0 port=4 eth-macro=3 lane=0 max-speed=10g active=true
init set port-map unit=0 port=5 eth-macro=3 lane=1 max-speed=10g active=true
init set port-map unit=0 port=6 eth-macro=3 lane=2 max-speed=10g active=true
init set port-map unit=0 port=7 eth-macro=3 lane=3 max-speed=10g active=true
init set port-map unit=0 port=8 eth-macro=4 lane=0 max-speed=10g active=true
init set port-map unit=0 port=9 eth-macro=4 lane=1 max-speed=10g active=true
init set port-map unit=0 port=10 eth-macro=4 lane=2 max-speed=10g active=true
init set port-map unit=0 port=11 eth-macro=4 lane=3 max-speed=10g active=true
init set port-map unit=0 port=12 eth-macro=5 lane=0 max-speed=10g active=true
init set port-map unit=0 port=13 eth-macro=5 lane=1 max-speed=10g active=true
init set port-map unit=0 port=14 eth-macro=5 lane=2 max-speed=10g active=true
init set port-map unit=0 port=15 eth-macro=5 lane=3 max-speed=10g active=true
init set port-map unit=0 port=16 eth-macro=8 lane=0 max-speed=10g active=true
init set port-map unit=0 port=17 eth-macro=8 lane=1 max-speed=10g active=true
init set port-map unit=0 port=18 eth-macro=8 lane=2 max-speed=10g active=true
init set port-map unit=0 port=19 eth-macro=8 lane=3 max-speed=10g active=true
init set port-map unit=0 port=20 eth-macro=10 lane=0 max-speed=10g active=true
init set port-map unit=0 port=21 eth-macro=10 lane=1 max-speed=10g active=true
init set port-map unit=0 port=22 eth-macro=10 lane=2 max-speed=10g active=true
init set port-map unit=0 port=23 eth-macro=10 lane=3 max-speed=10g active=true
init set port-map unit=0 port=24 eth-macro=12 lane=0 max-speed=10g active=true
init set port-map unit=0 port=25 eth-macro=12 lane=1 max-speed=10g active=true
init set port-map unit=0 port=26 eth-macro=12 lane=2 max-speed=10g active=true
init set port-map unit=0 port=27 eth-macro=12 lane=3 max-speed=10g active=true
init set port-map unit=0 port=28 eth-macro=14 lane=0 max-speed=10g active=true
init set port-map unit=0 port=29 eth-macro=14 lane=1 max-speed=10g active=true
init set port-map unit=0 port=30 eth-macro=14 lane=2 max-speed=10g active=true
init set port-map unit=0 port=31 eth-macro=14 lane=3 max-speed=10g active=true
init set port-map unit=0 port=32 eth-macro=16 lane=0 max-speed=10g active=true
init set port-map unit=0 port=33 eth-macro=16 lane=1 max-speed=10g active=true
init set port-map unit=0 port=34 eth-macro=16 lane=2 max-speed=10g active=true
init set port-map unit=0 port=35 eth-macro=16 lane=3 max-speed=10g active=true
init set port-map unit=0 port=36 eth-macro=17 lane=0 max-speed=10g active=true
init set port-map unit=0 port=37 eth-macro=17 lane=1 max-speed=10g active=true
init set port-map unit=0 port=38 eth-macro=17 lane=2 max-speed=10g active=true
init set port-map unit=0 port=39 eth-macro=17 lane=3 max-speed=10g active=true
init set port-map unit=0 port=40 eth-macro=18 lane=0 max-speed=10g active=true
init set port-map unit=0 port=41 eth-macro=18 lane=1 max-speed=10g active=true
init set port-map unit=0 port=42 eth-macro=18 lane=2 max-speed=10g active=true
init set port-map unit=0 port=43 eth-macro=18 lane=3 max-speed=10g active=true
init set port-map unit=0 port=44 eth-macro=19 lane=0 max-speed=10g active=true
init set port-map unit=0 port=45 eth-macro=19 lane=1 max-speed=10g active=true
init set port-map unit=0 port=46 eth-macro=19 lane=2 max-speed=10g active=true
init set port-map unit=0 port=47 eth-macro=19 lane=3 max-speed=10g active=true
init set port-map unit=0 port=48 eth-macro=20 lane=0 max-speed=100g active=true
init set port-map unit=0 port=49 eth-macro=21 lane=0 max-speed=100g active=true
init set port-map unit=0 port=50 eth-macro=26 lane=0 max-speed=100g active=true
init set port-map unit=0 port=51 eth-macro=27 lane=0 max-speed=100g active=true
init set port-map unit=0 port=52 eth-macro=28 lane=0 max-speed=100g active=true
init set port-map unit=0 port=53 eth-macro=29 lane=0 max-speed=100g active=true init-done=true
init start stage unit=0 task-rsrc
init start stage unit=0 module
init start stage unit=0 task
phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=tx data=0x00
phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=tx data=0x01
phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=tx data=0x02
phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=tx data=0x03
phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=tx data=0x03.02.01.00
phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=tx data=0x01.02.03.00
phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=tx data=0x01.02.03.00
phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=tx data=0x03.02.01.00
phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=tx data=0x03.02.01.00
phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=tx data=0x01.02.03.00
phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=rx data=0x02
phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=rx data=0x01
phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=rx data=0x00
phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=rx data=0x03
phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=rx data=0x03.00.01.02
phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=rx data=0x03.00.01.02
phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=rx data=0x03.01.02.00
phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=rx data=0x03.02.01.00
phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=rx data=0x03.02.01.00
phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=rx data=0x00.01.02.03
phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=tx data=0x00
phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=tx data=0x01
phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=tx data=0x00.01.00.00
phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=tx data=0x00.00.01.00
phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=tx data=0x01.00.01.01
phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=tx data=0x01.01.01.01
phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=tx data=0x01.00.00.00
phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=tx data=0x00.00.01.00
phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=rx data=0x01
phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=rx data=0x00
phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=rx data=0x00.01.00.00
phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=rx data=0x00.00.01.00
phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=rx data=0x00.00.01.01
phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=rx data=0x00.01.00.01
phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=rx data=0x00.01.00.01
phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=rx data=0x01.01.01.01
phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c2 data=0x00
phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=cn1 data=0x04
phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c0 data=0x1E
phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c1 data=0x02
phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c2 data=0x00
phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=cn1 data=0x04
phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c0 data=0x1E
phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c1 data=0x02
phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c2 data=0x00
phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=cn1 data=0x04
phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c0 data=0x1E
phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c1 data=0x02
phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c2 data=0x00
phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=cn1 data=0x04
phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c0 data=0x1E
phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c1 data=0x02
phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c1 data=0x07
phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c1 data=0x07
phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c1 data=0x07
phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c1 data=0x07
phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c1 data=0x07
phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c1 data=0x07
phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c1 data=0x07
phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c0 data=0x1B
phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c1 data=0x07
phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c0 data=0x1D
phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c1 data=0x05
phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c0 data=0x1D
phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c1 data=0x05
phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c0 data=0x1D
phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c1 data=0x05
phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c0 data=0x1D
phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c1 data=0x05
phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c1 data=0x05
phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c1 data=0x05
phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c1 data=0x05
phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c1 data=0x05
phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c2 data=0x02
phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=cn1 data=0x00
phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c0 data=0x1C
phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c1 data=0x06
phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c2 data=0x02.02.02.02
phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=cn1 data=0x00.00.00.00
phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C
phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c1 data=0x06.06.06.06
phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c2 data=0x02.02.02.02
phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=cn1 data=0x00.00.00.00
phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B
phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c1 data=0x06.06.06.06
phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c2 data=0x02.02.02.02
phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=cn1 data=0x00.00.00.00
phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B
phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c1 data=0x06.06.06.06
phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c2 data=0x02.02.02.02
phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=cn1 data=0x00.00.00.00
phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B
phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c1 data=0x06.06.06.06
phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c2 data=0x02.02.02.02
phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=cn1 data=0x00.00.00.00
phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B
phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c1 data=0x07.07.07.07
phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c2 data=0x02.02.02.02
phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=cn1 data=0x00.00.00.00
phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c0 data=0x1A.1A.1A.1A
phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c1 data=0x07.07.07.07
port set property unit=0 portlist=0-47 speed=10g
port set property unit=0 portlist=0-47 medium-type=sr
port set property unit=0 portlist=48-53 speed=100g
port set property unit=0 portlist=48-53 medium-type=sr4
port set property unit=0 portlist=0-53 fec=disable
port set property unit=0 portlist=0-53 an=disable
port set property unit=0 portlist=0-53 admin=enable

View File

@ -0,0 +1,23 @@
#This configuration file is for customer init value feature. Please refer to mtk_cfg.h/mtk_cfg.c for detail.
#1. The lines beginning with # are comment lines. The lines beginning with number are the setting lines.
#2. There are five parameters which can be set.
# 1) the first is unit.
# 2) the second is NPS_CFG_TYPE_XXX. Refer to NPS_CFG_TYPE_T.
# 3) the 3-5 are {param0, param1, value} pairs. Refer to NPS_CFG_VALUE_T. Support HEX format.
# 4) the (unit, NPS_CFG_TYPE_XXX, param0, param1) group is the key to get the correspingding value.
# There should be no same (unit, NPS_CFG_TYPE_XXX, param0, param1) group.
#3. User must follow correct format to apply the setting. Please refer to below commentted example(#0 NPS_CFG_TYPE_L2_ADDR_MODE 0 0 1);
#4. Usage under the linux shell:
# 1) ./image-path/image-name -c cfg-path/NPS_Ari_EVB_24.cfg : mamually specify directory path if they are not in current work dirctory.
# 2) ./image-name -c NPS_Ari_EVB_24.cfg : the image and the NPS_Ari_EVB_24.cfg are in the current work directory.
#unit NPS_CFG_TYPE_XXX param0 param1 value
#---- ---------------- ------ ------ -----
0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1
0 NPS_CFG_TYPE_LED_CFG 0 0 3
0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 1
0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 1
0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1
0 NPS_CFG_TYPE_HASH_L2_FDB_REGION_ENTRY_NUM 0 0 49152
0 NPS_CFG_TYPE_HASH_L3_WITH_IPV6_PREFIX_64_REGION_ENTRY_NUM 0 0 32768

View File

@ -6,6 +6,7 @@ $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
$(SONIC_ONE_IMAGE)_INSTALLS += $(NEPHOS_NPS_KERNEL)
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9130_32X_PLATFORM_MODULE) \
$(INGRASYS_S9230_64X_PLATFORM_MODULE) \
$(ACCTON_AS7116_54X_PLATFORM_MODULE)
$(ACCTON_AS7116_54X_PLATFORM_MODULE) \
$(PEGATRON_PORSCHE_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
SONIC_INSTALLERS += $(SONIC_ONE_IMAGE)

View File

@ -0,0 +1,13 @@
# Pegatron Platform modules
PEGATRON_PORSCHE_PLATFORM_MODULE_VERSION = 0.1
export PEGATRON_PORSCHE_PLATFORM_MODULE_VERSION
PEGATRON_PORSCHE_PLATFORM_MODULE = sonic-platform-pegatron-porsche_$(PEGATRON_PORSCHE_PLATFORM_MODULE_VERSION)_amd64.deb
$(PEGATRON_PORSCHE_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-pegatron
$(PEGATRON_PORSCHE_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
$(PEGATRON_PORSCHE_PLATFORM_MODULE)_PLATFORM = x86_64-pegatron_porsche-r0
SONIC_DPKG_DEBS += $(PEGATRON_PORSCHE_PLATFORM_MODULE)
$(eval $(call add_extra_package,$(PEGATRON_PORSCHE_PLATFORM_MODULE)))

View File

@ -2,6 +2,7 @@ include $(PLATFORM_PATH)/sdk.mk
include $(PLATFORM_PATH)/sai.mk
include $(PLATFORM_PATH)/platform-modules-ingrasys.mk
include $(PLATFORM_PATH)/platform-modules-accton.mk
include $(PLATFORM_PATH)/platform-modules-pegatron.mk
include $(PLATFORM_PATH)/docker-orchagent-nephos.mk
include $(PLATFORM_PATH)/docker-syncd-nephos.mk
include $(PLATFORM_PATH)/docker-syncd-nephos-rpc.mk

View File

@ -0,0 +1,16 @@
Copyright (C) 2016 Microsoft, Inc
Copyright (C) 2018 Pegatron Corporation.
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.

View File

@ -0,0 +1 @@
platform drivers of Pegatron products for the SONiC project

View File

@ -0,0 +1,5 @@
sonic-pegatron-platform-modules (0.1) unstable; urgency=low
* Initial release
-- Pegatron <Peter5_Lin@pegatroncorp.com> Mon, 12 Mar 2018 15:22:37 +0800

View File

@ -0,0 +1 @@
9

View File

@ -0,0 +1,12 @@
Source: sonic-pegatron-platform-modules
Section: main
Priority: extra
Maintainer: Pegatron <Peter5_Lin@pegatroncorp.com>
Build-Depends: debhelper (>= 8.0.0), bzip2
Standards-Version: 3.9.3
Package: sonic-platform-pegatron-porsche
Architecture: amd64
Depends: linux-image-3.16.0-5-amd64
Description: kernel modules for platform devices such as fan, led, sfp

View File

@ -0,0 +1,88 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
include /usr/share/dpkg/pkg-info.mk
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export INSTALL_MOD_DIR:=extra
PYTHON ?= python2
PACKAGE_PRE_NAME := sonic-platform-pegatron
KVERSION ?= $(shell uname -r)
KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= porsche
MODULE_DIR := modules
UTILS_DIR := utils
SERVICE_DIR := service
SCRIPTS_DIR := scripts
CONF_DIR := conf
%:
dh $@ --with systemd,python2,python3 --buildsystem=pybuild
clean:
dh_testdir
dh_testroot
dh_clean
build:
#make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC)
(for mod in $(MODULE_DIRS); do \
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \
#$(PYTHON) $${mod}/setup.py build; \
done)
binary: binary-arch binary-indep
# Nothing to do
binary-arch:
# Nothing to do
#install: build
#dh_testdir
#dh_testroot
#dh_clean -k
#dh_installdirs
binary-indep:
dh_testdir
dh_installdirs
# Custom package commands
(for mod in $(MODULE_DIRS); do \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/bin; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \
cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \
cp $(MOD_SRC_DIR)/$${mod}/$(SCRIPTS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/bin/; \
#$(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
done)
# Resuming debhelper scripts
dh_testroot
dh_install
dh_installchangelogs
dh_installdocs
dh_systemd_enable
dh_installinit
dh_systemd_start
dh_link
dh_fixperms
dh_compress
dh_strip
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
.PHONY: build binary binary-arch binary-indep clean

View File

@ -0,0 +1 @@
obj-m:=pegatron_porsche_cpld.o pegatron_hwmon_mcu.o pegatron_porsche_sfp.o

View File

@ -0,0 +1 @@
../../common/modules/pegatron_hwmon_mcu.c

View File

@ -0,0 +1,431 @@
/*
* A SFP driver for the porsche platform
*
* Copyright (C) 2018 Pegatron Corporation.
* Peter5_Lin <Peter5_Lin@pegatroncorp.com.tw>
*
* 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.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/mod_devicetable.h>
#include <linux/log2.h>
#include <linux/bitops.h>
#include <linux/jiffies.h>
#include <linux/of.h>
#include <linux/i2c.h>
#undef PEGA_DEBUG
/*#define PEGA_DEBUG*/
#ifdef PEGA_DEBUG
#define DBG(x) x
#else
#define DBG(x)
#endif /* DEBUG */
#define SFP_EEPROM_SIZE 256
#define SFP_EEPROM_A0_ADDR 0x50
#define SFP_EEPROM_A2_ADDR 0x51
#define SFP_EEPROM_BUS_TYPE I2C_SMBUS_I2C_BLOCK_DATA
#define CPLDA_SFP_NUM 24
#define CPLDB_SFP_NUM 12
#define CPLDC_SFP_NUM 18
#define CPLDA_ADDRESS 0x74
#define CPLDB_ADDRESS 0x75
#define CPLDC_ADDRESS 0x76
#define SFP_13_36_SCL_BASE 0x4
#define SFP_1_12_SCL_BASE 0x2
#define SFP_37_54_SCL_BASE 0x5
#define QSFP_I2C_ENABLE_BASE 0x17
#define GET_BIT(data, bit, value) value = (data >> bit) & 0x1
#define SET_BIT(data, bit) data |= (1 << bit)
#define CLEAR_BIT(data, bit) data &= ~(1 << bit)
enum cpld_croups { cpld_group_a, cpld_group_b, cpld_group_c};
static const unsigned short normal_i2c[] = { SFP_EEPROM_A0_ADDR, SFP_EEPROM_A2_ADDR, I2C_CLIENT_END };
static char *SFP_CPLD_GROUPA_MAPPING[CPLDA_SFP_NUM][16]={0};
static char *SFP_CPLD_GROUPB_MAPPING[CPLDB_SFP_NUM][16]={0};
static char *SFP_CPLD_GROUPC_MAPPING[CPLDC_SFP_NUM][16]={0};
/*
* This parameter is to help this driver avoid blocking other drivers out
* of I2C for potentially troublesome amounts of time. With a 100 kHz I2C
* clock, one 256 byte read takes about 1/43 second which is excessive;
* but the 1/170 second it takes at 400 kHz may be quite reasonable; and
* at 1 MHz (Fm+) a 1/430 second delay could easily be invisible.
*
* This value is forced to be a power of two so that writes align on pages.
*/
static unsigned io_limit = 128;
module_param(io_limit, uint, 0);
MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)");
/*
* Specs often allow 5 msec for a page write, sometimes 20 msec;
* it's important to recover from write timeouts.
*/
static unsigned write_timeout = 25;
module_param(write_timeout, uint, 0);
MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)");
struct porsche_sfp_data {
struct mutex lock;
struct bin_attribute bin;
int use_smbus;
kernel_ulong_t driver_data;
struct i2c_client *client;
};
extern int pegatron_porsche_cpld_read(unsigned short cpld_addr, u8 reg);
extern int pegatron_porsche_cpld_write(unsigned short cpld_addr, u8 reg, u8 value);
static ssize_t porsche_sfp_eeprom_read(struct porsche_sfp_data *data, char *buf,
unsigned offset, size_t count)
{
struct i2c_msg msg[2];
u8 msgbuf[2];
struct i2c_client *client = data->client;
unsigned long timeout, read_time;
int status;
memset(msg, 0, sizeof(msg));
if (count > io_limit)
count = io_limit;
/* Smaller eeproms can work given some SMBus extension calls */
if (count > I2C_SMBUS_BLOCK_MAX)
count = I2C_SMBUS_BLOCK_MAX;
/*
* Reads fail if the previous write didn't complete yet. We may
* loop a few times until this one succeeds, waiting at least
* long enough for one entire page write to work.
*/
timeout = jiffies + msecs_to_jiffies(write_timeout);
do {
read_time = jiffies;
switch (data->use_smbus) {
case I2C_SMBUS_I2C_BLOCK_DATA:
status = i2c_smbus_read_i2c_block_data(client, offset,
count, buf);
break;
case I2C_SMBUS_WORD_DATA:
status = i2c_smbus_read_word_data(client, offset);
if (status >= 0) {
buf[0] = status & 0xff;
if (count == 2)
buf[1] = status >> 8;
status = count;
}
break;
case I2C_SMBUS_BYTE_DATA:
status = i2c_smbus_read_byte_data(client, offset);
if (status >= 0) {
buf[0] = status;
status = count;
}
break;
default:
status = i2c_transfer(client->adapter, msg, 2);
if (status == 2)
status = count;
}
dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n",
count, offset, status, jiffies);
if (status == count)
return count;
/* REVISIT: at HZ=100, this is sloooow */
msleep(1);
} while (time_before(read_time, timeout));
return -ETIMEDOUT;
}
static ssize_t porsche_sfp_read(struct porsche_sfp_data *data,
char *buf, loff_t off, size_t count)
{
ssize_t retval = 0;
if (unlikely(!count))
return count;
/*
* Read data from chip, protecting against concurrent updates
* from this host, but not from other I2C masters.
*/
mutex_lock(&data->lock);
while (count) {
ssize_t status;
status = porsche_sfp_eeprom_read(data, buf, off, count);
if (status <= 0) {
if (retval == 0)
retval = status;
break;
}
buf += status;
off += status;
count -= status;
retval += status;
}
mutex_unlock(&data->lock);
return retval;
}
static ssize_t
porsche_sfp_bin_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr,
char *buf, loff_t off, size_t count)
{
int i;
u8 cpldData = 0;
struct porsche_sfp_data *data;
/*SFP 1-12*/
for(i=0; i<CPLDB_SFP_NUM; i++)
{
if(!strcmp(attr->attr.name, SFP_CPLD_GROUPB_MAPPING[i]))
{
pegatron_porsche_cpld_write(CPLDB_ADDRESS, SFP_1_12_SCL_BASE, i+1);
goto check_done;
}
}
/*SFP 13-36*/
for(i=0; i<CPLDA_SFP_NUM; i++)
{
if(!strcmp(attr->attr.name, SFP_CPLD_GROUPA_MAPPING[i]))
{
pegatron_porsche_cpld_write(CPLDA_ADDRESS, SFP_13_36_SCL_BASE, i+1);
goto check_done;
}
}
/*SFP 37-54*/
for(i=0; i<CPLDC_SFP_NUM; i++)
{
if(!strcmp(attr->attr.name, SFP_CPLD_GROUPC_MAPPING[i]))
{
/* Enable QSFP i2c function */
if(i >= 12)
{
cpldData = 0xff;
cpldData = pegatron_porsche_cpld_read(CPLDC_ADDRESS, QSFP_I2C_ENABLE_BASE);
CLEAR_BIT(cpldData, i-12);
pegatron_porsche_cpld_write(CPLDC_ADDRESS, QSFP_I2C_ENABLE_BASE, cpldData);
}
pegatron_porsche_cpld_write(CPLDC_ADDRESS, SFP_37_54_SCL_BASE, i+1);
goto check_done;
}
}
check_done:
data = dev_get_drvdata(container_of(kobj, struct device, kobj));
return porsche_sfp_read(data, buf, off, count);
}
#define SFP_EEPROM_ATTR(_num) \
static struct bin_attribute sfp##_num##_eeprom_attr = { \
.attr = { \
.name = __stringify(sfp##_num##_eeprom), \
.mode = S_IRUGO\
}, \
.size = SFP_EEPROM_SIZE, \
.read = porsche_sfp_bin_read, \
}
SFP_EEPROM_ATTR(1);SFP_EEPROM_ATTR(2);SFP_EEPROM_ATTR(3);SFP_EEPROM_ATTR(4);SFP_EEPROM_ATTR(5);SFP_EEPROM_ATTR(6);SFP_EEPROM_ATTR(7);SFP_EEPROM_ATTR(8);SFP_EEPROM_ATTR(9);
SFP_EEPROM_ATTR(10);SFP_EEPROM_ATTR(11);SFP_EEPROM_ATTR(12);SFP_EEPROM_ATTR(13);SFP_EEPROM_ATTR(14);SFP_EEPROM_ATTR(15);SFP_EEPROM_ATTR(16);SFP_EEPROM_ATTR(17);SFP_EEPROM_ATTR(18);
SFP_EEPROM_ATTR(19);SFP_EEPROM_ATTR(20);SFP_EEPROM_ATTR(21);SFP_EEPROM_ATTR(22);SFP_EEPROM_ATTR(23);SFP_EEPROM_ATTR(24);SFP_EEPROM_ATTR(25);SFP_EEPROM_ATTR(26);SFP_EEPROM_ATTR(27);
SFP_EEPROM_ATTR(28);SFP_EEPROM_ATTR(29);SFP_EEPROM_ATTR(30);SFP_EEPROM_ATTR(31);SFP_EEPROM_ATTR(32);SFP_EEPROM_ATTR(33);SFP_EEPROM_ATTR(34);SFP_EEPROM_ATTR(35);SFP_EEPROM_ATTR(36);
SFP_EEPROM_ATTR(37);SFP_EEPROM_ATTR(38);SFP_EEPROM_ATTR(39);SFP_EEPROM_ATTR(40);SFP_EEPROM_ATTR(41);SFP_EEPROM_ATTR(42);SFP_EEPROM_ATTR(43);SFP_EEPROM_ATTR(44);SFP_EEPROM_ATTR(45);
SFP_EEPROM_ATTR(46);SFP_EEPROM_ATTR(47);SFP_EEPROM_ATTR(48);SFP_EEPROM_ATTR(49);SFP_EEPROM_ATTR(50);SFP_EEPROM_ATTR(51);SFP_EEPROM_ATTR(52);SFP_EEPROM_ATTR(53);SFP_EEPROM_ATTR(54);
static struct bin_attribute *porsche_cpldA_sfp_epprom_attributes[] = {
&sfp13_eeprom_attr, &sfp14_eeprom_attr, &sfp15_eeprom_attr, &sfp16_eeprom_attr, &sfp17_eeprom_attr, &sfp18_eeprom_attr, &sfp19_eeprom_attr, &sfp20_eeprom_attr,
&sfp21_eeprom_attr, &sfp22_eeprom_attr, &sfp23_eeprom_attr, &sfp24_eeprom_attr, &sfp25_eeprom_attr, &sfp26_eeprom_attr, &sfp27_eeprom_attr, &sfp28_eeprom_attr,
&sfp29_eeprom_attr, &sfp30_eeprom_attr, &sfp31_eeprom_attr, &sfp32_eeprom_attr, &sfp33_eeprom_attr, &sfp34_eeprom_attr, &sfp35_eeprom_attr, &sfp36_eeprom_attr,
NULL
};
static struct bin_attribute *porsche_cpldB_sfp_epprom_attributes[] = {
&sfp1_eeprom_attr, &sfp2_eeprom_attr, &sfp3_eeprom_attr, &sfp4_eeprom_attr, &sfp5_eeprom_attr, &sfp6_eeprom_attr, &sfp7_eeprom_attr, &sfp8_eeprom_attr,
&sfp9_eeprom_attr, &sfp10_eeprom_attr, &sfp11_eeprom_attr, &sfp12_eeprom_attr,
NULL
};
static struct bin_attribute *porsche_cpldC_sfp_epprom_attributes[] = {
&sfp37_eeprom_attr, &sfp38_eeprom_attr, &sfp39_eeprom_attr, &sfp40_eeprom_attr, &sfp41_eeprom_attr, &sfp42_eeprom_attr, &sfp43_eeprom_attr, &sfp44_eeprom_attr,
&sfp45_eeprom_attr, &sfp46_eeprom_attr, &sfp47_eeprom_attr, &sfp48_eeprom_attr, &sfp49_eeprom_attr, &sfp50_eeprom_attr, &sfp51_eeprom_attr, &sfp52_eeprom_attr,
&sfp53_eeprom_attr, &sfp54_eeprom_attr,
NULL
};
static const struct attribute_group porsche_sfpA_group = { .bin_attrs = porsche_cpldA_sfp_epprom_attributes};
static const struct attribute_group porsche_sfpB_group = { .bin_attrs = porsche_cpldB_sfp_epprom_attributes};
static const struct attribute_group porsche_sfpC_group = { .bin_attrs = porsche_cpldC_sfp_epprom_attributes};
static int porsche_sfp_device_probe(struct i2c_client *client, const struct i2c_device_id *dev_id)
{
int use_smbus = SFP_EEPROM_BUS_TYPE;
struct porsche_sfp_data *data;
int err, i;
unsigned num_addresses;
kernel_ulong_t magic;
data = kzalloc(sizeof(struct porsche_sfp_data) , GFP_KERNEL);
if (!data)
return -ENOMEM;
mutex_init(&data->lock);
data->use_smbus = use_smbus;
/*
* Export the EEPROM bytes through sysfs, since that's convenient.
* By default, only root should see the data (maybe passwords etc)
*/
data->client = client;
data->driver_data = dev_id->driver_data;
sysfs_bin_attr_init(&data->bin);
switch(dev_id->driver_data)
{
case cpld_group_a:
err = sysfs_create_group(&client->dev.kobj, &porsche_sfpA_group);
if (err)
goto err_clients;
break;
case cpld_group_b:
err = sysfs_create_group(&client->dev.kobj, &porsche_sfpB_group);
if (err)
goto err_clients;
break;
case cpld_group_c:
err = sysfs_create_group(&client->dev.kobj, &porsche_sfpC_group);
if (err)
goto err_clients;
break;
default:
printk(KERN_ALERT "i2c_check_CPLD failed\n");
err = -EIO;
break;
}
i2c_set_clientdata(client, data);
return 0;
err_clients:
kfree(data);
return err;
}
static int porsche_sfp_device_remove(struct i2c_client *client)
{
struct porsche_sfp_data *data;
int i;
data = i2c_get_clientdata(client);
switch(data->driver_data)
{
case cpld_group_a:
sysfs_remove_group(&client->dev.kobj, &porsche_sfpA_group);
break;
case cpld_group_b:
sysfs_remove_group(&client->dev.kobj, &porsche_sfpB_group);
break;
case cpld_group_c:
sysfs_remove_group(&client->dev.kobj, &porsche_sfpC_group);
break;
default:
dev_dbg(&client->dev, "i2c_remove_CPLD failed (0x%x)\n", client->addr);
break;
}
return 0;
}
static const struct i2c_device_id porsche_sfp_id[] = {
{ "porsche_sfpA", cpld_group_a },
{ "porsche_sfpB", cpld_group_b },
{ "porsche_sfpC", cpld_group_c },
{}
};
MODULE_DEVICE_TABLE(i2c, porsche_sfp_id);
static struct i2c_driver porsche_sfp_driver = {
.driver = {
.name = "pegatron_porsche_sfp",
},
.probe = porsche_sfp_device_probe,
.remove = porsche_sfp_device_remove,
.id_table = porsche_sfp_id,
.address_list = normal_i2c,
};
static int __init porsche_sfp_init(void)
{
int i;
/*SFP 1-12*/
for(i=0; i<CPLDB_SFP_NUM; i++)
{
sprintf(SFP_CPLD_GROUPB_MAPPING[i], "sfp%d_eeprom", i+1);
}
/*SFP 13-36*/
for(i=0; i<CPLDA_SFP_NUM; i++)
{
sprintf(SFP_CPLD_GROUPA_MAPPING[i], "sfp%d_eeprom", i+1+CPLDB_SFP_NUM);
}
/*SFP 37-54*/
for(i=0; i<CPLDC_SFP_NUM; i++)
{
sprintf(SFP_CPLD_GROUPC_MAPPING[i], "sfp%d_eeprom",i+1+CPLDA_SFP_NUM+CPLDB_SFP_NUM);
}
return i2c_add_driver(&porsche_sfp_driver);
}
static void __exit porsche_sfp_exit(void)
{
i2c_del_driver(&porsche_sfp_driver);
}
MODULE_AUTHOR("Peter5 Lin <Peter5_Lin@pegatroncorp.com.tw>");
MODULE_DESCRIPTION("porsche_cpld_mux driver");
MODULE_LICENSE("GPL");
module_init(porsche_sfp_init);
module_exit(porsche_sfp_exit);

View File

@ -0,0 +1,7 @@
#!/bin/bash
docker exec -i pmon sensors "$@"
#To probe sensors not part of lm-sensors
if [ -r /usr/local/bin/porsche_sensors.py ]; then
python /usr/local/bin/porsche_sensors.py get_sensors
fi

View File

@ -0,0 +1,13 @@
[Unit]
Description=Pegastron porsche Platform initialization service
After=local-fs.target
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=/usr/local/bin/pegatron_porsche_util.py install
ExecStop=/usr/local/bin/pegatron_porsche_util.py uninstall
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,209 @@
#!/usr/bin/env python
#
# Copyright (C) 2018 Pegatron, Inc.
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
import sys, getopt
import logging
import os
import commands
import threading
DEBUG = False
SFP_MAX_NUM = 48
CPLDA_SFP_NUM = 24
CPLDB_SFP_NUM = 12
CPLDC_SFP_NUM = 18
kernel_module = ['i2c_dev', 'i2c-mux-pca954x force_deselect_on_exit=1', 'at24', 'pegatron_porsche_cpld', 'pegatron_hwmon_mcu', 'pegatron_porsche_sfp']
moduleID = ['pca9544', 'pca9544', '24c02', 'porsche_hwmon_mcu', 'porsche_cpld', 'porsche_cpld', 'porsche_cpld', 'porsche_sfpA', 'porsche_sfpB', 'porsche_sfpC']
i2c_check_node = ['i2c-0', 'i2c-1']
device_address = ['0x72', '0x73', '0x54', '0x70', '0x74', '0x75', '0x76', '0x50', '0x50', '0x50']
device_node= ['i2c-2', 'i2c-6', 'i2c-4', 'i2c-5', 'i2c-6', 'i2c-7', 'i2c-8', 'i2c-6', 'i2c-7', 'i2c-8']
i2c_prefix = '/sys/bus/i2c/devices/'
cpld_bus = ['6-0074', '7-0075', '8-0076']
led_nodes = ['sys_led', 'pwr_led', 'loc_led', 'fan_led', "cpld_allled_ctrl", "serial_led_enable"]
def dbg_print(string):
if DEBUG == True:
print string
return
def do_cmd(cmd, show):
logging.info('Run :' + cmd)
status, output = commands.getstatusoutput(cmd)
dbg_print(cmd + "with result:" + str(status))
dbg_print("output:" + output)
if status:
logging.info('Failed :' + cmd)
if show:
print('Failed :' + cmd)
return status, output
def check_device_position(num):
for i in range(0, len(i2c_check_node)):
status, output = do_cmd("echo " + moduleID[num] + " " + device_address[num] + " > " + i2c_prefix + i2c_check_node[i] + "/new_device", 0)
status, output = do_cmd("ls " + i2c_prefix + device_node[num], 0)
device_node[num] = i2c_check_node[i]
if status:
status, output = do_cmd("echo " + device_address[num] + " > " + i2c_prefix + i2c_check_node[i] + "/delete_device", 0)
else:
return
return
def install_device():
for i in range(0, len(moduleID)):
if moduleID[i] == "pca9544":
check_device_position(i)
else:
status, output = do_cmd("echo " + moduleID[i] + " " + device_address[i] + " > " + i2c_prefix + device_node[i] + "/new_device", 1)
return
def check_driver():
for i in range(0, len(kernel_module)):
status, output = do_cmd("lsmod | grep " + kernel_module[i], 0)
if status:
status, output = do_cmd("modprobe " + kernel_module[i], 1)
return
def do_install():
status, output = do_cmd("depmod -a", 1)
check_driver()
install_device()
return
def do_uninstall():
for i in range(0, len(kernel_module)):
status, output = do_cmd("modprobe -r " + kernel_module[i], 1)
for i in range(0, len(moduleID)):
status, output = do_cmd("echo " + device_address[i] + " > " + i2c_prefix + i2c_check_node[i] + "/delete_device", 0)
return
led_command = {'sys_led': {'green':'0', 'amber':'1', 'off':'2', 'blink_green':'3', 'blink_amber':'4'},
'pwr_led': {'green':'0', 'amber':'1', 'off':'2', 'blink_green':'3', 'blink_amber':'4'},
'loc_led': {'on':'0', 'off':'1', 'blink':'2'},
'fan_led': {'green':'0', 'amber':'1', 'off':'2', 'blink_green':'3', 'blink_amber':'4'},
'cpld_allled_ctrl': {'off':'0', 'mix':'1', 'amber':'2', 'normal':'3'},
'serial_led_enable': {'disable':'0', 'enable':'1'}}
def set_led(args):
"""
Usage: %(scriptName)s set led object command
object:
sys_led : set SYS led [command: off|green|amber|blink_green|blink_amber]
pwr_led : set PWR led [command: off|green|amber|blink_green|blink_amber]
loc_led : set LOCATOR led [command: off|on|blink]
fan_led : set FAN led [command: off|green|amber|blink_green|blink_amber]
"""
if args[0] not in led_command:
print set_led.__doc__
sys.exit(0)
for i in range(0,len(led_nodes)):
if args[0] == led_nodes[i]:
node = i2c_prefix + cpld_bus[1] + '/'+ led_nodes[i]
command = led_command[args[0]]
data = command[args[1]]
status, output = do_cmd("echo "+ str(data) + " > "+ node, 1)
return
def set_device(args):
"""
Usage: %(scriptName)s command object
command:
led : set status led sys_led|pwr_led|loc_led|mst_led|fan_led|digit_led
"""
if args[0] == 'led':
set_led(args[1:])
return
else:
print set_device.__doc__
return
device_init = {'led': [['led', 'sys_led', 'green'], ['led', 'pwr_led', 'green'], ['led', 'fan_led', 'green'], ['led', 'cpld_allled_ctrl', 'normal'], ['led', 'serial_led_enable', 'enable']]}
def pega_init():
#set led
for i in range(0,len(device_init['led'])):
set_device(device_init['led'][i])
#set tx_disable
for x in range(0, SFP_MAX_NUM-1):
if x < CPLDB_SFP_NUM:
bus = cpld_bus[1]
elif x < CPLDB_SFP_NUM + CPLDA_SFP_NUM:
bus = cpld_bus[0]
else:
bus = cpld_bus[2]
nodes = i2c_prefix + bus + '/sfp' + str(x+1) + '_tx_disable'
dbg_print("SFP_TX_DISABLE NODES: " + nodes)
status, output = do_cmd("echo 0 > "+ nodes, 1)
return
def main():
"""
Usage: %(scriptName)s command object
command:
install : install drivers and generate related sysfs nodes
clean : uninstall drivers and remove related sysfs nodes
set : change board setting [led]
debug : debug info [on/off]
"""
if len(sys.argv)<2:
print main.__doc__
for arg in sys.argv[1:]:
if arg == 'install':
do_install()
pega_init()
elif arg == 'uninstall':
do_uninstall()
elif arg == 'set':
if len(sys.argv[2:])<1:
print main.__doc__
else:
set_device(sys.argv[2:])
return
elif arg == 'debug':
if sys.argv[2] == 'on':
DEBUG = True
else:
DEBUG = False
else:
print main.__doc__
if __name__ == "__main__":
main()

View File

@ -0,0 +1,141 @@
#!/usr/bin/python
import os
import sys
import logging
FAN_NUM = 5
sensors_path = '/sys/bus/i2c/devices/5-0070/'
sensors_nodes = {'fan_rpm': ['_inner_rpm', '_outer_rpm'],
'fan_vol': ['ADC8_vol', 'ADC7_vol','ADC6_vol', 'ADC5_vol','ADC4_vol', 'ADC3_vol'],
'temp':['lm75_49_temp', 'lm75_48_temp', 'SA56004_local_temp','SA56004_remote_temp']}
sensors_type = {'fan_rpm': ['Inner RPM', 'Outer RPM'],
'fan_vol': ['P0.2', 'P0.6','P0.1', 'P1.5','P0.7', 'P1.6'],
'temp':['lm75_49_temp', 'lm75_48_temp', 'SA56004_local_temp','SA56004_remote_temp']}
# Get sysfs attribute
def get_attr_value(attr_path):
retval = 'ERR'
if (not os.path.isfile(attr_path)):
return retval
try:
with open(attr_path, 'r') as fd:
retval = fd.read()
except Exception as error:
logging.error("Unable to open ", attr_path, " file !")
retval = retval.rstrip('\r\n')
fd.close()
return retval
def get_fan_status(number):
attr_value = get_attr_value(sensors_path + "fan" + str(number+1) + "_present")
if (attr_value != 'ERR'):
attr_value = int(attr_value, 16)
if(attr_value == 0):
string = "Connect"
else:
string = "Disconnect"
return string
def get_fan_alert(number):
attr_value = get_attr_value(sensors_path + "fan" + str(number+1) + "_status_alert")
if (attr_value != 'ERR'):
attr_value = int(attr_value, 16)
if(attr_value == 0):
string = "Normal"
else:
string = "Abnormal"
return string
def get_fan_inner_rpm(number):
return get_attr_value(sensors_path + "fan" + str(number+1) + "_inner_rpm")
def get_fan_outer_rpm(number):
return get_attr_value(sensors_path + "fan" + str(number+1) + "_outer_rpm")
def get_fan():
for i in range(0,FAN_NUM):
print " "
#status
string = get_fan_status(i)
print "FAN " + str(i+1) + ":" + ' ' + string
if string=='Disconnect':
continue
#alert
string = get_fan_alert(i)
print " Status:"+ ' ' + string
#inner rpm
string = get_fan_inner_rpm(i)
print " Inner RPM:"+ string.rjust(10) + ' RPM'
#outer rpm
string = get_fan_outer_rpm(i)
print " Outer RPM:"+ string.rjust(10) + ' RPM'
return
def get_hwmon():
print " "
string = get_attr_value(sensors_path + "lm75_48_temp")
print "Sensor A: " + string + " C"
string = get_attr_value(sensors_path + "lm75_49_temp")
print "Sensor B: " + string + " C"
return
def get_voltage():
print " "
nodes = sensors_nodes['fan_vol']
types = sensors_type['fan_vol']
for i in range(0,len(nodes)):
string = get_attr_value(sensors_path + nodes[i])
print types[i] + ': ' + string + " V"
return
def init_fan():
return
def main():
"""
Usage: %(scriptName)s command object
command:
install : install drivers and generate related sysfs nodes
clean : uninstall drivers and remove related sysfs nodes
show : show all systen status
set : change board setting with fan|led|sfp
"""
if len(sys.argv)<2:
print main.__doc__
for arg in sys.argv[1:]:
if arg == 'fan_init':
init_fan()
elif arg == 'get_sensors':
ver = get_attr_value(sensors_path + "fb_hw_version")
print 'HW Version: ' + ver
ver = get_attr_value(sensors_path + "fb_fw_version")
print 'SW Version: ' + ver
get_fan()
get_hwmon()
get_voltage()
elif arg == 'fan_set':
if len(sys.argv[1:])<1:
print main.__doc__
else:
set_fan(sys.argv[1:])
return
else:
print main.__doc__
if __name__ == "__main__":
main()