[devices/accton]:bugfix: potential i2c fault from IC IR3570a (#2966)
Disabling i2c function of ir3507a which may failed i2c tranfer to others. Signed-off-by: roy_lee <roy_lee@accton.com>
This commit is contained in:
parent
bd519322cb
commit
4f85c7cd5f
@ -252,7 +252,7 @@ def driver_inserted():
|
||||
kos = [
|
||||
'depmod -ae',
|
||||
'modprobe i2c_dev',
|
||||
'modprobe i2c_mux_pca954x',
|
||||
'modprobe i2c_mux_pca954x force_deselect_on_exit=1',
|
||||
'modprobe optoe',
|
||||
'modprobe i2c-mux-accton_as5712_54x_cpld',
|
||||
'modprobe cpr_4011_4mxx',
|
||||
@ -273,7 +273,15 @@ def driver_install():
|
||||
def driver_uninstall():
|
||||
global FORCE
|
||||
for i in range(0,len(kos)):
|
||||
rm = kos[-(i+1)].replace("modprobe", "modprobe -rq")
|
||||
#remove parameter if any
|
||||
rm = kos[-(i+1)]
|
||||
lst = rm.split(" ")
|
||||
if len(lst) > 2:
|
||||
del(lst[2:])
|
||||
rm = " ".join(lst)
|
||||
|
||||
#Change to removing commands
|
||||
rm = rm.replace("modprobe", "modprobe -rq")
|
||||
rm = rm.replace("insmod", "rmmod")
|
||||
status, output = log_os_system(rm, 1)
|
||||
if status:
|
||||
|
@ -252,7 +252,7 @@ def driver_inserted():
|
||||
kos = [
|
||||
'depmod -ae',
|
||||
'modprobe i2c_dev',
|
||||
'modprobe i2c_mux_pca954x',
|
||||
'modprobe i2c_mux_pca954x force_deselect_on_exit=1',
|
||||
'modprobe optoe',
|
||||
'modprobe i2c-mux-accton_as5812_54x_cpld',
|
||||
'modprobe cpr_4011_4mxx',
|
||||
@ -273,7 +273,15 @@ def driver_install():
|
||||
def driver_uninstall():
|
||||
global FORCE
|
||||
for i in range(0,len(kos)):
|
||||
rm = kos[-(i+1)].replace("modprobe", "modprobe -rq")
|
||||
#remove parameter if any
|
||||
rm = kos[-(i+1)]
|
||||
lst = rm.split(" ")
|
||||
if len(lst) > 2:
|
||||
del(lst[2:])
|
||||
rm = " ".join(lst)
|
||||
|
||||
#Change to removing commands
|
||||
rm = rm.replace("modprobe", "modprobe -rq")
|
||||
rm = rm.replace("insmod", "rmmod")
|
||||
status, output = log_os_system(rm, 1)
|
||||
if status:
|
||||
|
@ -260,7 +260,7 @@ def driver_inserted():
|
||||
kos = [
|
||||
'depmod -ae',
|
||||
'modprobe i2c_dev',
|
||||
'modprobe i2c_mux_pca954x',
|
||||
'modprobe i2c_mux_pca954x force_deselect_on_exit=1',
|
||||
'modprobe optoe',
|
||||
'modprobe accton_as6712_32x_cpld',
|
||||
'modprobe cpr_4011_4mxx',
|
||||
@ -281,7 +281,15 @@ def driver_install():
|
||||
def driver_uninstall():
|
||||
global FORCE
|
||||
for i in range(0,len(kos)):
|
||||
rm = kos[-(i+1)].replace("modprobe", "modprobe -rq")
|
||||
#remove parameter if any
|
||||
rm = kos[-(i+1)]
|
||||
lst = rm.split(" ")
|
||||
if len(lst) > 2:
|
||||
del(lst[2:])
|
||||
rm = " ".join(lst)
|
||||
|
||||
#Change to removing commands
|
||||
rm = rm.replace("modprobe", "modprobe -rq")
|
||||
rm = rm.replace("insmod", "rmmod")
|
||||
status, output = log_os_system(rm, 1)
|
||||
if status:
|
||||
|
@ -221,6 +221,29 @@ def show_set_help():
|
||||
print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable"
|
||||
sys.exit(0)
|
||||
|
||||
def diss_i2c_ir3507a(addr):
|
||||
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
|
||||
status, output = commands.getstatusoutput(cmd)
|
||||
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
|
||||
status, output = commands.getstatusoutput(cmd)
|
||||
return status
|
||||
|
||||
def ir3507_check():
|
||||
cmd = "i2cdump -y 0 0x42 s 0x9a"
|
||||
try:
|
||||
status, output = commands.getstatusoutput(cmd)
|
||||
lines = output.split('\n')
|
||||
hn = re.findall(r'\w+', lines[-1])
|
||||
version = int(hn[1], 16)
|
||||
if version == 0x24: #only for ir3507a
|
||||
ret = diss_i2c_ir3507a(4)
|
||||
else:
|
||||
ret = 0
|
||||
except Exception as e:
|
||||
print "Error on ir3507_check() e:" + str(e)
|
||||
return -1
|
||||
return ret
|
||||
|
||||
def show_eeprom_help():
|
||||
cmd = sys.argv[0].split("/")[-1]+ " " + args[0]
|
||||
print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom"
|
||||
@ -256,7 +279,7 @@ def driver_inserted():
|
||||
kos = [
|
||||
'depmod -ae',
|
||||
'modprobe i2c_dev',
|
||||
'modprobe i2c_mux_pca954x',
|
||||
'modprobe i2c_mux_pca954x force_deselect_on_exit=1',
|
||||
'modprobe accton_i2c_cpld',
|
||||
'modprobe cpr_4011_4mxx',
|
||||
'modprobe ym2651y',
|
||||
@ -277,7 +300,15 @@ def driver_install():
|
||||
def driver_uninstall():
|
||||
global FORCE
|
||||
for i in range(0,len(kos)):
|
||||
rm = kos[-(i+1)].replace("modprobe", "modprobe -rq")
|
||||
#remove parameter if any
|
||||
rm = kos[-(i+1)]
|
||||
lst = rm.split(" ")
|
||||
if len(lst) > 2:
|
||||
del(lst[2:])
|
||||
rm = " ".join(lst)
|
||||
|
||||
#Change to removing commands
|
||||
rm = rm.replace("modprobe", "modprobe -rq")
|
||||
rm = rm.replace("insmod", "rmmod")
|
||||
status, output = log_os_system(rm, 1)
|
||||
if status:
|
||||
@ -378,6 +409,9 @@ def do_install():
|
||||
return status
|
||||
else:
|
||||
print PROJECT_NAME.upper()+" drivers detected...."
|
||||
|
||||
ir3507_check()
|
||||
|
||||
if not device_exist():
|
||||
status = device_install()
|
||||
if status:
|
||||
|
@ -124,6 +124,29 @@ def show_set_help():
|
||||
print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable"
|
||||
sys.exit(0)
|
||||
|
||||
def diss_i2c_ir3507a(addr):
|
||||
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
|
||||
status, output = commands.getstatusoutput(cmd)
|
||||
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
|
||||
status, output = commands.getstatusoutput(cmd)
|
||||
return status
|
||||
|
||||
def ir3507_check():
|
||||
cmd = "i2cdump -y 0 0x42 s 0x9a"
|
||||
try:
|
||||
status, output = commands.getstatusoutput(cmd)
|
||||
lines = output.split('\n')
|
||||
hn = re.findall(r'\w+', lines[-1])
|
||||
version = int(hn[1], 16)
|
||||
if version == 0x24: #only for ir3507a
|
||||
ret = diss_i2c_ir3507a(4)
|
||||
else:
|
||||
ret = 0
|
||||
except Exception as e:
|
||||
print "Error on ir3507_check() e:" + str(e)
|
||||
return -1
|
||||
return ret
|
||||
|
||||
def show_eeprom_help():
|
||||
cmd = sys.argv[0].split("/")[-1]+ " " + args[0]
|
||||
print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom"
|
||||
@ -156,7 +179,7 @@ def driver_check():
|
||||
|
||||
kos = [
|
||||
'modprobe i2c_dev',
|
||||
'modprobe i2c_mux_pca954x',
|
||||
'modprobe i2c_mux_pca954x force_deselect_on_exit=1',
|
||||
'modprobe accton_i2c_cpld' ,
|
||||
'modprobe ym2651y' ,
|
||||
'modprobe x86-64-accton-as7816-64x-fan' ,
|
||||
@ -177,7 +200,15 @@ def driver_install():
|
||||
def driver_uninstall():
|
||||
global FORCE
|
||||
for i in range(0,len(kos)):
|
||||
rm = kos[-(i+1)].replace("modprobe", "modprobe -rq")
|
||||
#remove parameter if any
|
||||
rm = kos[-(i+1)]
|
||||
lst = rm.split(" ")
|
||||
if len(lst) > 2:
|
||||
del(lst[2:])
|
||||
rm = " ".join(lst)
|
||||
|
||||
#Change to removing commands
|
||||
rm = rm.replace("modprobe", "modprobe -rq")
|
||||
rm = rm.replace("insmod", "rmmod")
|
||||
status, output = log_os_system(rm, 1)
|
||||
if status:
|
||||
@ -304,6 +335,9 @@ def do_install():
|
||||
return status
|
||||
else:
|
||||
print PROJECT_NAME.upper()+" drivers detected...."
|
||||
|
||||
ir3507_check()
|
||||
|
||||
if not device_exist():
|
||||
print "No device, installing...."
|
||||
status = device_install()
|
||||
|
@ -193,7 +193,6 @@ kos = [
|
||||
'depmod -ae',
|
||||
'modprobe i2c_dev',
|
||||
'modprobe i2c_mux_pca954x force_deselect_on_exit=1',
|
||||
#'modprobe i2c_mux_pca954x',
|
||||
'modprobe optoe',
|
||||
'modprobe minipack_psensor']
|
||||
|
||||
@ -207,7 +206,15 @@ def driver_install():
|
||||
|
||||
def driver_uninstall():
|
||||
for i in range(0,len(kos)):
|
||||
rm = kos[-(i+1)].replace("modprobe", "modprobe -rq")
|
||||
#remove parameter if any
|
||||
rm = kos[-(i+1)]
|
||||
lst = rm.split(" ")
|
||||
if len(lst) > 2:
|
||||
del(lst[2:])
|
||||
rm = " ".join(lst)
|
||||
|
||||
#Change to removing commands
|
||||
rm = rm.replace("modprobe", "modprobe -rq")
|
||||
rm = rm.replace("insmod", "rmmod")
|
||||
status, output = log_os_system(rm, 1)
|
||||
if status:
|
||||
|
Loading…
Reference in New Issue
Block a user