DellEMC: Dell platform bug fixes on s5248 and s6232 (#4071)

* Dynamic bus detection and loading driver for eeprom on s5248,s5232
* sfputil fix for S5248
This commit is contained in:
Srideep 2020-01-28 00:28:26 -07:00 committed by lguohan
parent c9483796dc
commit dc994b8425
5 changed files with 27 additions and 7 deletions

View File

@ -9,7 +9,9 @@
# - specific encoder/decoder if there is special need # - specific encoder/decoder if there is special need
############################################################################# #############################################################################
try: try:
import os.path
from sonic_eeprom import eeprom_tlvinfo from sonic_eeprom import eeprom_tlvinfo
except ImportError, e: except ImportError, e:
raise ImportError (str(e) + "- required module not found") raise ImportError (str(e) + "- required module not found")
@ -18,5 +20,13 @@ except ImportError, e:
class board(eeprom_tlvinfo.TlvInfoDecoder): class board(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self, name, path, cpld_root, ro): def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0050/eeprom" self.eeprom_path = None
for b in (0, 1):
f = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom'.format(b)
if os.path.exists(f):
self.eeprom_path = f
break
if self.eeprom_path is None:
return
super(board, self).__init__(self.eeprom_path, 0, '', True) super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -9,7 +9,9 @@
# - specific encoder/decoder if there is special need # - specific encoder/decoder if there is special need
############################################################################# #############################################################################
try: try:
import os.path
from sonic_eeprom import eeprom_tlvinfo from sonic_eeprom import eeprom_tlvinfo
except ImportError, e: except ImportError, e:
raise ImportError (str(e) + "- required module not found") raise ImportError (str(e) + "- required module not found")
@ -18,5 +20,13 @@ except ImportError, e:
class board(eeprom_tlvinfo.TlvInfoDecoder): class board(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self, name, path, cpld_root, ro): def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0050/eeprom" self.eeprom_path = None
for b in (0, 1):
f = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom'.format(b)
if os.path.exists(f):
self.eeprom_path = f
break
if self.eeprom_path is None:
return
super(board, self).__init__(self.eeprom_path, 0, '', True) super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -319,7 +319,7 @@ class SfpUtil(SfpUtilBase):
time.sleep(0.5) time.sleep(0.5)
def get_transceiver_dom_info_dict(self, port_num): def get_transceiver_dom_info_dict(self, port_num):
transceiver_dom_info_dict = {} transceiver_dom_info_dict = {}
dom_info_dict_keys = ['temperature', 'voltage', 'rx1power', dom_info_dict_keys = ['temperature', 'voltage', 'rx1power',

View File

@ -17,9 +17,9 @@ init_devnum() {
# Attach/Detach syseeprom on CPU board # Attach/Detach syseeprom on CPU board
sys_eeprom() { sys_eeprom() {
case $1 in case $1 in
"new_device") echo 24c16 0x50 > /sys/bus/i2c/devices/i2c-0/$1 "new_device") echo 24c16 0x50 > /sys/bus/i2c/devices/i2c-${devnum}/$1
;; ;;
"delete_device") echo 0x50 > /sys/bus/i2c/devices/i2c-0/$1 "delete_device") echo 0x50 > /sys/bus/i2c/devices/i2c-${devnum}/$1
;; ;;
*) echo "s5232f_platform: sys_eeprom : invalid command !" *) echo "s5232f_platform: sys_eeprom : invalid command !"
;; ;;

View File

@ -17,9 +17,9 @@ init_devnum() {
# Attach/Detach syseeprom on CPU board # Attach/Detach syseeprom on CPU board
sys_eeprom() { sys_eeprom() {
case $1 in case $1 in
"new_device") echo 24c16 0x50 > /sys/bus/i2c/devices/i2c-0/$1 "new_device") echo 24c16 0x50 > /sys/bus/i2c/devices/i2c-${devnum}/$1
;; ;;
"delete_device") echo 0x50 > /sys/bus/i2c/devices/i2c-0/$1 "delete_device") echo 0x50 > /sys/bus/i2c/devices/i2c-${devnum}/$1
;; ;;
*) echo "s5248f_platform: sys_eeprom : invalid command !" *) echo "s5248f_platform: sys_eeprom : invalid command !"
;; ;;