Commit ff8e344 1 parent 35989ab commit ff8e344 Copy full SHA for ff8e344
File tree 5 files changed +93
-12
lines changed
platform/broadcom/sonic-platform-modules-accton
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():
133
133
print " use \" " + cmd + " sfp 1-56 {0|1}\" to set sfp# tx_disable"
134
134
sys .exit (0 )
135
135
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
+
136
160
def show_eeprom_help ():
137
161
cmd = sys .argv [0 ].split ("/" )[- 1 ]+ " " + args [0 ]
138
162
print " use \" " + cmd + " 1-56 \" to dump sfp# eeprom"
@@ -359,6 +383,9 @@ def do_install():
359
383
return status
360
384
else :
361
385
print PROJECT_NAME .upper ()+ " drivers detected...."
386
+
387
+ ir3570_check ()
388
+
362
389
if not device_exist ():
363
390
print "No device, installing...."
364
391
status = device_install ()
Original file line number Diff line number Diff line change @@ -221,26 +221,26 @@ def show_set_help():
221
221
print " use \" " + cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable"
222
222
sys .exit (0 )
223
223
224
- def diss_i2c_ir3507a (addr ):
224
+ def dis_i2c_ir3570a (addr ):
225
225
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
226
226
status , output = commands .getstatusoutput (cmd )
227
227
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
228
228
status , output = commands .getstatusoutput (cmd )
229
229
return status
230
230
231
- def ir3507_check ():
231
+ def ir3570_check ():
232
232
cmd = "i2cdump -y 0 0x42 s 0x9a"
233
233
try :
234
234
status , output = commands .getstatusoutput (cmd )
235
235
lines = output .split ('\n ' )
236
236
hn = re .findall (r'\w+' , lines [- 1 ])
237
237
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 )
240
240
else :
241
241
ret = 0
242
242
except Exception as e :
243
- print "Error on ir3507_check () e:" + str (e )
243
+ print "Error on ir3570_check () e:" + str (e )
244
244
return - 1
245
245
return ret
246
246
@@ -410,7 +410,7 @@ def do_install():
410
410
else :
411
411
print PROJECT_NAME .upper ()+ " drivers detected...."
412
412
413
- ir3507_check ()
413
+ ir3570_check ()
414
414
415
415
if not device_exist ():
416
416
status = device_install ()
Original file line number Diff line number Diff line change @@ -206,6 +206,30 @@ def show_eeprom_help():
206
206
print " use \" " + cmd + " 1-32 \" to dump sfp# eeprom"
207
207
sys .exit (0 )
208
208
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
+
209
233
def my_log (txt ):
210
234
if DEBUG == True :
211
235
print "[ACCTON DBG]: " + txt
@@ -355,6 +379,9 @@ def do_install():
355
379
return status
356
380
else :
357
381
print PROJECT_NAME .upper ()+ " drivers detected...."
382
+
383
+ ir3570_check ()
384
+
358
385
if not device_exist ():
359
386
status = device_install ()
360
387
if status :
Original file line number Diff line number Diff line change @@ -124,26 +124,26 @@ def show_set_help():
124
124
print " use \" " + cmd + " sfp 1-64 {0|1}\" to set sfp# tx_disable"
125
125
sys .exit (0 )
126
126
127
- def diss_i2c_ir3507a (addr ):
127
+ def dis_i2c_ir3570a (addr ):
128
128
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
129
129
status , output = commands .getstatusoutput (cmd )
130
130
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
131
131
status , output = commands .getstatusoutput (cmd )
132
132
return status
133
133
134
- def ir3507_check ():
134
+ def ir3570_check ():
135
135
cmd = "i2cdump -y 0 0x42 s 0x9a"
136
136
try :
137
137
status , output = commands .getstatusoutput (cmd )
138
138
lines = output .split ('\n ' )
139
139
hn = re .findall (r'\w+' , lines [- 1 ])
140
140
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 )
143
143
else :
144
144
ret = 0
145
145
except Exception as e :
146
- print "Error on ir3507_check () e:" + str (e )
146
+ print "Error on ir3570_check () e:" + str (e )
147
147
return - 1
148
148
return ret
149
149
@@ -338,7 +338,7 @@ def do_install():
338
338
else :
339
339
print PROJECT_NAME .upper ()+ " drivers detected...."
340
340
341
- ir3507_check ()
341
+ ir3570_check ()
342
342
343
343
if not device_exist ():
344
344
print "No device, installing...."
Original file line number Diff line number Diff line change @@ -206,6 +206,30 @@ def show_set_help():
206
206
print " use \" " + cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable"
207
207
sys .exit (0 )
208
208
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
+
209
233
def show_eeprom_help ():
210
234
cmd = sys .argv [0 ].split ("/" )[- 1 ]+ " " + args [0 ]
211
235
print " use \" " + cmd + " 1-32 \" to dump sfp# eeprom"
@@ -352,6 +376,9 @@ def do_install():
352
376
return status
353
377
else :
354
378
print PROJECT_NAME .upper ()+ " drivers detected...."
379
+
380
+ ir3570_check ()
381
+
355
382
if not device_exist ():
356
383
status = device_install ()
357
384
if status :
You can’t perform that action at this time.
0 commit comments