-
Notifications
You must be signed in to change notification settings - Fork 7
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 support for ET6448M pmon2.0 #53
Open
lkunjumon
wants to merge
3
commits into
Marvell-OpenNOS:master
Choose a base branch
from
lkunjumon:ET6448M_PMON2.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
device/marvell/armhf-marvell_et6448m_52x-r0/et6448m/qos.json.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{# this file empty temporarily until qos supported SAI Marvell #} | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
- bus: '00' | ||
dev: '01' | ||
fn: '0' | ||
id: '6820' | ||
name: 'PCI bridge: Marvell Technology Group Ltd. Device 6820 (rev 0a)' | ||
- bus: '00' | ||
dev: '02' | ||
fn: '0' | ||
id: '6820' | ||
name: 'PCI bridge: Marvell Technology Group Ltd. Device 6820 (rev 0a)' | ||
- bus: '01' | ||
dev: '00' | ||
fn: '0' | ||
id: c804 | ||
name: 'Ethernet controller: Marvell Technology Group Ltd. Device c804' | ||
- bus: '02' | ||
dev: '00' | ||
fn: '0' | ||
id: c804 | ||
name: 'Ethernet controller: Marvell Technology Group Ltd. Device c804' |
10 changes: 10 additions & 0 deletions
10
device/marvell/armhf-marvell_et6448m_52x-r0/platform_components.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"chassis": { | ||
"et6448m": { | ||
"component": { | ||
"U-Boot": { }, | ||
"System-CPLD": { } | ||
} | ||
} | ||
} | ||
} |
132 changes: 132 additions & 0 deletions
132
device/marvell/armhf-marvell_et6448m_52x-r0/plugins/led_control.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# | ||
# led_control.py | ||
# | ||
# Platform-specific LED control functionality for SONiC | ||
# | ||
|
||
try: | ||
from sonic_led.led_control_base import LedControlBase | ||
import os | ||
import time | ||
import syslog | ||
import sonic_platform.platform | ||
import sonic_platform.chassis | ||
except ImportError as e: | ||
raise ImportError(str(e) + " - required module not found") | ||
|
||
smbus_present = 1 | ||
|
||
try: | ||
import smbus | ||
except ImportError as e: | ||
smbus_present = 0 | ||
|
||
|
||
def DBG_PRINT(str): | ||
syslog.openlog("Led") | ||
syslog.syslog(syslog.LOG_INFO, str) | ||
syslog.closelog() | ||
|
||
|
||
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): | ||
# The fan tray leds and system led managed by new chassis class API | ||
# leaving only a couple other front panel leds to be done old style | ||
DBG_PRINT("starting system leds") | ||
self._initSystemLed() | ||
DBG_PRINT(" led done") | ||
|
||
def _set_i2c_register(self, reg_file, value): | ||
# On successful write, the value read will be written on | ||
# reg_name and on failure returns 'ERR' | ||
rv = 'ERR' | ||
|
||
if (not os.path.isfile(reg_file)): | ||
return rv | ||
try: | ||
with open(reg_file, 'w') as fd: | ||
rv = fd.write(str(value)) | ||
except Exception as e: | ||
rv = 'ERR' | ||
|
||
return rv | ||
|
||
def _initSystemLed(self): | ||
# Front Panel System LEDs setting | ||
oldfan = 0xf | ||
oldpsu = 0xf | ||
|
||
# Write sys led | ||
if smbus_present == 0: | ||
DBG_PRINT(" PMON LED SET ERROR -> smbus present = 0 ") | ||
else: | ||
bus = smbus.SMBus(0) | ||
DEVICE_ADDRESS = 0x41 | ||
DEVICEREG = 0x7 | ||
bus.write_byte_data(DEVICE_ADDRESS, DEVICEREG, 0x02) | ||
DBG_PRINT(" System LED set O.K. ") | ||
|
||
while True: | ||
# Front Panel FAN Panel LED setting in register 0x08 | ||
if (self.chassis.get_fan(0).get_status() == self.chassis.get_fan(1).get_status() == True): | ||
if (os.path.isfile("/sys/class/gpio/fanLedAmber/value")): | ||
if oldfan != 0x1: | ||
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 0) | ||
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 1) | ||
oldfan = 0x1 | ||
else: | ||
oldfan = 0xf | ||
else: | ||
if (os.path.isfile("/sys/class/gpio/fanLedGreen/value")): | ||
if oldfan != 0x0: | ||
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 0) | ||
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 1) | ||
oldfan = 0x0 | ||
else: | ||
oldfan = 0xf | ||
|
||
# Front Panel PSU Panel LED setting in register 0x09 | ||
if (self.chassis.get_psu(0).get_status() == self.chassis.get_psu(1).get_status() == True): | ||
if (os.path.isfile("/sys/class/gpio/psuLedAmber/value")): | ||
if oldpsu != 0x1: | ||
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 0) | ||
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 1) | ||
oldpsu = 0x1 | ||
else: | ||
oldpsu = 0xf | ||
else: | ||
if (os.path.isfile("/sys/class/gpio/psuLedGreen/value")): | ||
if oldpsu != 0x0: | ||
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 0) | ||
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 1) | ||
oldpsu = 0x0 | ||
else: | ||
oldpsu = 0xf | ||
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 | ||
|
||
def _port_state_to_mode(self, port_idx, state): | ||
DBG_PRINT("_port_state_to_mode") | ||
|
||
def _port_led_mode_update(self, port_idx, ledMode): | ||
DBG_PRINT("_port_led_mode_update") | ||
|
||
# called when port states change- implementation of port_link_state_change() method if needed | ||
def port_link_state_change(self, portname, state): | ||
# DBG_PRINT("port_link_state_change ") | ||
return |
4 changes: 0 additions & 4 deletions
4
device/marvell/armhf-marvell_et6448m_52x-r0/pmon_daemon_control.json
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
device/marvell/armhf-marvell_et6448m_52x-r0/thermal_policy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"thermal_control_algorithm": { | ||
"run_at_boot_up": "false", | ||
"fan_speed_when_suspend": "50" | ||
}, | ||
"info_types": [ | ||
{ | ||
"type": "fan_info" | ||
}, | ||
{ | ||
"type": "thermal_info" | ||
}, | ||
{ | ||
"type": "chassis_info" | ||
} | ||
], | ||
"policies": [ | ||
{ | ||
"name": "any fan absence", | ||
"conditions": [ | ||
{ | ||
"type": "fan.any.absence" | ||
} | ||
], | ||
"actions": [ | ||
{ | ||
"type": "thermal_control.control", | ||
"status": "false" | ||
}, | ||
{ | ||
"type": "fan.all.set_speed", | ||
"speed": "100" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "all fan presence", | ||
"conditions": [ | ||
{ | ||
"type": "fan.all.presence" | ||
} | ||
], | ||
"actions": [ | ||
{ | ||
"type": "thermal.temp_check_and_set_all_fan_speed", | ||
"default_speed": "50", | ||
"hightemp_speed": "100" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "temp over high critical threshold", | ||
"conditions": [ | ||
{ | ||
"type": "thermal.over.high_critical_threshold" | ||
} | ||
], | ||
"actions": [ | ||
{ | ||
"type": "switch.shutdown" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
platform/marvell-armhf/sonic-platform-et6448m/debian/sonic-platform-et6448m.install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
et6448m_plt_setup.sh usr/sbin | ||
et6448m/scripts/et6448m-init.sh usr/local/bin | ||
et6448m/service/et6448m-init.service etc/systemd/system | ||
et6448m/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/armhf-marvell_et6448m_52x-r0 | ||
entropy.py etc/ | ||
inband_mgmt.sh etc/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this script packed ? |
11 changes: 11 additions & 0 deletions
11
platform/marvell-armhf/sonic-platform-et6448m/debian/sonic-platform-et6448m.postinst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
# postinst script for sonic-platform-et6448m | ||
# | ||
# see: dh_installdeb(1) | ||
|
||
sh /usr/sbin/et6448m_plt_setup.sh | ||
systemctl enable et6448m-init.service | ||
systemctl start et6448m-init.service | ||
|
||
exit 0 | ||
|
60 changes: 60 additions & 0 deletions
60
platform/marvell-armhf/sonic-platform-et6448m/et6448m/scripts/et6448m-init.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
# Platform init script for ET6448M | ||
|
||
# Load required kernel-mode drivers | ||
load_kernel_drivers() { | ||
# Remove modules loaded during Linux init | ||
# FIX-ME: This will be removed in the future when Linux init no longer loads these | ||
rmmod i2c_mux_gpio | ||
rmmod i2c_dev | ||
rmmod i2c_mv64xxx | ||
|
||
# Carefully control the load order here to ensure consistent i2c bus numbering | ||
modprobe i2c_mv64xxx | ||
modprobe i2c_dev | ||
modprobe i2c_mux_gpio | ||
modprobe eeprom | ||
} | ||
|
||
|
||
et6448m_profile() | ||
{ | ||
MAC_ADDR=$(sudo decode-syseeprom -m) | ||
sed -i "s/switchMacAddress=.*/switchMacAddress=$MAC_ADDR/g" /usr/share/sonic/device/armhf-marvell_et6448m_52x-r0/et6448m/profile.ini | ||
echo "et6448m: Updating switch mac address ${MAC_ADDR}" | ||
} | ||
|
||
# - Main entry | ||
|
||
# Install kernel drivers required for i2c bus access | ||
load_kernel_drivers | ||
|
||
# LOGIC to enumerate SFP eeprom devices - send 0x50 to kernel i2c driver - initialize devices | ||
# the mux may be enumerated at number 4 or 5 so we check for the mux and skip if needed | ||
|
||
# Get list of the mux channels | ||
ismux_bus=$(i2cdetect -l|grep mux|cut -f1) | ||
|
||
# Enumerate the SFP eeprom device on each mux channel | ||
for mux in ${ismux_bus} | ||
do | ||
echo optoe2 0x50 > /sys/class/i2c-adapter/${mux}/new_device | ||
done | ||
|
||
# Enumerate fan eeprom devices | ||
echo eeprom 0x55 > /sys/class/i2c-adapter/i2c-0/new_device | ||
echo eeprom 0x56 > /sys/class/i2c-adapter/i2c-0/new_device | ||
|
||
# Enumerate PSU eeprom devices | ||
echo eeprom 0x50 > /sys/class/i2c-adapter/i2c-1/new_device | ||
echo eeprom 0x51 > /sys/class/i2c-adapter/i2c-1/new_device | ||
|
||
# Enable optical SFP Tx | ||
i2cset -y -m 0x0f 0 0x41 0x5 0x00 | ||
|
||
# Ensure switch is programmed with chassis base MAC addr | ||
et6448m_profile | ||
|
||
echo "et6448m - completed platform init script" | ||
exit 0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think w shoudl add only c804 ac3x chips, and not all are requireed