sonic-buildimage/platform/centec/sonic-platform-modules-v682/48y8c-d/service/release.py
LuiSzee 1e17d9c5b2 [centec] support v682-48y8c and v682-48x8c (#9349)
Why I did it
Adding platform support for centec v682-48y8c and v682-48x8c.
V682-48y8c switch has 48 SFP+ (1G/10G/25G) ports, 8 QSFP28 (40G/100G) ports on CENTEC TsingMa.MX.
V682-48y8c is different from V682-48y8c_d in that:

transceiver is managed by cpu smbus rather than TsingMa.MX i2c bus.
port led is managed by mcu inside TsingMa.MX.
fan, psu, sensors, leds are managed by cpu smbus other than the cpu board vendor's close sourse driver.
V682-48x8c switch has 48 SFP+ (1G/10G) ports, 8 QSFP28 (40G/100G) ports on CENTEC TsingMa.MX.
CPU used in v682-48y8c and v682-48x8c is Intel(R) Xeon(R) CPU D-1527.

How I did it
Modify related code in platform and device directory.
Upgrade centec sai to v1.9.
upgrade python to python3 and kernel version to 5.0 for V682-48y8c_d.
How to verify it
Build centec amd64 sonic image, verify platform functions (port, sfp, led etc) on centec v682-48y8c and v682-48x8c board.

Co-authored-by: shil <shil@centecnetworks.com>
2021-12-26 20:57:12 -08:00

71 lines
2.3 KiB
Python

#!/usr/bin/env python
import os
import sys
import time
susi4_lib = '/usr/local/lib/python3.9/dist-packages/'
if not susi4_lib in os.environ.setdefault('LD_LIBRARY_PATH', ''):
os.environ['LD_LIBRARY_PATH'] += (':' + susi4_lib)
try:
os.execv(sys.argv[0], sys.argv)
except Exception as e:
sys.exit('failed to execute under modified environment!')
from _Susi4 import *
def release_board():
SusiLibInitialize()
SusiI2CWriteTransfer(0, 0x36 * 2, 0x0e, '\x00')
SusiI2CWriteTransfer(0, 0x36 * 2, 0x0f, '\x00')
SusiI2CWriteTransfer(0, 0x36 * 2, 0x10, '\x00')
SusiI2CWriteTransfer(0, 0x37 * 2, 0x0e, '\x00')
SusiI2CWriteTransfer(0, 0x37 * 2, 0x0f, '\x00')
SusiI2CWriteTransfer(0, 0x37 * 2, 0x10, '\x00')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x04')
SusiI2CWriteTransfer(0, 0x2c * 2, 0x32, '\x7f')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x04')
SusiI2CWriteTransfer(0, 0x2c * 2, 0x33, '\x7f')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x04')
SusiI2CWriteTransfer(0, 0x2c * 2, 0x34, '\x7f')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x04')
SusiI2CWriteTransfer(0, 0x2c * 2, 0x35, '\x7f')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x08')
SusiI2CWriteTransfer(0, 0x2c * 2, 0x32, '\x7f')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x08')
SusiI2CWriteTransfer(0, 0x2c * 2, 0x33, '\x7f')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x08')
SusiI2CWriteTransfer(0, 0x2c * 2, 0x34, '\x7f')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x08')
SusiI2CWriteTransfer(0, 0x2c * 2, 0x35, '\x7f')
SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00')
SusiI2CWriteTransfer(0, 0x37 * 2, 0x4, '\x00')
time.sleep(1)
SusiI2CWriteTransfer(0, 0x37 * 2, 0x4, '\x01')
time.sleep(3)
os.system('echo 1 > /sys/bus/pci/devices/0000\:00\:1c.0/remove')
time.sleep(1)
os.system('echo 1 > /sys/bus/pci/rescan')
SusiLibUninitialize()
if __name__ == '__main__':
release_board()