Skip to content
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_tg4810m-r0/default_sku
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delta_tg4810m 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 %}
49 changes: 49 additions & 0 deletions device/delta/arm64-delta_tg4810m-r0/delta_tg4810m/port_config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# name lanes alias index speed
Ethernet0 0 Ethernet0 1 10000
Ethernet1 1 Ethernet1 2 10000
Ethernet2 2 Ethernet2 3 10000
Ethernet3 3 Ethernet3 4 10000
Ethernet4 4 Ethernet4 5 10000
Ethernet5 5 Ethernet5 6 10000
Ethernet6 6 Ethernet6 7 10000
Ethernet7 7 Ethernet7 8 10000
Ethernet8 8 Ethernet8 9 10000
Ethernet9 9 Ethernet9 10 10000
Ethernet10 10 Ethernet10 11 10000
Ethernet11 11 Ethernet11 12 10000
Ethernet12 12 Ethernet12 13 10000
Ethernet13 13 Ethernet13 14 10000
Ethernet14 14 Ethernet14 15 10000
Ethernet15 15 Ethernet15 16 10000
Ethernet16 16 Ethernet16 17 10000
Ethernet17 17 Ethernet17 18 10000
Ethernet18 18 Ethernet18 19 10000
Ethernet19 19 Ethernet19 20 10000
Ethernet20 20 Ethernet20 21 10000
Ethernet21 21 Ethernet21 22 10000
Ethernet22 22 Ethernet22 23 10000
Ethernet23 23 Ethernet23 24 10000
Ethernet24 24 Ethernet24 25 10000
Ethernet25 25 Ethernet25 26 10000
Ethernet26 26 Ethernet26 27 10000
Ethernet27 27 Ethernet27 28 10000
Ethernet28 28 Ethernet28 29 10000
Ethernet29 29 Ethernet29 30 10000
Ethernet30 30 Ethernet30 31 10000
Ethernet31 31 Ethernet31 32 10000
Ethernet32 32 Ethernet32 33 10000
Ethernet33 33 Ethernet33 34 10000
Ethernet34 34 Ethernet34 35 10000
Ethernet35 35 Ethernet35 36 10000
Ethernet36 36 Ethernet36 37 10000
Ethernet37 37 Ethernet37 38 10000
Ethernet38 38 Ethernet38 39 10000
Ethernet39 39 Ethernet39 40 10000
Ethernet40 40 Ethernet40 41 10000
Ethernet41 41 Ethernet41 42 10000
Ethernet42 42 Ethernet42 43 10000
Ethernet43 43 Ethernet43 44 10000
Ethernet44 44 Ethernet44 45 10000
Ethernet45 45 Ethernet45 46 10000
Ethernet46 46 Ethernet46 47 10000
Ethernet47 47 Ethernet47 48 10000
Empty file.
3 changes: 3 additions & 0 deletions device/delta/arm64-delta_tg4810m-r0/delta_tg4810m/sai.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mode=1
hwId=ALDRIN2XL
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/profile.ini
10 changes: 10 additions & 0 deletions device/delta/arm64-delta_tg4810m-r0/fancontrol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Configuration file for tg4810m
INTERVAL=10
DEVPATH=hwmon1=devices/platform/cp0/cp0:config-space@f2000000/f2701000.i2c/i2c-0/0-002e hwmon3=devices/virtual/thermal/thermal_zone1
DEVNAME=hwmon1=adt7473 hwmon3=f2400078.thermal
FCTEMPS=hwmon1/device/pwm3=hwmon1/device/temp1_input hwmon1/device/pwm2=hwmon3/temp1_input hwmon1/device/pwm1=hwmon1/device/temp2_input
FCFANS=hwmon1/device/pwm3=hwmon1/device/fan3_input hwmon1/device/pwm2=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input
MINTEMP=hwmon1/device/pwm3=20 hwmon1/device/pwm2=20 hwmon1/device/pwm1=20
MAXTEMP=hwmon1/device/pwm3=60 hwmon1/device/pwm2=60 hwmon1/device/pwm1=60
MINSTART=hwmon1/device/pwm3=150 hwmon1/device/pwm2=150 hwmon1/device/pwm1=150
MINSTOP=hwmon1/device/pwm3=0 hwmon1/device/pwm2=0 hwmon1/device/pwm1=0
14 changes: 14 additions & 0 deletions device/delta/arm64-delta_tg4810m-r0/plugins/eeprom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/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)
89 changes: 89 additions & 0 deletions device/delta/arm64-delta_tg4810m-r0/plugins/led_control.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/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"""
def __init__(self):
self.chassis = sonic_platform.platform.Platform().get_chassis()
self._initDefaultConfig()

def _initDefaultConfig(self):
self._initLed()

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

def _initLed(self):
# Front Panel 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
10 changes: 10 additions & 0 deletions device/delta/arm64-delta_tg4810m-r0/plugins/pcie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- bus: '00'
dev: '00'
fn: '0'
id: '0110'
name: 'PCI bridge: Marvell Technology Group Ltd. Device 0110'
- bus: '01'
dev: '00'
fn: '0'
id: cc1e
name: 'Ethernet controller: Marvell Technology Group Ltd. Device cc1e'
72 changes: 72 additions & 0 deletions device/delta/arm64-delta_tg4810m-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env python
# psuutil.py
# Platform-specific PSU functionality for SONiC

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')
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')
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