Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Hwsku TG48M-P #31

Open
wants to merge 5 commits into
base: target_master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions device/delta/arm64-delta_tg48m_poe-r0/default_sku
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delta_tg48m_poe t1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
{% for port_idx in range(0,32) %}
{% if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{% endif %}
{% endfor %}
{%- endmacro %}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "12766208",
"type": "ingress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "12766208",
"type": "egress",
"mode": "static"
},
"egress_lossy_pool": {
"size": "7326924",
"type": "egress",
"mode": "dynamic"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_lossless_pool]",
"size":"0",
"static_th":"12766208"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"1518",
"dynamic_th":"3"
}
},
{%- endmacro %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# name lanes alias index speed
Ethernet0 1 Ethernet0 1 1000
Ethernet1 2 Ethernet1 2 1000
Ethernet2 3 Ethernet2 3 1000
Ethernet3 4 Ethernet3 4 1000
Ethernet4 5 Ethernet4 5 1000
Ethernet5 6 Ethernet5 6 1000
Ethernet6 7 Ethernet6 7 1000
Ethernet7 8 Ethernet7 8 1000
Ethernet8 9 Ethernet8 9 1000
Ethernet9 10 Ethernet9 10 1000
Ethernet10 11 Ethernet10 11 1000
Ethernet11 12 Ethernet11 12 1000
Ethernet12 13 Ethernet12 13 1000
Ethernet13 14 Ethernet13 14 1000
Ethernet14 15 Ethernet14 15 1000
Ethernet15 16 Ethernet15 16 1000
Ethernet16 17 Ethernet16 17 1000
Ethernet17 18 Ethernet17 18 1000
Ethernet18 19 Ethernet18 19 1000
Ethernet19 20 Ethernet19 20 1000
Ethernet20 21 Ethernet20 21 1000
Ethernet21 22 Ethernet21 22 1000
Ethernet22 23 Ethernet22 23 1000
Ethernet23 24 Ethernet23 24 1000
Ethernet24 25 Ethernet24 25 1000
Ethernet25 26 Ethernet25 26 1000
Ethernet26 27 Ethernet26 27 1000
Ethernet27 28 Ethernet27 28 1000
Ethernet28 29 Ethernet28 29 1000
Ethernet29 30 Ethernet29 30 1000
Ethernet30 31 Ethernet30 31 1000
Ethernet31 32 Ethernet31 32 1000
Ethernet32 33 Ethernet32 33 1000
Ethernet33 34 Ethernet33 34 1000
Ethernet34 35 Ethernet34 35 1000
Ethernet35 36 Ethernet35 36 1000
Ethernet36 37 Ethernet36 37 1000
Ethernet37 38 Ethernet37 38 1000
Ethernet38 39 Ethernet38 39 1000
Ethernet39 40 Ethernet39 40 1000
Ethernet40 41 Ethernet40 41 1000
Ethernet41 42 Ethernet41 42 1000
Ethernet42 43 Ethernet42 43 1000
Ethernet43 44 Ethernet43 44 1000
Ethernet44 45 Ethernet44 45 1000
Ethernet45 46 Ethernet45 46 1000
Ethernet46 47 Ethernet46 47 1000
Ethernet47 48 Ethernet47 48 1000
Ethernet48 49 Ethernet48 49 10000
Ethernet49 50 Ethernet49 50 10000
Ethernet50 51 Ethernet50 51 10000
Ethernet51 52 Ethernet51 52 10000
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mode=1
hwId=TG48MP
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini
10 changes: 10 additions & 0 deletions device/delta/arm64-delta_tg48m_poe-r0/fancontrol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon1=devices/platform/cp0/cp0:config-space@f2000000/f2701000.i2c/i2c-0/0-002e hwmon3=devices/virtual/thermal/thermal_zone1 hwmon4=devices/platform/cp0/cp0:config-space@f2000000/f2701000.i2c/i2c-0/0-004a hwmon5=devices/platform/cp0/cp0:config-space@f2000000/f2701000.i2c/i2c-0/0-004b
DEVNAME=hwmon1=adt7473 hwmon3=f2400078.thermal hwmon4=tmp75 hwmon5=tmp75
FCTEMPS=hwmon1/device/pwm1=hwmon3/temp1_input hwmon1/device/pwm3=hwmon4/temp1_input hwmon1/device/pwm2=hwmon5/temp1_input
FCFANS=hwmon1/device/pwm1=hwmon1/device/fan1_input hwmon1/device/pwm3=hwmon1/device/fan3_input+hwmon1/device/fan2_input hwmon1/device/pwm2=hwmon1/device/fan2_input
MINTEMP=hwmon1/device/pwm1=20 hwmon1/device/pwm3=20 hwmon1/device/pwm2=20
MAXTEMP=hwmon1/device/pwm1=60 hwmon1/device/pwm3=60 hwmon1/device/pwm2=60
MINSTART=hwmon1/device/pwm1=150 hwmon1/device/pwm3=150 hwmon1/device/pwm2=150
MINSTOP=hwmon1/device/pwm1=0 hwmon1/device/pwm3=100 hwmon1/device/pwm2=0
16 changes: 16 additions & 0 deletions device/delta/arm64-delta_tg48m_poe-r0/plugins/eeprom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python

try:
import os
from sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
raise ImportError (str(e) + "- required module not found")


class board(eeprom_tlvinfo.TlvInfoDecoder):

def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0057/eeprom"
if not os.path.exists(self.eeprom_path):
os.system("echo 24c64 0x57 > /sys/class/i2c-adapter/i2c-0/new_device")
super(board, self).__init__(self.eeprom_path, 0, '', True)
99 changes: 99 additions & 0 deletions device/delta/arm64-delta_tg48m_poe-r0/plugins/led_control.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@

#!/usr/bin/env python
#
# led_control.py
#
# Platform-specific LED control functionality for SONiC
#
try:
from sonic_led.led_control_base import LedControlBase
import time
from socket import *
from select import *
import sonic_platform.platform
import sonic_platform.chassis
except ImportError as e:
raise ImportError(str(e) + " - required module not found")


class LedControl(LedControlBase):
"""Platform specific LED control class"""

# Constructor
def __init__(self):
self.chassis = sonic_platform.platform.Platform().get_chassis()
self._initDefaultConfig()

def _initDefaultConfig(self):
# For the D1 box the port leds are controlled by Trident3 LED program
# The fan tray leds will be managed with the new thermalctl daemon / chassis class based API
# leaving only the system leds to be done old style
self._initSystemLed()

def gpio_led_write(self,gpio_led_path, value):
try:
gpio_file = open(gpio_led_path + "/brightness", 'w')
gpio_file.write(str(value))
gpio_file.close
except IOError as e:
print "error: unable to open gpio file: %s" % str(e)

def _initSystemLed(self):
# Front Panel System LEDs setting
fan_led=0xf
psu_led=0xf
sys_led=0xf


while True:

# Front Panel FAN LED
if ( self.chassis.get_fan(0).get_status() == self.chassis.get_fan(1).get_status() == self.chassis.get_fan(2).get_status() == True ):
if ( fan_led != 0x1 ):
self.gpio_led_write("/sys/class/leds/fanLedGreen",1)
self.gpio_led_write("/sys/class/leds/fanLedAmber",0)
fan_led = 0x1
else :
if ( fan_led != 0x0 ):
self.gpio_led_write("/sys/class/leds/fanLedAmber",1)
self.gpio_led_write("/sys/class/leds/fanLedGreen",0)
fan_led = 0x0

# Front Panel PSU LED
if ( self.chassis.get_psu(0).get_status() == self.chassis.get_psu(1).get_status() == True ):
if ( psu_led != 0x1 ):
self.gpio_led_write("/sys/class/leds/psuLedGreen",1)
self.gpio_led_write("/sys/class/leds/psuLedAmber",0)
psu_led = 0x1
else :
if ( psu_led != 0x0 ):
self.gpio_led_write("/sys/class/leds/psuLedAmber",1)
self.gpio_led_write("/sys/class/leds/psuLedGreen",0)
psu_led = 0x0

# Front Panel system LED
if ( fan_led == psu_led == 0x1 ) :
if ( sys_led != 0x1 ):
self.gpio_led_write("/sys/class/leds/sysLedGreen",1)
self.gpio_led_write("/sys/class/leds/sysLedAmber",0)
sys_led = 0x1
else:
if ( sys_led != 0x0 ):
self.gpio_led_write("/sys/class/leds/sysLedAmber",1)
self.gpio_led_write("/sys/class/leds/sysLedGreen",0)
sys_led = 0x0

time.sleep(6)

# Helper method to map SONiC port name to index
def _port_name_to_index(self, port_name):
# Strip "Ethernet" off port name
if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX):
return -1

