[device/Accton] Fix i2c fault from ir3570a on 3 models (#3245)

I2c burst read may failed due to misoperation of ir3570a(A DC-to-DC converter IC).
As #2966, there are 3 more models have this symptom, as7326-56x, as7726-32x, and as9716-32d.
Also correct typo of naming on as7816-64x and as7716-32x.

Signed-off-by: roy_lee roy_lee@accton.com

What I did
Disabling i2c function of ir3570a which may failed i2c tranfer to others.
Close channel of mux after data transfered.

How I did it
Identify version of ir3570, if it's ir3570a, disable its alias i2c address.
Enable parameter of driver i2c_mux_pca954x to close channel on after every access.

How to verify it
Write 08 to offset 0xcf of systom eeprom and execute i2c block read.
It will return error.
plug-in several transceivers and run "show interfaces transceiver presence" and "sfputil show presence". You may see the different result. (But doing this requires updated xcvrd).

Signed-off-by: roy_lee <roy_lee@accton.com>
This commit is contained in:
Roy Lee 2019-08-01 02:28:03 +08:00 committed by lguohan
parent 35989ab7c7
commit ff8e34463d
5 changed files with 93 additions and 12 deletions

View File

@ -133,6 +133,30 @@ def show_set_help():
print " use \""+ cmd + " sfp 1-56 {0|1}\" to set sfp# tx_disable"
sys.exit(0)
def dis_i2c_ir3570a(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 ir3570_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 ir3570a
ret = dis_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3570_check() e:" + str(e)
return -1
return ret
def show_eeprom_help():
cmd = sys.argv[0].split("/")[-1]+ " " + args[0]
print " use \""+ cmd + " 1-56 \" to dump sfp# eeprom"
@ -359,6 +383,9 @@ def do_install():
return status
else:
print PROJECT_NAME.upper()+" drivers detected...."
ir3570_check()
if not device_exist():
print "No device, installing...."
status = device_install()

View File

@ -221,26 +221,26 @@ 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):
def dis_i2c_ir3570a(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():
def ir3570_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)
if version == 0x24: #only for ir3570a
ret = dis_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3507_check() e:" + str(e)
print "Error on ir3570_check() e:" + str(e)
return -1
return ret
@ -410,7 +410,7 @@ def do_install():
else:
print PROJECT_NAME.upper()+" drivers detected...."
ir3507_check()
ir3570_check()
if not device_exist():
status = device_install()

View File

@ -206,6 +206,30 @@ def show_eeprom_help():
print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom"
sys.exit(0)
def dis_i2c_ir3570a(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 ir3570_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 ir3570a
ret = dis_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3570_check() e:" + str(e)
return -1
return ret
def my_log(txt):
if DEBUG == True:
print "[ACCTON DBG]: "+txt
@ -355,6 +379,9 @@ def do_install():
return status
else:
print PROJECT_NAME.upper()+" drivers detected...."
ir3570_check()
if not device_exist():
status = device_install()
if status:

View File

@ -124,26 +124,26 @@ def show_set_help():
print " use \""+ cmd + " sfp 1-64 {0|1}\" to set sfp# tx_disable"
sys.exit(0)
def diss_i2c_ir3507a(addr):
def dis_i2c_ir3570a(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():
def ir3570_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)
if version == 0x24: #only for ir3570a
ret = dis_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3507_check() e:" + str(e)
print "Error on ir3570_check() e:" + str(e)
return -1
return ret
@ -338,7 +338,7 @@ def do_install():
else:
print PROJECT_NAME.upper()+" drivers detected...."
ir3507_check()
ir3570_check()
if not device_exist():
print "No device, installing...."

View File

@ -206,6 +206,30 @@ def show_set_help():
print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable"
sys.exit(0)
def dis_i2c_ir3570a(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 ir3570_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 ir3570a
ret = dis_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3570_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"
@ -352,6 +376,9 @@ def do_install():
return status
else:
print PROJECT_NAME.upper()+" drivers detected...."
ir3570_check()
if not device_exist():
status = device_install()
if status: