File tree Expand file tree Collapse file tree 5 files changed +93
-12
lines changed
platform/broadcom/sonic-platform-modules-accton Expand file tree Collapse file tree 5 files changed +93
-12
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,30 @@ def show_set_help():
133133 print " use \" " + cmd + " sfp 1-56 {0|1}\" to set sfp# tx_disable"
134134 sys .exit (0 )
135135
136+ def dis_i2c_ir3570a (addr ):
137+ cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
138+ status , output = commands .getstatusoutput (cmd )
139+ cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
140+ status , output = commands .getstatusoutput (cmd )
141+ return status
142+
143+ def ir3570_check ():
144+ cmd = "i2cdump -y 0 0x42 s 0x9a"
145+ try :
146+ status , output = commands .getstatusoutput (cmd )
147+ lines = output .split ('\n ' )
148+ hn = re .findall (r'\w+' , lines [- 1 ])
149+ version = int (hn [1 ], 16 )
150+ if version == 0x24 : #only for ir3570a
151+ ret = dis_i2c_ir3570a (4 )
152+ else :
153+ ret = 0
154+ except Exception as e :
155+ print "Error on ir3570_check() e:" + str (e )
156+ return - 1
157+ return ret
158+
159+
136160def show_eeprom_help ():
137161 cmd = sys .argv [0 ].split ("/" )[- 1 ]+ " " + args [0 ]
138162 print " use \" " + cmd + " 1-56 \" to dump sfp# eeprom"
@@ -359,6 +383,9 @@ def do_install():
359383 return status
360384 else :
361385 print PROJECT_NAME .upper ()+ " drivers detected...."
386+
387+ ir3570_check ()
388+
362389 if not device_exist ():
363390 print "No device, installing...."
364391 status = device_install ()
Original file line number Diff line number Diff line change @@ -221,26 +221,26 @@ def show_set_help():
221221 print " use \" " + cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable"
222222 sys .exit (0 )
223223
224- def diss_i2c_ir3507a (addr ):
224+ def dis_i2c_ir3570a (addr ):
225225 cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
226226 status , output = commands .getstatusoutput (cmd )
227227 cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
228228 status , output = commands .getstatusoutput (cmd )
229229 return status
230230
231- def ir3507_check ():
231+ def ir3570_check ():
232232 cmd = "i2cdump -y 0 0x42 s 0x9a"
233233 try :
234234 status , output = commands .getstatusoutput (cmd )
235235 lines = output .split ('\n ' )
236236 hn = re .findall (r'\w+' , lines [- 1 ])
237237 version = int (hn [1 ], 16 )
238- if version == 0x24 : #only for ir3507a
239- ret = diss_i2c_ir3507a (4 )
238+ if version == 0x24 : #only for ir3570a
239+ ret = dis_i2c_ir3570a (4 )
240240 else :
241241 ret = 0
242242 except Exception as e :
243- print "Error on ir3507_check () e:" + str (e )
243+ print "Error on ir3570_check () e:" + str (e )
244244 return - 1
245245 return ret
246246
@@ -410,7 +410,7 @@ def do_install():
410410 else :
411411 print PROJECT_NAME .upper ()+ " drivers detected...."
412412
413- ir3507_check ()
413+ ir3570_check ()
414414
415415 if not device_exist ():
416416 status = device_install ()
Original file line number Diff line number Diff line change @@ -206,6 +206,30 @@ def show_eeprom_help():
206206 print " use \" " + cmd + " 1-32 \" to dump sfp# eeprom"
207207 sys .exit (0 )
208208
209+ def dis_i2c_ir3570a (addr ):
210+ cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
211+ status , output = commands .getstatusoutput (cmd )
212+ cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
213+ status , output = commands .getstatusoutput (cmd )
214+ return status
215+
216+ def ir3570_check ():
217+ cmd = "i2cdump -y 0 0x42 s 0x9a"
218+ try :
219+ status , output = commands .getstatusoutput (cmd )
220+ lines = output .split ('\n ' )
221+ hn = re .findall (r'\w+' , lines [- 1 ])
222+ version = int (hn [1 ], 16 )
223+ if version == 0x24 : #only for ir3570a
224+ ret = dis_i2c_ir3570a (4 )
225+ else :
226+ ret = 0
227+ except Exception as e :
228+ print "Error on ir3570_check() e:" + str (e )
229+ return - 1
230+ return ret
231+
232+
209233def my_log (txt ):
210234 if DEBUG == True :
211235 print "[ACCTON DBG]: " + txt
@@ -355,6 +379,9 @@ def do_install():
355379 return status
356380 else :
357381 print PROJECT_NAME .upper ()+ " drivers detected...."
382+
383+ ir3570_check ()
384+
358385 if not device_exist ():
359386 status = device_install ()
360387 if status :
Original file line number Diff line number Diff line change @@ -124,26 +124,26 @@ def show_set_help():
124124 print " use \" " + cmd + " sfp 1-64 {0|1}\" to set sfp# tx_disable"
125125 sys .exit (0 )
126126
127- def diss_i2c_ir3507a (addr ):
127+ def dis_i2c_ir3570a (addr ):
128128 cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
129129 status , output = commands .getstatusoutput (cmd )
130130 cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
131131 status , output = commands .getstatusoutput (cmd )
132132 return status
133133
134- def ir3507_check ():
134+ def ir3570_check ():
135135 cmd = "i2cdump -y 0 0x42 s 0x9a"
136136 try :
137137 status , output = commands .getstatusoutput (cmd )
138138 lines = output .split ('\n ' )
139139 hn = re .findall (r'\w+' , lines [- 1 ])
140140 version = int (hn [1 ], 16 )
141- if version == 0x24 : #only for ir3507a
142- ret = diss_i2c_ir3507a (4 )
141+ if version == 0x24 : #only for ir3570a
142+ ret = dis_i2c_ir3570a (4 )
143143 else :
144144 ret = 0
145145 except Exception as e :
146- print "Error on ir3507_check () e:" + str (e )
146+ print "Error on ir3570_check () e:" + str (e )
147147 return - 1
148148 return ret
149149
@@ -338,7 +338,7 @@ def do_install():
338338 else :
339339 print PROJECT_NAME .upper ()+ " drivers detected...."
340340
341- ir3507_check ()
341+ ir3570_check ()
342342
343343 if not device_exist ():
344344 print "No device, installing...."
Original file line number Diff line number Diff line change @@ -206,6 +206,30 @@ def show_set_help():
206206 print " use \" " + cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable"
207207 sys .exit (0 )
208208
209+ def dis_i2c_ir3570a (addr ):
210+ cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
211+ status , output = commands .getstatusoutput (cmd )
212+ cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
213+ status , output = commands .getstatusoutput (cmd )
214+ return status
215+
216+ def ir3570_check ():
217+ cmd = "i2cdump -y 0 0x42 s 0x9a"
218+ try :
219+ status , output = commands .getstatusoutput (cmd )
220+ lines = output .split ('\n ' )
221+ hn = re .findall (r'\w+' , lines [- 1 ])
222+ version = int (hn [1 ], 16 )
223+ if version == 0x24 : #only for ir3570a
224+ ret = dis_i2c_ir3570a (4 )
225+ else :
226+ ret = 0
227+ except Exception as e :
228+ print "Error on ir3570_check() e:" + str (e )
229+ return - 1
230+ return ret
231+
232+
209233def show_eeprom_help ():
210234 cmd = sys .argv [0 ].split ("/" )[- 1 ]+ " " + args [0 ]
211235 print " use \" " + cmd + " 1-32 \" to dump sfp# eeprom"
@@ -352,6 +376,9 @@ def do_install():
352376 return status
353377 else :
354378 print PROJECT_NAME .upper ()+ " drivers detected...."
379+
380+ ir3570_check ()
381+
355382 if not device_exist ():
356383 status = device_install ()
357384 if status :
You can’t perform that action at this time.
0 commit comments