port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):])
return port_idx

# called when port states change- implementation of port_link_state_change() method if needed
def port_link_state_change(self, portname, state):
return
24 changes: 24 additions & 0 deletions device/delta/arm64-delta_tg48m_poe-r0/plugins/pcie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- bus: '00'
dev: '00'
domain: '0000'
fn: '0'
id: '0110'
name: 'PCI bridge: Marvell Technology Group Ltd. Device 0110'
- bus: '01'
dev: '00'
domain: '0000'
fn: '0'
id: c80c
name: 'Ethernet controller: Marvell Technology Group Ltd. Device c80c'
- bus: '00'
dev: '00'
domain: '0001'
fn: '0'
id: '0110'
name: 'PCI bridge: Marvell Technology Group Ltd. Device 0110'
- bus: '01'
dev: '00'
domain: '0001'
fn: '0'
id: c80c
name: 'Ethernet controller: Marvell Technology Group Ltd. Device c80c'
74 changes: 74 additions & 0 deletions device/delta/arm64-delta_tg48m_poe-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env python

import sys
if sys.version_info[0] < 3:
import commands as cmd
else:
import subprocess as cmd

smbus_present = 1
try:
import smbus
except ImportError as e:
smbus_present = 0

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)

def get_num_psus(self):
MAX_PSUS = 2
return MAX_PSUS

def get_psu_status(self, index):
if index is None:
return False
if smbus_present == 0:
cmdstatus, psustatus = cmd.getstatusoutput('i2cget -y 2 0x41 0xa') #need to verify the cpld register logic
psustatus = int(psustatus, 16)
else :
bus = smbus.SMBus(2)
DEVICE_ADDRESS = 0x41
DEVICE_REG = 0xa
psustatus = bus.read_byte_data(DEVICE_ADDRESS, DEVICE_REG)
if index == 1:
psustatus = psustatus&4
if psustatus == 4 :
return True
if index == 2:
psustatus = psustatus&8
if psustatus == 8 :
return True

return False

def get_psu_presence(self, index):
if index is None:
return False

if smbus_present == 0:
cmdstatus, psustatus = cmd.getstatusoutput('i2cget -y 2 0x41 0xa') #need to verify the cpld register logic
psustatus = int(psustatus, 16)
else :
bus = smbus.SMBus(2)
DEVICE_ADDRESS = 0x41
DEVICE_REG = 0xa
psustatus = bus.read_byte_data(DEVICE_ADDRESS, DEVICE_REG)

if index == 1:
psustatus = psustatus&1
if psustatus == 0 :
return True
if index == 2:
psustatus = psustatus&2
if psustatus == 0 :
return True
return False

Loading