From 3bdfdd95ea5d1403193f5680ee62a30e1cc23dd4 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Fri, 1 Sep 2023 22:43:18 -0700 Subject: [PATCH] Revert "[Ragile]: Add new centec platform ra-b6010 (#14819)" This reverts commit 75062436e82e28e15469da8ad3c3b4a5c7039750. --- .../RA-b6010-48gt4x-board.json | 868 ---- .../RA-b6010-48gt4x-p-chip-profile.txt | 96 - .../RA-b6010-48gt4x-p-datapath.txt | 281 -- .../RA-B6010-48GT4X/default_sku | 1 - .../RA-B6010-48GT4X/phy_mapping.cfg | 198 - .../RA-B6010-48GT4X/platform_asic | 1 - .../RA-B6010-48GT4X/port_config.ini | 53 - .../RA-B6010-48GT4X/sai.profile | 4 - .../RA-B6010-48GT4X/start_up.cfg | 48 - .../default_sku | 1 - .../installer.conf | 9 - .../platform.json | 173 - .../platform_asic | 1 - .../plugins/config.py | 22 - .../plugins/eeprom.py | 21 - .../plugins/sfputil.py | 455 -- .../plugins/ssd_util.py | 112 - .../pmon_daemon_control.json | 7 - .../system_health_monitoring_config.json | 0 platform/centec-arm64/one-image.mk | 3 +- .../centec-arm64/platform-modules-ragile.dep | 9 - .../centec-arm64/platform-modules-ragile.mk | 10 - platform/centec-arm64/rules.mk | 1 - .../sonic-platform-modules-ragile/LICENSE | 15 - .../sonic-platform-modules-ragile/README.md | 1 - .../common/Makefile | 47 - .../common/app/Makefile | 26 - .../common/app/firmware_upgrade/Makefile | 20 - .../common/app/firmware_upgrade/Rules.mk | 45 - .../firmware-cpld-ispvme.spec | 25 - .../firmware_driver_ispvme/Makefile | 22 - .../firmware_cpld_ispvme.c | 283 -- .../firmware_cpld_upgrade_ispvme.c | 329 -- .../firmware_driver_ispvme/firmware_ispvme.c | 142 - .../include/config_ispvme.h | 10 - .../include/firmware_cpld_ispvme.h | 52 - .../include/firmware_ispvme.h | 90 - .../firmware_driver_ispvme/ra_b6010_48gt4x.c | 493 --- .../firmware_driver_ispvme/ra_b6010_48gt4x.h | 29 - .../firmware_upgrade_ispvme/Makefile | 39 - .../firmware_upgrade_ispvme/common.h | 28 - .../firmware_upgrade_ispvme/debug_ispvme.c | 67 - .../firmware_upgrade_ispvme/dfd_fpga_debug.c | 120 - .../firmware_upgrade_ispvme/dfd_fpga_debug.h | 70 - .../firmware_upgrade_ispvme/dfd_fpga_pkt.c | 321 -- .../firmware_upgrade_ispvme/dfd_fpga_pkt.h | 95 - .../firmware_upgrade_ispvme/dfd_fpga_upg.c | 1443 ------- .../firmware_app_ispvme.c | 906 ---- .../firmware_upgrade_ispvme/hardware.c | 249 -- .../include/debug_ispvme.h | 21 - .../include/firmware_app_ispvme.h | 119 - .../firmware_upgrade_ispvme/ispvm_ui.c | 845 ---- .../firmware_upgrade_ispvme/ivm_core.c | 3033 ------------- .../firmware_upgrade_ispvme/vmopcode.h | 192 - .../common/app/libextphy.so | Bin 632408 -> 0 bytes .../common/lib/eepromutil/__init__.py | 0 .../common/lib/eepromutil/fantlv.py | 210 - .../common/lib/eepromutil/fru.py | 957 ----- .../common/lib/rgutil/__init__.py | 0 .../common/lib/rgutil/baseutil.py | 23 - .../common/lib/rgutil/logutil.py | 67 - .../common/lib/rgutil/smbus.py | 774 ---- .../common/modules/Makefile | 32 - .../common/modules/dfd_tlveeprom.c | 521 --- .../common/modules/dfd_tlveeprom.h | 121 - .../common/modules/i2c-mux-pca954x.c | 3817 ----------------- .../common/modules/i2c-mux-pca9641.c | 643 --- .../common/modules/optoe.c | 1195 ------ .../common/modules/ragile.h | 158 - .../common/modules/ragile_common_module.c | 210 - .../common/modules/ragile_platform.c | 79 - .../common/modules/rg_at24.c | 858 ---- .../common/modules/rg_spi_gpio.c | 91 - .../common/modules/rtcpcf85063.c | 258 -- .../common/modules/spi-bitbang-txrx.h | 107 - .../common/modules/spi-gpio.c | 546 --- .../common/modules/tpm.h | 543 --- .../common/modules/tpm_tis_core.c | 855 ---- .../common/modules/tpm_tis_core.h | 156 - .../common/modules/tpm_tis_spi.c | 262 -- .../common/script/device_i2c.py | 285 -- .../common/script/fancontrol.py | 497 --- .../common/script/interface.py | 77 - .../common/script/platform_sensors.py | 92 - .../common/script/ragilecommon.py | 1365 ------ .../common/script/ragileconfig.py | 228 - .../common/script/ragileutil.py | 2088 --------- .../common/script/sensors | 8 - .../common/service/device_i2c.service | 15 - .../common/service/fancontrol.service | 12 - .../common_custom/common_ragile/Makefile | 24 - .../common_ragile/lib/fruutil/__init__.py | 0 .../common_ragile/lib/fruutil/fru.py | 1286 ------ .../common_ragile/lib/fruutil/product.conf | 67 - .../common_ragile/lib/logutil/__init__.py | 0 .../common_ragile/lib/logutil/logutil.py | 64 - .../lib/redfishutil/redfish_api.py | 304 -- .../common_ragile/lib/rjutil/__init__.py | 0 .../common_ragile/lib/rjutil/ragileutil.py | 290 -- .../common_ragile/lib/sonic_fwmgr/__init__.py | 0 .../lib/sonic_fwmgr/fwgmr_base.py | 141 - .../common_custom/common_ragile/script/ctccmd | 3 - .../common_ragile/script/privatenetwork.py | 50 - .../common_ragile/script/privatenetwork.sh | 26 - .../script/update_machine_config.sh | 24 - .../service/privatenetwork.service | 13 - .../debian/changelog | 6 - .../debian/compat | 1 - .../debian/control | 11 - .../platform-modules-ra-b6010-48gt4x.init | 61 - .../platform-modules-ra-b6010-48gt4x.install | 2 - .../platform-modules-ra-b6010-48gt4x.postinst | 8 - .../debian/rules | 94 - .../arm64_ragile_ra_b6010_48gt4x_r0_config.py | 94 - .../ra-b6010-48gt4x/config/fan_ctrl_cfg.json | 40 - .../ra-b6010-48gt4x/modules/Makefile | 1 - .../ra-b6010-48gt4x/modules/rg_cpld.c | 340 -- .../service/ra-b6010-48gt4x_platform.service | 13 - .../ra-b6010-48gt4x/setup.py | 15 - .../sonic_platform/__init__.py | 3 - .../ra-b6010-48gt4x/sonic_platform/chassis.py | 444 -- .../sonic_platform/component.py | 93 - .../ra-b6010-48gt4x/sonic_platform/eeprom.py | 38 - .../ra-b6010-48gt4x/sonic_platform/fan.py | 178 - .../sonic_platform/fan_drawer.py | 124 - .../sonic_platform/hwaccess.py | 46 - .../sonic_platform/platform.py | 15 - .../ra-b6010-48gt4x/sonic_platform/psu.py | 231 - .../sonic_platform/redfish_api.py | 304 -- .../ra-b6010-48gt4x/sonic_platform/sfp.py | 325 -- .../ra-b6010-48gt4x/sonic_platform/thermal.py | 172 - platform/centec-arm64/sonic_fit.its | 19 - .../centec-arm64/tsingma-bsp/debian/rules | 2 - .../tsingma-bsp/debian/tsingma-bsp.install | 1 - .../tsingma-bsp/src/ctcmac/ctcmac.c | 3 +- .../tsingma-bsp/src/ra-b6010-48gt4x/Makefile | 5 - .../tsingma-bsp/src/ra-b6010-48gt4x/arm-gic.h | 23 - .../src/ra-b6010-48gt4x/ctc5236-clks.h | 25 - .../src/ra-b6010-48gt4x/ctc5236-clock.dtsi | 63 - .../src/ra-b6010-48gt4x/ctc5236.dtsi | 428 -- .../tsingma-bsp/src/ra-b6010-48gt4x/irq.h | 20 - .../ra-b6010-48gt4x/ra-b6010-48gt4x-r0.dts | 328 -- 142 files changed, 2 insertions(+), 34567 deletions(-) delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-board.json delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-p-chip-profile.txt delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-p-datapath.txt delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/default_sku delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/phy_mapping.cfg delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/platform_asic delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/port_config.ini delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/sai.profile delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/start_up.cfg delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/default_sku delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/installer.conf delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/platform.json delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/platform_asic delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/config.py delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/eeprom.py delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/sfputil.py delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/ssd_util.py delete mode 100644 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/pmon_daemon_control.json delete mode 100755 device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/system_health_monitoring_config.json delete mode 100644 platform/centec-arm64/platform-modules-ragile.dep delete mode 100644 platform/centec-arm64/platform-modules-ragile.mk delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/LICENSE delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/README.md delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/Makefile delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/Makefile delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/Makefile delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/Rules.mk delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware-cpld-ispvme.spec delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/Makefile delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_cpld_ispvme.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_cpld_upgrade_ispvme.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_ispvme.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/config_ispvme.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/firmware_cpld_ispvme.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/firmware_ispvme.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/ra_b6010_48gt4x.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/ra_b6010_48gt4x.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/Makefile delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/common.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/debug_ispvme.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_debug.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_debug.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_pkt.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_pkt.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_upg.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/firmware_app_ispvme.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/hardware.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/include/debug_ispvme.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/include/firmware_app_ispvme.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/ispvm_ui.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/ivm_core.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/vmopcode.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/app/libextphy.so delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/__init__.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/fantlv.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/fru.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/__init__.py delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/baseutil.py delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/logutil.py delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/smbus.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/Makefile delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/dfd_tlveeprom.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/dfd_tlveeprom.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/optoe.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile_common_module.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile_platform.c delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rg_at24.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rg_spi_gpio.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rtcpcf85063.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/spi-bitbang-txrx.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/spi-gpio.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_core.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_core.h delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_spi.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/script/device_i2c.py delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/common/script/fancontrol.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/script/interface.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/script/platform_sensors.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragilecommon.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragileconfig.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragileutil.py delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/common/script/sensors delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/service/device_i2c.service delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common/service/fancontrol.service delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/Makefile delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/__init__.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/fru.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/product.conf delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/logutil/__init__.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/logutil/logutil.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/redfishutil/redfish_api.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/rjutil/__init__.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/rjutil/ragileutil.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/sonic_fwmgr/__init__.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/sonic_fwmgr/fwgmr_base.py delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/ctccmd delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/privatenetwork.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/privatenetwork.sh delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/update_machine_config.sh delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/service/privatenetwork.service delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/debian/changelog delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/debian/compat delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/debian/control delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.init delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.install delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.postinst delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/debian/rules delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/config/arm64_ragile_ra_b6010_48gt4x_r0_config.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/config/fan_ctrl_cfg.json delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/modules/Makefile delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/modules/rg_cpld.c delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/service/ra-b6010-48gt4x_platform.service delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/setup.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/__init__.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/chassis.py delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/component.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/eeprom.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/fan.py delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/fan_drawer.py delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/hwaccess.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/platform.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/psu.py delete mode 100755 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/redfish_api.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/sfp.py delete mode 100644 platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/thermal.py delete mode 100755 platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/Makefile delete mode 100755 platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/arm-gic.h delete mode 100755 platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236-clks.h delete mode 100755 platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236-clock.dtsi delete mode 100755 platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236.dtsi delete mode 100755 platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/irq.h delete mode 100755 platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ra-b6010-48gt4x-r0.dts diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-board.json b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-board.json deleted file mode 100644 index 80fb222380..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-board.json +++ /dev/null @@ -1,868 +0,0 @@ -{ - "macleds" : { - "polarity" : 1, - "freq" : 2500, - "interval" : 50000000, - "maps" : [ - { - "port_id" : 0, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port1/brightness" - }, - { - "port_id" : 1, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port2/brightness" - }, - { - "port_id" : 2, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port3/brightness" - }, - { - "port_id" : 3, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port4/brightness" - }, - { - "port_id" : 4, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port5/brightness" - }, - { - "port_id" : 5, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port6/brightness" - }, - { - "port_id" : 6, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port7/brightness" - }, - { - "port_id" : 7, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port8/brightness" - }, - { - "port_id" : 16, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port9/brightness" - }, - { - "port_id" : 17, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port10/brightness" - }, - { - "port_id" : 18, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port11/brightness" - }, - { - "port_id" : 19, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port12/brightness" - }, - { - "port_id" : 20, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port13/brightness" - }, - { - "port_id" : 21, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port14/brightness" - }, - { - "port_id" : 22, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port15/brightness" - }, - { - "port_id" : 23, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port16/brightness" - }, - { - "port_id" : 8, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port17/brightness" - }, - { - "port_id" : 9, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port18/brightness" - }, - { - "port_id" : 10, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port19/brightness" - }, - { - "port_id" : 11, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port20/brightness" - }, - { - "port_id" : 32, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port21/brightness" - }, - { - "port_id" : 33, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port22/brightness" - }, - { - "port_id" : 34, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port23/brightness" - }, - { - "port_id" : 35, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port24/brightness" - }, - { - "port_id" : 36, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port25/brightness" - }, - { - "port_id" : 37, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port26/brightness" - }, - { - "port_id" : 38, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port27/brightness" - }, - { - "port_id" : 39, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port28/brightness" - }, - { - "port_id" : 40, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port29/brightness" - }, - { - "port_id" : 41, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port30/brightness" - }, - { - "port_id" : 42, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port31/brightness" - }, - { - "port_id" : 43, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port32/brightness" - }, - { - "port_id" : 24, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port33/brightness" - }, - { - "port_id" : 25, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port34/brightness" - }, - { - "port_id" : 26, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port35/brightness" - }, - { - "port_id" : 27, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port36/brightness" - }, - { - "port_id" : 48, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port37/brightness" - }, - { - "port_id" : 49, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port38/brightness" - }, - { - "port_id" : 50, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port39/brightness" - }, - { - "port_id" : 51, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port40/brightness" - }, - { - "port_id" : 52, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port41/brightness" - }, - { - "port_id" : 53, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port42/brightness" - }, - { - "port_id" : 54, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port43/brightness" - }, - { - "port_id" : 55, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port44/brightness" - }, - { - "port_id" : 56, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port45/brightness" - }, - { - "port_id" : 57, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port46/brightness" - }, - { - "port_id" : 58, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port47/brightness" - }, - { - "port_id" : 59, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port48/brightness" - }, - { - "port_id" : 12, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port49/brightness" - }, - { - "port_id" : 13, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port50/brightness" - }, - { - "port_id" : 14, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port51/brightness" - }, - { - "port_id" : 15, - "lchip" : 0, - "ctl_id" : 0, - "mode" : "LED_MODE_1_RXLNK_BIACT", - "fixed" : 0, - "sysfs_path" : "/sys/class/leds/port52/brightness" - } - ] - }, - "phys" : [ - { - "macid" : 0, - "busid" : 0, - "addr" : 0, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 1, - "busid" : 0, - "addr" : 1, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 2, - "busid" : 0, - "addr" : 2, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 3, - "busid" : 0, - "addr" : 3, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 4, - "busid" : 0, - "addr" : 4, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 5, - "busid" : 0, - "addr" : 5, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 6, - "busid" : 0, - "addr" : 6, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 7, - "busid" : 0, - "addr" : 7, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 16, - "busid" : 0, - "addr" : 8, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 17, - "busid" : 0, - "addr" : 9, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 18, - "busid" : 0, - "addr" : 10, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 19, - "busid" : 0, - "addr" : 11, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 20, - "busid" : 0, - "addr" : 12, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 21, - "busid" : 0, - "addr" : 13, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 22, - "busid" : 0, - "addr" : 14, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 23, - "busid" : 0, - "addr" : 15, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 8, - "busid" : 0, - "addr" : 16, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 9, - "busid" : 0, - "addr" : 17, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 10, - "busid" : 0, - "addr" : 18, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 11, - "busid" : 0, - "addr" : 19, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 32, - "busid" : 0, - "addr" : 20, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 33, - "busid" : 0, - "addr" : 21, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 34, - "busid" : 0, - "addr" : 22, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 35, - "busid" : 0, - "addr" : 23, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 36, - "busid" : 1, - "addr" : 0, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 37, - "busid" : 1, - "addr" : 1, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 38, - "busid" : 1, - "addr" : 2, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 39, - "busid" : 1, - "addr" : 3, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 40, - "busid" : 1, - "addr" : 4, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 41, - "busid" : 1, - "addr" : 5, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 42, - "busid" : 1, - "addr" : 6, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 43, - "busid" : 1, - "addr" : 7, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 24, - "busid" : 1, - "addr" : 8, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 25, - "busid" : 1, - "addr" : 9, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 26, - "busid" : 1, - "addr" : 10, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 27, - "busid" : 1, - "addr" : 11, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 48, - "busid" : 1, - "addr" : 12, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 49, - "busid" : 1, - "addr" : 13, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 50, - "busid" : 1, - "addr" : 14, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 51, - "busid" : 1, - "addr" : 15, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 52, - "busid" : 1, - "addr" : 16, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 53, - "busid" : 1, - "addr" : 17, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 54, - "busid" : 1, - "addr" : 18, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 55, - "busid" : 1, - "addr" : 19, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 56, - "busid" : 1, - "addr" : 20, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 57, - "busid" : 1, - "addr" : 21, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 58, - "busid" : 1, - "addr" : 22, - "base_port": 1, - "last_port": 4 - }, - { - "macid" : 59, - "busid" : 1, - "addr" : 23, - "base_port": 1, - "last_port": 4 - } - ], - "ffe" : { - "board_material" : "BOARD_MATERIAL_M4", - "config" : [ - { - "serdes_id" : [0], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [0, 255, 10, 0] - }, - { - "serdes_id" : [1], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [0, 240, 10, 0] - }, - { - "serdes_id" : [2], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [0, 230, 10, 0] - }, - { - "serdes_id" : [3], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [0, 220, 7, 0] - }, - { - "serdes_id" : [4], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [0, 220, 8, 0] - }, - { - "serdes_id" : [5], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [0, 210, 6, 0] - }, - { - "serdes_id" : [6], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [0, 180, 6, 0] - }, - { - "serdes_id" : [7], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [0, 180, 5, 0] - }, - { - "serdes_id" : [8], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [2, 160, 4, 0] - }, - { - "serdes_id" : [9], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [2, 160, 4, 0] - }, - { - "serdes_id" : [10], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [3, 140, 9, 0] - }, - { - "serdes_id" : [11], - "is_dac" : 0, - "speed" : [1000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [3, 140, 5, 0] - }, - { - "serdes_id" : [12, 13, 14, 15], - "is_dac" : 0, - "speed" : [10000], - "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", - "cfg" : [3, 94, 15, 0] - } - ] - }, - "ctle" : { - "config" : [ - { - "serdes_id" : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], - "auto-en" : 0, - "cfg" : [6, 14, 2] - } - ] - } -} diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-p-chip-profile.txt b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-p-chip-profile.txt deleted file mode 100644 index 2373e27f5f..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-p-chip-profile.txt +++ /dev/null @@ -1,96 +0,0 @@ -#----------------- SDK Feature Support -------------- -[MPLS_SUPPORT] = 1; -[APS_SUPPORT] = 1; -[OAM_SUPPORT] = 1; -[PTP_SUPPORT] = 0; -[SYNCE_SUPPORT] = 0; -[STACKING_SUPPORT] = 1; -[BPE_SUPPORT] = 0; -[IPFIX_SUPPORT] = 1; -[MONITOR_SUPPORT] = 1; -[OVERLAY_SUPPORT] = 1; -[EFD_SUPPORT] = 1; -[FCOE_SUPPORT] = 0; -[TRILL_SUPPORT] = 0; -[WLAN_SUPPORT] = 1; -[NPM_SUPPORT] = 1; -[DOT1AE_SUPPORT] = 1; - -#----------------- Chip Init Parameter -------------- -#Local chip number and global chip id -[Local chip_num] = 1 -[Local chip0] = 0 -[Local chip1] = 1 - -#Cut through mode 0: Disable; 1:10/40/100G; 2:1/10/100G; 3:1/10/40G; other:Flex, refer to CUT_THROUGH_BITMAP -[CUT_THROUGH_SPEED] = 0 -#Flex cut through mode, speed enable by bitmap, refer to ctc_port_speed_t, Notice: 10M/100M/1G treat as the same speed -[CUT_THROUGH_BITMAP] = 0 - -#Network cpu port -[CPU_NETWORK_PORT_EN] = 0 -[CPU_NETWORK_PORT_ID] = 47 - -#Enable parity error and multi-bit ecc recover -[ECC_RECOVER_EN] = 0 -[TCAM_SCAN_EN] = 0 - -#----------------- Interrupt Init Parameter -------------- -#0: pin, 1: msi -[Interrupt_mode] = 0 -[IRQ] = 69 - -#----------------- NextHop Init Parameter -------------- -#0: SDK work in pizzbox (single chip system), 1: SDK work in multi-chip system -[Nexthop Edit Mode] = 0 -[External Nexthop Number] = 16384 -[MPLS Tunnel Number] = 1024 - -#----------------- L2 Init Parameter -------------- -[FDB Hw Learning] = 1 -[Logic Port Num] = 1024 -#0: 128 instance per port, 1: 64 instance per port, 2: 32 instance per port -[STP MODE] = 0 -[MAX_FID_NUM] = 5120 - -#----------------- Stats Init Parameter -------------- -[STATS_PORT_EN] = 0 -[STATS_ECMP_EN] = 0 - -#----------------- BPE Init Parameter -------------- -[BPE_BR_PORT_EXTENDER_EN] = 0 -[BPE_BR_UC_MAX_ECID] = 1024 -[BPE_BR_MC_MAX_ECID] = 4096 -[BPE_BR_PORT_BASE] = 0 - -#----------------- Ipuc Init Parameter -------------- -#0: tcam use prefix 16; 1: tcam use prefix 8 -[IPUC_TCAM_PREFIX_8] = 1 - -#----------------- QoS Init Parameter -------------- -#QoS policer number support 1K/2K/4K/8K, default 4K -[QOS_POLICER_NUM] = 4096 -#QoS port queue number support 16/8/8 BPE/4 BPE, -#When resrc_profile.cfg exist, queue number valid, -#Default 8 queue mode -#8 queue = 8 -#16 queue = 16 -#4 queue BPE = 17 -#8 queue BPE = 18 -[QOS_PORT_QUEUE_NUM] = 8 -#QoS port extend queue number support 0/4, default 0 -[QOS_PORT_EXT_QUEUE_NUM] = 0 -#QoS CPU reason queue number support 128/64/32, default 128 -[QOS_CPU_QUEUE_NUM] = 128 -[QOS_INGRESS_VLAN_POLICER_NUM] = 0 -[QOS_EGRESS_VLAN_POLICER_NUM] = 0 -[QOS_POLICER_MERGE_MODE] = 0 -#QOS service queue mode, default 0,0:logic scr port + dstport enq 1:service id + dstport enq -[QOS_SERVICE_QUEUE_MODE] = 0 -#Global enable logic dst port + dstport enq -[QOS_SERVICE_QUEUE_EGRESS_EN] = 0 - -#----------------- Stacking Init Parameter -------------- -#0: normal mode; 1: spine-leaf mode -[FABRIC MODE] = 0 -[STACKING VERSION] = 1 diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-p-datapath.txt b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-p-datapath.txt deleted file mode 100644 index 959b97a150..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/RA-b6010-48gt4x-p-datapath.txt +++ /dev/null @@ -1,281 +0,0 @@ -#Generated by 'CTC DataPath Tools' on Fri Dec 18 19:15:31 2020 -#Version 1.0, Supported by TsingMa SDK - - -#SERDES_MODE : 0-NONE, 1-XFI, 2-SGMII, 3-Not Support, 4-QSGMII, 5-XAUI, 6-DXAUI, 7-XLG, 8-CG, 9-SGMII2G5 -# 10-USXGMII-S, 11-USXGMII-M2G5, 12-USXGMII-M5G, 13-XXVG, 14-LG, 15-100BASE-FX -#SERDES_RX_POLY: 0-Normal, 1-Inverse -#SERDES_SWITCH : 0-Not Support Dynamic Switch, 1-Support Dynamic Switch - -[WLAN_ENABLE] = 1 -[DOT1AE_ENABLE] = 1 - -[CORE_PLLA] = 600 -#{ -[SERDES_ITEM] -#repeat 32 step 6 -[SERDES_ID] = 0 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 1 -[SERDES_TX_POLY] = 1 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 1 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 2 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 1 -[SERDES_TX_POLY] = 1 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 3 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 4 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 5 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 6 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 7 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 1 -[SERDES_TX_POLY] = 1 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 8 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 1 -[SERDES_TX_POLY] = 1 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 9 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 10 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 11 -[SERDES_MODE] = 4 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 12 -[SERDES_MODE] = 1 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 1 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 13 -[SERDES_MODE] = 1 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 1 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 14 -[SERDES_MODE] = 1 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 1 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 15 -[SERDES_MODE] = 1 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 1 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 16 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 17 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 18 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 19 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 20 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 21 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 22 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 23 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 24 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 25 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 26 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 1 - -[SERDES_ID] = 27 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 1 - -[SERDES_ID] = 28 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 29 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 0 - -[SERDES_ID] = 30 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 1 - -[SERDES_ID] = 31 -[SERDES_MODE] = 3 -[SERDES_RX_POLY] = 0 -[SERDES_TX_POLY] = 0 -[SERDES_SWITCH] = 0 -[SERDES_GROUP] = 1 - -#repeat end -#} - - -#[SERDES_TO_LPORT] -#{ -# | QSGMII/USXGMII-M2G5 | USXGMII-M5G | USXGMII-S | 100BASE-FX | SGMII/SGMII2G5/XFI | XAUI/DXAUI | XLG | XXVG | LG | CG -#---------|---------------------|-------------|-----------|------------|--------------------|------------|-----|------|----|--- -#serdes 0 |0 /1 /2 /3 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 1 |4 /5 /6 /7 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 2 |16/17/18/19 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 3 |20/21/22/23 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 4 |8 /9 /10/11 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 5 |32/33/34/35 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 6 |36/37/38/39 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 7 |40/41/42/43 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 8 |24/25/26/27 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 9 |48/49/50/51 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 10|52/53/54/55 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 11|56/57/58/59 |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 12|NA |NA |NA |12 |12 |12 |12 |NA |NA |NA -#serdes 13|NA |NA |NA |13 |13 |12 |12 |NA |NA |NA -#serdes 14|NA |NA |NA |14 |14 |12 |12 |NA |NA |NA -#serdes 15|NA |NA |NA |15 |15 |12 |12 |NA |NA |NA -#serdes 16|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 17|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 18|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 19|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 20|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 21|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 22|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 23|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 24|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 25|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 26|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 27|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 28|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 29|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 30|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#serdes 31|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA -#} diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/default_sku b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/default_sku deleted file mode 100644 index 2a8d51c1f2..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/default_sku +++ /dev/null @@ -1 +0,0 @@ -RA-B6010-48GT4X l1 diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/phy_mapping.cfg b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/phy_mapping.cfg deleted file mode 100644 index eefd67e9c2..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/phy_mapping.cfg +++ /dev/null @@ -1,198 +0,0 @@ -#######################PHY_MAPPING_48+4####################### - -#{ -[PHY_MAPPING_ITEM] - -[API_PORT] = 0 -[PHY_ADDR] = 0 -[MDIO_BUS] = 0 - -[API_PORT] = 1 -[PHY_ADDR] = 1 -[MDIO_BUS] = 0 - -[API_PORT] = 2 -[PHY_ADDR] = 2 -[MDIO_BUS] = 0 - -[API_PORT] = 3 -[PHY_ADDR] = 3 -[MDIO_BUS] = 0 - -[API_PORT] = 4 -[PHY_ADDR] = 4 -[MDIO_BUS] = 0 - -[API_PORT] = 5 -[PHY_ADDR] = 5 -[MDIO_BUS] = 0 - -[API_PORT] = 6 -[PHY_ADDR] = 6 -[MDIO_BUS] = 0 - -[API_PORT] = 7 -[PHY_ADDR] = 7 -[MDIO_BUS] = 0 - -[API_PORT] = 16 -[PHY_ADDR] = 8 -[MDIO_BUS] = 0 - -[API_PORT] = 17 -[PHY_ADDR] = 9 -[MDIO_BUS] = 0 - -[API_PORT] = 18 -[PHY_ADDR] = 10 -[MDIO_BUS] = 0 - -[API_PORT] = 19 -[PHY_ADDR] = 11 -[MDIO_BUS] = 0 - -[API_PORT] = 20 -[PHY_ADDR] = 12 -[MDIO_BUS] = 0 - -[API_PORT] = 21 -[PHY_ADDR] = 13 -[MDIO_BUS] = 0 - -[API_PORT] = 22 -[PHY_ADDR] = 14 -[MDIO_BUS] = 0 - -[API_PORT] = 23 -[PHY_ADDR] = 15 -[MDIO_BUS] = 0 - -[API_PORT] = 8 -[PHY_ADDR] = 16 -[MDIO_BUS] = 0 - -[API_PORT] = 9 -[PHY_ADDR] = 17 -[MDIO_BUS] = 0 - -[API_PORT] = 10 -[PHY_ADDR] = 18 -[MDIO_BUS] = 0 - -[API_PORT] = 11 -[PHY_ADDR] = 19 -[MDIO_BUS] = 0 - -[API_PORT] = 32 -[PHY_ADDR] = 20 -[MDIO_BUS] = 0 - -[API_PORT] = 33 -[PHY_ADDR] = 21 -[MDIO_BUS] = 0 - -[API_PORT] = 34 -[PHY_ADDR] = 22 -[MDIO_BUS] = 0 - -[API_PORT] = 35 -[PHY_ADDR] = 23 -[MDIO_BUS] = 0 - -[API_PORT] = 36 -[PHY_ADDR] = 0 -[MDIO_BUS] = 1 - -[API_PORT] = 37 -[PHY_ADDR] = 1 -[MDIO_BUS] = 1 - -[API_PORT] = 38 -[PHY_ADDR] = 2 -[MDIO_BUS] = 1 - -[API_PORT] = 39 -[PHY_ADDR] = 3 -[MDIO_BUS] = 1 - -[API_PORT] = 40 -[PHY_ADDR] = 4 -[MDIO_BUS] = 1 - -[API_PORT] = 41 -[PHY_ADDR] = 5 -[MDIO_BUS] = 1 - -[API_PORT] = 42 -[PHY_ADDR] = 6 -[MDIO_BUS] = 1 - -[API_PORT] = 43 -[PHY_ADDR] = 7 -[MDIO_BUS] = 1 - -[API_PORT] = 24 -[PHY_ADDR] = 8 -[MDIO_BUS] = 1 - -[API_PORT] = 25 -[PHY_ADDR] = 9 -[MDIO_BUS] = 1 - -[API_PORT] = 26 -[PHY_ADDR] = 10 -[MDIO_BUS] = 1 - -[API_PORT] = 27 -[PHY_ADDR] = 11 -[MDIO_BUS] = 1 - -[API_PORT] = 48 -[PHY_ADDR] = 12 -[MDIO_BUS] = 1 - -[API_PORT] = 49 -[PHY_ADDR] = 13 -[MDIO_BUS] = 1 - -[API_PORT] = 50 -[PHY_ADDR] = 14 -[MDIO_BUS] = 1 - -[API_PORT] = 51 -[PHY_ADDR] = 15 -[MDIO_BUS] = 1 - -[API_PORT] = 52 -[PHY_ADDR] = 16 -[MDIO_BUS] = 1 - -[API_PORT] = 53 -[PHY_ADDR] = 17 -[MDIO_BUS] = 1 - -[API_PORT] = 54 -[PHY_ADDR] = 18 -[MDIO_BUS] = 1 - -[API_PORT] = 55 -[PHY_ADDR] = 19 -[MDIO_BUS] = 1 - -[API_PORT] = 56 -[PHY_ADDR] = 20 -[MDIO_BUS] = 1 - -[API_PORT] = 57 -[PHY_ADDR] = 21 -[MDIO_BUS] = 1 - -[API_PORT] = 58 -[PHY_ADDR] = 22 -[MDIO_BUS] = 1 - -[API_PORT] = 59 -[PHY_ADDR] = 23 -[MDIO_BUS] = 1 - -#} diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/platform_asic b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/platform_asic deleted file mode 100644 index 0815c8a78c..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/platform_asic +++ /dev/null @@ -1 +0,0 @@ -centec-arm64 diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/port_config.ini b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/port_config.ini deleted file mode 100644 index cd9f488c53..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/port_config.ini +++ /dev/null @@ -1,53 +0,0 @@ -# name lanes alias index speed admin_status -Ethernet1 0 eth-0-1 1 1000 up -Ethernet2 1 eth-0-2 2 1000 up -Ethernet3 2 eth-0-3 3 1000 up -Ethernet4 3 eth-0-4 4 1000 up -Ethernet5 4 eth-0-5 5 1000 up -Ethernet6 5 eth-0-6 6 1000 up -Ethernet7 6 eth-0-7 7 1000 up -Ethernet8 7 eth-0-8 8 1000 up -Ethernet9 16 eth-0-9 9 1000 up -Ethernet10 17 eth-0-10 10 1000 up -Ethernet11 18 eth-0-11 11 1000 up -Ethernet12 19 eth-0-12 12 1000 up -Ethernet13 20 eth-0-13 13 1000 up -Ethernet14 21 eth-0-14 14 1000 up -Ethernet15 22 eth-0-15 15 1000 up -Ethernet16 23 eth-0-16 16 1000 up -Ethernet17 8 eth-0-17 17 1000 up -Ethernet18 9 eth-0-18 18 1000 up -Ethernet19 10 eth-0-19 19 1000 up -Ethernet20 11 eth-0-20 20 1000 up -Ethernet21 32 eth-0-21 21 1000 up -Ethernet22 33 eth-0-22 22 1000 up -Ethernet23 34 eth-0-23 23 1000 up -Ethernet24 35 eth-0-24 24 1000 up -Ethernet25 36 eth-0-25 25 1000 up -Ethernet26 37 eth-0-26 26 1000 up -Ethernet27 38 eth-0-27 27 1000 up -Ethernet28 39 eth-0-28 28 1000 up -Ethernet29 40 eth-0-29 29 1000 up -Ethernet30 41 eth-0-30 30 1000 up -Ethernet31 42 eth-0-31 31 1000 up -Ethernet32 43 eth-0-32 32 1000 up -Ethernet33 24 eth-0-33 33 1000 up -Ethernet34 25 eth-0-34 34 1000 up -Ethernet35 26 eth-0-35 35 1000 up -Ethernet36 27 eth-0-36 36 1000 up -Ethernet37 48 eth-0-37 37 1000 up -Ethernet38 49 eth-0-38 38 1000 up -Ethernet39 50 eth-0-39 39 1000 up -Ethernet40 51 eth-0-40 40 1000 up -Ethernet41 52 eth-0-41 41 1000 up -Ethernet42 53 eth-0-42 42 1000 up -Ethernet43 54 eth-0-43 43 1000 up -Ethernet44 55 eth-0-44 44 1000 up -Ethernet45 56 eth-0-45 45 1000 up -Ethernet46 57 eth-0-46 46 1000 up -Ethernet47 58 eth-0-47 47 1000 up -Ethernet48 59 eth-0-48 48 1000 up -Ethernet49 12 eth-0-49 49 10000 up -Ethernet50 13 eth-0-50 50 10000 up -Ethernet51 14 eth-0-51 51 10000 up -Ethernet52 15 eth-0-52 52 10000 up diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/sai.profile b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/sai.profile deleted file mode 100644 index 5a5fe93dd4..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/sai.profile +++ /dev/null @@ -1,4 +0,0 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/RA-b6010-48gt4x-p-chip-profile.txt -SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/usr/share/sonic/hwsku/RA-b6010-48gt4x-p-datapath.txt -SAI_PLATFORM_CFG_FILE=/usr/share/sonic/hwsku/RA-b6010-48gt4x-board.json -SAI_PHY_DRIVER_PATH=/usr/share/sonic/hwsku/phy_drv \ No newline at end of file diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/start_up.cfg b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/start_up.cfg deleted file mode 100644 index b012adedb2..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X/start_up.cfg +++ /dev/null @@ -1,48 +0,0 @@ - -chip set serdes 0 ffe mode user-define c0 0 c1 255 c2 10 c3 0 c4 0 -chip set serdes 1 ffe mode user-define c0 0 c1 240 c2 10 c3 0 c4 0 -chip set serdes 2 ffe mode user-define c0 0 c1 230 c2 10 c3 0 c4 0 -chip set serdes 3 ffe mode user-define c0 0 c1 220 c2 7 c3 0 c4 0 -chip set serdes 4 ffe mode user-define c0 0 c1 220 c2 8 c3 0 c4 0 -chip set serdes 5 ffe mode user-define c0 0 c1 210 c2 6 c3 0 c4 0 -chip set serdes 6 ffe mode user-define c0 0 c1 180 c2 6 c3 0 c4 0 -chip set serdes 7 ffe mode user-define c0 0 c1 180 c2 5 c3 0 c4 0 -chip set serdes 8 ffe mode user-define c0 2 c1 160 c2 4 c3 0 c4 0 -chip set serdes 9 ffe mode user-define c0 2 c1 160 c2 4 c3 0 c4 0 -chip set serdes 10 ffe mode user-define c0 3 c1 140 c2 9 c3 0 c4 0 -chip set serdes 11 ffe mode user-define c0 3 c1 140 c2 5 c3 0 c4 0 -chip set serdes 12 ffe mode user-define c0 3 c1 94 c2 15 c3 0 c4 0 -chip set serdes 13 ffe mode user-define c0 3 c1 94 c2 15 c3 0 c4 0 -chip set serdes 14 ffe mode user-define c0 3 c1 94 c2 15 c3 0 c4 0 -chip set serdes 15 ffe mode user-define c0 3 c1 94 c2 15 c3 0 c4 0 - - -chip set serdes 0 ctle 6 14 2 -chip set serdes 1 ctle 6 14 2 -chip set serdes 2 ctle 6 14 2 -chip set serdes 3 ctle 6 14 2 -chip set serdes 4 ctle 6 14 2 -chip set serdes 5 ctle 6 14 2 -chip set serdes 6 ctle 6 14 2 -chip set serdes 7 ctle 6 14 2 -chip set serdes 8 ctle 6 14 2 -chip set serdes 9 ctle 6 14 2 -chip set serdes 10 ctle 6 14 2 -chip set serdes 11 ctle 6 14 2 - - - -# rtk eye param, post_amp|main_amp|pre_amp -port 0 phy-attr type 2001 value 0x1c1e00 -port 4 phy-attr type 2001 value 0x101600 -port 16 phy-attr type 2001 value 0x111500 -port 20 phy-attr type 2001 value 0x0e1100 -port 8 phy-attr type 2001 value 0x0f1000 -port 32 phy-attr type 2001 value 0x0e0f00 -port 36 phy-attr type 2001 value 0x0a0a00 -port 40 phy-attr type 2001 value 0x0a0900 -port 24 phy-attr type 2001 value 0x000c00 -port 48 phy-attr type 2001 value 0x000b00 -port 52 phy-attr type 2001 value 0x000b00 -port 56 phy-attr type 2001 value 0x000a00 - diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/default_sku b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/default_sku deleted file mode 100644 index 2a8d51c1f2..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/default_sku +++ /dev/null @@ -1 +0,0 @@ -RA-B6010-48GT4X l1 diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/installer.conf b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/installer.conf deleted file mode 100644 index 6e00c7ff77..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/installer.conf +++ /dev/null @@ -1,9 +0,0 @@ -CONSOLE_SPEED=115200 - -#fix env -config_env(){ - dd if=/dev/mtd1 of=env.bin - flashcp -v env.bin /dev/mtd4 -} -trap_push "config_env || true" - diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/platform.json b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/platform.json deleted file mode 100644 index b3a5623d1c..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/platform.json +++ /dev/null @@ -1,173 +0,0 @@ -{ - "chassis": { - "name": "RA-B6010-48GT4X", - "thermal_manager": false, - "status_led": { - "controllable": false, - "colors": ["green", "blinking_green", "amber", "blinking_amber"] - }, - "components": [ - { - "name": "CPU CPLD" - }, - { - "name": "MAC1 CPLD" - } - ], - "fans": [ - { - "name": "Fantray1_1", - "speed": { - "controllable": true, - "minimum": 30, - "maximum": 99 - }, - "status_led": { - "available": false, - "colors": ["off", "red", "amber", "green"] - } - }, - { - "name": "Fantray2_1", - "speed": { - "controllable": true, - "minimum": 30, - "maximum": 99 - }, - "status_led": { - "available": false, - "colors": ["off", "red", "amber", "green"] - } - } - ], - "fan_drawers":[ - { - "name": "Fantray1", - "num_fans" : 1, - "status_led": { - "controllable": false, - "colors": ["amber", "green", "off"] - }, - "fans": [ - { - "name": "FanTray1_1", - "speed": { - "controllable": true, - "minimum": 30, - "maximum": 99 - }, - "status_led": { - "available": false - } - } - ] - }, - { - "name": "Fantray2", - "num_fans" : 1, - "status_led": { - "controllable": false, - "colors": ["amber", "green", "off"] - }, - "fans": [ - { - "name": "FanTray2_1", - "speed": { - "controllable": true, - "minimum": 30, - "maximum": 99 - }, - "status_led": { - "available": false - } - } - ] - } - ], - "psus": [ - { - "name": "PSU 1", - "voltage": true, - "current": true, - "power": true, - "max_power": false, - "voltage_high_threshold": true, - "voltage_low_threshold": true, - "temperature": true, - "fans_target_speed": false, - "status_led": { - "controllable": false - } - }, - { - "name": "PSU 2", - "voltage": true, - "current": true, - "power": true, - "max_power": false, - "voltage_high_threshold": true, - "voltage_low_threshold": true, - "temperature": true, - "fans_target_speed": false, - "status_led": { - "controllable": false - } - } - ], - "thermals": [ - { - "name": "ASIC_TEMP", - "controllable": false, - "low-crit-threshold": true, - "high-crit-threshold": true, - "low-threshold": true, - "high-threshold": true, - "minimum-recorded": true, - "maximum-recorded": true - }, - { - "name": "CPU_TEMP", - "controllable": false, - "low-crit-threshold": true, - "high-crit-threshold": true, - "low-threshold": true, - "high-threshold": true, - "minimum-recorded": true, - "maximum-recorded": true - }, - { - "name": "INLET_TEMP", - "controllable": false, - "low-crit-threshold": true, - "high-crit-threshold": true, - "low-threshold": true, - "high-threshold": true, - "minimum-recorded": true, - "maximum-recorded": true - }, - { - "name": "OUTLET_TEMP", - "controllable": false, - "low-crit-threshold": true, - "high-crit-threshold": true, - "low-threshold": true, - "high-threshold": true, - "minimum-recorded": true, - "maximum-recorded": true - }, - { - "name": "TPS53688_TEMP", - "controllable": false, - "low-crit-threshold": true, - "high-crit-threshold": true, - "low-threshold": true, - "high-threshold": true, - "minimum-recorded": true, - "maximum-recorded": true - } - ], - "modules": [], - "sfps": [] - }, - "interfaces": {} -} diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/platform_asic b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/platform_asic deleted file mode 100644 index 0815c8a78c..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/platform_asic +++ /dev/null @@ -1 +0,0 @@ -centec-arm64 diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/config.py b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/config.py deleted file mode 100644 index 93b331573d..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/config.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/python -# -*- coding: UTF-8 -*- -RAGILE_CARDID = 0x00004099 -RAGILE_PRODUCTNAME = "RA-B6010-48GT4X" -RAGILE_PART_NUMBER = "RJ000001" -RAGILE_LABEL_REVISION = "R01" -RAGILE_ONIE_VERSION = "2018.02" -RAGILE_MAC_SIZE = 3 -RAGILE_MANUF_NAME = "Ragile" -RAGILE_MANUF_COUNTRY = "CHN" -RAGILE_VENDOR_NAME = "Ragile" -RAGILE_DIAG_VERSION = "0.1.0.15" -RAGILE_SERVICE_TAG = "www.ragile.com" - -CPUEEPROMS = {"name":"cpueeprom","bus":5,"loc":0x57,"E2PRODUCT":'2', "E2TYPE":'4'} - -# rg_eeprom = "1-0056/eeprom" -E2_LOC = {"bus":1, "devno":0x56} -E2_PROTECT = {} -FAN_PROTECT = {"bus":1, "devno":0x0d, "addr":0x19, "open":0x00, "close":0xff} - - diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/eeprom.py b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/eeprom.py deleted file mode 100644 index 77016e1794..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/eeprom.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python - -try: - import exceptions - import binascii - import time - import optparse - import warnings - import os - import sys - from sonic_eeprom import eeprom_base - from sonic_eeprom import eeprom_tlvinfo -except ImportError, e: - raise ImportError (str(e) + "- required module not found") - - -class board(eeprom_tlvinfo.TlvInfoDecoder): - - def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom" - super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/sfputil.py b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/sfputil.py deleted file mode 100644 index ad619bf334..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/sfputil.py +++ /dev/null @@ -1,455 +0,0 @@ -# sfputil.py -# -# Platform-specific SFP transceiver interface for SONiC -# - -try: - import time - import subprocess - import re - import os - import threading - from sonic_sfp.sfputilbase import SfpUtilBase -except ImportError as e: - raise ImportError("%s - required module not found" % str(e)) - - -class SfpUtil(SfpUtilBase): - """Platform-specific SfpUtil class""" - - PORT_START = 49 - PORT_END = 52 - PORTS_IN_BLOCK = 53 - EEPROM_OFFSET = 9 - SFP_DEVICE_TYPE = "optoe2" - QSFP_DEVICE_TYPE = "optoe1" - I2C_MAX_ATTEMPT = 3 - - SFP_STATUS_INSERTED = '1' - SFP_STATUS_REMOVED = '0' - - TXWRT_PROTECT = 0X4E - TXWRT_NO_PROTECT = 0X59 - - _port_to_eeprom_mapping = {} - port_to_i2cbus_mapping ={} - port_dict = {} - port_presence_info = {} - port_reset_info = {} - port_txdis_info = {} - port_txwrt_info = {} - port_led_info = {} - - port_rxlos_info = {} - port_txfault_info = {} - port_drop_info = {} - - @property - def port_start(self): - return self.PORT_START - - @property - def port_end(self): - return self.PORT_END - - @property - def sfp_ports(self): - return list(range(self.PORT_START, self.PORTS_IN_BLOCK)) - - @property - def qsfp_ports(self): - return [] - - @property - def port_to_eeprom_mapping(self): - return self._port_to_eeprom_mapping - - def __init__(self): - for x in range(self.PORT_START, self.PORTS_IN_BLOCK): - self.port_to_i2cbus_mapping[x] = (x - self.PORT_START + self.EEPROM_OFFSET) - self.port_presence_info["/sys/bus/i2c/devices/3-0030/sfp_presence1"] = [49, 50, 51, 52] - self.port_txdis_info["/sys/bus/i2c/devices/3-0030/tx_disable"] = [49, 50, 51, 52] - self.port_txwrt_info["/sys/bus/i2c/devices/3-0030/tx_write_protect"] = [49, 50, 51, 52] - - # bit 1: los - self.port_rxlos_info["/sys/bus/i2c/devices/3-0030/sfp_rx_loss1"] = [49, 50, 51, 52] - - # bit 1: fault - self.port_txfault_info["/sys/bus/i2c/devices/3-0030/sfp_tx_fault1"] = [49, 50, 51, 52] - - # bit 1: drop - self.port_drop_info["/sys/bus/i2c/devices/3-0030/sfp_drop_record1"] = [49, 50, 51, 52] - - SfpUtilBase.__init__(self) - - def _sfp_read_file_path(self, file_path, offset, num_bytes): - attempts = 0 - while attempts < self.I2C_MAX_ATTEMPT: - try: - file_path.seek(offset) - read_buf = file_path.read(num_bytes) - except: - attempts += 1 - time.sleep(0.05) - else: - return True, read_buf - return False, None - - def _sfp_eeprom_present(self, sysfs_sfp_i2c_client_eeprompath, offset): - """Tries to read the eeprom file to determine if the - device/sfp is present or not. If sfp present, the read returns - valid bytes. If not, read returns error 'Connection timed out""" - - if not os.path.exists(sysfs_sfp_i2c_client_eeprompath): - return False - else: - with open(sysfs_sfp_i2c_client_eeprompath, "rb", buffering=0) as sysfsfile: - rv, buf = self._sfp_read_file_path(sysfsfile, offset, 1) - return rv - - def _add_new_sfp_device(self, sysfs_sfp_i2c_adapter_path, devaddr, devtype): - try: - sysfs_nd_path = "%s/new_device" % sysfs_sfp_i2c_adapter_path - - # Write device address to new_device file - nd_file = open(sysfs_nd_path, "w") - nd_str = "%s %s" % (devtype, hex(devaddr)) - nd_file.write(nd_str) - nd_file.close() - - except Exception as err: - print(("Error writing to new device file: %s" % str(err))) - return 1 - else: - return 0 - - def _get_port_eeprom_path(self, port_num, devid): - sysfs_i2c_adapter_base_path = "/sys/class/i2c-adapter" - - if port_num in list(self.port_to_eeprom_mapping.keys()): - sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[port_num] - else: - sysfs_i2c_adapter_base_path = "/sys/class/i2c-adapter" - - i2c_adapter_id = self._get_port_i2c_adapter_id(port_num) - if i2c_adapter_id is None: - print("Error getting i2c bus num") - return None - - # Get i2c virtual bus path for the sfp - sysfs_sfp_i2c_adapter_path = "%s/i2c-%s" % (sysfs_i2c_adapter_base_path, - str(i2c_adapter_id)) - - # If i2c bus for port does not exist - if not os.path.exists(sysfs_sfp_i2c_adapter_path): - print(("Could not find i2c bus %s. Driver not loaded?" % sysfs_sfp_i2c_adapter_path)) - return None - - sysfs_sfp_i2c_client_path = "%s/%s-00%s" % (sysfs_sfp_i2c_adapter_path, - str(i2c_adapter_id), - hex(devid)[-2:]) - - # If sfp device is not present on bus, Add it - if not os.path.exists(sysfs_sfp_i2c_client_path): - if port_num in self.qsfp_ports: - ret = self._add_new_sfp_device( - sysfs_sfp_i2c_adapter_path, devid, self.QSFP_DEVICE_TYPE) - else: - ret = self._add_new_sfp_device( - sysfs_sfp_i2c_adapter_path, devid, self.SFP_DEVICE_TYPE) - if ret != 0: - print("Error adding sfp device") - return None - - sysfs_sfp_i2c_client_eeprom_path = "%s/eeprom" % sysfs_sfp_i2c_client_path - return sysfs_sfp_i2c_client_eeprom_path - - def _read_eeprom_specific_bytes(self, sysfsfile_eeprom, offset, num_bytes): - eeprom_raw = [] - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - rv, raw = self._sfp_read_file_path(sysfsfile_eeprom, offset, num_bytes) - if rv == False: - return None - - try: - if isinstance(raw, str): - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) - else: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - except Exception as err: - return None - return eeprom_raw - - def get_eeprom_dom_raw(self, port_num): - if port_num in self.qsfp_ports: - # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw - return None - else: - # Read dom eeprom at addr 0x51 - return self._read_eeprom_devid(port_num, self.IDENTITY_EEPROM_ADDR, 256) - - def get_presence(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - presence_path = None - for presence_key in self.port_presence_info: - if port_num in self.port_presence_info[presence_key]: - presence_path = presence_key - presence_offset = self.port_presence_info[presence_key].index(port_num) - break - if presence_path == None: - return False - - try: - data = open(presence_path, "rb") - except IOError: - return False - - presence_data = data.read(2) - if presence_data == "": - return False - result = int(presence_data, 16) - data.close() - - # ModPrsL is active low - if result & (1 << presence_offset) == 0: - return True - - return False - - def get_low_power_mode(self, port_num): - return False - - def set_low_power_mode(self, port_num, lpmode): - return False - - def reset(self, port_num): - return False - - def reset_all(self): - return False - - def _do_write_file(self, file_handle, offset, value): - file_handle.seek(offset) - file_handle.write(hex(value)) - - def get_transceiver_change_event(self, timeout=0): - - start_time = time.time() - currernt_port_dict = {} - forever = False - - if timeout == 0: - forever = True - elif timeout > 0: - timeout = timeout / float(1000) # Convert to secs - else: - print(("get_transceiver_change_event:Invalid timeout value", timeout)) - return False, {} - - end_time = start_time + timeout - if start_time > end_time: - print(('get_transceiver_change_event:' \ - 'time wrap / invalid timeout value', timeout)) - - return False, {} # Time wrap or possibly incorrect timeout - - while timeout >= 0: - # Check for OIR events and return updated port_dict - for x in range(self.PORT_START, self.PORTS_IN_BLOCK): - if self.get_presence(x): - currernt_port_dict[x] = self.SFP_STATUS_INSERTED - else: - currernt_port_dict[x] = self.SFP_STATUS_REMOVED - if (currernt_port_dict == self.port_dict): - if forever: - time.sleep(1) - else: - timeout = end_time - time.time() - if timeout >= 1: - time.sleep(1) # We poll at 1 second granularity - else: - if timeout > 0: - time.sleep(timeout) - return True, {} - else: - # Update reg value - self.port_dict = currernt_port_dict - return True, self.port_dict - print ("get_transceiver_change_event: Should not reach here.") - return False, {} - - def tx_disable(self, port_num, disable): - if not self.get_presence(port_num): - return False - - if port_num in self.sfp_ports: - txwrt_path = None - txdis_path = None - txdis_offset = 0 - - for key in self.port_txwrt_info: - if port_num in self.port_txwrt_info[key]: - txwrt_path = key - break - if txwrt_path == None: - return False - - for key in self.port_txdis_info: - if port_num in self.port_txdis_info[key]: - txdis_path = key - txdis_offset = self.port_txdis_info[key].index(port_num) - break - if txdis_path == None: - return False - - - try: - with open(txwrt_path, "r+") as sys_file: - sres = hex(self.TXWRT_NO_PROTECT)[2:] - sys_file.write(sres) - - with open(txdis_path, "r+") as sys_file: - txdis_data = sys_file.read(2) - if not txdis_data: - return False - result = int(txdis_data, 16) - if disable: - result = result | (1 << txdis_offset) - else: - result = result & (~(1 << txdis_offset)) - sys_file.seek(0) - sres = hex(result)[2:] - print(result,sres) - sys_file.write(sres) - - with open(txwrt_path, "r+") as sys_file: - sres = hex(self.TXWRT_PROTECT)[2:] - sys_file.write(sres) - except Exception as err: - print(err) - return False - - return True - else: - return False - -########### sysdiag ########### - def _get_cpld_info(self, port_num, info): - path = None - offset = 0 - for key in info: - if port_num in info[key]: - path = key - offset = info[key].index(port_num) - break - return path, offset - - def get_tx_disable(self, port_num): - # cur only support sfp moudle - if port_num not in self.sfp_ports: - return False - - if not self.get_presence(port_num): - return False - - path, offset = self._get_cpld_info(port_num, self.port_txdis_info) - if path == None: - return False - - result = 0 - try: - with open(path, "r") as sys_file: - data = sys_file.read(2) - result = int(data, 16) - except Exception as e: - print((str(e))) - return False - - # 1: disable - if result & (1 << offset): - return True - else: - return False - - def get_rx_los(self, port_num): - # cur only support sfp moudle - if port_num not in self.sfp_ports: - return False - - path, offset = self._get_cpld_info(port_num, self.port_rxlos_info) - if path == None: - return False - - result = 0 - try: - with open(path, "r") as sys_file: - data = sys_file.read(2) - result = int(data, 16) - except Exception as e: - print((str(e))) - return False - - # 1: los - if result & (1 << offset): - return True - else: - return False - - def get_tx_fault(self, port_num): - # cur only support sfp moudle - if port_num not in self.sfp_ports: - return False - - if not self.get_presence(port_num): - return False - - path, offset = self._get_cpld_info(port_num, self.port_txfault_info) - if path == None: - return False - - result = 0 - try: - with open(path, "r") as sys_file: - data = sys_file.read(2) - result = int(data, 16) - except Exception as e: - print((str(e))) - return False - - # 1: fault - if result & (1 << offset): - return True - else: - return False - - return False - - def get_plug_record(self, port_num): - if not self.get_presence(port_num): - return False - - path, offset = self._get_cpld_info(port_num, self.port_drop_info) - if path == None: - return False - - result = 0 - try: - with open(path, "r") as sys_file: - data = sys_file.read(2) - result = int(data, 16) - except Exception as e: - print((str(e))) - return False - - # 1: drop - if result & (1 << offset): - return True - else: - return False diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/ssd_util.py b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/ssd_util.py deleted file mode 100644 index 95ca23e8b3..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/plugins/ssd_util.py +++ /dev/null @@ -1,112 +0,0 @@ -# -# ssd_util.py -# -# Generic implementation of the SSD health API -# SSD models supported: -# - InnoDisk -# - StorFly -# - Virtium - -try: - import subprocess - from sonic_platform_base.sonic_ssd.ssd_base import SsdBase -except ImportError as e: - raise ImportError (str(e) + "- required module not found") - -HEALTH_CMD = "cat /sys/kernel/debug/mmc0/mmc0:0001/ext_csd | cut -c 537-538" -SERIAL_CMD = "cat /sys/bus/mmc/devices/mmc0\\:0001/serial" -FIRMWARE_CMD = "cat /sys/kernel/debug/mmc0/mmc0:0001/ext_csd | cut -c 509-522" -NOT_AVAILABLE = "N/A" - -class SsdUtil(SsdBase): - """ - Generic implementation of the SSD health API - """ - def __init__(self, diskdev): - self.model = "KLMCG4JETD-B041" - self.temperature = NOT_AVAILABLE - self.vendor_ssd_info = "====No vendor information====" - self.health_list = [100,90,80,70,60,50,40,30,20,10,0] - try: - life_time = self._execute_shell(HEALTH_CMD) - if int(life_time) in range(1,12): - self.health = self.health_list[int(life_time) - 1] - else: - self.health = NOT_AVAILABLE - except Exception as e: - self.health = NOT_AVAILABLE - - try: - self.firmware = self._execute_shell(FIRMWARE_CMD) - except Exception as e: - self.firmware = NOT_AVAILABLE - - try: - serial = self._execute_shell(SERIAL_CMD) - self.serial = serial.replace("0x",'') - except Exception as e: - self.serial = NOT_AVAILABLE - - def _execute_shell(self, cmd): - status, output = subprocess.getstatusoutput(cmd) - if status: - return None - - return output - - def get_health(self): - """ - Retrieves current disk health in percentages - - Returns: - A float number of current ssd health - e.g. 83.5 - """ - return self.health - - def get_temperature(self): - """ - Retrieves current disk temperature in Celsius - - Returns: - A float number of current temperature in Celsius - e.g. 40.1 - """ - return self.temperature - - def get_model(self): - """ - Retrieves model for the given disk device - - Returns: - A string holding disk model as provided by the manufacturer - """ - return self.model - - def get_firmware(self): - """ - Retrieves firmware version for the given disk device - - Returns: - A string holding disk firmware version as provided by the manufacturer - """ - return self.firmware - - def get_serial(self): - """ - Retrieves serial number for the given disk device - - Returns: - A string holding disk serial number as provided by the manufacturer - """ - return self.serial - - def get_vendor_output(self): - """ - Retrieves vendor specific data for the given disk device - - Returns: - A string holding some vendor specific disk information - """ - return self.vendor_ssd_info - diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/pmon_daemon_control.json b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/pmon_daemon_control.json deleted file mode 100644 index 5fdf83f1b9..0000000000 --- a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/pmon_daemon_control.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "skip_ledd": true, - "skip_xcvrd": false, - "skip_syseepromd": false, - "skip_thermalctld": false, - "skip_psud": false -} diff --git a/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/system_health_monitoring_config.json b/device/ragile/arm64-ragile_ra-b6010-48gt4x-r0/system_health_monitoring_config.json deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/platform/centec-arm64/one-image.mk b/platform/centec-arm64/one-image.mk index 47042e4556..3bcb9258fc 100755 --- a/platform/centec-arm64/one-image.mk +++ b/platform/centec-arm64/one-image.mk @@ -11,9 +11,8 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_24X2C_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_48S4X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_24X2Q_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(FS_S5800_48T4S_PLATFORM_MODULE) -$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(RA_B6010_48GT4X_PLATFORM_MODULE) -ifeq ($(INSTALL_DEBUG_TOOLS),y) +ifeq ($(INSTALL_DEBUG_TOOLS),y) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) $(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) else diff --git a/platform/centec-arm64/platform-modules-ragile.dep b/platform/centec-arm64/platform-modules-ragile.dep deleted file mode 100644 index 48684b053f..0000000000 --- a/platform/centec-arm64/platform-modules-ragile.dep +++ /dev/null @@ -1,9 +0,0 @@ -MPATH := $($(RA_B6010_48GT4X_PLATFORM_MODULE)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/centec-arm64/platform-modules-ragile.mk platform/centec-arm64/platform-modules-ragile.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -DEP_FILES += $(addprefix $(MPATH)/,$(shell cd $(MPATH) && git ls-files)) - -$(RA_B6010_48GT4X_PLATFORM_MODULE)_CACHE_MODE := GIT_CONTENT_SHA -$(RA_B6010_48GT4X_PLATFORM_MODULE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(RA_B6010_48GT4X_PLATFORM_MODULE)_DEP_FILES := $(DEP_FILES) - diff --git a/platform/centec-arm64/platform-modules-ragile.mk b/platform/centec-arm64/platform-modules-ragile.mk deleted file mode 100644 index 232d183bc9..0000000000 --- a/platform/centec-arm64/platform-modules-ragile.mk +++ /dev/null @@ -1,10 +0,0 @@ -## RA-B6010-48GT4X -RA_B6010_48GT4X_PLATFORM_MODULE_VERSION =1.3 -export RA_B6010_48GT4X_PLATFORM_MODULE_VERSION - -RA_B6010_48GT4X_PLATFORM_MODULE = platform-modules-ra-b6010-48gt4x_$(RA_B6010_48GT4X_PLATFORM_MODULE_VERSION)_arm64.deb - -$(RA_B6010_48GT4X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ragile -$(RA_B6010_48GT4X_PLATFORM_MODULE)_PLATFORM = arm64-ragile_ra-b6010-48gt4x-r0 -$(RA_B6010_48GT4X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -SONIC_DPKG_DEBS += $(RA_B6010_48GT4X_PLATFORM_MODULE) diff --git a/platform/centec-arm64/rules.mk b/platform/centec-arm64/rules.mk index 2466b7032d..d88670f130 100755 --- a/platform/centec-arm64/rules.mk +++ b/platform/centec-arm64/rules.mk @@ -7,7 +7,6 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/tsingma-bsp.mk include $(PLATFORM_PATH)/platform-modules-centec-e530.mk include $(PLATFORM_PATH)/platform-modules-fs.mk -include $(PLATFORM_PATH)/platform-modules-ragile.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM) diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/LICENSE b/platform/centec-arm64/sonic-platform-modules-ragile/LICENSE deleted file mode 100644 index 2d14d2b778..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -Copyright (C) 2019 Centec, Inc - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/README.md b/platform/centec-arm64/sonic-platform-modules-ragile/README.md deleted file mode 100644 index 6b907de173..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/README.md +++ /dev/null @@ -1 +0,0 @@ -platform drivers for Centec E530 for the SONiC project diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/Makefile b/platform/centec-arm64/sonic-platform-modules-ragile/common/Makefile deleted file mode 100644 index 3db49b5961..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -PWD = $(shell pwd) -CC ?=gcc -INSTALL_MOD_DIR ?=extra -KVERSION ?= $(shell uname -r) -KERNEL_SRC ?= /lib/modules/$(KVERSION) -EXTRA_CFLAGS:= -I$(M)/include -EXTRA_CFLAGS+= -Wall -ifdef ENABLE_GCOV -ifeq ($(ENABLE_GCOV), y) -EXTRA_CFLAGS+= -fprofile-arcs -ftest-coverage -lgcov -endif -endif # ENABLE_GCOV -SUB_BUILD_DIR = $(PWD)/build -DIR_KERNEL_SRC = $(PWD)/modules -SCRIPT_DIR = $(PWD)/script -SERVICE_DIR = $(PWD)/service -BLACK_DRIVER_CONF_DIR = $(PWD)/modprobe_conf - -app_dir = $(PWD)/app -app_build_dir = $(app_dir)/build -modules_build_dir = $(DIR_KERNEL_SRC)/build - -INSTALL_MODULE_DIR = $(SUB_BUILD_DIR)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) -INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin -INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system -INSTALL_LIB_DIR = $(SUB_BUILD_DIR)/usr/lib/python3.9/dist-packages -INSTALL_BLACK_DRIVER = $(SUB_BUILD_DIR)/etc/modprobe.d -CTC_48GT4X_PHY_DIR = $(SUB_BUILD_DIR)/usr/share/sonic/device/arm64-ragile_ra-b6010-48gt4x-r0/RA-B6010-48GT4X - -all: - $(MAKE) -C $(app_dir) - $(MAKE) -C $(DIR_KERNEL_SRC) - @if [ ! -d ${INSTALL_MODULE_DIR} ]; then mkdir -p ${INSTALL_MODULE_DIR} ;fi - @if [ ! -d ${INSTALL_SCRIPT_DIR} ]; then mkdir -p ${INSTALL_SCRIPT_DIR} ;fi - @if [ ! -d ${INSTALL_SERVICE_DIR} ]; then mkdir -p ${INSTALL_SERVICE_DIR} ;fi - @if [ ! -d ${CTC_48GT4X_PHY_DIR} ]; then mkdir -p ${CTC_48GT4X_PHY_DIR}/phy_drv ;fi - @if [ ! -d ${INSTALL_LIB_DIR} ]; then mkdir -p ${INSTALL_LIB_DIR} ;fi - @if [ -d $(PWD)/lib/ ]; then cp -r $(PWD)/lib/* ${INSTALL_LIB_DIR} ;fi - cp -r $(app_dir)/*.so $(CTC_48GT4X_PHY_DIR)/phy_drv - cp -r $(app_build_dir)/module/*.ko $(INSTALL_MODULE_DIR) - cp -r $(modules_build_dir)/*.ko $(INSTALL_MODULE_DIR) - cp -r $(app_dir)/build/app/* $(INSTALL_SCRIPT_DIR) - if [ -d $(SCRIPT_DIR) ]; then cp -r $(SCRIPT_DIR)/* $(INSTALL_SCRIPT_DIR) ;fi - if [ -d $(SERVICE_DIR) ]; then cp -r $(SERVICE_DIR)/* $(INSTALL_SERVICE_DIR) ;fi - @if [ -d $(INSTALL_SCRIPT_DIR) ]; then chmod +x $(INSTALL_SCRIPT_DIR)/* ;fi -clean: - rm -rf $(SUB_BUILD_DIR) diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/Makefile b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/Makefile deleted file mode 100644 index 2d86cdf4c4..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -pes_parent_dir:=$(shell pwd)/$(lastword $(MAKEFILE_LIST)) -pes_parent_dir:=$(shell dirname $(pes_parent_dir)) - -SUBDIRS=$(shell ls -l | grep ^d | awk '{if($$9 != "build") print $$9}') -INC = -I./inc - -COMMON_OUT_PUT := $(shell pwd)/build -common_out_put_dir := $(COMMON_OUT_PUT)/app -common_module_dir := $(COMMON_OUT_PUT)/module/ -export common_out_put_dir common_module_dir - -all : CHECK $(SUBDIRS) -CHECK : - @echo $(pes_parent_dir) - -$(SUBDIRS):ECHO -# make all - #@echo $@ - make -C $@ - -ECHO: - @echo $(SUBDIRS) - -.PHONY : clean -clean : - -rm -rf $(COMMON_OUT_PUT) diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/Makefile b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/Makefile deleted file mode 100644 index 448b52f44f..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -top_srcdir:= $(shell pwd) -include $(top_srcdir)/Rules.mk -export top_srcdir - -firmware-y:= -firmware-y += firmware_driver_ispvme -firmware-y += firmware_upgrade_ispvme - -.PHONY: all -all: build - -.PHONY: build -build: $(firmware-y) -$(foreach dir,$(firmware-y),$(eval $(call compile_dirs,$(dir)))) - -.PHONY: rpmpkg -rpmpkg: -ifeq ("$(CONFIG_CPLD_UPGRADE_ISPVME)", "y") - #$(RPMPKG) $(install_cpld_dir) firmware-cpld-ispvme.spec git -endif diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/Rules.mk b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/Rules.mk deleted file mode 100644 index c342398674..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/Rules.mk +++ /dev/null @@ -1,45 +0,0 @@ -CC ?= $(CROSS)gcc -AR ?= $(CROSS)ar -AS ?= $(CROSS)as -LD ?= $(CROSS)ld -STRIP ?= $(CROSS)strip - -install_root:=${top_srcdir}/images - -install_header_dir:=${install_root}/header -install_adir:=$(install_root)/lib -install_symbol_dir:=$(install_root)/symbol -# symbol_files -symbol_files:=$(shell find $(EXPORT_SYMBOL) -name 'Module.symvers') -# -# symbol_files += $(shell find $(install_symbol_dir) -name 'Module.symvers') - -# top root: install_rootfs_dir -# install_rootfs_dir -install_rootfs_dir:=$(install_root)/rootfs - -# install_sodir -install_sodir:=$(install_rootfs_dir)/$(INSTALL_SODIR) - -install_usr_bin_dir:=$(install_rootfs_dir)/usr/bin -# install_sbin_dir -install_sbin_dir:=$(install_rootfs_dir)/sbin -install_etc_dir:=$(install_rootfs_dir)/etc - -export INSTALL_MOD_PATH:=$(ROOT) - -BUILD_CFLAGS:=$(CFLAGS) -I$(install_header_dir) -BUILD_LDFLAGS:=$(LDFLAGS) -L/$(install_sodir) -L/$(install_adir) - -define compile_dirs -.PHONY: $(1) -$(1): - @echo;echo "building $(1)..." - @$(MAKE) -C ${1} -endef - -compile.c = $(CC) $(BUILD_CFLAGS) -d -c -o $@ $< - -%.o: %.c - $(compile.c) - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware-cpld-ispvme.spec b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware-cpld-ispvme.spec deleted file mode 100644 index b8c1ca37b5..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware-cpld-ispvme.spec +++ /dev/null @@ -1,25 +0,0 @@ -Summary: Firmware Upgrade Package - -Name: firmware-cpld - -Version: 1.0.0.%patch - -Release: firmware - -License: Ragile - -Group: common - -AutoReqProv: no - -%clean -%description -[common] -%des_name -%des_ver -%des_target - -%files - -%attr(755,root,root) -/* diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/Makefile b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/Makefile deleted file mode 100644 index 57a67bea2d..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -PWD = $(shell pwd) - -EXTRA_CFLAGS:= -I$(M)/include -EXTRA_CFLAGS+= -Wall -ifdef ENABLE_GCOV -ifeq ($(ENABLE_GCOV), y) -EXTRA_CFLAGS+= -fprofile-arcs -ftest-coverage -lgcov -endif -endif # ENABLE_GCOV -RAGILE_PRODUCT = ra_b6010_48gt4x -firmware_driver-objs := firmware_ispvme.o -firmware_driver-objs += firmware_cpld_ispvme.o firmware_cpld_upgrade_ispvme.o - -#ifndef CONFIG_FRM_PRODUCT_FILE - -firmware_driver-objs += $(RAGILE_PRODUCT).o -$(warning $(firmware_driver-objs)) -obj-m := firmware_driver.o -all: - $(MAKE) -C $(KERNEL_SRC)/build M=$(PWD) modules - @if [ ! -d $(common_module_dir) ]; then mkdir -p $(common_module_dir) ;fi - cp -p $(PWD)/*.ko $(common_module_dir) \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_cpld_ispvme.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_cpld_ispvme.c deleted file mode 100644 index 9c7e694c5a..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_cpld_ispvme.c +++ /dev/null @@ -1,283 +0,0 @@ -/** - * Copyright(C) 2013 Ragile Network. All rights reserved. - */ -/* - * firmware_cpld.c - * Original Author : support 2013-10-25 - * - * CPLD driver - * - * History - * v1.0 support 2013-10-25 Initial version. - * - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int firmware_cpld_open(struct inode *inode, struct file *file) -{ - firmware_cpld_t *cpld_info; - firmware_device_t *frm_dev; - - dev_debug(firmware_debug(), "Open cpld device.\n"); - - frm_dev = firmware_get_device_by_minor(FIRMWARE_CPLD, MINOR(inode->i_rdev)); - if (frm_dev == NULL) { - return -ENXIO; - } - - file->private_data = frm_dev; - cpld_info = (firmware_cpld_t *)frm_dev->priv; - - if (cpld_info != NULL && cpld_info->init_cpld) { - cpld_info->init_cpld(); - } - - if (cpld_info != NULL && cpld_info->init_chip) { - cpld_info->init_chip(0); - } - - return FIRMWARE_SUCCESS; -} - -static ssize_t firmware_cpld_read (struct file *file, char __user *buf, size_t count, - loff_t *offset) -{ - return 0; -} - -static ssize_t firmware_cpld_write (struct file *file, const char __user *buf, size_t count, - loff_t *offset) -{ - return 0; -} - -static loff_t firmware_cpld_llseek(struct file *file, loff_t offset, int origin) -{ - return 0; -} - -static long firmware_cpld_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - char value; - void __user *argp; - cmd_info_t cmd_info; - char *buf; - int ret; - - argp = (void __user *)arg; - - switch (cmd) { - case FIRMWARE_JTAG_TDI: - if (copy_from_user(&value, argp, sizeof(value))) { - return -EFAULT; - } - fwm_cpld_tdi_op(value); - break; - case FIRMWARE_JTAG_TCK: - if (copy_from_user(&value, argp, sizeof(value))) { - return -EFAULT; - } - fwm_cpld_tck_op(value); - break; - - case FIRMWARE_JTAG_TMS: - if (copy_from_user(&value, argp, sizeof(value))) { - return -EFAULT; - } - fwm_cpld_tms_op(value); - break; - - case FIRMWARE_JTAG_TDO: - value = fwm_cpld_tdo_op(); - - if (copy_to_user(argp, &value, sizeof(value))) { - return -EFAULT; - } - - break; - - case FIRMWARE_SET_GPIO_INFO: - /* set GPIO information */ - if (copy_from_user(&cmd_info, argp, sizeof(cmd_info_t))) { - return -EFAULT; - } - - buf = (char *) kzalloc(cmd_info.size + 1, GFP_KERNEL); - if (buf == NULL) { - return -ENOMEM; - } - if (copy_from_user(buf, cmd_info.data, cmd_info.size)) { - kfree(buf); - return -EFAULT; - } - - ret = fmw_cpld_set_gpio_info((firmware_upg_gpio_info_t*)buf); - if (ret != FIRMWARE_SUCCESS) { - dev_debug(firmware_debug(), "Failed to set gpio info.\n"); - kfree(buf); - return -ESRCH; - } - - kfree(buf); - break; - - case FIRMWARE_SET_DEBUG_ON: - /* DEBUG ON */ - firmware_set_debug(1); - break; - case FIRMWARE_SET_DEBUG_OFF: - /* DEBUG_OFF */ - firmware_set_debug(0); - break; - - default: - return -ENOTTY; - } - - return FIRMWARE_SUCCESS; -} - -static int firmware_cpld_release(struct inode *inode, struct file *file) -{ - firmware_cpld_t *cpld_info; - firmware_device_t *frm_dev; - - frm_dev = (firmware_device_t *)(file->private_data); - cpld_info = (firmware_cpld_t *)(frm_dev->priv); - - if (cpld_info != NULL && cpld_info->finish_chip) { - cpld_info->finish_chip(0); - } - - if (cpld_info != NULL && cpld_info->finish_cpld) { - cpld_info->finish_cpld(); - } - return 0; -} - -static const struct file_operations cpld_dev_fops = { - .owner = THIS_MODULE, - .llseek = firmware_cpld_llseek, - .read = firmware_cpld_read, - .write = firmware_cpld_write, - .unlocked_ioctl = firmware_cpld_ioctl, - .open = firmware_cpld_open, - .release = firmware_cpld_release, -}; - -static int firmware_cpld_probe(struct platform_device *pdev) -{ - const __be32 *slot; - int len; - int ret; - firmware_cpld_t *cpld_info; - firmware_device_t *frm_dev; - - frm_dev = (firmware_device_t *) kzalloc(sizeof(firmware_device_t), GFP_KERNEL); - if (frm_dev == NULL) { - dev_debug(firmware_debug(), "Failed to kzalloc firmware device.\n"); - return -EPERM; - } - - slot = of_get_property(pdev->dev.of_node, "slot", &len); - if (slot && len == sizeof(*slot)) { - frm_dev->slot = be32_to_cpup(slot); - } else { - frm_dev->slot = firmware_get_device_num(FIRMWARE_CPLD) + 1; - } - - snprintf(frm_dev->name, FIRMWARE_NAME_LEN - 1, "firmware_cpld_ispvme%d", frm_dev->slot - 1); - cpld_info = fmw_cpld_upg_get_cpld(frm_dev->name); - - INIT_LIST_HEAD(&frm_dev->list); - frm_dev->type = FIRMWARE_CPLD; - frm_dev->dev.minor = MISC_DYNAMIC_MINOR; - frm_dev->dev.name = frm_dev->name; - frm_dev->dev.fops = &cpld_dev_fops; - frm_dev->priv = cpld_info; - - dev_debug(firmware_debug(), "Register cpld firmware slot:%d, name:%s.\n", frm_dev->slot, frm_dev->name); - - ret = firmware_device_register(frm_dev); - if (ret < 0) { - dev_debug(firmware_debug(), "Failed to register firmware device.\n"); - kfree(frm_dev); - return -EPERM; - } - - platform_set_drvdata(pdev, frm_dev); - - return 0; -} - -static int __exit firmware_cpld_remove(struct platform_device *dev) -{ - firmware_device_t *frm_dev; - - frm_dev = (firmware_device_t *)platform_get_drvdata(dev); - firmware_device_unregister(frm_dev); - - kfree(frm_dev); - - return 0; -} - -static struct of_device_id cpld_match[] = { - { - .compatible = "firmware_cpld_ispvme", - }, - {}, -}; - -static struct platform_driver cpld_driver = { - .driver = { - .name = "firmware_cpld_ispvme", - .owner = THIS_MODULE, - .of_match_table = cpld_match, - }, - .probe = firmware_cpld_probe, - .remove = firmware_cpld_remove, -}; - -static firmware_driver_t fmw_drv = { - .name = "firmware_cpld_ispvme", - .type = FIRMWARE_CPLD, - .drv = &cpld_driver, -}; - -void firmware_cpld_init(void) -{ - int ret; -#if 0 - struct device_node* node; - node = of_find_node_by_name(NULL, "cpld_upgrade"); - if (node == NULL) { - pr_notice("No cpld_upgrade\r\n"); - return; - } - pr_notice("Found cpld_upgrade\r\n"); -#else - printk(KERN_INFO "Do init cpld_upgrade\r\n"); -#endif - INIT_LIST_HEAD(&fmw_drv.list); - ret = fmw_cpld_upg_init(); - if (ret < 0) { - return; - } - firmware_driver_register(&fmw_drv); -} - -void firmware_cpld_exit(void) -{ - fmw_cpld_upg_exit(); - firmware_driver_unregister(&fmw_drv); - INIT_LIST_HEAD(&fmw_drv.list); -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_cpld_upgrade_ispvme.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_cpld_upgrade_ispvme.c deleted file mode 100644 index 758498796b..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_cpld_upgrade_ispvme.c +++ /dev/null @@ -1,329 +0,0 @@ -/** - * Copyright(C) 2013 Ragile Network. All rights reserved. - */ -/* - * firmware_cpld_upgrade.c - * Original Author : support 2013-10-25 - * - * CPLD upgrade driver - * - * History - * v1.0 support 2013-10-25 Initial version. - * - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* TCK clock MAX 16MHz */ -#define TCK_DELAY (current_fmw_cpld->tck_delay) -#if 0 -static firmware_cpld_t default_fmw_cpld; -#endif -static firmware_cpld_t fmw_cpld[FIRMWARE_MAX_CPLD_NUM]; -static firmware_cpld_t *current_fmw_cpld; - -static firmware_set_gpio_info_func_t g_set_gpio_info_func = NULL; - -void set_currrent_cpld_info(firmware_cpld_t *info) -{ - current_fmw_cpld = info; -} - -static void TDI_PULL_DOWN(void) -{ - if (current_fmw_cpld != NULL && current_fmw_cpld->pull_tdi_down) { - current_fmw_cpld->pull_tdi_down(); - } else { - dev_debug(firmware_debug(), "NO support TDI_PULL_DOWN.\n"); - } -} - -static void TDI_PULL_UP(void) -{ - if (current_fmw_cpld != NULL && current_fmw_cpld->pull_tdi_up) { - current_fmw_cpld->pull_tdi_up(); - } else { - dev_debug(firmware_debug(), "NO support TDI_PULL_UP.\n"); - } -} - -static void TCK_PULL_DOWN(void) -{ - if (current_fmw_cpld != NULL && current_fmw_cpld->pull_tck_down) { - current_fmw_cpld->pull_tck_down(); - } else { - dev_debug(firmware_debug(), "NO support TCK_PULL_DOWN.\n"); - } -} - -static void TCK_PULL_UP(void) -{ - if (current_fmw_cpld != NULL && current_fmw_cpld->pull_tck_up) { - current_fmw_cpld->pull_tck_up(); - } else { - dev_debug(firmware_debug(), "NO support TCK_PULL_UP.\n"); - } -} - -static void TMS_PULL_DOWN(void) -{ - if (current_fmw_cpld != NULL && current_fmw_cpld->pull_tms_down) { - current_fmw_cpld->pull_tms_down(); - } else { - dev_debug(firmware_debug(), "NO support TMS_PULL_DOWN.\n"); - } -} - -static void TMS_PULL_UP(void) -{ - if (current_fmw_cpld != NULL && current_fmw_cpld->pull_tms_up) { - current_fmw_cpld->pull_tms_up(); - } else { - dev_debug(firmware_debug(), "NO support TMS_PULL_UP.\n"); - } -} - -static int TDO_READ(void) -{ - if (current_fmw_cpld != NULL && current_fmw_cpld->read_tdo) { - return current_fmw_cpld->read_tdo(); - } else { - dev_debug(firmware_debug(), "NO support TDO_READ.\n"); - return -1; - } -} - -firmware_cpld_t *fmw_cpld_upg_get_cpld(char *name) -{ - int i; - - for (i = 0; i < FIRMWARE_MAX_CPLD_NUM; i++) { - if (fmw_cpld[i].is_used == 1 && strcmp(name, fmw_cpld[i].devname) == 0) { - return &fmw_cpld[i]; - } - } - - return NULL; -} - -int fmw_cpld_upg_copy_firmware_info(firmware_cpld_t *info) -{ - int i; - - for (i = 0; i < FIRMWARE_MAX_CPLD_NUM; i++) { - if (fmw_cpld[i].is_used == 1) { - continue; - } else { - strncpy(fmw_cpld[i].devname, info->devname, FIRMWARE_DEV_NAME_LEN); - fmw_cpld[i].slot = info->slot; - fmw_cpld[i].chip_index = info->chip_index; - fmw_cpld[i].is_used = info->is_used; - fmw_cpld[i].tck_delay = info->tck_delay; - fmw_cpld[i].pull_tdi_up = info->pull_tdi_up; - fmw_cpld[i].pull_tdi_down = info->pull_tdi_down; - fmw_cpld[i].pull_tck_up = info->pull_tck_up; - fmw_cpld[i].pull_tck_down = info->pull_tck_down; - fmw_cpld[i].pull_tms_up = info->pull_tms_up; - fmw_cpld[i].pull_tms_down = info->pull_tms_down; - fmw_cpld[i].read_tdo = info->read_tdo; - fmw_cpld[i].init_cpld = info->init_cpld; - fmw_cpld[i].init_chip = info->init_chip; - fmw_cpld[i].finish_chip = info->finish_chip; - fmw_cpld[i].finish_cpld = info->finish_cpld; - fmw_cpld[i].touch_watch_dog = info->touch_watch_dog; - fmw_cpld[i].keeplive = info->keeplive; - fmw_cpld[i].get_version = info->get_version; - fmw_cpld[i].get_card_name = info->get_card_name; - return 0; - } - } - return -1; -} - -int fmw_cpld_set_gpio_info(firmware_upg_gpio_info_t *info) -{ - if (g_set_gpio_info_func == NULL) { - dev_debug(firmware_debug(), "g_set_gpio_info_func is null.\n"); - return -1; - } - - return g_set_gpio_info_func(info); -} - -void fmw_cpld_reg_gpio_info_set_func(firmware_set_gpio_info_func_t func) -{ - if (func == NULL) { - dev_debug(firmware_debug(), "fmw_cpld_register_gpio_info_set_func func = NULL.\n"); - return; - } - g_set_gpio_info_func = func; - return; - -} -#if 0 -/* CPLD upgrade initialization operation */ -static int fmw_cpld_upg_init_cpld(void) -{ - gpio_request(JTAG_TDI, "cpld_upgrade"); - gpio_request(JTAG_TCK, "cpld_upgrade"); - gpio_request(JTAG_TMS, "cpld_upgrade"); - gpio_request(JTAG_EN, "cpld_upgrade"); - gpio_request(JTAG_TDO, "cpld_upgrade"); - - gpio_direction_output(JTAG_TDI, 1); - gpio_direction_output(JTAG_TCK, 1); - gpio_direction_output(JTAG_TMS, 1); - gpio_direction_output(JTAG_EN, 1); - - gpio_direction_input(JTAG_TDO); - return 0; -} - -/* CPLD upgrade completion operation */ -static int fmw_cpld_upg_finish_cpld(void) -{ - gpio_direction_output(JTAG_EN, 0); - - gpio_free(JTAG_TDI); - gpio_free(JTAG_TCK); - gpio_free(JTAG_TMS); - gpio_free(JTAG_EN); - gpio_free(JTAG_TDO); - return 0; -} - -/* TDI pull up */ -static void fmw_cpld_upg_pull_tdi_up(void) -{ - __gpio_set_value(JTAG_TDI, 1); -} - -/* TDI pull down */ -static void fmw_cpld_upg_pull_tdi_down(void) -{ - __gpio_set_value(JTAG_TDI, 0); -} - -/* TCK pull up */ -static void fmw_cpld_upg_pull_tck_up(void) -{ - __gpio_set_value(JTAG_TCK, 1); -} - -/* TCK pull down */ -static void fmw_cpld_upg_pull_tck_down(void) -{ - __gpio_set_value(JTAG_TCK, 0); -} - -/* TMS pull up */ -static void fmw_cpld_upg_pull_tms_up(void) -{ - __gpio_set_value(JTAG_TMS, 1); -} - -/* TCK pull down */ -static void fmw_cpld_upg_pull_tms_down(void) -{ - __gpio_set_value(JTAG_TMS, 0); -} - -/* read TDO */ -static int fmw_cpld_upg_read_tdo(void) -{ - return __gpio_get_value(JTAG_TDO); -} -#endif -#if 0 -static firmware_cpld_t default_fmw_cpld = { - .devname = "default_firmware_cpld", - .slot = 1, - .is_used = 1, - .tck_delay = 50, - .pull_tdi_up = fmw_cpld_upg_pull_tdi_up, - .pull_tdi_down = fmw_cpld_upg_pull_tdi_down, - .pull_tck_up = fmw_cpld_upg_pull_tck_up, - .pull_tck_down = fmw_cpld_upg_pull_tck_down, - .pull_tms_up = fmw_cpld_upg_pull_tms_up, - .pull_tms_down = fmw_cpld_upg_pull_tms_down, - .read_tdo = fmw_cpld_upg_read_tdo, - .init_cpld = fmw_cpld_upg_init_cpld, - .finish_cpld = fmw_cpld_upg_finish_cpld, -}; -#endif - -/** - * Each product initializes its own related CPLD driver and needs to re-define the interface - * In the new interface, assign the relevant driver to fmw_cpld through the fmw_cpld_upg_copy_firmware_info interface - */ -int __attribute__ ((weak))fmw_cpld_product_init(void) -{ - dev_debug(firmware_debug(), "Nothing cpld init for this product.\n"); - return 0; -} - -void __attribute__ ((weak))fmw_cpld_product_exit(void) -{ - dev_debug(firmware_debug(), "Nothing exit init for this product.\n"); - return; -} - -int fmw_cpld_upg_init(void) -{ - int ret; - mem_clear(fmw_cpld, FIRMWARE_MAX_CPLD_NUM * sizeof(firmware_cpld_t)); - ret = fmw_cpld_product_init(); - if (ret < 0) { - return ret; - } -#if 0 - set_currrent_cpld_info(&default_fmw_cpld); -#endif - - return 0; -} - -void fmw_cpld_upg_exit(void) -{ - fmw_cpld_product_exit(); - return; -} - -void fwm_cpld_tdi_op(int value) -{ - if (value) { - TDI_PULL_UP(); - } else { - TDI_PULL_DOWN(); - } -} - -void fwm_cpld_tck_op(int value) -{ - if (value) { - TCK_PULL_UP(); - } else { - TCK_PULL_DOWN(); - } -} - -void fwm_cpld_tms_op(int value) -{ - if (value) { - TMS_PULL_UP(); - } else { - TMS_PULL_DOWN(); - } -} - -int fwm_cpld_tdo_op() -{ - return TDO_READ(); -} diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_ispvme.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_ispvme.c deleted file mode 100644 index 9aabfeb5f6..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/firmware_ispvme.c +++ /dev/null @@ -1,142 +0,0 @@ -/** - * Copyright(C) 2013 Ragile Network. All rights reserved. - */ -/* - * firmware.c - * Original Author : support 2013-10-25 - * - * firmware upgrade driver - * - * History - * v1.0 support 2013-10-25 Initial version. - * - */ -#include -#include -#include -#include - -int drv_debug = 0; -module_param(drv_debug, int, S_IRUGO | S_IWUSR); - -static LIST_HEAD(drv_list); -static LIST_HEAD(dev_list); - -void firmware_set_debug(int value) -{ - drv_debug = value; - return; -} - -int firmware_debug(void) -{ - return drv_debug; -} - -int firmware_driver_register(firmware_driver_t *fw_drv) -{ - int ret; - - if (fw_drv == NULL) { - return FIRMWARE_FAILED; - } - - ret = platform_driver_register(fw_drv->drv); - if (ret < 0) { - return FIRMWARE_FAILED; - } - - list_add(&fw_drv->list, &drv_list); - - return FIRMWARE_SUCCESS; -} - -void firmware_driver_unregister(firmware_driver_t *fw_drv) -{ - list_del_init(&fw_drv->list); - platform_driver_unregister(fw_drv->drv); -} - -int firmware_get_device_num(int type) -{ - int num; - firmware_device_t *tmp; - - num = 0; - list_for_each_entry(tmp, &dev_list, list) { - if (tmp->type == type) { - num++; - } - } - - return num; -} - -firmware_device_t *firmware_get_device_by_minor(int type, int minor) -{ - firmware_device_t *tmp; - - list_for_each_entry(tmp, &dev_list, list) { - if (tmp->type == type && tmp->dev.minor == minor) { - return tmp; - } - } - - return NULL; -} - -int firmware_device_register(firmware_device_t *fw_dev) -{ - int ret; - firmware_device_t *tmp; - - if (fw_dev == NULL) { - return FIRMWARE_FAILED; - } - - list_for_each_entry(tmp, &dev_list, list) { - if (strcmp(tmp->name, fw_dev->name) == 0) { - return FIRMWARE_FAILED; - } - } - - ret = misc_register(&fw_dev->dev); - if (ret < 0) { - return FIRMWARE_FAILED; - } - - list_add(&fw_dev->list, &dev_list); - return FIRMWARE_SUCCESS; -} - -void firmware_device_unregister(firmware_device_t *fw_dev) -{ - list_del(&fw_dev->list); - misc_deregister(&fw_dev->dev); -} - -static int __init firmware_driver_init(void) -{ - INIT_LIST_HEAD(&drv_list); - INIT_LIST_HEAD(&dev_list); - dev_debug(firmware_debug(), "firmware_driver_init cpld init.\n"); - firmware_cpld_init(); - - return FIRMWARE_SUCCESS; -} - -static void __exit firmware_driver_exit(void) -{ - dev_debug(firmware_debug(), "firmware_driver_exit cpld exit.\n"); - firmware_cpld_exit(); - INIT_LIST_HEAD(&drv_list); - INIT_LIST_HEAD(&dev_list); - return; -} - -module_init(firmware_driver_init); -module_exit(firmware_driver_exit); - -MODULE_AUTHOR("support "); -MODULE_DESCRIPTION("ragile Platform Support"); -MODULE_LICENSE("GPL"); \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/config_ispvme.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/config_ispvme.h deleted file mode 100644 index ac9f12006c..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/config_ispvme.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __CONFIG_H__ -#define __CONFIG_H__ - -#define JTAG_TDI (32) -#define JTAG_TDO (67) -#define JTAG_TCK (65) -#define JTAG_TMS (6) -#define JTAG_EN (50) - -#endif /* __CONFIG_H__ */ \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/firmware_cpld_ispvme.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/firmware_cpld_ispvme.h deleted file mode 100644 index 6c809aa0b9..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/firmware_cpld_ispvme.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef __FIRMWARE_CPLD_H__ -#define __FIRMWARE_CPLD_H__ - -#define FIRMWARE_DEV_NAME_LEN 32 -#define FIRMWARE_MAX_CPLD_NUM 16 - -typedef struct firmware_cpld_s { - char devname[FIRMWARE_DEV_NAME_LEN]; - int slot; - int chip_index; - int is_used; /* 0:unused 1:used */ - u32 tck_delay; /* delay time */ - void (*pull_tdi_up)(void); /* TDI pull up */ - void (*pull_tdi_down)(void); /* TDI pull dowm */ - void (*pull_tck_up)(void); /* TCK pull up */ - void (*pull_tck_down)(void); /* TCK pull dowm */ - void (*pull_tms_up)(void); /* TMS pull up */ - void (*pull_tms_down)(void); /* TCK pull dowm */ - int (*read_tdo)(void); /* read ?TDO */ - int (*init_cpld)(void); /* CPLD upgrade initialization operation */ - int (*init_chip)(int slot); /* Chip related initialization operations */ - int (*finish_chip)(int slot); /* Chip related completion operations */ - int (*finish_cpld)(void); /* CPLD upgrade completion operation */ - int (*check_upgrade_data)(char *src, int src_len, int *dst, int dst_len); - int (*touch_watch_dog)(void); /* touch watch dog related operation */ - int (*keeplive)(void); /* KEEPLIVE */ - int (*get_version)(int slot, char *ver, int len); - int (*get_card_name)(char *name, int len); /* get card name */ -} firmware_cpld_t; - -typedef int (*firmware_set_gpio_info_func_t)(firmware_upg_gpio_info_t *info); - -extern int fmw_cpld_upg_get_chip_name(int slot, firmware_cpld_t *cpld, char *info, int len); -extern int fmw_cpld_upg_get_card_name(int slot, firmware_cpld_t *cpld, char *info, int len); -extern int fmw_cpld_upg_program(int slot, firmware_cpld_t *cpld, char *info, int len); -extern int fmw_cpld_upg_get_version(int slot, firmware_cpld_t *cpld, char *info, int len); -extern firmware_cpld_t *fmw_cpld_upg_get_cpld(char *name); -extern int fmw_cpld_upg_init(void); -extern void fmw_cpld_upg_exit(void); -extern int fmw_cpld_upg_copy_firmware_info(firmware_cpld_t *info); -extern int fmw_cpld_upg_get_chip_info(int slot, firmware_cpld_t *cpld, void *info, int len); - -extern void fwm_cpld_tdi_op(int value); -extern void fwm_cpld_tck_op(int value); -extern void fwm_cpld_tms_op(int value); -extern int fwm_cpld_tdo_op(void); -extern void firmware_cpld_upgrade_init(void); -extern void firmware_cpld_upgrade_finish(void); -extern int fmw_cpld_set_gpio_info(firmware_upg_gpio_info_t *info); -extern void fmw_cpld_reg_gpio_info_set_func(firmware_set_gpio_info_func_t func); - -#endif /* __FIRMWARE_CPLD_H__ */ \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/firmware_ispvme.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/firmware_ispvme.h deleted file mode 100644 index 7568602770..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/include/firmware_ispvme.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef __FIRMWARE_H__ -#define __FIRMWARE_H__ - -#include -#include - -#include -#include - -#define mem_clear(data, size) memset((data), 0, (size)) -#define dev_debug(debug, fmt, arg...) \ - if (debug == 1) { do{printk(KERN_ERR fmt,##arg);} while(0); } - -#define FIRMWARE_NAME_LEN 48 - -#define FIRMWARE_FAILED (-1) -#define FIRMWARE_SUCCESS 0 - -enum firmware_type_s { - FIRMWARE_CPLD = 0, - FIRMWARE_FPGA, -}; - -/* ioctl command */ -#define FIRMWARE_TYPE 'F' -#define FIRMWARE_JTAG_TDI _IOR(FIRMWARE_TYPE, 0, char) -#define FIRMWARE_JTAG_TDO _IOR(FIRMWARE_TYPE, 1, char) -#define FIRMWARE_JTAG_TCK _IOR(FIRMWARE_TYPE, 2, char) -#define FIRMWARE_JTAG_TMS _IOR(FIRMWARE_TYPE, 3, char) -#define FIRMWARE_JTAG_EN _IOR(FIRMWARE_TYPE, 4, char) -#define FIRMWARE_SET_DEBUG_ON _IOW(FIRMWARE_TYPE, 5, int) /* debug on */ -#define FIRMWARE_SET_DEBUG_OFF _IOW(FIRMWARE_TYPE, 6, int) /* debug off */ -#define FIRMWARE_SET_GPIO_INFO _IOR(FIRMWARE_TYPE, 7, int) /* Set GPIO pin configuration */ - -typedef struct cmd_info_s { - int size; - void __user *data; -} cmd_info_t; - -typedef struct firmware_device_s { - struct list_head list; /* device linked list */ - int type; /* the type of device */ - int slot; /* position */ - char name[FIRMWARE_NAME_LEN]; /* name */ - struct miscdevice dev; /* device */ - void *priv; /* private data */ -} firmware_device_t; - -typedef struct firmware_driver_s { - struct list_head list; /* linked list */ - int type; /* type */ - char name[FIRMWARE_NAME_LEN]; /* name */ - struct platform_driver *drv; /* driver */ - void *priv; /* private data */ -} firmware_driver_t; - -typedef struct gpio_group_s { - int pin; - int val; - int dir; -} gpio_group_t; - -typedef struct firmware_upg_gpio_info_s { - int tdi; - int tck; - int tms; - int tdo; - int jtag_en; - int select; - gpio_group_t jtag_5; - gpio_group_t jtag_4; - gpio_group_t jtag_3; - gpio_group_t jtag_2; - gpio_group_t jtag_1; -} firmware_upg_gpio_info_t; - -extern int firmware_debug(void); -extern void firmware_set_debug(int value); -extern firmware_device_t *firmware_get_device_by_minor(int type, int minor); -extern int firmware_get_device_num(int type); -extern int firmware_device_register(firmware_device_t *fw_dev); -extern void firmware_device_unregister(firmware_device_t *fw_dev); -extern int firmware_driver_register(firmware_driver_t *fw_drv); -extern void firmware_driver_unregister(firmware_driver_t *fw_drv); -extern void firmware_fpga_init(void); -extern void firmware_cpld_init(void); -extern void firmware_fpga_exit(void); -extern void firmware_cpld_exit(void); - -#endif /* end of __FIRMWARE_H__ */ \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/ra_b6010_48gt4x.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/ra_b6010_48gt4x.c deleted file mode 100644 index 880fffbfc8..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/ra_b6010_48gt4x.c +++ /dev/null @@ -1,493 +0,0 @@ -/** - * Copyright(C) 2013 Ragile Network. All rights reserved. - */ -/* - * ca-octeon-cmx.c - * Original Author : support 2013-10-25 - * ca-octeon-cmx CPLD upgrade driver - * - * firmware upgrade driver - * - * History - * v1.0 support 2013-10-25 Initial version. - */ - -#include -#include -#include -#if 0 -#include -#include -#endif -#include -#include -#include "ra_b6010_48gt4x.h" - -/* extern void cmic_gpio_set_output_value(int gpio, int val); */ -firmware_device_info_t *current_info = NULL; -static firmware_device_info_t set_gpio_info; -static int set_gpio_info_flag = 0; -firmware_device_info_t default_cpld_info = { - .type = 0, - .tdi = JTAG_TDI, - .tck = JTAG_TCK, - .tms = JTAG_TMS, - .tdo = JTAG_TDO, - .jtag_en = JTAG_EN, - .select = -1, - .cmic_start_gpio = -1, - .cmic_end_gpio = -1, -}; - -firmware_device_info_t as13_cpld_info = { - .type = 0, - .tdi = 67, - .tck = JTAG_TCK, - .tms = JTAG_TMS, - .tdo = 32, - .jtag_en = JTAG_EN, - .select = 48, - .cmic_start_gpio = -1, - .cmic_end_gpio = -1, -}; - -static int firmware_cpld_gpio_is_from_cmic(int gpio) -{ - if (current_info == NULL) { - return -1; - } - - dev_debug(firmware_debug(), "gpio %d current_info.cmic_start_gpio %d current_info.cmic_end_gpio %d.\n", - gpio, current_info->cmic_start_gpio, current_info->cmic_end_gpio); - - if ((current_info->cmic_start_gpio == -1) || (current_info->cmic_end_gpio == -1)) { - return 0; - } - - if ((gpio >= current_info->cmic_start_gpio) && (gpio <= current_info->cmic_end_gpio)) { - return 1; - } - - return 0; -} - -static int firmware_cpld_gpio_get_value(int gpio) -{ -#if 0 - int ret; - - ret = firmware_cpld_gpio_is_from_cmic(gpio); - if (ret < 0) { - dev_debug(firmware_debug(), "firmware_cpld_gpio_is_from_cmic gpio %d failed ret %d.\n", - gpio, ret); - return -1; - } - - if (ret == 1) { - /* Not currently supported */ - dev_debug(firmware_debug(), "gpio %d not support to get value.\n", gpio); - return -1; - } else { - return __gpio_get_value(gpio); - } -#endif - - return __gpio_get_value(gpio); -} - -static void firmware_cpld_gpio_set_output_value(int gpio, int val) -{ -#if 0 - int ret; - - ret = firmware_cpld_gpio_is_from_cmic(gpio); - if (ret < 0) { - dev_debug(firmware_debug(), "firmware_cpld_gpio_is_from_cmic gpio %d failed ret %d.\n", - gpio, ret); - return; - } - - if (ret == 1) { - __gpio_set_value(gpio, val); - /*cmic_gpio_set_output_value(gpio, val);*/ - } else { - __gpio_set_value(gpio, val); - } -#endif - - __gpio_set_value(gpio, val); -} - -static void firmware_cpld_gpio_set_direction(int gpio, int out) -{ - if (out) { - gpio_direction_output(gpio, 1); - } else { - gpio_direction_input(gpio); - } - - return; -} - -static void firmware_cpld_gpio_request(int gpio, char *name) -{ - int ret; - - ret = firmware_cpld_gpio_is_from_cmic(gpio); - if (ret < 0) { - dev_debug(firmware_debug(), "firmware_cpld_gpio_is_from_cmic gpio %d failed ret %d.\n", - gpio, ret); - return; - } - - if (ret == 1) { - /* do nothing */ - } else { - gpio_request(gpio, name); - } - - return; -} - -static void firmware_cpld_gpio_free(int gpio) -{ - int ret; - - ret = firmware_cpld_gpio_is_from_cmic(gpio); - if (ret < 0) { - dev_debug(firmware_debug(), "firmware_cpld_gpio_is_from_cmic gpio %d failed ret %d.\n", - gpio, ret); - return; - } - - if (ret == 1) { - /* do nothing */ - } else { - gpio_free(gpio); - } - - return; -} - -/* CPLD upgrade initialization operation */ -static int init_cpld(void) -{ - if (current_info == NULL) { - return -1; - } - - firmware_cpld_gpio_request(current_info->tdi, "cpld_upgrade"); - firmware_cpld_gpio_request(current_info->tck, "cpld_upgrade"); - firmware_cpld_gpio_request(current_info->tms, "cpld_upgrade"); - firmware_cpld_gpio_request(current_info->jtag_en, "cpld_upgrade"); - if (current_info->select >= 0) { - firmware_cpld_gpio_request(current_info->select, "cpld_upgrade"); - } - firmware_cpld_gpio_request(current_info->tdo, "cpld_upgrade"); - if (current_info->jtag_4.pin >= 0){ - firmware_cpld_gpio_request(current_info->jtag_1.pin, "cpld_upgrade"); - firmware_cpld_gpio_request(current_info->jtag_2.pin, "cpld_upgrade"); - firmware_cpld_gpio_request(current_info->jtag_3.pin, "cpld_upgrade"); - firmware_cpld_gpio_request(current_info->jtag_4.pin, "cpld_upgrade"); - firmware_cpld_gpio_request(current_info->jtag_5.pin, "cpld_upgrade"); - } - return 0; -} - -/* CPLD upgrade completion operation */ -static int finish_cpld(void) -{ - if (current_info == NULL) { - return -1; - } - - firmware_cpld_gpio_set_output_value(current_info->jtag_en, 0); - if (current_info->select >= 0) { - firmware_cpld_gpio_set_output_value(current_info->select, 0); - } - if (current_info->jtag_4.pin >= 0) { - gpio_direction_input(current_info->jtag_4.pin); - gpio_direction_input(current_info->jtag_1.pin); - gpio_direction_input(current_info->jtag_2.pin); - gpio_direction_input(current_info->jtag_3.pin); - gpio_direction_input(current_info->jtag_5.pin); - } - firmware_cpld_gpio_free(current_info->tdi); - firmware_cpld_gpio_free(current_info->tck); - firmware_cpld_gpio_free(current_info->tms); - firmware_cpld_gpio_free(current_info->jtag_en); - firmware_cpld_gpio_free(current_info->tdo); - if (current_info->jtag_4.pin >= 0) { - firmware_cpld_gpio_free(current_info->jtag_1.pin); - firmware_cpld_gpio_free(current_info->jtag_2.pin); - firmware_cpld_gpio_free(current_info->jtag_3.pin); - firmware_cpld_gpio_free(current_info->jtag_4.pin); - firmware_cpld_gpio_free(current_info->jtag_5.pin); - } - - if (current_info->select >= 0) { - firmware_cpld_gpio_free(current_info->select); - } - - if (set_gpio_info_flag == 1) { - memcpy(current_info, &set_gpio_info, sizeof(firmware_device_info_t)); - set_gpio_info_flag = 0; - } - - dev_debug(firmware_debug(), "%s %d\n", __func__, __LINE__); - - return 0; -} - -static void init_chip_pre(void) -{ - - dev_debug(firmware_debug(), "%s %d\n", __func__, __LINE__); - - /* to be reset every time when upgrade,solve the use of MAC side GPIO, - During the startup process, the MAC terminal will be reset, causing the problem of invalid settings */ - firmware_cpld_gpio_set_direction(current_info->tdi, 1); - firmware_cpld_gpio_set_direction(current_info->tck, 1); - firmware_cpld_gpio_set_direction(current_info->tms, 1); - firmware_cpld_gpio_set_direction(current_info->jtag_en, 1); - if (current_info->select >= 0) { - firmware_cpld_gpio_set_direction(current_info->select, 1); - } - if (current_info->jtag_4.pin >= 0) { - firmware_cpld_gpio_set_direction(current_info->jtag_4.pin, 1); - firmware_cpld_gpio_set_direction(current_info->jtag_3.pin, 1); - firmware_cpld_gpio_set_direction(current_info->jtag_2.pin, 1); - firmware_cpld_gpio_set_direction(current_info->jtag_1.pin, 1); - firmware_cpld_gpio_set_direction(current_info->jtag_5.pin, 1); - } - - firmware_cpld_gpio_set_output_value(current_info->tdi, 1); - firmware_cpld_gpio_set_output_value(current_info->tck, 1); - firmware_cpld_gpio_set_output_value(current_info->tms, 1); - firmware_cpld_gpio_set_output_value(current_info->jtag_en, 1); - if (current_info->jtag_4.pin >= 0) { - firmware_cpld_gpio_set_output_value(current_info->jtag_1.pin, current_info->jtag_1.val); - firmware_cpld_gpio_set_output_value(current_info->jtag_2.pin, current_info->jtag_2.val); - firmware_cpld_gpio_set_output_value(current_info->jtag_3.pin, current_info->jtag_3.val); - firmware_cpld_gpio_set_output_value(current_info->jtag_4.pin, current_info->jtag_4.val); - firmware_cpld_gpio_set_output_value(current_info->jtag_5.pin, current_info->jtag_5.val); - } - if (current_info->select >= 0) { - firmware_cpld_gpio_set_output_value(current_info->select, 1); - } - - firmware_cpld_gpio_set_direction(current_info->tdo, 0); - return; -} - -static int init_chip(int slot) -{ - - dev_debug(firmware_debug(), "%s %d\n", __func__, __LINE__); - - if (current_info == NULL) { - return -1; - } - init_chip_pre(); - - dev_debug(firmware_debug(), "tdi %d %d\n",current_info->tdi, firmware_cpld_gpio_get_value(current_info->tdi)); - dev_debug(firmware_debug(), "tdo %d %d\n",current_info->tdo, firmware_cpld_gpio_get_value(current_info->tdo)); - dev_debug(firmware_debug(), "tck %d %d\n",current_info->tck, firmware_cpld_gpio_get_value(current_info->tck)); - dev_debug(firmware_debug(), "tms %d %d\n",current_info->tms, firmware_cpld_gpio_get_value(current_info->tms)); - dev_debug(firmware_debug(), " jtag_en:%d %d\n",current_info->jtag_en, firmware_cpld_gpio_get_value(current_info->jtag_en)); - if (current_info->select >= 0) { - dev_debug(firmware_debug(), " select:%d %d\n",current_info->select, firmware_cpld_gpio_get_value(current_info->select)); - } - - return 0; -} - -static int finish_chip(int slot) -{ - if (current_info == NULL) { - return -1; - } - - firmware_cpld_gpio_set_output_value(current_info->jtag_en, 0); - if (current_info->select >= 0) { - firmware_cpld_gpio_set_output_value(current_info->select, 0); - } - if (current_info->jtag_4.pin >= 0) { - firmware_cpld_gpio_set_output_value(current_info->jtag_4.pin, 1); - } - - return 0; -} - -/* TDI pull up */ -static void pull_tdi_up(void) -{ - if (current_info == NULL) { - return; - } - firmware_cpld_gpio_set_output_value(current_info->tdi, 1); -} - -/* TDI pull dowm */ -static void pull_tdi_down(void) -{ - if (current_info == NULL) { - return; - } - firmware_cpld_gpio_set_output_value(current_info->tdi, 0); -} - -/* TCK pull up */ -static void pull_tck_up(void) -{ - if (current_info == NULL) { - return; - } - firmware_cpld_gpio_set_output_value(current_info->tck, 1); -} - -/* TCK pull down */ -static void pull_tck_down(void) -{ - if (current_info == NULL) { - return; - } - firmware_cpld_gpio_set_output_value(current_info->tck, 0); -} - -/* TMS pull up */ -static void pull_tms_up(void) -{ - if (current_info == NULL) { - return; - } - firmware_cpld_gpio_set_output_value(current_info->tms, 1); -} - -/* TCK pull dowm */ -static void pull_tms_down(void) -{ - if (current_info == NULL) { - return; - } - firmware_cpld_gpio_set_output_value(current_info->tms, 0); -} - -/* read TDO */ -static int read_tdo(void) -{ - if (current_info == NULL) { - return -1; - } - return firmware_cpld_gpio_get_value(current_info->tdo); -} - -int B6510_fmw_set_gpio_info(firmware_upg_gpio_info_t *info) -{ - if (info == NULL) { - dev_debug(firmware_debug(), "set gpio info info %p is null.\n", info); - return -1; - } - - set_gpio_info.tdi = info->tdi; - set_gpio_info.tck = info->tck; - set_gpio_info.tms = info->tms; - set_gpio_info.tdo = info->tdo; - set_gpio_info.jtag_en = info->jtag_en; - set_gpio_info.select= info->select; - set_gpio_info.jtag_5.pin = info->jtag_5.pin; - set_gpio_info.jtag_4.pin = info->jtag_4.pin; - set_gpio_info.jtag_3.pin = info->jtag_3.pin; - set_gpio_info.jtag_2.pin = info->jtag_2.pin; - set_gpio_info.jtag_1.pin = info->jtag_1.pin; - set_gpio_info.jtag_5.val = info->jtag_5.val; - set_gpio_info.jtag_4.val = info->jtag_4.val; - set_gpio_info.jtag_3.val = info->jtag_3.val; - set_gpio_info.jtag_2.val = info->jtag_2.val; - set_gpio_info.jtag_1.val = info->jtag_1.val; - set_gpio_info_flag = 1; - dev_debug(firmware_debug(), "set gpio info[tdi:%d tck:%d tms:%d tdo:%d jtag_en:%d select:%d].\n", - info->tdi, info->tck, info->tms, info->tdo, info->jtag_en, info->select); - return 0; -} - -firmware_cpld_t fmw_cpld0 = { - .devname = "firmware_cpld_ispvme0", - .slot = 1, - .chip_index = 1, - .is_used = 1, - .tck_delay = 60, - .pull_tdi_up = pull_tdi_up, - .pull_tdi_down = pull_tdi_down, - .pull_tck_up = pull_tck_up, - .pull_tck_down = pull_tck_down, - .pull_tms_up = pull_tms_up, - .pull_tms_down = pull_tms_down, - .read_tdo = read_tdo, - .init_cpld = init_cpld, - .init_chip = init_chip, - .finish_chip = finish_chip, - .finish_cpld = finish_cpld, - .get_version = NULL, -}; - -static void cpld_release(struct device *dev) -{ - return; -} - -static struct platform_device cpld = { - .name = "firmware_cpld_ispvme", - .id = 0, - .num_resources = 0, - .dev = { - .release = cpld_release, - } -}; - -extern void set_currrent_cpld_info(firmware_cpld_t *info); -extern int dfd_get_my_card_type(void); - -int fmw_cpld_product_init(void) -{ - current_info = NULL; -#if 0 - int dev_type; - int i; - - dev_type = drv_get_my_dev_type(); - if (dev_type < 0) { - printk(KERN_ERR "Failed to get device type, when upgrade cpld.\n"); - return FIRMWARE_FAILED; - } - - for (i = 0; i < sizeof(cpld_info)/sizeof(cpld_info[0]); i++) { - if (cpld_info[i].type == dev_type) { - current_info = &cpld_info[i]; - printk(KERN_ERR "device type 0x%x match i %d.\n", dev_type, i); - printk(KERN_ERR "tdi[%d] tck[%d] tms[%d] tdo[%d] jtat_en[%d].\n", current_info->tdi, - current_info->tck, current_info->tms, current_info->tdo, current_info->jtag_en); - } - } -#endif - - if (current_info == NULL) { - current_info = &default_cpld_info; - } - - platform_device_register(&cpld); - fmw_cpld_upg_copy_firmware_info(&fmw_cpld0); - - /* fmw_cpld0.init_cpld(); */ - set_currrent_cpld_info(&fmw_cpld0); - - fmw_cpld_reg_gpio_info_set_func(B6510_fmw_set_gpio_info); - - return FIRMWARE_SUCCESS; -} - -void fmw_cpld_product_exit(void) -{ - platform_device_unregister(&cpld); - return; -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/ra_b6010_48gt4x.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/ra_b6010_48gt4x.h deleted file mode 100644 index 90307c4117..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_driver_ispvme/ra_b6010_48gt4x.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __CONFIG_H__ -#define __CONFIG_H__ - -#include - -#define JTAG_TDI (32) -#define JTAG_TDO (67) -#define JTAG_TCK (65) -#define JTAG_TMS (6) -#define JTAG_EN (50) - -typedef struct firmware_device_info_s { - int type; - int tdi; - int tck; - int tms; - int tdo; - int jtag_en; - int select; - gpio_group_t jtag_5; - gpio_group_t jtag_4; - gpio_group_t jtag_3; - gpio_group_t jtag_2; - gpio_group_t jtag_1; - int cmic_start_gpio; - int cmic_end_gpio; -} firmware_device_info_t; - -#endif /* __CONFIG_H__ */ \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/Makefile b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/Makefile deleted file mode 100644 index c42c9bf3d2..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -include $(top_srcdir)/Rules.mk - -OBJ = firmware_app_ispvme.o debug_ispvme.o hardware.o ispvm_ui.o ivm_core.o dfd_fpga_pkt.o dfd_fpga_upg.o dfd_fpga_debug.o -LIB += $(BUILD_CFALGS) $(BUILD_LDFLAGS) -lpthread -lreadline -lncurses -ifdef ENABLE_GCOV -ifeq ($(ENABLE_GCOV), y) -LIB += -lgcov -endif -endif # ENABLE_GCOV -APP = firmware_upgrade -BUILD_DIR = tmp -ELF_FILE = $(BUILD_DIR)/$(APP) -MAP_FILE = $(BUILD_DIR)/$(APP).map.sym -INCLUDE = -Iinclude - -.PHONY: build -build:make-dir $(addprefix $(BUILD_DIR)/,$(OBJ)) - $(CC) -o $(ELF_FILE) $(addprefix $(BUILD_DIR)/,$(OBJ)) $(LINKFLAGS) $(LIB) - $(NM) $(ELF_FILE) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' \ - | sort > $(MAP_FILE) - @if [ ! -d $(common_out_put_dir) ]; then mkdir -p $(common_out_put_dir) ;fi - cp -p $(ELF_FILE) $(common_out_put_dir) - -# build -.PHONY: make-dir -make-dir: - @mkdir -p $(BUILD_DIR) - -$(BUILD_DIR)/%.o:%.c - $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@ - -.PHONY: install -install: - echo "firmware_upgrade install success." - cp -p $(ELF_FILE) $(common_out_put_dir) - -.PHONY: clean -clean: - rm -rf $(BUILD_DIR) diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/common.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/common.h deleted file mode 100644 index 208c415f36..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/common.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __COMMON_H__ -#define __COMMON_H__ - -#include -#include -#include -#include -#include -#include - -#define FIRMWARE_TYPE 'F' -#define FIRMWARE_JTAG_TDI _IOR(FIRMWARE_TYPE, 0, char) -#define FIRMWARE_JTAG_TDO _IOR(FIRMWARE_TYPE, 1, char) -#define FIRMWARE_JTAG_TCK _IOR(FIRMWARE_TYPE, 2, char) -#define FIRMWARE_JTAG_TMS _IOR(FIRMWARE_TYPE, 3, char) -#define FIRMWARE_JTAG_EN _IOR(FIRMWARE_TYPE, 4, char) -#define FIRMWARE_SET_DEBUG_ON _IOW(FIRMWARE_TYPE, 5, int) /* debug on */ -#define FIRMWARE_SET_DEBUG_OFF _IOW(FIRMWARE_TYPE, 6, int) /* debug off */ -#define FIRMWARE_SET_GPIO_INFO _IOR(FIRMWARE_TYPE, 7, int) /* set GPIO pin configuration */ - -#define JTAG_TDI (1) -#define JTAG_TDO (2) -#define JTAG_TCK (3) -#define JTAG_TMS (4) -#define JTAG_ENABLE (5) -#define JTAG_TRST (6) - -#endif \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/debug_ispvme.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/debug_ispvme.c deleted file mode 100644 index 0b49ad034d..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/debug_ispvme.c +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright(C) 2013 Ragile Network. All rights reserved. - */ -/* - * debug.c - * - * firmware upgrade debug control - * - * Original Author : support 2013-10-25 - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** - * firmware_upgrade_debug:handle debug switch - * - * analyse file /tmp/firmware_upgrade_debug,return the information correspoding to debug - * - * return:return DEBUG_OFF when debug off,return DEBUG_ON when debug on,return DEBUG_IGNORE in other cases - */ -int firmware_upgrade_debug(void) -{ - int size; - FILE *fp; - char debug_info[DEBUG_INFO_LEN] = {0}; - - fp = fopen(DEBUG_FILE, "r"); - if (fp == NULL) { - return DEBUG_IGNORE; - } - - size = fread(debug_info, DEBUG_INFO_LEN - 1, 1, fp); - if (size < 0) { - fclose(fp); - return DEBUG_IGNORE; - } - - if (strncmp(debug_info, DEBUG_ON_INFO, 1) == 0) { - fclose(fp); - return DEBUG_APP_ON; - } - - if (strncmp(debug_info, DEBUG_ON_KERN, 1) == 0) { - fclose(fp); - return DEBUG_KERN_ON; - } - - if (strncmp(debug_info, DEBUG_ON_ALL, 1) == 0) { - fclose(fp); - return DEBUG_ALL_ON; - } - - if (strncmp(debug_info, DEBUG_OFF_INFO, 1) == 0) { - fclose(fp); - return DEBUG_OFF; - } - - fclose(fp); - return DEBUG_IGNORE; -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_debug.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_debug.c deleted file mode 100644 index f9deb51e24..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_debug.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright(C) 2001-2013 Ragile Network. All rights reserved. - */ -/* - * dfd_debug.c - * - * Function:Device framework driver debugging interface - * - * History - * v1.0 support 2013-10-25 Initial version. - */ - -#include -#include - -#include -#include -#include -#include -#include - -#include "dfd_fpga_debug.h" - -#undef ARRAY_SIZE -#define ARRAY_SIZE(a) (sizeof(a) /sizeof((a)[0])) -/* Debug switch storage of dfd module */ -int g_dfd_fpga_debug = 0x0; - -/** - * dfd_fpga_pkt_debug_set - Debug switch setting interface of dfd module - * @type: Types of debugging information - * @enable: enable/Disable debugging information - * - * return 0 if success, otherwise reuturn -1. - */ -static int dfd_fpga_pkt_debug_set(int type, int enable) -{ - - if (type >= DFD_DBG_CNT || type < 0) { - DFD_ERROR("unknow dfd debug type=%d\n", type); - return -1; - } - - if (enable) { - g_dfd_fpga_debug |= 1U << type; - } else { - g_dfd_fpga_debug &= ~(1U << type); - } - - return 0; -} - -void dfd_fpga_open_debug(int val) -{ - if (val == 1) { - (void)dfd_fpga_pkt_debug_set(DFD_DBG_ERR, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_WARN, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_VBOSE, 1); - } else if (val == 2) { - (void)dfd_fpga_pkt_debug_set(DFD_FLOCK_DBG_VBOSE, 1); - } else if (val == 3) { - (void)dfd_fpga_pkt_debug_set(DFD_DBG_ERR, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_WARN, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_VBOSE, 1); - (void)dfd_fpga_pkt_debug_set(DFD_FLOCK_DBG_VBOSE, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_DBG, 1); - } else if (val == 4) { - (void)dfd_fpga_pkt_debug_set(DFD_DBG_DBG, 1); - } else { - (void)dfd_fpga_pkt_debug_set(DFD_DBG_ERR, 0); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_WARN, 0); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_VBOSE, 0); - (void)dfd_fpga_pkt_debug_set(DFD_FLOCK_DBG_VBOSE, 0); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_DBG, 0); - } - - return; -} - -void dfd_fpga_debug_init(void) -{ - FILE *fp; - char buf[10] = {0}; - - fp = fopen(DFD_DEBUG_FILE, "r"); - if (fp != NULL) { - if (fgets(buf, sizeof(buf), fp) != NULL) { - if (strstr(buf, DFD_DEBUG_SET_NO_WARN) != NULL) { - (void)dfd_fpga_pkt_debug_set(DFD_DBG_ERR, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_WARN, 0); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_VBOSE, 0); - (void)dfd_fpga_pkt_debug_set(DFD_FLOCK_DBG_VBOSE, 0); - } else if (strstr(buf, DFD_DEBUG_SET_NO_VBOSE) != NULL) { - (void)dfd_fpga_pkt_debug_set(DFD_DBG_ERR, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_WARN, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_VBOSE, 0); - (void)dfd_fpga_pkt_debug_set(DFD_FLOCK_DBG_VBOSE, 0); - } else if (strstr(buf, DFD_DEBUG_SET_NO_FLOCK_VBOSE) != NULL) { - (void)dfd_fpga_pkt_debug_set(DFD_DBG_ERR, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_WARN, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_VBOSE, 1); - (void)dfd_fpga_pkt_debug_set(DFD_FLOCK_DBG_VBOSE, 0); - } else if (strstr(buf, DFD_DEBUG_SET_ALL) != NULL) { - (void)dfd_fpga_pkt_debug_set(DFD_DBG_ERR, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_WARN, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_VBOSE, 1); - (void)dfd_fpga_pkt_debug_set(DFD_FLOCK_DBG_VBOSE, 1); - (void)dfd_fpga_pkt_debug_set(DFD_DBG_DBG, 1); - } else if (strstr(buf, DFD_DEBUG_SET_DBG) != NULL) { - (void)dfd_fpga_pkt_debug_set(DFD_DBG_DBG, 1); - } else if (strstr(buf, DFD_DEBUG_SET_FLOCK) != NULL) { - (void)dfd_fpga_pkt_debug_set(DFD_FLOCK_DBG_VBOSE, 1); - } - } - - fclose(fp); - } - - return; -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_debug.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_debug.h deleted file mode 100644 index 501ba7f373..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_debug.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _DFD_FPGA_DEBUG_H_ -#define _DFD_FPGA_DEBUG_H_ - -#include -#include -#include - -#define DFD_DEBUG_FILE "/sbin/.dfd_debug_flag" - -#define DFD_DEBUG_SET_NO_WARN "0x1" -#define DFD_DEBUG_SET_NO_VBOSE "0x3" -#define DFD_DEBUG_SET_NO_FLOCK_VBOSE "0x7" -#define DFD_DEBUG_SET_ALL "0xf" -#define DFD_DEBUG_SET_DBG "0xd" -#define DFD_DEBUG_SET_FLOCK "0xe" -#define mem_clear(data, size) memset((data), 0, (size)) - -#define DFD_DEBUG_CHECK(type) (g_dfd_fpga_debug & (1U << (type))) - -#define DFD_ERROR(fmt, args...) do { \ - if (DFD_DEBUG_CHECK(DFD_DBG_ERR)) { \ - printf("[%s-%s]:\n" fmt, "DFD", "err", \ - __FILE__, __FUNCTION__, __LINE__, ##args); \ - } \ -} while (0) - -#define DFD_WARN(fmt, args...) do { \ - if (DFD_DEBUG_CHECK(DFD_DBG_WARN)) { \ - printf("[%s-%s]:\n" fmt, "DFD", "warn", \ - __FILE__, __FUNCTION__, __LINE__, ##args); \ - } \ -} while (0) - -#define DFD_VERBOS(fmt, args...) do { \ - if (DFD_DEBUG_CHECK(DFD_DBG_VBOSE)) { \ - printf("[%s-%s]:\n" fmt, "DFD", "vbose", \ - __FILE__, __FUNCTION__, __LINE__, ##args); \ - } \ -} while (0) - -#define DFD_FLOCK_VERBOS(fmt, args...) do { \ - if (DFD_DEBUG_CHECK(DFD_FLOCK_DBG_VBOSE)) { \ - printf("[%s-%s]:\n" fmt, "DFD", "flock_vbose", \ - __FILE__, __FUNCTION__, __LINE__, ##args); \ - } \ -} while (0) - -#define DFD_DBG(fmt, args...) do { \ - if (DFD_DEBUG_CHECK(DFD_DBG_DBG)) { \ - printf("" fmt,\ - ##args); \ - } \ - } while (0) -/* define the type of debugging information */ -typedef enum { - DFD_DBG_ERR, - DFD_DBG_WARN, - DFD_DBG_VBOSE, - DFD_FLOCK_DBG_VBOSE, - DFD_DBG_DBG, - DFD_DBG_CNT -} DFD_DEBUG_TYPE_E; - -extern int g_dfd_fpga_debug; - -int dfd_fpga_debug_set(int type, int enable); -void dfd_fpga_open_debug(int val); -void dfd_fpga_debug_init(void); - -#endif \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_pkt.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_pkt.c deleted file mode 100644 index 8014267806..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_pkt.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright(C) 2001-2012 Ragile Network. All rights reserved. - */ -/* - * dfd_fpga_pkt.c - * - * FPGA message interaction related interface - * - * History - * v1.0 support 2013-10-25 Initial version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dfd_fpga_pkt.h" -#include "dfd_fpga_debug.h" - -#define DFD_FPGA_FAC_MODE_CONFIG_FILE "/tmp/.factory_disabale_cli_tty" -#if 1 -#define DFD_FPGA_PKT_SEND_PKT_TO_FRAME -#endif - -void dfd_fpga_pkt_print(uint8_t *buf, int buf_len) -{ - int i; - - for (i = 0; i < buf_len; i++) { - if ((i % 16) == 0) { - DFD_DBG("\n"); - } - DFD_DBG("%02x ", buf[i]); - } - - DFD_DBG("\n"); - return; -} - -static unsigned int littel_endian_byte_to_word32(uint8_t *byte_buf, int len) -{ - uint8_t tmp_buf[4]; - unsigned int word; - - word = 0; - - mem_clear(tmp_buf, 4); - memcpy(tmp_buf, byte_buf, len < 4 ? len : 4); - - word = tmp_buf[0] | (tmp_buf[1] << 8) | (tmp_buf[2] << 16) | (tmp_buf[3] << 24); - - return word; -} - -static int littel_endian_word32_to_byte(uint8_t *byte_buf, int len, unsigned int word) -{ - uint8_t tmp_buf[4]; - int ret; - - if (len < 4) { - DFD_ERROR("Not enough buf, word32 to byte: len[%d], word[0x%x]\n"); - return -1; - } - - mem_clear(tmp_buf, 4); - tmp_buf[0] = word & 0xff; - tmp_buf[1] = (word >> 8) & 0xff; - tmp_buf[2] = (word >> 16) & 0xff; - tmp_buf[3] = (word >> 24) & 0xff; - - memcpy(byte_buf, tmp_buf, 4); - - return 0; -} - -static int open_pci_dev(dfd_pci_dev_priv_t *pci_priv, int is_cfg) -{ - int file, ret; - char filename[DFD_PCI_MAX_NAME_SIZE]; - - if (is_cfg) { - ret = snprintf(filename, DFD_PCI_MAX_NAME_SIZE, - "/sys/class/pci_bus/%04x:%02x/device/%04x:%02x:%02x.%d/config", - 0, pci_priv->pcibus, 0, pci_priv->pcibus, pci_priv->slot, pci_priv->fn); - } else { - ret = snprintf(filename, DFD_PCI_MAX_NAME_SIZE, - "/sys/class/pci_bus/%04x:%02x/device/%04x:%02x:%02x.%d/resource%d", - 0, pci_priv->pcibus, 0, pci_priv->pcibus, pci_priv->slot, pci_priv->fn, - pci_priv->bar); - } - - filename[ret] = '\0'; - if ((file = open(filename, O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO)) < 0) { - DFD_ERROR("Error: Could not open file %s\n", filename); - } - - return file; -} - -/** - * dfd_fpga_buf_read - provide FPGA write register interface (address must be four-byte aligned) - * @dst: The data structure of sslot and unit corresponding to the target chip - * @addr: address (four-byte alignment). For the byte alignment required by the specific FPGA address, please refer to the FPGA manual - * @buf: Buffer for reading data - * @wr_len: the length of reading data,please refer to the FPGA manual for the length of the specific FPGA address requirements - * return: return if success,else return -1 - */ -int dfd_fpga_pci_read(dfd_pci_dev_priv_t *pci_priv, int offset, uint8_t *buf, int rd_len) -{ - int ret, fd; - unsigned int data; - uint8_t *ptr, *ptr_data; - struct stat sb; - int i; - int len, align; - - if ((pci_priv == NULL) || (buf == NULL)) { - DFD_ERROR("pci_prive or read buf is null.\n"); - return -1; - } - - if ((pci_priv->align < 1) || (offset & (pci_priv->align - 1)) || (rd_len & (pci_priv->align - 1))) { - DFD_ERROR("offset[%d] or rd_len[%d] don't align[%d].\n", offset, rd_len, pci_priv->align); - return -1; - } - - if ((fd = open_pci_dev(pci_priv, 0)) < 0) { - return -1; - } - - if ((ret = fstat(fd, &sb)) == -1) { - DFD_ERROR("Error: Could not fstat : %s\n", strerror(errno)); - close(fd); - return -1; - } - - if (offset + rd_len >= sb.st_size) { - DFD_ERROR("Error: offset is out of range\n"); - close(fd); - return -1; - } - - if ((ptr = mmap(NULL, sb.st_size, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, 0)) == MAP_FAILED) { - DFD_ERROR("Error: Could not mmap : %s or resource is IO\n", strerror(errno)); - close(fd); - return -1; - } - - align = pci_priv->align; - len = rd_len; - ret = 0; - i = 0; - ptr_data = ptr + offset; - - while((i < len) && (ret == 0)){ - if (align == 4) { - data = *((volatile unsigned int *)(ptr_data + i)); - ret = littel_endian_word32_to_byte(buf + i, len - i, data); - i += 4; - } else { - ret = -1; - } - } - - munmap(ptr, sb.st_size); - close(fd); - return ret; - -} - -/** - * dfd_fpga_buf_write -provide FPGA write register interface (address must be four-byte aligned) - * @dst: The data structure of sslot and unit corresponding to the target chip - * @addr: address (four-byte alignment). For the byte alignment required by the specific FPGA address, please refer to the FPGA manual - * @buf: Buffer for reading data - * @wr_len: the length of reading data,please refer to the FPGA manual for the length of the specific FPGA address requirements - * return: return if success,else return -1 - */ - -int dfd_fpga_pci_write(dfd_pci_dev_priv_t *pci_priv, int offset, uint8_t *buf, int wr_len) -{ - int ret, fd; - unsigned int data; - uint8_t *ptr, *ptr_data; - struct stat sb; - int i; - int len, align; - - if ((pci_priv == NULL) || (buf == NULL)) { - DFD_ERROR("pci_prive or write buf is null.\n"); - return -1; - } - - if ((pci_priv->align < 1) || (offset & (pci_priv->align - 1)) || (wr_len & (pci_priv->align - 1))) { - DFD_ERROR("offset[%d] or rd_len[%d] don't align[%d].\n", offset, wr_len, pci_priv->align); - return -1; - } - - if ((fd = open_pci_dev(pci_priv, 0)) < 0) { - return -1; - } - - if ((ret = fstat(fd, &sb)) == -1) { - DFD_ERROR("Error: Could not fstat : %s\n", strerror(errno)); - close(fd); - return -1; - } - - if (offset + wr_len >= sb.st_size) { - DFD_ERROR("Error: offset is out of range\n"); - close(fd); - return -1; - } - - if ((ptr = mmap(NULL, sb.st_size, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, 0)) == MAP_FAILED) { - DFD_ERROR("Error: Could not mmap : %s or resource is IO\n", strerror(errno)); - close(fd); - return -1; - } - - align = pci_priv->align; - len = wr_len; - ret = 0; - i = 0; - ptr_data = ptr + offset; - - while((i < len) && (ret == 0)){ - if (align == 4) { - data = littel_endian_byte_to_word32(buf + i,len - i); - *((volatile unsigned int *)(ptr_data + i)) = data; - i += 4; - } else { - ret = -1; - } - } - - munmap(ptr, sb.st_size); - close(fd); - return ret; - -} - -/** - * dfd_fpga_read_word -provide FPGA read register interface (address must be four-byte aligned) - * @addr: address (four-byte alignment) - * @val: the returned number of reading - * return: return 0 if success,else return failure - */ -int dfd_fpga_read_word(dfd_pci_dev_priv_t *pci_priv, int addr, int *val) -{ - int ret, i; - uint8_t tmp[DFD_FPGA_PKT_WORD_LEN]; - - if ((pci_priv == NULL) || (val == NULL) || (addr & 0x03)) { - DFD_ERROR("Input para invalid pci_priv %p val %p addr 0x%x.\n", pci_priv, val, addr); - return -1; - } - - ret = dfd_fpga_pci_read(pci_priv, addr, tmp, DFD_FPGA_PKT_WORD_LEN); - if (ret) { - DFD_ERROR("dfd_fpga_pci_read addr 0x%x failed ret %d.\n", addr, ret); - return ret; - } - - *val = littel_endian_byte_to_word32(tmp,DFD_FPGA_PKT_WORD_LEN); - for (i = 0; i < DFD_FPGA_PKT_WORD_LEN; i++) { - DFD_VERBOS("tmp[%d]: 0x%x.\n", i, tmp[i]); - } - DFD_VERBOS("dfd_fpga_read_word addr 0x%x val 0x%x.\n", addr, *val); - - return 0; -} - -/** - * dfd_fpga_write_word -provide FPGA write register interface (address must be four-byte aligned) - * @addr: address (four-byte alignment) - * @val: Data written - * return: return 0 if success,else return failure - */ -int dfd_fpga_write_word(dfd_pci_dev_priv_t *pci_priv, int addr, int val) -{ - int ret, i; - uint8_t tmp[DFD_FPGA_PKT_WORD_LEN]; - - if ((pci_priv == NULL) || (addr & 0x03)) { - DFD_ERROR("Input para invalid pci_priv %p addr 0x%x.\n", pci_priv, addr); - return -1; - } - - littel_endian_word32_to_byte(tmp, DFD_FPGA_PKT_WORD_LEN, val); - for (i = 0; i < DFD_FPGA_PKT_WORD_LEN; i++) { - DFD_VERBOS("tmp[%d]: 0x%x.\n", i, tmp[i]); - } - - ret = dfd_fpga_pci_write(pci_priv, addr, tmp, DFD_FPGA_PKT_WORD_LEN); - if (ret) { - DFD_ERROR("dfd_fpga_pci_write addr 0x%x failed ret %d.\n", addr, ret); - return ret; - } - - DFD_VERBOS("dfd_fpga_write_word addr 0x%x val 0x%x.\n", addr, val); - return 0; -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_pkt.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_pkt.h deleted file mode 100644 index 0d3c3fc9f1..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_pkt.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef __DFD_FPGA_PKT_H__ -#define __DFD_FPGA_PKT_H__ - -typedef enum dfd_fpga_pkt_op_type_e { - DFD_FPGA_PKT_OP_TYPE_READ = 0, /* read */ - DFD_FPGA_PKT_OP_TYPE_WRITE = 1, /* write */ - DFD_FPGA_PKT_OP_TYPE_END, -} dfd_fpga_pkt_op_type_t; - -typedef enum dfd_fpga_pkt_ack_type_e { - DFD_FPGA_PKT_ACK_TYPE_NO_ERROR = 0, /* successful operation */ - DFD_FPGA_PKT_ACK_TYPE_FCS_ERROR = 1, /* operation FCS check error */ - DFD_FPGA_PKT_ACK_TYPE_FAIL_ERROR = 2, /* operation failed */ - DFD_FPGA_PKT_ACK_TYPE_END, -} dfd_fpga_pkt_ack_type_t; - -typedef enum dfd_rv_s { - DFD_RV_OK = 0, - DFD_RV_INIT_ERR = 1, - DFD_RV_SLOT_INVALID = 2, - DFD_RV_MODE_INVALID = 3, - DFD_RV_MODE_NOTSUPPORT = 4, - DFD_RV_TYPE_ERR = 5, - DFD_RV_DEV_NOTSUPPORT = 6, - DFD_RV_DEV_FAIL = 7, - DFD_RV_INDEX_INVALID = 8, - DFD_RV_NO_INTF = 9, - DFD_RV_NO_NODE = 10, - DFD_RV_NODE_FAIL = 11, -} dfd_rv_t; - -typedef struct dfd_pci_dev_priv_s { - int pcibus; - int slot; - int fn; - int bar; - int offset; - int times; - int align; - int fpga_upg_base; -}dfd_pci_dev_priv_t; - -#define DFD_PCI_MAX_NAME_SIZE 256 - -#define DFD_MAX_FPGA_NUM (8) -#define DFD_FPGA_PKT_WORD_LEN (4) - -#define DFD_FPGA_PKT_MAC_LEN (6) -#define DFD_FPGA_PKT_PAYLOAD_WORD_DATA_LEN (4) - -#define DFD_FPGA_PKT_WORD_RW_LEN (1)/* for each access, according to 1 WORD, 4 bytes to access FPGA */ - -#define DFD_FPGA_PKT_ETYPE (0xfff9) - -#define DFD_FPGA_PKT_PAYLOAD_ADDR_LEN (4) -#define DFD_FPGA_PKT_PAYLOAD_LENGTH_LEN (2) - -#define DFD_FPGA_PKT_PAYLOAD_ADDR_OFFSET (0) -#define DFD_FPGA_PKT_PAYLOAD_LENGTH_OFFSET (DFD_FPGA_PKT_PAYLOAD_ADDR_LEN) -#define DFD_FPGA_PKT_PAYLOAD_DATA_OFFSET ((DFD_FPGA_PKT_PAYLOAD_ADDR_LEN) + (DFD_FPGA_PKT_PAYLOAD_LENGTH_LEN)) - -#define DFD_FPGA_PKT_GET_DATA(payload) (((uint8_t*)(payload)) + DFD_FPGA_PKT_PAYLOAD_DATA_OFFSET) -#define DFD_FPGA_PKT_GET_PAYLOAD_LEN(len) ((DFD_FPGA_PKT_PAYLOAD_ADDR_LEN) + (DFD_FPGA_PKT_PAYLOAD_LENGTH_LEN) + (len)) - -#pragma pack (1) -typedef struct dfd_fpga_pkt_payload_s { - uint32_t addr; /* the address of reading and writting */ - uint16_t length; /* the length of reading and writting */ - uint32_t data; /* read and write data (for read operations, you don't need to care about this field) */ -} dfd_fpga_pkt_payload_t; - -typedef struct dfd_fpga_pkt_rd_payload_s { - uint32_t addr; /* the address of reading */ - uint16_t length; /* the length of reading */ -} dfd_fpga_pkt_rd_payload_t; -#pragma pack () - -typedef enum fpga_version_e { - FPGA_VER_00 = 0x00, - FPGA_VER_01, - FPGA_VER_02, - FPGA_VER_03, - FPGA_VER_04, - FPGA_VER_05, - FPGA_VER_06, -} fpga_version_t; - -int dfd_fpga_upg_init(void); -int dfd_fpga_write_word(dfd_pci_dev_priv_t *pci_priv, int addr, int val); -int dfd_fpga_read_word(dfd_pci_dev_priv_t *pci_priv, int addr, int *val); -int dfd_fpga_pci_write(dfd_pci_dev_priv_t *pci_priv, int offset, uint8_t *buf, int wr_len); -int dfd_fpga_pci_read(dfd_pci_dev_priv_t *pci_priv, int offset, uint8_t *buf, int rd_len); -extern int drv_get_my_dev_type(void); - -#endif \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_upg.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_upg.c deleted file mode 100644 index 57c648d915..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/dfd_fpga_upg.c +++ /dev/null @@ -1,1443 +0,0 @@ -/* - * Copyright(C) 2001-2012 Ragile Network. All rights reserved. - */ -/* - * dfd_fpga_upg.c - * - * FPGA upgrade related interface - * v1.0 support 2013-10-25 Initial version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dfd_fpga_pkt.h" -#include "dfd_fpga_debug.h" - -typedef struct dfd_fpga_upg_node_s { - int sslot; /* Expansion card slot number */ - int extype; /* Expansion card type */ - int fpga_ver; /* Expansion card FPGA version number */ -} dfd_fpga_upg_node_t; - -/* FPGA upgrade related registers */ -#define FPGA_UPG_CONTENT_BASE_REG_A00 (0xa00) -#define FPGA_UPG_CONTENT_BASE_REG_E00 (0xe00) - -#define FPGA_UPG_STATUS_REG (0x180) -#define FPGA_UPG_SPI_CTRL_REG (0x184) -#define FPGA_UPG_WR_FLASH_STATUS_REG (0x188) -#define FPGA_UPG_RD_FLASH_STATUS_REG (0x18C) -#define FPGA_UPG_INSTRUCTION_REG (0x190) - -#define FPGA_UPG_ADDR_REG (0x194) -#define FPGA_UPG_LENGTH_REG (0x198) -#define FPGA_UPG_DEVICE_ID_REG (0x19C) - -#define FPGA_UPG_DROP_REQ_NUM_REG (0x1A8) - -#define FPGA_VER_ADDRESS (0x00000000) - -#define FPGA_VER_MASK (0xFFFF) -#define FPGA_VERSION(ver) ((ver & FPGA_VER_MASK) >> 8) - -/* define FPGA upgrade related instructions */ -#define FPGA_UPG_INSTRUTION_SE (0xD8) -#define FPGA_UPG_INSTRUTION_RDID (0x9F) -#define FPGA_UPG_INSTRUTION_WRSR (0x01) -#define FPGA_UPG_INSTRUTION_RDSR (0x05) -#define FPGA_UPG_INSTRUTION_WREN (0x06) -#define FPGA_UPG_INSTRUTION_WRDI (0x04) -#define FPGA_UPG_INSTRUTION_BE (0xC7) -#define FPGA_UPG_INSTRUTION_PP (0x02) -#define FPGA_UPG_INSTRUTION_FR (0x0B) -#define FPGA_UPG_INSTRUTION_P4E (0x20) - -#define FPGA_UPG_CONTENT_LENGTH (256) - -#define FPGA_UPG_STATUS_MASK (0x1) -#define FPGA_UPG_ACCESS_ENABLE (0x3) -#define FPGA_UPG_STATUS_RESET (0x0) - -#define FPGA_UPG_SPI_STATUS_MASK (0x1) - -#define FPGA_UPG_RETRY_SLEEP_TIME (10) /* 10us */ -#define FPGA_UPG_RETRY_CNT (1000) - -#define FPGA_UPG_PKT_RETRY_CNT (100) - -#define DFD_FPGA_VERSION_REG (0x10D0) - -#define DFD_FPGA_UPGRADE_BUFF_SIZE (256) -#define DFD_FPGA_UPGADE_RETRY_CNT (10) -#define DFD_FPGA_UPGRADE_CMD_BUFF_SIZE (100) -#define DFD_FPGA_UPGRADE_MAX_NODE (16) - -#define DFD_FPGA_UPDATE_BOOT_ADDR (0x1A0000) /* UPDATE area start address */ -#define DFD_FPGA_UPDATE_BOOT_ADDR_FIX (0x2F0000) -#define DFD_FPGA_SPI_SECTOR_SIZE (0x10000) /* One sector is 64k */ -#define DFD_FPGA_UPDATE_FLASH_SIZE (0x4000000) -#define DFD_FPGA_BASE_TEST_ADD (DFD_FPGA_UPDATE_FLASH_SIZE - DFD_FPGA_SPI_SECTOR_SIZE) - -#define DFD_FPGA_CRITICAL_SWITCH_PAGE_ADDR (0xF00) /* CRITICAL SWITCH page address */ -#define DFD_FPGA_CRITICAL_SWITCH_PAGE_OFFSET (0xFC) /* CRITICAL SWITCH in-page offset address */ -#define DFD_FPGA_CRITICAL_SWITCH_WORD (0xAA995566) /* CRITICAL SWITCH value */ - -#define DFD_FPGA_ERASE_P4E_SIZE (0x1000)/* erase p4e,4k at a time*/ - -#define FPGA_UPG_WAIT_SPI_RETRY_CNT (1000) -#define FPGA_UPG_WAIT_SPI_RETRY_SLEEP_TIME (1000 * 10) /* 10ms */ -#define FPGA_RETRY_TIMES (3) - -static dfd_pci_dev_priv_t default_pci_priv = { - .pcibus = 8, - .slot = 0, - .fn = 0, - .bar = 0, - .align = 4, -}; - -static dfd_pci_dev_priv_t *current_pci_priv = NULL; - -static void dfd_utest_printf_reg(uint8_t *buf, int buf_len) -{ - int i; - - for (i = 0; i < buf_len; i++) { - if ((i % 16) == 0) { - printf("\n"); - } - printf("%02x ", buf[i]); - } - - printf("\n"); - return; -} - -static int dfd_fpga_upg_write_word(dfd_pci_dev_priv_t *pci_priv, int addr, int val) -{ - int ret; - int i; - int cnt; - - i = 0; - cnt = FPGA_UPG_PKT_RETRY_CNT; - while(i < cnt) { - ret = dfd_fpga_write_word(pci_priv, addr, val); - if (ret) { - i++; - DFD_VERBOS("dfd_fpga_write_word addr 0x%x val 0x%x i %d failed ret %d.\n", addr, val, i, - ret); - continue; - } else { - DFD_VERBOS("dfd_fpga_write_word addr 0x%x val 0x%x success.\n", addr, val); - return 0; - } - } - - DFD_VERBOS("dfd_fpga_upg_write_word addr 0x%x val 0x%x i %d failed ret %d.\n", addr, val, i, ret); - return -1; -} - -static int dfd_fpga_upg_read_word(dfd_pci_dev_priv_t *pci_priv, int addr, int *val) -{ - int ret; - int i; - int cnt; - - i = 0; - cnt = FPGA_UPG_PKT_RETRY_CNT; - while(i < cnt) { - ret = dfd_fpga_read_word(pci_priv, addr, val); - if (ret) { - i++; - DFD_VERBOS("dfd_fpga_read_word addr 0x%x i %d failed ret %d.\n", addr, i, - ret); - continue; - } else { - DFD_VERBOS("dfd_fpga_read_word addr 0x%x val 0x%x success.\n", addr, *val); - return 0; - } - } - - DFD_VERBOS("dfd_fpga_read_word addr 0x%x i %d failed ret %d.\n", addr, i, ret); - return -1; -} - -static int dfd_fpga_upg_buf_write(dfd_pci_dev_priv_t *pci_priv, int addr, uint8_t *buf, int wr_len) -{ - int ret; - int i; - int cnt; - - i = 0; - cnt = FPGA_UPG_PKT_RETRY_CNT; - while(i < cnt) { - ret = dfd_fpga_pci_write(pci_priv, addr, buf, wr_len); - if (ret) { - i++; - DFD_VERBOS("dfd_fpga_buf_write addr 0x%x wr_len %d i %d failed ret %d.\n", addr, wr_len, i, - ret); - continue; - } else { - DFD_VERBOS("dfd_fpga_buf_write addr 0x%x wr_len %d success.\n", addr, wr_len); - return 0; - } - } - - DFD_VERBOS("dfd_fpga_buf_write addr 0x%x wr_len %d i %d failed ret %d.\n", addr, wr_len, i, ret); - return -1; -} - -static int dfd_fpga_upg_buf_read(dfd_pci_dev_priv_t *pci_priv, int addr, uint8_t *buf, int rd_len) -{ - int ret; - int i; - int cnt; - - i = 0; - cnt = FPGA_UPG_PKT_RETRY_CNT; - while(i < cnt) { - ret = dfd_fpga_pci_read(pci_priv, addr, buf, rd_len); - if (ret) { - i++; - DFD_VERBOS("dfd_fpga_buf_read addr 0x%x rd_len %d i %d failed ret %d.\n", addr, rd_len, i, - ret); - continue; - } else { - DFD_VERBOS("dfd_fpga_buf_read addr 0x%x rd_len %d success.\n", addr, rd_len); - return 0; - } - } - - DFD_VERBOS("dfd_fpga_buf_read addr 0x%x rd_len %d i %d failed ret %d.\n", addr, rd_len, i, ret); - return -1; -} - -/* Configuring boot Access */ -static int dfd_fpga_upg_set_access(dfd_pci_dev_priv_t *pci_priv, int cmd) -{ - int ret; - int val; - int addr; - - addr = pci_priv->fpga_upg_base + FPGA_UPG_INSTRUCTION_REG; - val = cmd; - ret = dfd_fpga_upg_write_word(pci_priv, addr, val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_write_word addr 0x%x val 0x%x failed ret %d.\n", addr, val, ret); - return -1; - } - - addr = pci_priv->fpga_upg_base + FPGA_UPG_SPI_CTRL_REG; - val = FPGA_UPG_ACCESS_ENABLE; - ret = dfd_fpga_upg_write_word(pci_priv, addr, val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_write_word addr 0x%x val 0x%x failed ret %d.\n", addr, val, ret); - return -1; - } - - DFD_VERBOS("Success: cmd %d.\n", cmd); - return 0; -} - -static int dfd_fpga_upg_reset(dfd_pci_dev_priv_t *pci_priv) -{ - int ret; - int val; - int addr; - - addr = pci_priv->fpga_upg_base + FPGA_UPG_SPI_CTRL_REG; - val = FPGA_UPG_STATUS_RESET; - ret = dfd_fpga_upg_write_word(pci_priv, addr, val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_write_word addr 0x%x val 0x%x failed ret %d.\n", addr, val, ret); - return -1; - } - - DFD_VERBOS("Success: reset %d.\n", val); - return 0; -} - -/* Whether the SPI port is idle. 0 indicates idle, and 1 indicates busy */ -static int dfd_fpga_upg_get_status(dfd_pci_dev_priv_t *pci_priv, char *status) -{ - int ret; - int val; - int addr; - - addr = pci_priv->fpga_upg_base + FPGA_UPG_STATUS_REG; - ret = dfd_fpga_upg_read_word(pci_priv, addr, &val); - DFD_VERBOS("dfd_fpga_upg_read_word return.\n"); - if (ret) { - DFD_ERROR("dfd_fpga_upg_read_word addr 0x%x failed ret %d.\n", addr, ret); - return -1; - } - - *status = val & FPGA_UPG_STATUS_MASK; - DFD_VERBOS("Success: val %d status %d.\n", val, *status); - return 0; -} - -/* Wait for the SPI port to become idle */ -static int dfd_fpga_upg_wait_ready(dfd_pci_dev_priv_t *pci_priv) -{ - int timeout; - char status; - int ret; - - timeout = FPGA_UPG_RETRY_CNT; - while (timeout--) { - DFD_VERBOS("timeout %d.\n", timeout); - ret = dfd_fpga_upg_get_status(pci_priv, &status); - if (ret) { - DFD_ERROR("dfd_fpga_upg_get_status failed ret %d.\n", ret); - continue; - } - - DFD_VERBOS("timeout %d status %d.\n", timeout, status); - /* Determine whether to be idle */ - if (!status) { - DFD_VERBOS("FPGA SPI READY.\n"); - return 0; - } - usleep(FPGA_UPG_RETRY_SLEEP_TIME); - } - - return -2; -} - -/* Configure the FPGA upgrade write function */ -static int dfd_fpga_upg_set_wr_enable(dfd_pci_dev_priv_t *pci_priv) -{ - int ret; - int cmd; - - cmd = FPGA_UPG_INSTRUTION_WREN; - ret = dfd_fpga_upg_set_access(pci_priv, cmd); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_access cmd %d failed ret %d.\n", cmd, ret); - return -1; - } - - DFD_VERBOS("Success.\n"); - return 0; -} - -/* get SPI's STATUS register */ -static int dfd_fpga_upg_get_spi_status(dfd_pci_dev_priv_t *pci_priv, char *status) -{ - int ret; - int val; - int addr; - int cmd; - - cmd = FPGA_UPG_INSTRUTION_RDSR; - ret = dfd_fpga_upg_set_access(pci_priv, cmd); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_access cmd %d failed ret %d.\n", cmd, ret); - return -1; - } - - addr = pci_priv->fpga_upg_base + FPGA_UPG_RD_FLASH_STATUS_REG; - ret = dfd_fpga_upg_read_word(pci_priv, addr, &val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_read_word addr 0x%x failed ret %d.\n", addr, ret); - return -1; - } - - ret = dfd_fpga_upg_reset(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_reset failed ret %d.\n", ret); - return -1; - } - - *status = val & FPGA_UPG_SPI_STATUS_MASK; - DFD_VERBOS("Success: val %d spi_status %d.\n", val, *status); - return 0; -} - -/* waiting for SPI chip opreation to complete */ -static int dfd_fpga_wait_spi_ready(dfd_pci_dev_priv_t *pci_priv) -{ - int timeout; - char status; - int ret; - - timeout = FPGA_UPG_WAIT_SPI_RETRY_CNT; - while (timeout--) { - DFD_VERBOS("timeout %d.\n", timeout); - ret = dfd_fpga_upg_get_spi_status(pci_priv, &status); - if (ret) { - DFD_ERROR("dfd_fpga_upg_get_spi_status failed ret %d.\n", ret); - continue; - } - DFD_VERBOS("timeout %d status %d.\n", timeout, status); - /* assert whether it is free */ - if (!status) { - DFD_VERBOS("SPI CHIP READY.\n"); - return 0; - } - usleep(FPGA_UPG_RETRY_SLEEP_TIME); - } - - return -2; -} - -/* Erase the entire chip */ -static int dfd_fpga_upg_set_erase_all(dfd_pci_dev_priv_t *pci_priv) -{ - int ret; - int cmd; - - /* waiting for FPGA's SPI port to become free */ - ret = dfd_fpga_upg_wait_ready(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_wait_ready failed ret %d.\n", ret); - return -1; - } - - /* configure write enable */ - ret = dfd_fpga_upg_set_wr_enable(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_wr_enable failed ret %d.\n", ret); - return -1; - } - - cmd = FPGA_UPG_INSTRUTION_BE; - ret = dfd_fpga_upg_set_access(pci_priv, cmd); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_access cmd %d failed ret %d.\n", cmd, ret); - return -1; - } - - /* Hardware requirements, delay 1s */ - sleep(1); - - /* Waiting for the SPI chip operation to complete */ - ret = dfd_fpga_wait_spi_ready(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_wait_ready sslot %d unit %d failed ret %d.\n", ret); - return -1; - } - - ret = dfd_fpga_upg_reset(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_reset failed ret %d.\n", ret); - return -1; - } - - DFD_VERBOS("Success.\n"); - return 0; -} - -/* Erase sector (256 pages, 64k in total) */ -int dfd_fpga_upg_set_erase_sector(dfd_pci_dev_priv_t *pci_priv, int spi_addr) -{ - int ret; - int cmd, val, addr; - - DFD_VERBOS("Enter spi_addr 0x%x.\n", spi_addr); - - /* waiting for FPGA's SPI port to become free*/ - ret = dfd_fpga_upg_wait_ready(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_wait_ready failed ret %d.\n", ret); - return -1; - } - - /* Start write enable */ - ret = dfd_fpga_upg_set_wr_enable(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_wr_enable failed ret %d.\n", ret); - return -1; - } - - /* Write erase address */ - val = spi_addr; - addr = pci_priv->fpga_upg_base + FPGA_UPG_ADDR_REG; - ret = dfd_fpga_upg_write_word(pci_priv, addr, val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_write_word addr 0x%x val 0x%x failed ret %d.\n", addr, val, ret); - return -1; - } - - /* Start sector erase? */ - cmd = FPGA_UPG_INSTRUTION_SE; - ret = dfd_fpga_upg_set_access(pci_priv, cmd); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_access cmd %d failed ret %d.\n", cmd, ret); - return -1; - } - - /* hardware requirment ,delay 500ms */ - usleep(500 * 1000); - - /* waiting for SPI chip operation to complete */ - ret = dfd_fpga_wait_spi_ready(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_wait_ready failed ret %d.\n", ret); - return -1; - } - - ret = dfd_fpga_upg_reset(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_reset failed ret %d.\n", ret); - return -1; - } - - DFD_VERBOS("Success.\n"); - - return 0; -} - -/* eara 4k area */ -int dfd_fpga_upg_set_erase_p4e(dfd_pci_dev_priv_t *pci_priv, int spi_addr) -{ - int ret; - int cmd, val, addr; - - DFD_VERBOS("Enter spi_addr 0x%x.\n", spi_addr); - - /* waiting for FPGA's SPI port to become free */ - ret = dfd_fpga_upg_wait_ready(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_wait_ready failed ret %d.\n", ret); - return -1; - } - - /* start write enable */ - ret = dfd_fpga_upg_set_wr_enable(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_wr_enable failed ret %d.\n", ret); - return -1; - } - - /* write erase address */ - val = spi_addr; - addr = pci_priv->fpga_upg_base + FPGA_UPG_ADDR_REG; - ret = dfd_fpga_upg_write_word(pci_priv, addr, val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_write_word addr 0x%x val 0x%x failed ret %d.\n", addr, val, ret); - return -1; - } - - /* start 4k erase */ - cmd = FPGA_UPG_INSTRUTION_P4E; - ret = dfd_fpga_upg_set_access(pci_priv, cmd); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_access cmd %d failed ret %d.\n", cmd, ret); - return -1; - } - - /* hardware requirment,delay 200ms */ - usleep(200 * 1000); - - /* waiting for SPI chip operation to complete */ - ret = dfd_fpga_wait_spi_ready(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_wait_ready failed ret %d.\n", ret); - return -1; - } - - ret = dfd_fpga_upg_reset(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_reset failed ret %d.\n", ret); - return -1; - } - - DFD_VERBOS("Success.\n"); - - return 0; -} - -static int dfd_fpga_upg_program(dfd_pci_dev_priv_t *pci_priv, int spi_addr, char *buf, int len) -{ - int ret; - int addr; - int val; - int cmd; - int step; - int wr_len; - - /* Write data to upgrade content register */ - step = 1; - #if 0 - /* FPGA temporarily only supports 4 bytes of read and write */ - for (i = 0; i < len; i += 4) { - addr = pci_priv->fpga_upg_base + i; - wr_len = ((i + 4) <= len) ? (4) : (len - i); - DFD_VERBOS("dfd_fpga_buf_write sslot %d unit %d i %d addr 0x%x wr_len %d.\n", - dst->sslot, dst->unit, i, addr, wr_len); - ret = dfd_fpga_upg_buf_write(dst, addr, (uint8_t*)&buf[i], wr_len); - if (ret) { - DFD_ERROR("dfd_fpga_upg_buf_write addr 0x%x wr_len %d failed ret %d.\n", addr, len, ret); - return -1; - } - } - #else - addr = pci_priv->fpga_upg_base; - wr_len = len; - DFD_VERBOS("dfd_fpga_buf_write addr 0x%x wr_len %d.\n", addr, wr_len); - ret = dfd_fpga_upg_buf_write(pci_priv, addr, (uint8_t*)buf, wr_len); - if (ret) { - DFD_ERROR("dfd_fpga_upg_buf_write addr 0x%x wr_len %d failed ret %d.\n", addr, len, ret); - return -1; - } - #endif - - /* Write length register */ - step++; - val = FPGA_UPG_CONTENT_LENGTH;/* Fpga is always written in 256 length */ - addr = pci_priv->fpga_upg_base + FPGA_UPG_LENGTH_REG; - ret = dfd_fpga_upg_write_word(pci_priv, addr, val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_write_word addr 0x%x val 0x%x failed ret %d.\n", addr, val, ret); - return -step; - } - - /* write address register */ - step++; - val = spi_addr; - addr = pci_priv->fpga_upg_base + FPGA_UPG_ADDR_REG; - ret = dfd_fpga_upg_write_word(pci_priv, addr, val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_write_word addr 0x%x val 0x%x failed ret %d.\n", addr, val, ret); - return -step; - } - - /* Start writing upgrade data to SPI */ - step++; - cmd = FPGA_UPG_INSTRUTION_PP; - ret = dfd_fpga_upg_set_access(pci_priv, cmd); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_access cmd %d failed ret %d.\n", cmd, ret); - return -step; - } - - /* Wait for the SPI port of FPGA to recover from idle */ - step++; - ret = dfd_fpga_upg_wait_ready(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_wait_ready failed ret %d.\n", ret); - return -step; - } - - step++; - ret = dfd_fpga_upg_reset(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_reset failed ret %d.\n", ret); - return -step; - } - - return 0; -} - -/** - * dfd_fpga_upg_write -write operation interface provided to upgrade module - * @dst: the data structure of sslot and unit corresponding to the target chip to be upgraded - * @addr: write address (must ensure 256-byte alignment) - * @buf: write address buffer - * @len: Write length (when upgrading, 256 bytes of data must be written every time, only the last set of data can be less than 256) - * return: return 0 if success,else return failure - * - */ -int dfd_fpga_upg_write(dfd_pci_dev_priv_t *pci_priv, int addr, char *buf, int len) -{ - int ret; - int step; - - /* address must be 256-byte alignment */ - step = 1; - if ((pci_priv == NULL) || (buf == NULL) || (addr & 0xff) || (len > 256)) { - DFD_ERROR("Input para invalid pci_priv %p buf %p addr 0x%x len %d.\n", pci_priv, buf, addr, len); - return -step; - } - - DFD_VERBOS("Enter: addr 0x%x len %d.\n", addr, len); - - /* waiting for FPGA's SPI port to become free */ - step++; - ret = dfd_fpga_upg_wait_ready(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_wait_ready failed ret %d.\n", ret); - return -step; - } - - /* configure write enable */ - step++; - ret = dfd_fpga_upg_set_wr_enable(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_wr_enable failed ret %d.\n", ret); - return -step; - } - - /* write upgrade data */ - step++; - ret = dfd_fpga_upg_program(pci_priv, addr, buf, len); - if (ret) { - DFD_ERROR("dfd_fpga_upg_program addr 0x%x len %d failed ret %d.\n", addr, len, ret); - return -step; - } - - DFD_VERBOS("Success: addr 0x%x len %d.\n", addr, len); - return 0; -} - -static int dfd_fpga_upg_fast_read(dfd_pci_dev_priv_t *pci_priv, int spi_addr, char *buf, int len) -{ - int ret; - uint32_t val; - int addr; - int cmd; - int step; - - step = 0; - - /* clear register value */ - step++; - addr = pci_priv->fpga_upg_base; - ret = dfd_fpga_upg_buf_write(pci_priv, addr, buf, len); - if (ret) { - DFD_ERROR("dfd_fpga_upg_buf_write addr 0x%x len %d failed ret %d.\n", addr, len, ret); - return -step; - } - /* write length register */ - step++; - val = FPGA_UPG_CONTENT_LENGTH; - addr = pci_priv->fpga_upg_base + FPGA_UPG_LENGTH_REG; - ret = dfd_fpga_upg_write_word(pci_priv, addr, val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_write_word addr 0x%x val 0x%x failed ret %d.\n", addr, val, ret); - return -step; - } - - /* write address register */ - step++; - val = spi_addr; - addr = pci_priv->fpga_upg_base + FPGA_UPG_ADDR_REG; - ret = dfd_fpga_upg_write_word(pci_priv, addr, val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_write_word addr 0x%x val 0x%x failed ret %d.\n", addr, val, ret); - return -step; - } - - /* start reading SPI data */ - step++; - cmd = FPGA_UPG_INSTRUTION_FR; - ret = dfd_fpga_upg_set_access(pci_priv, cmd); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_access cmd %d failed ret %d.\n", cmd, ret); - return -step; - } - - /* waiting for FPGA's SPI port to become free */ - step++; - ret = dfd_fpga_upg_wait_ready(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_wait_ready failed ret %d.\n", ret); - return -step; - } - - /* Read upgrade content register to buffer */ - step++; - - /* FPGA temporarily only supports 4 bytes of read and write */ - #if 1 - addr = pci_priv->fpga_upg_base; - ret = dfd_fpga_upg_buf_read(pci_priv, addr, (uint8_t*)buf, len); - if (ret) { - DFD_ERROR("dfd_fpga_upg_buf_read addr 0x%x len %d failed ret %d.\n", addr, len, ret); - return -step; - } - - step++; - ret = dfd_fpga_upg_reset(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_reset failed ret %d.\n", ret); - return -step; - } - - #else - for (i = 0; i < len; i += 4) { - addr = pci_priv->fpga_upg_base + i; - rd_len = ((i + 4) <= len) ? (4) : (len - i); - DFD_VERBOS("dfd_fpga_upg_buf_read sslot %d unit %d i %d addr 0x%x rd_len %d.\n", - dst->sslot, dst->unit, i, addr, rd_len); - ret = dfd_fpga_upg_buf_read(dst, addr, (uint8_t*)(&buf[i]), rd_len); - if (ret) { - DFD_ERROR("dfd_fpga_upg_buf_read addr 0x%x rd_len %d failed ret %d.\n", addr, rd_len, ret); - return -step; - } - - for (j = 0; j < rd_len; j++) { - DFD_VERBOS("buf[%d]: 0x%x.\n", i, buf[i]); - } - } - #endif - - return 0; -} - -/** - * dfd_fpga_upg_read -read operation interface provided to upgrade module - * @dst: the data structure of sslot and unit corresponding to the target chip - * @addr: read address (must ensure 256-byte alignment) - * @buf: buffer for reading data - * @len: read length (the data read each time must be 256 bytes, only the last time can be less than 256 bytes) - * return: return 0 if success,else return failure - * - */ -int dfd_fpga_upg_read(dfd_pci_dev_priv_t *pci_priv, int addr, char *buf, int len) -{ - int ret; - int step; - - /* address must be 256-byte alignment */ - step = 1; - if ((pci_priv == NULL) || (buf == NULL) || (addr & 0xff) || (len > 256)) { - DFD_ERROR("Input para invalid pci_priv %p buf %p addr 0x%x len %d.\n", pci_priv, buf, addr, len); - return -step; - } - - DFD_VERBOS("Enter: addr 0x%x len %d.\n", addr, len); - - /* waiting for FPGA's SPI port to become free */ - step++; - ret = dfd_fpga_upg_wait_ready(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_wait_ready failed ret %d.\n", ret); - return -step; - } - - /* configure write enable */ - step++; - ret = dfd_fpga_upg_set_wr_enable(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_wr_enable failed ret %d.\n", ret); - return -step; - } - - /* read upgrade data */ - step++; - ret = dfd_fpga_upg_fast_read(pci_priv, addr, buf, len); - if (ret) { - DFD_ERROR("dfd_fpga_upg_fast_read addr 0x%x len %d failed ret %d.\n", addr, len, ret); - return -step; - } - - DFD_VERBOS("Success: addr 0x%x len %d.\n", addr, len); - return 0; - -} - -/** - * dfd_fpga_upg_hw_init -upgrade initialization interface provided to the upgrade module (call before starting the upgrade) - * @dst: the data structure of sslot and unit corresponding to the target chip to be upgraded - * return: return 0 if success,else return failure - * Before the interface returns, it will actively delay 1s (required by FPGA) - */ -int dfd_fpga_upg_hw_init(dfd_pci_dev_priv_t *pci_priv) -{ - int ret; - - ret = dfd_fpga_upg_set_erase_all(pci_priv); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_wr_enable failed ret %d.\n", ret); - return -2; - } - - DFD_VERBOS("Success.\n"); - return 0; -} - -static int dfd_fpga_upgrade_get_fpga_version(dfd_pci_dev_priv_t *pci_priv, int *ver) -{ - int addr; - int ret; - int val; - - addr = DFD_FPGA_VERSION_REG; - ret = dfd_fpga_upg_read_word(pci_priv, addr, &val); - if (ret) { - DFD_ERROR("dfd_fpga_upg_read_word addr 0x%x failed ret %d.\n", addr, ret); - return -1; - } - - *ver = val; - DFD_VERBOS("ver 0x%x.\n", *ver); - return 0; -} - -unsigned long dfd_fpga_upg_get_file_size(const char *path) -{ - unsigned long filesize; - struct stat statbuff; - - if(stat(path, &statbuff) < 0){ - filesize = -1; - } else{ - filesize = statbuff.st_size; - } - - DFD_VERBOS("file %s size is %lu.\n", path, filesize); - return filesize; -} - -static int dfd_fpga_address_init(void) -{ - int fw_version; - int ret; - - ret = dfd_fpga_upg_read_word(current_pci_priv, FPGA_VER_ADDRESS, &fw_version); - switch (FPGA_VERSION(fw_version)) { - case FPGA_VER_00: - case FPGA_VER_02: - case FPGA_VER_03: - case FPGA_VER_06: - current_pci_priv->fpga_upg_base = FPGA_UPG_CONTENT_BASE_REG_A00; - break; - case FPGA_VER_05: - current_pci_priv->fpga_upg_base = FPGA_UPG_CONTENT_BASE_REG_E00; - break; - default: - current_pci_priv->fpga_upg_base = FPGA_UPG_CONTENT_BASE_REG_A00; - break; - } - return ret; -} - -static int dfd_fpga_device_init(void) -{ - current_pci_priv = &default_pci_priv; - if (drv_get_my_dev_type() == 0x4075){ - current_pci_priv->pcibus = 1; /* ATS48's pcie channel is 1 */ - } - - return dfd_fpga_address_init(); -} - -/** - * dfd_fpga_pkt_init -DFD FPGA driver library initialization interface (if you need to use DFD FPGA driver, you must initialize first) - * return: return 0 if success,else return failure - */ - -int dfd_fpga_upg_init(void) -{ - int ret; - static int flag; - - if (flag) { - DFD_VERBOS("Already init.\n"); - return 0; - } - - /* debug initialization */ - dfd_fpga_debug_init(); - - ret = dfd_fpga_device_init(); - if (ret) { - DFD_ERROR("dfd_fpga_upg_init failed ret %d.\n", ret); - return ret; - } - - flag = 1; - return 0; -} - -int dfd_fpga_erase64_sector(dfd_pci_dev_priv_t *pci_priv, int offset) -{ - int ret; - ret = -1; - - if ((offset % DFD_FPGA_SPI_SECTOR_SIZE) == 0) { - DFD_VERBOS("erase 64k area, offset 0x%x.\n", offset); - ret = dfd_fpga_upg_set_erase_sector(pci_priv, offset); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_erase_sector offset 0x%x failed ret %d.\n", offset, ret); - return ret; - } - } - DFD_ERROR("Input para invalid, offset 0x%x.\n", offset); - return ret; -} - -int dfd_fpga_upgrade_test(void) -{ - int ret, i, j, offset, num, len, res, retry; - char wbuf[DFD_FPGA_SPI_SECTOR_SIZE]; - char rbuf[DFD_FPGA_UPGRADE_BUFF_SIZE]; - - offset = DFD_FPGA_BASE_TEST_ADD; - len = DFD_FPGA_UPGRADE_BUFF_SIZE; - dfd_pci_dev_priv_t *pci_priv; - dfd_fpga_upg_init(); - - if (current_pci_priv == NULL) { - printf("fpga test input para invalid pci_priv %p.\n", current_pci_priv); - return -DFD_RV_INIT_ERR; - } - pci_priv = current_pci_priv; - - mem_clear(wbuf, DFD_FPGA_SPI_SECTOR_SIZE); - /* get random data */ - for (j = 0; j < DFD_FPGA_SPI_SECTOR_SIZE; j++) { - num = rand() % 256; - wbuf[j] = num & 0xff; - } - ret = dfd_fpga_erase64_sector(pci_priv, offset); - if (ret) { - goto exit; - } - - for (i = 0; i < DFD_FPGA_UPGRADE_BUFF_SIZE; i++) { - mem_clear(rbuf, DFD_FPGA_UPGRADE_BUFF_SIZE); - /* write data first */ - ret = dfd_fpga_upg_write(pci_priv, offset, &wbuf[i * DFD_FPGA_UPGRADE_BUFF_SIZE], len); - if (ret) { - DFD_ERROR("fpga upg write offset 0x%x len %d failed ret %d.\n", offset, len, ret); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } else { - DFD_VERBOS("page %d upg write offset 0x%x len %d success.\n", i, offset, len); - } - - /* go back to read the data*/ - for (retry = 0; retry < FPGA_RETRY_TIMES; retry++) { /*retry 3 times*/ - ret = dfd_fpga_upg_read(pci_priv, offset, rbuf, len); - res = memcmp(rbuf, &wbuf[i * DFD_FPGA_UPGRADE_BUFF_SIZE], len); - if (ret || res) { - usleep(1000); - continue; - } - break; - } - if (ret) { - DFD_ERROR("fpga upg read offset 0x%x len %d failed ret %d.\n", offset, len, ret); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } else { - DFD_VERBOS("page %d upg read offset 0x%x len %d success.\n", i, offset, len); - } - - if (res) { - DFD_ERROR("rbuf wbuf not equal, len %d, check failed.\n", len); - DFD_ERROR("wbuf: \n"); - dfd_utest_printf_reg((uint8_t*)wbuf, len); - DFD_ERROR("rbuf: \n"); - dfd_utest_printf_reg((uint8_t*)rbuf, len); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } - - offset += len; - } - - offset = DFD_FPGA_BASE_TEST_ADD; - ret = dfd_fpga_erase64_sector(pci_priv, offset); - if (ret) { - goto exit; - } -exit: - return ret; -} - -static int dfd_fpga_upgrade_do_upgrade_onetime(dfd_pci_dev_priv_t *pci_priv, int fd, unsigned long filesize) -{ - int ret, res; - int i, len, read_len, retry; - char wbuf[DFD_FPGA_UPGRADE_BUFF_SIZE]; - char rbuf[DFD_FPGA_UPGRADE_BUFF_SIZE]; - int offset; - - if (current_pci_priv == NULL) { - DFD_ERROR("Input para invalid pci_priv %p.\n", pci_priv); - return -DFD_RV_INDEX_INVALID; - } - -#if 0 - /* handle before upgrading */ - ret = dfd_fpga_upg_do_pre(dst, filesize); - if (ret) { - DFD_ERROR("fpga hw init failed ret %d.\n", ret); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } -#endif - - i = 0; - offset = DFD_FPGA_UPDATE_BOOT_ADDR; - ret = lseek(fd, 0, SEEK_SET); - if (ret == -1) { - DFD_ERROR("seek file failed ret %d.\n", ret); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } - while(1) { - len = DFD_FPGA_UPGRADE_BUFF_SIZE; -#if 0 - if ((offset % DFD_FPGA_ERASE_P4E_SIZE) == 0) { - DFD_VERBOS("erase 4k area, offset 0x%x.\n", offset); - ret = dfd_fpga_upg_set_erase_p4e(dst, offset); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_erase_p4e offset 0x%x failed ret %d.\n", offset, ret); - goto exit; - } - } -#else - if ((offset % DFD_FPGA_SPI_SECTOR_SIZE) == 0) { - DFD_VERBOS("erase 64k area, offset 0x%x.\n", offset); - ret = dfd_fpga_upg_set_erase_sector(pci_priv, offset); - if (ret) { - DFD_ERROR("dfd_fpga_upg_set_erase_sector offset 0x%x failed ret %d.\n", offset, ret); - goto exit; - } - } -#endif - - mem_clear(wbuf, DFD_FPGA_UPGRADE_BUFF_SIZE); - read_len = read(fd, wbuf, len); - i++; - if ((read_len > 0) && (read_len <= len)) { - /* write data first */ - ret = dfd_fpga_upg_write(pci_priv, offset, wbuf, read_len); - if (ret) { - DFD_ERROR("fpga upg write offset 0x%x len %d failed ret %d.\n", offset, read_len, ret); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } else { - DFD_VERBOS("page %d upg write offset 0x%x len %d success.\n", i, offset, read_len); - } - - /* go back to read data */ - for (retry = 0; retry < FPGA_RETRY_TIMES; retry++) { /*retry 3 times*/ - mem_clear(rbuf, DFD_FPGA_UPGRADE_BUFF_SIZE); - ret = dfd_fpga_upg_read(pci_priv, offset, rbuf, read_len); - res = memcmp(rbuf, wbuf, read_len); - if (ret || res) { - usleep(1000); - continue; - } - break; - } - if (ret) { - DFD_ERROR("fpga upg read offset 0x%x len %d failed ret %d.\n", offset, read_len, ret); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } else { - DFD_VERBOS("page %d upg read offset 0x%x len %d success.\n", i, offset, read_len); - } - - if (res) { - DFD_ERROR("rbuf wbuf not equal, read_len %d, check failed.\n", read_len); - DFD_ERROR("wbuf: \n"); - dfd_utest_printf_reg((uint8_t*)wbuf, read_len); - DFD_ERROR("rbuf: \n"); - dfd_utest_printf_reg((uint8_t*)rbuf, read_len); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } - - DFD_VERBOS("page %d upg check offset 0x%x len %d success.\n", i, offset, read_len); - offset += read_len; - if (read_len != len) { - DFD_VERBOS("page %d read_len %d len %d, last page exit.\n", i, read_len, len); - break; - } - } else if (read_len == 0) { - DFD_VERBOS("read_len %d exit.\n", read_len); - break; - } else { - DFD_ERROR("len %d read_len %d, read failed, errno(%s).\n", len, read_len, strerror(errno)); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } - } - -#if 0 - ret = dfd_fpga_upg_do_post(dst); - if (ret) { - DFD_ERROR("dfd_fpga_upg_do_post dst->sslot %d dst->unit %d failed ret %d.\n", dst->sslot, - dst->unit, ret); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } -#endif - - ret = 0; - DFD_VERBOS("Update success.\n"); -exit: - return ret; -} - -/* external FPGA upgrade interface */ -int dfd_fpga_upgrade_do_upgrade(char* upg_file) -{ - int ret; - int i; - int cnt; - unsigned long filesize; - int fd; - - DFD_VERBOS("Enter.\n"); - - if (upg_file == NULL) { - DFD_ERROR("Input para invalid upg_file %p.\n", upg_file); - return -DFD_RV_INDEX_INVALID; - } - - dfd_fpga_upg_init(); - - filesize = dfd_fpga_upg_get_file_size(upg_file); - if (filesize <= 0) { - DFD_ERROR("invalid filesize %lu.\n", filesize); - return -DFD_RV_DEV_FAIL; - } - - fd = open(upg_file, O_RDONLY); - if (fd < 0) { - DFD_ERROR("open file[%s] fail.\n", upg_file); - return -DFD_RV_DEV_FAIL; - } - - i = 0; - cnt = DFD_FPGA_UPGADE_RETRY_CNT; - while(i < cnt) { - ret = dfd_fpga_upgrade_do_upgrade_onetime(current_pci_priv, fd, filesize); - if (ret) { - i++; - DFD_ERROR("dfd_fpga_upgrade_do_upgrade_onetime upg_file %s failed ret %d.\n", upg_file, ret); - continue; - } else { - DFD_ERROR("dfd_fpga_upgrade_do_upgrade_onetime upg_file %s success.\n", upg_file); - close(fd); - return 0; - } - } - - DFD_ERROR("upg_file %s failed ret %d.\n", upg_file, ret); - close(fd); - return ret; -} - -static int dfd_fpga_upgrade_do_upgrade_onetime_all(dfd_pci_dev_priv_t *pci_priv, char* upg_file) -{ - int ret; - int i, len, fd, read_len; - char wbuf[DFD_FPGA_UPGRADE_BUFF_SIZE]; - char rbuf[DFD_FPGA_UPGRADE_BUFF_SIZE]; - int offset; - - DFD_VERBOS("Update upg_file: %s.\n", upg_file); - - if ((current_pci_priv == NULL) || (upg_file == NULL)) { - DFD_ERROR("Input para invalid pci_priv %p upg_file %p.\n", pci_priv, upg_file); - return -DFD_RV_INDEX_INVALID; - } - - fd = open(upg_file, O_RDONLY); - if (fd < 0) { - DFD_ERROR("open file[%s] fail.\n", upg_file); - return -DFD_RV_DEV_FAIL; - } - - /* Before upgrading, first initialize the configuration and erase the entire SPI chip */ - ret = dfd_fpga_upg_hw_init(pci_priv); - if (ret) { - DFD_ERROR("fpga hw init failed ret %d.\n", ret); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } - - i = 0; - offset = 0; - while(1) { - len = DFD_FPGA_UPGRADE_BUFF_SIZE; - mem_clear(wbuf, DFD_FPGA_UPGRADE_BUFF_SIZE); - read_len = read(fd, wbuf, len); - i++; - if ((read_len > 0) && (read_len <= len)) { - /* write data first */ - ret = dfd_fpga_upg_write(pci_priv, offset, wbuf, read_len); - if (ret) { - DFD_ERROR("fpga upg write offset 0x%x len %d failed ret %d.\n", offset, read_len, ret); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } else { - DFD_VERBOS("page %d upg write offset 0x%x len %d success.\n", i, offset, read_len); - } - - /* go back to read data */ - mem_clear(rbuf, DFD_FPGA_UPGRADE_BUFF_SIZE); - ret = dfd_fpga_upg_read(pci_priv, offset, rbuf, read_len); - if (ret) { - DFD_ERROR("fpga upg read offset 0x%x len %d failed ret %d.\n", offset, read_len, ret); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } else { - DFD_VERBOS("page %d upg read offset 0x%x len %d success.\n", i, offset, read_len); - } - - if (memcmp(rbuf, wbuf, read_len)) { - DFD_ERROR("rbuf wbuf not equal, read_len %d, check failed.\n", read_len); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } - - DFD_VERBOS("page %d upg check offset 0x%x len %d success.\n", i, offset, read_len); - offset += read_len; - if (read_len != len) { - DFD_VERBOS("page %d read_len %d len %d, last page exit.\n", i, read_len, len); - break; - } - } else if (read_len == 0) { - DFD_VERBOS("read_len %d exit.\n", read_len); - break; - } else { - DFD_ERROR("len %d read_len %d, read failed.\n", len, read_len); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } - } - - ret = 0; - DFD_VERBOS("Update upg_file: %s success.\n", upg_file); -exit: - close(fd); - return ret; -} - -int dfd_fpga_upgrade_do_upgrade_all(char* upg_file) -{ - int ret; - int i; - int cnt; - - DFD_VERBOS("Enter.\n"); - - if (upg_file == NULL) { - DFD_ERROR("Input para invalid upg_file %p.\n", upg_file); - return -DFD_RV_INDEX_INVALID; - } - - dfd_fpga_upg_init(); - - i = 0; - cnt = DFD_FPGA_UPGADE_RETRY_CNT; - while(i < cnt) { - ret = dfd_fpga_upgrade_do_upgrade_onetime_all(current_pci_priv, upg_file); - if (ret) { - i++; - DFD_ERROR("dfd_fpga_upgrade_do_upgrade_onetime upg_file %s failed ret %d.\n", upg_file, ret); - continue; - } else { - DFD_ERROR("dfd_fpga_upgrade_do_upgrade_onetime upg_file %s success.\n", upg_file); - return 0; - } - } - - DFD_ERROR("upg_file %s failed ret %d.\n", upg_file, ret); - return ret; -} - -/* External fpga dump interface */ -int dfd_fpga_upgrade_dump_flash(int argc, char* argv[]) -{ - int offset, addr, len, dlen; - int size, cnt, i; - char *stopstring; - int ret, fd; - char filename[DFD_FPGA_UPGRADE_BUFF_SIZE]; - char tmp[DFD_FPGA_UPGRADE_BUFF_SIZE]; - char is_print; - char buf[DFD_FPGA_UPGRADE_BUFF_SIZE]; - dfd_pci_dev_priv_t *pci_priv; - - ret = DFD_RV_OK; - if (argc != 6) { - printf("fpga dump flash Input invalid.\n"); - return -DFD_RV_INDEX_INVALID; - } - - dfd_fpga_upg_init(); - - if (current_pci_priv == NULL) { - printf("fpga dump flash Input para invalid pci_priv %p.\n", current_pci_priv); - return -DFD_RV_INIT_ERR; - } - - offset = strtol(argv[3], &stopstring, 16); - size = strtol(argv[4], &stopstring, 16); - - if (strcmp(argv[5], "print") != 0) { - is_print = 0; - mem_clear(filename, DFD_FPGA_UPGRADE_BUFF_SIZE); - strncpy(filename, argv[5], (DFD_FPGA_UPGRADE_BUFF_SIZE - 1)); - fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, S_IRWXG|S_IRWXU|S_IRWXO); - if (fd < 0) { - snprintf(tmp, sizeof(tmp), "%s", filename); - printf("open file %s fail(err:%d)!\r\n", tmp, errno); - ret = -DFD_RV_DEV_FAIL; - goto exit; - } - } else { - is_print = 1; - } - - pci_priv = current_pci_priv; - cnt = size / DFD_FPGA_UPGRADE_BUFF_SIZE; - if (size % DFD_FPGA_UPGRADE_BUFF_SIZE) { - cnt++; - } - len = DFD_FPGA_UPGRADE_BUFF_SIZE; - printf("cnt %d.\n", cnt); - for (i = 0; i < cnt; i++) { - mem_clear(buf, len); - addr = offset + i * DFD_FPGA_UPGRADE_BUFF_SIZE; - if (i == (cnt - 1)) { - dlen = size - len * i; - if (dlen > len) { - printf("dlen %d len %d error.\n", dlen, len); - } - } else { - dlen = len; - } - ret = dfd_fpga_upg_read(pci_priv, addr, buf, dlen); - if (ret < 0) { - printf("addr 0x%x failed ret %d\n", addr, ret); - goto exit_close; - } - if (is_print) { - dfd_utest_printf_reg((uint8_t*)buf, dlen); - } else { - ret = write(fd, buf, dlen); - if (ret < 0) { - printf("write failed (errno: %d).\n", errno); - ret = -DFD_RV_DEV_FAIL; - goto exit_close; - } - } - } - -exit_close: - if (!is_print) { - close(fd); - } -exit: - return ret; -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/firmware_app_ispvme.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/firmware_app_ispvme.c deleted file mode 100644 index 13446ddebb..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/firmware_app_ispvme.c +++ /dev/null @@ -1,906 +0,0 @@ -/** - * Copyright(C) 2013 Ragile Network. All rights reserved. - */ -/* - * firmware_app.c - - * firmware upgrade - * v1.0 support 2013-10-25 Initial version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if 0 -#include -#include -#endif -#include -static firmware_card_info_t g_card_info[] = { - { - .dev_type = RA_B6010_48GT4X, - .slot_num = 1, - .card_name = "RA_B6010_48GT4X", - .gpio_info = { - /* slot 0 */ - { - .tdi = 507, - .tck = 505, - .tms = 506, - .tdo = 508, - .jtag_en = 504, - .select = -1, - .jtag_5 = GPIO(-1, 0,1) - .jtag_4 = GPIO(-1, 0,1) - .jtag_3 = GPIO(-1, 1,1) - .jtag_2 = GPIO(-1, 0,1) - .jtag_1 = GPIO(-1, 1,1) - }, - }, - - }, - - { - .dev_type = RA_B6010_48GT4X_R, - .slot_num = 1, - .card_name = "RA_B6010_48GT4X_R", - .gpio_info = { - /* slot 0 */ - { - .tdi = 507, - .tck = 505, - .tms = 506, - .tdo = 508, - .jtag_en = 504, - .select = -1, - .jtag_5 = GPIO(-1, 0,1) - .jtag_4 = GPIO(-1, 0,1) - .jtag_3 = GPIO(-1, 1,1) - .jtag_2 = GPIO(-1, 0,1) - .jtag_1 = GPIO(-1, 1,1) - }, - }, - }, -}; - -static int is_debug_on; -static int dfd_my_type = 0; - -#if 0 -#if defined(CONFIG_FRM_PRODUCT_NAME) -#define CONFIG_RAGILE_PRODUCT_NAME CONFIG_FRM_PRODUCT_NAME -#else -#define CONFIG_RAGILE_PRODUCT_NAME "card" -#endif -#endif - -#define DFD_TYPE_FILE "/sys/module/ragile_common/parameters/dfd_my_type" -#define DFD_TYPE_BUFF_SIZE (256) - -static int is_vme_file(char *file_name) -{ - char *tmp; - - tmp = strchr(file_name, '.'); - if (strcmp(tmp, ".bin") == 0) { - return 0; - } else if (strcmp(tmp, ".vme") == 0) { - return 1; - } else { - return -1; - } -} - -int drv_get_my_dev_type(void) -{ - int type; - int fd; - char rbuf[DFD_TYPE_BUFF_SIZE]; - int read_len; - - if (dfd_my_type != 0) { - dbg_print(is_debug_on, "my_type = 0x%x\r\n", dfd_my_type); - return dfd_my_type; - } - - fd = open(DFD_TYPE_FILE, O_RDONLY); - if (fd < 0) { - dbg_print(is_debug_on, "can't open device %s.\r\n", DFD_TYPE_FILE); - return RA_B6010_48GT4X; /* Avoid B6510 to obtain different device types */ - } - - mem_clear(rbuf, DFD_TYPE_BUFF_SIZE); - type = 0; - read_len = read(fd, rbuf, DFD_TYPE_BUFF_SIZE - 1); - if (read_len > 0) { - type = strtoul(rbuf, NULL, 0); - } - close(fd); - - dfd_my_type = type; - - dbg_print(is_debug_on, "read dfd type file is %s read_len %d, dfd_my_type 0x%x\n", rbuf, read_len, dfd_my_type); - return dfd_my_type; -} - -firmware_card_info_t* firmware_get_card_info(int dev_type) -{ - int i; - int size; - - size = (sizeof(g_card_info) /sizeof((g_card_info)[0])); - - dbg_print(is_debug_on, "Enter dev_type 0x%x size %d.\n", dev_type, size); - for (i = 0; i < size; i++) { - if (g_card_info[i].dev_type == dev_type) { - dbg_print(is_debug_on, "match dev_type 0x%x.\n", dev_type); - return &g_card_info[i]; - } - } - - dbg_print(is_debug_on, "dismatch dev_type 0x%x.\n", dev_type); - return NULL; -} - -int firmware_get_card_name(char *name, int len) -{ - int dev_type; - firmware_card_info_t *info; - - dbg_print(is_debug_on, "Enter len %d.\n", len); - dev_type = drv_get_my_dev_type(); - if (dev_type < 0) { - dbg_print(is_debug_on, "drv_get_my_dev_type failed ret %d.\n", dev_type); - return FIRMWARE_FAILED; - } - - info = firmware_get_card_info(dev_type); - if (info == NULL) { - dbg_print(is_debug_on, "firmware_get_card_info dev_type %d failed.\n", dev_type ); - return FIRMWARE_FAILED; - } - - strncpy(name, info->card_name, len - 1); - dbg_print(is_debug_on, "Leave dev_type 0x%x name %s, info->name %s.\n", dev_type, - name, info->card_name); - return FIRMWARE_SUCCESS; -} - -int get_debug_value(void) -{ - return is_debug_on; -} - -#if 0 -/* each device implements its own corresponding interface */ -int __attribute__ ((weak)) firmware_get_card_name(char *name, int len) -{ - strncpy(name, CONFIG_RAGILE_PRODUCT_NAME, len - 1); - return FIRMWARE_SUCCESS; -} -#endif - -static int firmware_check_file_is_dir(char *dir, char *file_name) -{ - int ret; - struct stat buf; - char tmp[FIRMWARE_FILE_DIR_LEN]; - - if (strcmp(file_name, ".") == 0 || strcmp(file_name, "..") == 0) { - return -1; - } - - mem_clear(tmp, FIRMWARE_FILE_DIR_LEN); - snprintf(tmp, FIRMWARE_FILE_DIR_LEN - 1, "%s/%s", dir, file_name); - ret = stat(tmp, &buf); - if (ret < 0) { - return -1; - } - - if (S_ISDIR(buf.st_mode)) { - return 1; - } - - return 0; -} - -static inline int firmware_error_type(int action, name_info_t *info) -{ - if (info == NULL) { - return ERR_FW_UPGRADE; - } - if (info->type == FIRMWARE_CPLD) { - switch (action) { - case FIRMWARE_ACTION_CHECK: - return ERR_FW_CHECK_CPLD_UPGRADE; - case FIRMWARE_ACTION_UPGRADE: - return ERR_FW_DO_CPLD_UPGRADE; - default: - return ERR_FW_UPGRADE; - } - } else if (info->type == FIRMWARE_FPGA) { - switch (action) { - case FIRMWARE_ACTION_CHECK: - return ERR_FW_CHECK_FPGA_UPGRADE; - case FIRMWARE_ACTION_UPGRADE: - return ERR_FW_DO_FPGA_UPGRADE; - default: - return ERR_FW_UPGRADE; - } - } else { - return ERR_FW_UPGRADE; - } -} - -/* analyze file's name,Name rule: card name_firmware type_slot number_firmware chip name.bin*/ -static int firmware_parse_file_name(char *name, name_info_t *info) -{ - int i; - char *tmp, *start; - char slot[FIRMWARE_NAME_LEN]; - - dbg_print(is_debug_on, "Parse file name: %s\n", name); - - start = name; - /* card name */ - tmp = strchr(start, '_'); - if (tmp == NULL) { - dbg_print(is_debug_on, "Failed to get card name form file name: %s.\n", name); - return firmware_error_type(FIRMWARE_ACTION_CHECK, NULL); - } - - strncpy(info->card_name, start, - (tmp - start > FIRMWARE_NAME_LEN - 1) ? (FIRMWARE_NAME_LEN - 1) : (tmp - start)); - - /* firmware type */ - start = tmp + 1; - tmp = strchr(start, '_'); - if (tmp == NULL) { - dbg_print(is_debug_on, "Failed to get upgrade type form file name: %s.\n", name); - return firmware_error_type(FIRMWARE_ACTION_CHECK, NULL); - } - - if (strncmp(start, FIRMWARE_CPLD_NAME, tmp - start) == 0) { - info->type = FIRMWARE_CPLD; - } else if (strncmp(start, FIRMWARE_FPGA_NAME, tmp - start) == 0) { - info->type = FIRMWARE_FPGA; - } else { - info->type = FIRMWARE_OTHER; - } - - /* slot number */ - start = tmp + 1; - tmp = strchr(start, '_'); - if (tmp == NULL) { - dbg_print(is_debug_on, "Failed to get slot form file name: %s.\n", name); - return firmware_error_type(FIRMWARE_ACTION_CHECK, info); - } - - mem_clear(slot, FIRMWARE_NAME_LEN); - strncpy(slot, start, - ((tmp - start > FIRMWARE_NAME_LEN - 1) ? FIRMWARE_NAME_LEN - 1 : tmp - start)); - - for (i = 0; i < FIRMWARE_NAME_LEN && slot[i] != '\0'; i++) { - if (!isdigit(slot[i])) { - return firmware_error_type(FIRMWARE_ACTION_CHECK, info); - } - } - - dbg_print(is_debug_on, "get slot info: %s.\n", name); - info->slot = strtoul(slot, NULL, 10); - dbg_print(is_debug_on, "get slot info slot: %d.\n", info->slot); - - /* firmware chip name */ - start = tmp + 1; - tmp = strchr(start, '_'); - if (tmp == NULL) { - dbg_print(is_debug_on, "Failed to get chip name form file name: %s.\n", name); - return firmware_error_type(FIRMWARE_ACTION_CHECK, info); - } - strncpy(info->chip_name, start, - (tmp - start > FIRMWARE_NAME_LEN - 1) ? (FIRMWARE_NAME_LEN - 1) : (tmp - start)); - - /* version */ - start = tmp + 1; - tmp = strstr(start, ".vme"); - if (tmp == NULL) { - dbg_print(is_debug_on, "Failed to get chip version form file name: %s.\n", name); - return firmware_error_type(FIRMWARE_ACTION_CHECK, info); - } - strncpy(info->version, start, - (tmp - start > FIRMWARE_NAME_LEN - 1) ? (FIRMWARE_NAME_LEN - 1) : (tmp - start)); - - /* finish checking */ - if (strcmp(tmp, ".vme") != 0) { - dbg_print(is_debug_on, "The file format is wrong: %s.\n", name); - return firmware_error_type(FIRMWARE_ACTION_CHECK, info); - } - - return FIRMWARE_SUCCESS; -} - -/* check the file information to determine whether the file can be used in the device */ -static int firmware_check_file_info(name_info_t *info) -{ - int ret; - char card_name[FIRMWARE_NAME_LEN]; - - dbg_print(is_debug_on, "Check file info.\n"); - - /* get card name */ - mem_clear(card_name, FIRMWARE_NAME_LEN); - ret = firmware_get_card_name(card_name, FIRMWARE_NAME_LEN); - if (ret != FIRMWARE_SUCCESS) { - dbg_print(is_debug_on, "Failed to get card name.(%s)\n", info->card_name); - return firmware_error_type(FIRMWARE_ACTION_CHECK, info); - } - - /* check card name */ - dbg_print(is_debug_on, "The card name: %s, the file card name: %s.\n", - card_name, info->card_name); - if (strcmp(card_name, info->card_name) != 0) { - dbg_print(is_debug_on, "The file card name %s is wrong.(real: %s)\n", - info->card_name, card_name); - return firmware_error_type(FIRMWARE_ACTION_CHECK, info); - } - - /* check type */ - if (info->type != FIRMWARE_CPLD && info->type != FIRMWARE_FPGA) { - dbg_print(is_debug_on, "The file type %d is wrong.(cpld %d, fpga %d)\n", - info->type, FIRMWARE_CPLD, FIRMWARE_FPGA); - return firmware_error_type(FIRMWARE_ACTION_CHECK, info); - } - - /* check slot */ - if (info->slot < 1 || info->slot > FIRMWARE_MAX_SLOT_NUM) { - dbg_print(is_debug_on, "The file slot %d is wrong.\n", info->slot); - return firmware_error_type(FIRMWARE_ACTION_CHECK, info); - } - - dbg_print(is_debug_on, "Success check file info.\n"); - return FIRMWARE_SUCCESS; -} - -static void firmware_get_dev_file_name(name_info_t *info, char *file_name, int len) -{ - if (info->type == FIRMWARE_CPLD) { - snprintf(file_name, len, "/dev/firmware_cpld_ispvme%d", info->slot - 1); - } else if (info->type == FIRMWARE_FPGA) { - snprintf(file_name, len, "/dev/firmware_fpga_ispvme%d", info->slot - 1); - } else { - snprintf(file_name, len, "/dev/firmware_ispvme%d", info->slot - 1); - } -} - -static void firmware_set_driver_debug(int fd) -{ - int ret; - - if (is_debug_on == DEBUG_ALL_ON || is_debug_on == DEBUG_KERN_ON) { - ret = ioctl(fd, FIRMWARE_SET_DEBUG_ON, NULL); - if (ret < 0) { - dbg_print(is_debug_on, "Failed to set driver debug on.\n"); - } else { - dbg_print(is_debug_on, "Open driver debug.\n"); - } - } else if (is_debug_on == DEBUG_OFF) { - ret = ioctl(fd, FIRMWARE_SET_DEBUG_OFF, NULL); - if (ret < 0) { - dbg_print(is_debug_on, "Failed to set driver debug off.\n"); - } else { - dbg_print(is_debug_on, "OFF driver debug.\n"); - } - } else { - dbg_print(is_debug_on, "Ignore driver debug.\n"); - } -} - -static int firmware_check_chip_name(int fd, name_info_t *info) -{ - return FIRMWARE_SUCCESS; -} - -static int firmware_check_chip_verison(int fd, name_info_t *info) -{ - return FIRMWARE_SUCCESS; -} - -static int firmware_get_file_size(char *file_name, int *size) -{ - int ret; - struct stat buf; - - ret = stat(file_name, &buf); - if (ret < 0) { - return FIRMWARE_FAILED; - } - - if (buf.st_size < 0) { - return FIRMWARE_FAILED; - } - - *size = buf.st_size; - - return FIRMWARE_SUCCESS; -} - -static int firmware_get_file_info(char *file_name, char *buf, int size) -{ - FILE *fp; - int len; - - fp = fopen(file_name, "r"); - if (fp == NULL) { - return FIRMWARE_FAILED; - } - - len = fread(buf, size, 1, fp); - if (len < 0) { - fclose(fp); - return FIRMWARE_FAILED; - } - - fclose(fp); - - return FIRMWARE_SUCCESS; -} - -static int firmware_upgrade_info(int fd, char *buf, int size) -{ - return FIRMWARE_SUCCESS; -} - -/* upgrade CPLD */ -static int firmware_upgrade(char *dir, char *file_name, name_info_t *info) -{ - return FIRMWARE_SUCCESS; -} - -static int firmware_upgrade_file(char *dir, char *file_name) -{ - int ret, argc; - name_info_t info; - char *argv[2]; - char tmp_file[FIRMWARE_FILE_DIR_LEN]; - - mem_clear(&info, sizeof(name_info_t)); - ret = firmware_parse_file_name(file_name, &info); - if (ret != FIRMWARE_SUCCESS) { - dbg_print(is_debug_on, "Failed to parse file name: %s\n", file_name); - return ret; - } - - dbg_print(is_debug_on, "The file name parse:(%s) \n" - " card name: %s, \n" - " type : %d, \n" - " slot : %d, \n" - " chip name: %s \n" - " version : %s \n", - file_name, info.card_name, info.type, info.slot, info.chip_name, info.version); - - ret = firmware_check_file_info(&info); - if (ret != FIRMWARE_SUCCESS) { - dbg_print(is_debug_on, "Failed to check file name: %s\n", file_name); - return ret; - } - - /* get the information of upgrade file */ - mem_clear(tmp_file, FIRMWARE_FILE_DIR_LEN); - if (dir != NULL) { - snprintf(tmp_file, FIRMWARE_FILE_DIR_LEN - 1, "%s/%s", dir, file_name); - } else { - snprintf(tmp_file, FIRMWARE_FILE_DIR_LEN - 1, "%s", file_name); - } - - argc = 2; - argv[1] = tmp_file; - ret = ispvme_main(argc, (char **)&argv); - if (ret != FIRMWARE_SUCCESS){ - dbg_print(is_debug_on, "Failed to upgrade file name: %s\n", file_name); - } - - return ret; -} - -static int firmware_upgrade_set_gpio_info(int slot) -{ - firmware_card_info_t *hw_info; - cmd_info_t cmd_info; - firmware_upg_gpio_info_t *gpio_info; - int ret; - int fd; - int dev_type; - int my_slot; - - ret = 0; - - dev_type = drv_get_my_dev_type(); - fd = open("/dev/firmware_cpld_ispvme0", O_RDWR); - if (fd < 0) { - dbg_print(is_debug_on, "%s can't open device\r\n", __func__); - return -1; - } - - hw_info = firmware_get_card_info(dev_type); - - if (hw_info == NULL) { - dbg_print(is_debug_on, "card type 0x%x don't support firmware.\n", dev_type); - ret = -1; - goto gpio_info_err; - } - - if (slot >= hw_info->slot_num) { - dbg_print(is_debug_on, "slot %d is too large, support slot num %d.\n", slot, hw_info->slot_num); - ret = -1; - goto gpio_info_err; - } - - gpio_info = &(hw_info->gpio_info[slot]); - cmd_info.size = sizeof(firmware_upg_gpio_info_t); - cmd_info.data = (void *)gpio_info; - - dbg_print(is_debug_on, "slot = %d, gpio_info[jtag_en:%d select:%d tck:%d tdi:%d tdo=%d tms=%d]\n",slot, \ - gpio_info->jtag_en, gpio_info->select,gpio_info->tck,gpio_info->tdi,gpio_info->tdo,gpio_info->tms); - - ret = ioctl(fd, FIRMWARE_SET_GPIO_INFO, &cmd_info); - -gpio_info_err: - if (ret < 0) { - dbg_print(is_debug_on, "Failed due to:set gpio info.\n"); - } - - close(fd); - - return ret; -} - -/** - * argv[1]: file name - * argv[2]: type - * argv[3]: slot number - * argv[4]: chip name - */ -static int firmware_upgrade_one_file(int argc, char *argv[]) -{ - int ret; - name_info_t info; - char tmp[FIRMWARE_FILE_DIR_LEN]; - - mem_clear(&info, sizeof(name_info_t)); - - info.slot = strtoul(argv[3], NULL, 10); - strncpy(info.chip_name, argv[4], FIRMWARE_NAME_LEN - 1); - - if (strcmp(argv[2], FIRMWARE_CPLD_NAME) == 0) { /* CPLD upgrade */ - if(is_vme_file(argv[1]) == 1){ /* VME upgrade file */ - dbg_print(is_debug_on, "vme file\n"); - info.type = FIRMWARE_CPLD; - ret = firmware_upgrade_set_gpio_info(info.slot); - if (ret < 0) { - goto upgrade_err; - } - ret = ispvme_main(2, argv); - } - else if(is_vme_file(argv[1]) == 0){ /* bin upgrade file */ - dbg_print(is_debug_on, "bin file\n"); - mem_clear(tmp, FIRMWARE_FILE_DIR_LEN); - snprintf(tmp, FIRMWARE_FILE_DIR_LEN, "firmware_upgrade_bin %s %s %s %s", argv[1], argv[2], argv[3], argv[4]); - ret = system(tmp); - } - else{ - dbg_print(is_debug_on, "unknow file\n"); - return FIRMWARE_FAILED; - } - } - else if (strcmp(argv[2], FIRMWARE_FPGA_NAME) == 0) { /* FPGA upgrade */ - info.type = FIRMWARE_FPGA; - ret = dfd_fpga_upgrade_do_upgrade(argv[1]); - } else { - dbg_print(is_debug_on, "Failed to get upgrade type: %s.\n", argv[2]); - return ERR_FW_UPGRADE; - } - -upgrade_err: - if (ret != FIRMWARE_SUCCESS){ - dbg_print(is_debug_on, "Failed to upgrade: %s.\n", argv[1]); - } - - return ret; -} - -static void firmware_get_err_type(int err, int *real_err) -{ - int tmp_err; - - tmp_err = *real_err; - - if (tmp_err == err) { - return; - } - switch (err) { - case ERR_FW_DO_CPLD_UPGRADE: - case ERR_FW_DO_FPGA_UPGRADE: - if (tmp_err == ERR_FW_CHECK_CPLD_UPGRADE - || tmp_err == ERR_FW_CHECK_FPGA_UPGRADE - || tmp_err == FIRMWARE_SUCCESS || tmp_err == ERR_FW_UPGRADE) { - tmp_err = err; - } - break; - case ERR_FW_CHECK_CPLD_UPGRADE: - case ERR_FW_CHECK_FPGA_UPGRADE: - if (tmp_err == FIRMWARE_SUCCESS || tmp_err == ERR_FW_UPGRADE) { - tmp_err = err; - } - break; - case ERR_FW_UPGRADE: - if (tmp_err == FIRMWARE_SUCCESS) { - tmp_err = err; - } - break; - case FIRMWARE_SUCCESS: - break; - default: - return; - } - - *real_err = tmp_err; - - return; -} - -/* argv[1]: Pathname */ -static int firmware_upgrade_one_dir(int argc, char *argv[]) -{ - int ret, real_ret; - int flag; - DIR *dirp; - struct dirent *dp; - char *dir; - - dir = argv[1]; - dirp = opendir(dir); - if (dirp == NULL) { - dbg_print(is_debug_on, "Failed to open the dir: %s.\n", dir); - return ERR_FW_UPGRADE; - } - - ret = ERR_FW_UPGRADE; - real_ret = FIRMWARE_SUCCESS; - flag = 0; - for (;;) { - /* read the pathname of the file */ - dp = readdir(dirp); - if (dp == NULL) { - break; - } - - dbg_print(is_debug_on, "The file name: %s.\n", dp->d_name); - /* check whether it is a file */ - if (firmware_check_file_is_dir(dir, dp->d_name) != 0) { - continue; - } - - dbg_print(is_debug_on, "\n=========== Start: %s ===========\n", dp->d_name); - - /* upgrade a upgrade file */ - ret = firmware_upgrade_file(dir, dp->d_name); - if (ret != FIRMWARE_SUCCESS) { - firmware_get_err_type(ret, &real_ret); - dbg_print(is_debug_on, "Failed to upgrade the file: %s.(%d, %d)\n", dp->d_name, ret, real_ret); - } else { - flag = 1; - dbg_print(is_debug_on, "Upgrade the file: %s success.\n", dp->d_name); - } - - dbg_print(is_debug_on, "=========== End: %s ===========\n", dp->d_name); - } - - if (flag == 1 && (real_ret == ERR_FW_CHECK_CPLD_UPGRADE || real_ret == ERR_FW_CHECK_FPGA_UPGRADE)) { - real_ret = FIRMWARE_SUCCESS; - } - - if (real_ret != FIRMWARE_SUCCESS) { - dbg_print(is_debug_on, "Failed to upgrade: %s.\n", dir); - } else { - dbg_print(is_debug_on, "Upgrade success: %s.\n", dir); - } - - closedir(dirp); - return real_ret; -} - -/** - * argv[1]: file name - * argv[2]: type - * argv[3]: slot number - */ -static int firmware_upgrade_read_chip(int argc, char *argv[]) -{ - - return FIRMWARE_SUCCESS; -} - -static int firmware_upgrade_test_fpga(int argc, char *argv[]) -{ - int ret; - char tmp1[128]; - char tmp2[128]; - - if ((strcmp(argv[1], FIRMWARE_FPGA_NAME) != 0) - || (strcmp(argv[2], FIRMWARE_FPGA_TEST) != 0)) { - snprintf(tmp1, sizeof(tmp1), "%s", argv[1]); - snprintf(tmp2, sizeof(tmp2), "%s", argv[2]); - printf( "fpga test:Failed to Input ERR Parm, argv[1]:%s, agrv[2]:%s\n", tmp1,tmp2); - return FIRMWARE_FAILED; - } - ret = dfd_fpga_upgrade_test(); - return ret; -} - -static int firmware_upgrade_test_chip(int argc, char *argv[]) -{ - int ret,dev_type,slot; - int err_ret=0; - firmware_card_info_t *hw_info; - char tmp1[128]; - char tmp2[128]; - - if ((strcmp(argv[1], FIRMWARE_CPLD_NAME) != 0) - || (strcmp(argv[2], FIRMWARE_CPLD_TEST) != 0)) { - snprintf(tmp1, sizeof(tmp1), "%s", argv[1]); - snprintf(tmp2, sizeof(tmp2), "%s", argv[2]); - printf( "gpio test:Failed to Input ERR Parm, argv[1]:%s, agrv[2]:%s\n", tmp1, tmp2); - return FIRMWARE_FAILED; - } - - dev_type = drv_get_my_dev_type(); /* get the type of card first */ - if (dev_type < 0) { - printf("gpio test:drv_get_my_dev_type failed ret 0x%x.\n", dev_type); - return FIRMWARE_FAILED; - } - - hw_info = firmware_get_card_info(dev_type); /* get the detail information of card */ - if (hw_info == NULL) { - printf( "gpio test:card type 0x%x don't support firmware.\n", dev_type); - return FIRMWARE_FAILED; - } - - for(slot = 0; slot < hw_info->slot_num; slot++){ - ret = firmware_upgrade_set_gpio_info(slot); /* set GPIO information */ - if(ret < 0){ - err_ret++; - printf( "gpio test:Failed to set gpio info,dev_type 0x%x,slot %d\n", dev_type, slot); - continue; - } - ret = ispvme_test(); /* GPIO path test */ - if(ret != 0){ - err_ret++; - printf("gpio test:ispvme_test failed,dev_type 0x%x,slot %d\n", dev_type, slot); - } - } - if(err_ret != 0) - return FIRMWARE_FAILED; - return FIRMWARE_SUCCESS; -} - -int main(int argc, char *argv[]) -{ - int ret; - - is_debug_on = firmware_upgrade_debug(); - - if (argc != 2 && argc != 5 && argc != 4 && argc != 3 && argc != 6) { - printf("Use:\n"); - printf(" upgrade dir : firmware_upgrade_ispvme dir\n"); - printf(" upgrade file : firmware_upgrade_ispvme file type slot chip_name\n"); - printf(" read chip : firmware_upgrade_ispvme file type slot\n"); - dbg_print(is_debug_on, "Failed to upgrade the number of argv: %d.\n", argc); - return ERR_FW_UPGRADE; - } -#if 0 - ret = dev_drv_init(); - if (ret) { - dbg_print(is_debug_on, "failed to init dfd ret %d.", ret); - return ERR_FW_UPGRADE; - } -#endif - /* dump fpga flash operation */ - if (argc == 6) { - if (strcmp(argv[1], "fpga_dump_flash") == 0) { - ret = dfd_fpga_upgrade_dump_flash(argc, argv); - printf("fpga_dump_flash ret %d.\n", ret); - return FIRMWARE_SUCCESS; - } else { - printf("Not support, please check your cmd.\n"); - return FIRMWARE_SUCCESS; - } - } - - /* upgrade individual files */ - if (argc == 5) { - printf("+================================+\n"); - printf("|Begin to upgrade, please wait...|\n"); - ret = firmware_upgrade_one_file(argc, argv); - if (ret != FIRMWARE_SUCCESS) { - if(strcmp(argv[2], FIRMWARE_CPLD_NAME) == 0) - printf("| CPLD Upgrade failed! |\n"); - else if(strcmp(argv[2], FIRMWARE_FPGA_NAME) == 0) - printf("| FPGA Upgrade failed! |\n"); - else - printf("| Failed to get upgrade type! |\n"); - printf("+================================+\n"); - dbg_print(is_debug_on, "Failed to upgrade a firmware file: %s.\n", argv[1]); - return ret; - } - if(strcmp(argv[2], FIRMWARE_CPLD_NAME) == 0) - printf("| CPLD Upgrade succeeded! |\n"); - else - printf("| FPGA Upgrade succeeded! |\n"); - printf("+================================+\n"); - return FIRMWARE_SUCCESS; - } - - if (argc == 2) { - printf("+================================+\n"); - printf("|Begin to upgrade, please wait...|\n"); - - ret = firmware_upgrade_one_dir(argc, argv); - if (ret != FIRMWARE_SUCCESS) { - printf("| Upgrade failed! |\n"); - printf("+================================+\n"); - dbg_print(is_debug_on, "Failed to upgrade a firmware dir: %s.\n", argv[1]); - return ret; - } - printf("| Upgrade succeeded! |\n"); - printf("+================================+\n"); - return FIRMWARE_SUCCESS; - } - - if (argc == 4) { - ret = firmware_upgrade_read_chip(argc, argv); - if (ret != FIRMWARE_SUCCESS) { - dbg_print(is_debug_on, "Failed to read chip: %s.\n", argv[1]); - return ret; - } - - return FIRMWARE_SUCCESS; - } - - if (argc == 3) { - if (strcmp(argv[1], FIRMWARE_FPGA_NAME) == 0) { - ret = firmware_upgrade_test_fpga(argc, argv); - if (ret != FIRMWARE_SUCCESS) { - printf("+=================+\n"); - printf("| FPGA TEST FAIL! |\n"); - printf("+=================+\n"); - return FIRMWARE_FAILED; - } else { - printf("+=================+\n"); - printf("| FPGA TEST PASS! |\n"); - printf("+=================+\n"); - return FIRMWARE_SUCCESS; - } - } else { - ret = firmware_upgrade_test_chip(argc, argv); - if (ret != FIRMWARE_SUCCESS) { - printf("+=================+\n"); - printf("| GPIO TEST FAIL! |\n"); - printf("+=================+\n"); - return FIRMWARE_FAILED; - } else { - printf("+=================+\n"); - printf("| GPIO TEST PASS! |\n"); - printf("+=================+\n"); - return FIRMWARE_SUCCESS; - } - } - } - - return ERR_FW_UPGRADE; -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/hardware.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/hardware.c deleted file mode 100644 index 8f8ca9ed8c..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/hardware.c +++ /dev/null @@ -1,249 +0,0 @@ -/********************************************************************************* -* Lattice Semiconductor Corp. Copyright 2000-2008 -* -* This is the hardware.c of ispVME V12.1 for JTAG programmable devices. -* All the functions requiring customization are organized into this file for -* the convinience of porting. -*********************************************************************************/ -/********************************************************************************* -* Revision History: -* -* 09/11/07 NN Type cast mismatch variables -* 09/24/07 NN Added calibration function. -* Calibration will help to determine the system clock frequency -* and the count value for one micro-second delay of the target -* specific hardware. -* Modified the ispVMDelay function -* Removed Delay Percent support -* Moved the sclock() function from ivm_core.c to hardware.c -*********************************************************************************/ - -/* #include */ -#include -#include -#include "common.h" - -/******************************************************************************** -* Declaration of global variables -* -*********************************************************************************/ - -unsigned char g_siIspPins = 0x00; /*Keeper of JTAG pin state*/ -unsigned short g_usInPort = 0x379; /*Address of the TDO pin*/ -unsigned short g_usOutPort = 0x378; /*Address of TDI, TMS, TCK pin*/ -unsigned short g_usCpu_Frequency = 1000; /*Enter your CPU frequency here, unit in MHz.*/ - -/********************************************************************************* -* This is the definition of the bit locations of each respective -* signal in the global variable g_siIspPins. -* -* NOTE: Users must add their own implementation here to define -* the bit location of the signal to target their hardware. -* The example below is for the Lattice download cable on -* on the parallel port. -* -*********************************************************************************/ - -#if 0 -const unsigned char g_ucPinTDI = JTAG_TDI; /* Bit address of TDI */ -const unsigned char g_ucPinTCK = JTAG_TCK; /* Bit address of TCK */ -const unsigned char g_ucPinTMS = JTAG_TMS; /* Bit address of TMS */ -const unsigned char g_ucPinENABLE = JTAG_ENABLE; /* Bit address of ENABLE */ -const unsigned char g_ucPinTRST = JTAG_TRST; /* Bit address of TRST */ -const unsigned char g_ucPinTDO = JTAG_TDO; /* Bit address of TDO*/ -#endif -int g_file_fd; -/*************************************************************** -* -* Functions declared in hardware.c module. -* -***************************************************************/ -void writePort(unsigned char a_ucPins, unsigned char a_ucValue); -unsigned char readPort(); -void sclock(); -void ispVMDelay(unsigned short a_usTimeDelay); -void calibration(void); - -/******************************************************************************** -* writePort -* To apply the specified value to the pins indicated. This routine will -* be modified for specific systems. -* As an example, this code uses the IBM-PC standard Parallel port, along with the -* schematic shown in Lattice documentation, to apply the signals to the -* JTAG pins. -* -* PC Parallel port pin Signal name Port bit address -* 2 g_ucPinTDI 1 -* 3 g_ucPinTCK 2 -* 4 g_ucPinTMS 4 -* 5 g_ucPinENABLE 8 -* 6 g_ucPinTRST 16 -* 10 g_ucPinTDO 64 -* -* Parameters: -* - a_ucPins, which is actually a set of bit flags (defined above) -* that correspond to the bits of the data port. Each of the I/O port -* bits that drives an isp programming pin is assigned a flag -* (through a #define) corresponding to the signal it drives. To -* change the value of more than one pin at once, the flags are added -* together, much like file access flags are. -* -* The bit flags are only set if the pin is to be changed. Bits that -* do not have their flags set do not have their levels changed. The -* state of the port is always manintained in the static global -* variable g_siIspPins, so that each pin can be addressed individually -* without disturbing the others. -* -* - a_ucValue, which is either HIGH (0x01 ) or LOW (0x00 ). Only these two -* values are valid. Any non-zero number sets the pin(s) high. -* -*********************************************************************************/ - -void writePort(unsigned char a_ucPins, unsigned char a_ucValue) -{ - switch (a_ucPins) { - case JTAG_TCK: - ioctl(g_file_fd, FIRMWARE_JTAG_TCK, &a_ucValue); - break; - case JTAG_TDI: - ioctl(g_file_fd, FIRMWARE_JTAG_TDI, &a_ucValue); - break; - case JTAG_TMS: - ioctl(g_file_fd, FIRMWARE_JTAG_TMS, &a_ucValue); - break; - case JTAG_ENABLE: - ioctl(g_file_fd, FIRMWARE_JTAG_EN, &a_ucValue); - break; - case JTAG_TRST: - /* ioctl(g_file_fd, FIRMWARE_JTAG_TRST, &a_ucValue); */ - break; - default: - break; - } -} - -/********************************************************************************* -* -* readPort -* -* Returns the value of the TDO from the device. -* -**********************************************************************************/ -unsigned char readPort() -{ - unsigned char ucRet = 0; - - ioctl(g_file_fd, FIRMWARE_JTAG_TDO, &ucRet); - return (ucRet); -} - -/********************************************************************************* -* sclock -* -* Apply a pulse to TCK. -* -* This function is located here so that users can modify to slow down TCK if -* it is too fast (> 25MHZ). Users can change the IdleTime assignment from 0 to -* 1, 2... to effectively slowing down TCK by half, quarter... -* -*********************************************************************************/ -void sclock() -{ - unsigned short IdleTime = 0; /* change to > 0 if need to slow down TCK */ - unsigned short usIdleIndex = 0; - IdleTime++; - for (usIdleIndex = 0; usIdleIndex < IdleTime; usIdleIndex++) { - writePort(JTAG_TCK, 0x01); - } - for (usIdleIndex = 0; usIdleIndex < IdleTime; usIdleIndex++) { - writePort(JTAG_TCK, 0x00); - } -} -/******************************************************************************** -* -* ispVMDelay -* -* -* Users must implement a delay to observe a_usTimeDelay, where -* bit 15 of the a_usTimeDelay defines the unit. -* 1 = milliseconds -* 0 = microseconds -* Example: -* a_usTimeDelay = 0x0001 = 1 microsecond delay. -* a_usTimeDelay = 0x8001 = 1 millisecond delay. -* -* This subroutine is called upon to provide a delay from 1 millisecond to a few -* hundreds milliseconds each time. -* It is understood that due to a_usTimeDelay is defined as unsigned short, a 16 bits -* integer, this function is restricted to produce a delay to 64000 micro-seconds -* or 32000 milli-second maximum. The VME file will never pass on to this function -* a delay time > those maximum number. If it needs more than those maximum, the VME -* file will launch the delay function several times to realize a larger delay time -* cummulatively. -* It is perfectly alright to provide a longer delay than required. It is not -* acceptable if the delay is shorter. -* -* Delay function example--using the machine clock signal of the native CPU------ -* When porting ispVME to a native CPU environment, the speed of CPU or -* the system clock that drives the CPU is usually known. -* The speed or the time it takes for the native CPU to execute one for loop -* then can be calculated as follows: -* The for loop usually is compiled into the ASSEMBLY code as shown below: -* LOOP: DEC RA; -* JNZ LOOP; -* If each line of assembly code needs 4 machine cycles to execute, -* the total number of machine cycles to execute the loop is 2 x 4 = 8. -* Usually system clock = machine clock (the internal CPU clock). -* Note: Some CPU has a clock multiplier to double the system clock for - the machine clock. -* -* Let the machine clock frequency of the CPU be F, or 1 machine cycle = 1/F. -* The time it takes to execute one for loop = (1/F ) x 8. -* Or one micro-second = F(MHz)/8; -* -* Example: The CPU internal clock is set to 100Mhz, then one micro-second = 100/8 = 12 -* -* The C code shown below can be used to create the milli-second accuracy. -* Users only need to enter the speed of the cpu. -* -**********************************************************************************/ -void ispVMDelay(unsigned short a_usTimeDelay) -{ - if (a_usTimeDelay & 0x8000) { - a_usTimeDelay &= ~0x8000; /* change it to ms */ - usleep(a_usTimeDelay * 1000); /* Use usleep to improve accuracy */ - } else - usleep(a_usTimeDelay); - return; -} - -/********************************************************************************* -* -* calibration -* -* It is important to confirm if the delay function is indeed providing -* the accuracy required. Also one other important parameter needed -* checking is the clock frequency. -* Calibration will help to determine the system clock frequency -* and the loop_per_micro value for one micro-second delay of the target -* specific hardware. -* -**********************************************************************************/ -void calibration(void) -{ - /*Apply 2 pulses to TCK.*/ - writePort(JTAG_TCK, 0x00); - writePort(JTAG_TCK, 0x01); - writePort(JTAG_TCK, 0x00); - writePort(JTAG_TCK, 0x01); - writePort(JTAG_TCK, 0x00); - - /*Delay for 1 millisecond. Pass on 1000 or 0x8001 both = 1ms delay.*/ - ispVMDelay(0x8001); - - /*Apply 2 pulses to TCK*/ - writePort(JTAG_TCK, 0x01); - writePort(JTAG_TCK, 0x00); - writePort(JTAG_TCK, 0x01); - writePort(JTAG_TCK, 0x00); -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/include/debug_ispvme.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/include/debug_ispvme.h deleted file mode 100644 index 17c6b02261..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/include/debug_ispvme.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __FIRMWARE_UPGRADE_DEBUG_H__ -#define __FIRMWARE_UPGRADE_DEBUG_H__ - -#define DEBUG_INFO_LEN 20 -#define DEBUG_FILE "/.firmware_upgrade_debug" -#define DEBUG_ON_ALL "3" -#define DEBUG_ON_KERN "2" -#define DEBUG_ON_INFO "1" -#define DEBUG_OFF_INFO "0" - -enum debug_s { - DEBUG_OFF = 0, /* debug off */ - DEBUG_APP_ON, /* debug app on */ - DEBUG_KERN_ON, /* kernel debug on */ - DEBUG_ALL_ON, /* debug app and kernel debug on */ - DEBUG_IGNORE, /* ignore debug */ -}; - -extern int firmware_upgrade_debug(void); - -#endif /* End of __FIRMWARE_UPGRADE_DEBUG_H__ */ \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/include/firmware_app_ispvme.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/include/firmware_app_ispvme.h deleted file mode 100644 index e44214dfca..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/include/firmware_app_ispvme.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef __FIRMWARE_APP_H__ -#define __FIRMWARE_APP_H__ - -#include -#include -#include - -/* Agreement with PKG_MGMT module */ -#define ERR_FW_CHECK_CPLD_UPGRADE (440 - 256) -#define ERR_FW_CHECK_FPGA_UPGRADE (441 - 256) -#define ERR_FW_DO_CPLD_UPGRADE (442 - 256) -#define ERR_FW_DO_FPGA_UPGRADE (443 - 256) -#define ERR_FW_UPGRADE (444 - 256) - -#define FIRMWARE_FAILED -1 -#define FIRMWARE_SUCCESS 0 - -#define FIRMWARE_ACTION_CHECK 0 -#define FIRMWARE_ACTION_UPGRADE 1 - -#define mem_clear(data, size) memset((data), 0, (size)) - -#define dbg_print(debug, fmt, arg...) \ - if (debug == DEBUG_APP_ON || debug == DEBUG_ALL_ON) \ - { do{printf(fmt,##arg);} while(0); } - -#define FIRMWARE_FILE_DIR_LEN 128 -#define FIRMWARE_NAME_LEN 48 -#define FIRMWARE_MAX_SLOT_NUM 32 - -#define FIRMWARE_CPLD_NAME "cpld" -#define FIRMWARE_FPGA_NAME "fpga" - -#define FIRMWARE_CPLD_EPM1270F256 "EPM1270F256" -#define FIRMWARE_CPLD_5M1270 "5M1270" -#define FIRMWARE_CPLD_TEST "test" -#define FIRMWARE_FPGA_TEST "test" - -/* ioctl command */ -#define FIRMWARE_TYPE 'F' - -#define FIRMWARE_JTAG_TDI _IOR(FIRMWARE_TYPE, 0, char) -#define FIRMWARE_JTAG_TDO _IOR(FIRMWARE_TYPE, 1, char) -#define FIRMWARE_JTAG_TCK _IOR(FIRMWARE_TYPE, 2, char) -#define FIRMWARE_JTAG_TMS _IOR(FIRMWARE_TYPE, 3, char) -#define FIRMWARE_JTAG_EN _IOR(FIRMWARE_TYPE, 4, char) -#define FIRMWARE_SET_DEBUG_ON _IOW(FIRMWARE_TYPE, 5, int) /* debug on */ -#define FIRMWARE_SET_DEBUG_OFF _IOW(FIRMWARE_TYPE, 6, int) /* debug off */ -#define FIRMWARE_SET_GPIO_INFO _IOR(FIRMWARE_TYPE, 7, int) /* GPIO info */ - -#define FIRMWARE_MAX_SUB_SLOT_NUM (8) -#define FIRMWARE_MAX_CARD_SLOT_NUM ((FIRMWARE_MAX_SUB_SLOT_NUM) + (1))/* max slot num */ -#define FIRMWARE_CARD_NAME_MAX_LEN (64) -#define GPIO(p, v, d) { \ - .pin = p, \ - .val = v, \ - .dir = d, \ - }, - -enum firmware_type_s { - FIRMWARE_CPLD = 0, - FIRMWARE_FPGA, - FIRMWARE_OTHER, -}; - -typedef struct name_info_s { - char card_name[FIRMWARE_NAME_LEN]; /* card name */ - int type; /* upgrade file type */ - int slot; /* slot number correspoding to upgrade file */ - char chip_name[FIRMWARE_NAME_LEN]; /* chip name */ - char version[FIRMWARE_NAME_LEN]; /* version */ -} name_info_t; - -typedef struct cmd_info_s { - int size; - void *data; -} cmd_info_t; - -typedef struct gpio_group_s { - int pin; - int val; - int dir; -} gpio_group_t; - -typedef struct firmware_upg_gpio_info_s { - int tdi; - int tck; - int tms; - int tdo; - int jtag_en; - int select; - gpio_group_t jtag_5; - gpio_group_t jtag_4; - gpio_group_t jtag_3; - gpio_group_t jtag_2; - gpio_group_t jtag_1; -} firmware_upg_gpio_info_t; - -typedef struct firmware_card_info_s { - int dev_type; /* the type of card */ - int slot_num; - char card_name[FIRMWARE_CARD_NAME_MAX_LEN]; - firmware_upg_gpio_info_t gpio_info[FIRMWARE_MAX_CARD_SLOT_NUM]; /* private data */ -} firmware_card_info_t; - -typedef enum card_type_e { - RA_B6010_48GT4X = 0X4065, - RA_B6010_48GT4X_R = 0X4065, -} card_type_t; - -extern firmware_card_info_t* firmware_get_card_info(int dev_type); -extern int dfd_fpga_upgrade_do_upgrade(char* upg_file); -extern int dfd_fpga_upgrade_test(void); -extern int ispvme_test(void); -extern int ispvme_main(int argc, char *argv[]); -/* External fpga dump interface */ -extern int dfd_fpga_upgrade_dump_flash(int argc, char* argv[]); - -#endif /* End of __FIRMWARE_APP_H__ */ \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/ispvm_ui.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/ispvm_ui.c deleted file mode 100644 index a06f9de9a8..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/ispvm_ui.c +++ /dev/null @@ -1,845 +0,0 @@ -/************************************************************** -* -* Lattice Semiconductor Corp. Copyright 2008 -* -* ispVME Embedded allows programming of Lattice's suite of FPGA -* devices on embedded systems through the JTAG port. The software -* is distributed in source code form and is open to re - distribution -* and modification where applicable. -* -* ispVME Embedded C Source comprised with 3 modules: -* ispvm_ui.c is the module provides input and output support. -* ivm_core.c is the module interpret the VME file(s). -* hardware.c is the module access the JTAG port of the device(s). -* -* The optional module cable.c is for supporting Lattice's parallel -* port ispDOWNLOAD cable on DOS and Windows 95/98 O/S. It can be -* requested from Lattice's ispVMSupport. -* -***************************************************************/ - -/************************************************************** -* -* Revision History of ispvm_ui.c -* -* 3/6/07 ht Added functions vme_out_char(),vme_out_hex(), -* vme_out_string() to provide output resources. -* Consolidate all printf() calls into the added output -* functions. -* -* 09/11/07 NN Added Global variables initialization -* 09/24/07 NN Added a switch allowing users to do calibration. -* Calibration will help to determine the system clock frequency -* and the count value for one micro-second delay of the target -* specific hardware. -* Removed Delay Percent support -* 11/15/07 NN moved the checking of the File CRC to the end of processing -* 08/28/08 NN Added Calculate checksum support. -***************************************************************/ - -#include -#include -#include -#include -#include -#include "vmopcode.h" -#include "common.h" - -#define dbg_print(debug, fmt, arg...) \ - if (debug == DEBUG_APP_ON || debug == DEBUG_ALL_ON) \ - { do{printf(fmt,##arg);} while(0); } - -/*************************************************************** -* -* File pointer to the VME file. -* -***************************************************************/ - -FILE *g_pVMEFile = NULL; - -/*************************************************************** -* -* Functions declared in this ispvm_ui.c module -* -***************************************************************/ -unsigned char GetByte(void); -void vme_out_char(unsigned char charOut); -void vme_out_hex(unsigned char hexOut); -void vme_out_string(char *stringOut); -void ispVMMemManager(signed char cTarget, unsigned short usSize); -void ispVMFreeMem(void); -void error_handler(short a_siRetCode, char *pszMessage); -signed char ispVM(const char *a_pszFilename); - -/*************************************************************** -* -* Global variables. -* -***************************************************************/ -unsigned short g_usPreviousSize = 0; -unsigned short g_usExpectedCRC = 0; - -/*************************************************************** -* -* External variables and functions declared in ivm_core.c module. -* -***************************************************************/ -extern signed char ispVMCode(); -extern void ispVMCalculateCRC32(unsigned char a_ucData); -extern void ispVMStart(); -extern void ispVMEnd(); -extern void ispVMStateMachine(signed char NextState); -extern void writePort(unsigned char a_ucPins, unsigned char a_ucValue); -extern void sclock(); -extern unsigned char readPort(); -extern unsigned short g_usCalculatedCRC; -extern unsigned short g_usDataType; -extern unsigned char *g_pucOutMaskData, -*g_pucInData, -*g_pucOutData, -*g_pucHIRData, -*g_pucTIRData, -*g_pucHDRData, -*g_pucTDRData, -*g_pucOutDMaskData, -*g_pucIntelBuffer; -extern unsigned char *g_pucHeapMemory; -extern unsigned short g_iHeapCounter; -extern unsigned short g_iHEAPSize; -extern unsigned short g_usIntelDataIndex; -extern unsigned short g_usIntelBufferSize; -extern LVDSPair *g_pLVDSList; -/* 08/28/08 NN Added Calculate checksum support. */ -extern unsigned long g_usChecksum; -extern unsigned int g_uiChecksumIndex; -/*************************************************************** -* -* External variables and functions declared in hardware.c module. -* -***************************************************************/ -extern void calibration(void); -extern unsigned short g_usCpu_Frequency; - -static int is_debug_on = -1; - -/*************************************************************** -* -* Supported VME versions. -* -***************************************************************/ - -const char *const g_szSupportedVersions[] = { "__VME2.0", "__VME3.0", "____12.0", "____12.1", 0 }; - -/*************************************************************** -* -* GetByte -* -* Returns a byte to the caller. The returned byte depends on the -* g_usDataType register. If the HEAP_IN bit is set, then the byte -* is returned from the HEAP. If the LHEAP_IN bit is set, then -* the byte is returned from the intelligent buffer. Otherwise, -* the byte is returned directly from the VME file. -* -***************************************************************/ - -char* strlwr(char *str) -{ - char *orig = str; - /* process the string */ - for (; *str != '\0'; str++) - *str = tolower(*str); - return orig; -} - -unsigned char GetByte() -{ - unsigned char ucData = 0; - - if (g_usDataType & HEAP_IN) { - - /*************************************************************** - * - * Get data from repeat buffer. - * - ***************************************************************/ - - if (g_iHeapCounter > g_iHEAPSize) { - - /*************************************************************** - * - * Data over-run. - * - ***************************************************************/ - - return 0xFF; - } - - ucData = g_pucHeapMemory[g_iHeapCounter++]; - } - else if ( g_usDataType & LHEAP_IN ) { - - /*************************************************************** - * - * Get data from intel buffer. - * - ***************************************************************/ - - if (g_usIntelDataIndex >= g_usIntelBufferSize) { - - /*************************************************************** - * - * Data over-run. - * - ***************************************************************/ - - return 0xFF; - } - - ucData = g_pucIntelBuffer[g_usIntelDataIndex++]; - } - else { - - /*************************************************************** - * - * Get data from file. - * - ***************************************************************/ - - ucData = (unsigned char)fgetc(g_pVMEFile); - - - if (feof(g_pVMEFile)) { - - /*************************************************************** - * - * Reached EOF. - * - ***************************************************************/ - - return 0xFF; - } - /*************************************************************** - * - * Calculate the 32-bit CRC if the expected CRC exist. - * - ***************************************************************/ - if( g_usExpectedCRC != 0) - { - ispVMCalculateCRC32(ucData); - } - } - - return (ucData); -} - -/*************************************************************** -* -* vme_out_char -* -* Send a character out to the output resource if available. -* The monitor is the default output resource. -* -* -***************************************************************/ -void vme_out_char(unsigned char charOut) -{ - dbg_print(is_debug_on, "%c", charOut); -} -/*************************************************************** -* -* vme_out_hex -* -* Send a character out as in hex format to the output resource -* if available. The monitor is the default output resource. -* -* -***************************************************************/ -void vme_out_hex(unsigned char hexOut) -{ - dbg_print(is_debug_on, "%.2X", hexOut); -} -/*************************************************************** -* -* vme_out_string -* -* Send a text string out to the output resource if available. -* The monitor is the default output resource. -* -* -***************************************************************/ -void vme_out_string(char *stringOut) -{ - if (is_debug_on == -1) { - is_debug_on = firmware_upgrade_debug(); - } - - dbg_print(is_debug_on, stringOut); -} -/*************************************************************** -* -* ispVMMemManager -* -* Allocate memory based on cTarget. The memory size is specified -* by usSize. -* -***************************************************************/ - -void ispVMMemManager(signed char cTarget, unsigned short usSize) -{ - switch (cTarget) { - case XTDI: - case TDI: - if (g_pucInData != NULL) { - if (g_usPreviousSize == usSize) { /*memory exist*/ - break; - } - else { - free(g_pucInData); - g_pucInData = NULL; - } - } - g_pucInData = (unsigned char *)malloc(usSize / 8 + 2); - g_usPreviousSize = usSize; - case XTDO: - case TDO: - if (g_pucOutData != NULL) { - if (g_usPreviousSize == usSize) { /*already exist*/ - break; - } - else { - free(g_pucOutData); - g_pucOutData = NULL; - } - } - g_pucOutData = (unsigned char *)malloc(usSize / 8 + 2); - g_usPreviousSize = usSize; - break; - case MASK: - if (g_pucOutMaskData != NULL) { - if (g_usPreviousSize == usSize) { /*already allocated*/ - break; - } - else { - free(g_pucOutMaskData); - g_pucOutMaskData = NULL; - } - } - g_pucOutMaskData = (unsigned char *)malloc(usSize / 8 + 2); - g_usPreviousSize = usSize; - break; - case HIR: - if (g_pucHIRData != NULL) { - free(g_pucHIRData); - g_pucHIRData = NULL; - } - g_pucHIRData = (unsigned char *)malloc(usSize / 8 + 2); - break; - case TIR: - if (g_pucTIRData != NULL) { - free(g_pucTIRData); - g_pucTIRData = NULL; - } - g_pucTIRData = (unsigned char *)malloc(usSize / 8 + 2); - break; - case HDR: - if (g_pucHDRData != NULL) { - free(g_pucHDRData); - g_pucHDRData = NULL; - } - g_pucHDRData = (unsigned char *)malloc(usSize / 8 + 2); - break; - case TDR: - if (g_pucTDRData != NULL) { - free(g_pucTDRData); - g_pucTDRData = NULL; - } - g_pucTDRData = (unsigned char *)malloc(usSize / 8 + 2); - break; - case HEAP: - if (g_pucHeapMemory != NULL) { - free(g_pucHeapMemory); - g_pucHeapMemory = NULL; - } - g_pucHeapMemory = (unsigned char *)malloc(usSize + 2); - break; - case DMASK: - if (g_pucOutDMaskData != NULL) { - if (g_usPreviousSize == usSize) { /*already allocated*/ - break; - } - else { - free(g_pucOutDMaskData); - g_pucOutDMaskData = NULL; - } - } - g_pucOutDMaskData = (unsigned char *)malloc(usSize / 8 + 2); - g_usPreviousSize = usSize; - break; - case LHEAP: - if (g_pucIntelBuffer != NULL) { - free(g_pucIntelBuffer); - g_pucIntelBuffer = NULL; - } - g_pucIntelBuffer = (unsigned char *)malloc(usSize + 2); - break; - case LVDS: - if (g_pLVDSList != NULL) { - free(g_pLVDSList); - g_pLVDSList = NULL; - } - g_pLVDSList = (LVDSPair * )calloc(usSize, sizeof(LVDSPair)); - break; - default: - return; - } -} - -/*************************************************************** -* -* ispVMFreeMem -* -* Free memory that were dynamically allocated. -* -***************************************************************/ - -void ispVMFreeMem() -{ - if (g_pucHeapMemory != NULL) { - free(g_pucHeapMemory); - g_pucHeapMemory = NULL; - } - - if (g_pucOutMaskData != NULL) { - free(g_pucOutMaskData); - g_pucOutMaskData = NULL; - } - - if (g_pucInData != NULL) { - free(g_pucInData); - g_pucInData = NULL; - } - - if (g_pucOutData != NULL) { - free(g_pucOutData); - g_pucOutData = NULL; - } - - if (g_pucHIRData != NULL) { - free(g_pucHIRData); - g_pucHIRData = NULL; - } - - if (g_pucTIRData != NULL) { - free(g_pucTIRData); - g_pucTIRData = NULL; - } - - if (g_pucHDRData != NULL) { - free(g_pucHDRData); - g_pucHDRData = NULL; - } - - if (g_pucTDRData != NULL) { - free(g_pucTDRData); - g_pucTDRData = NULL; - } - - if (g_pucOutDMaskData != NULL) { - free(g_pucOutDMaskData); - g_pucOutDMaskData = NULL; - } - - if (g_pucIntelBuffer != NULL) { - free(g_pucIntelBuffer); - g_pucIntelBuffer = NULL; - } - - if (g_pLVDSList != NULL) { - free(g_pLVDSList); - g_pLVDSList = NULL; - } -} - -/*************************************************************** -* -* error_handler -* -* Reports the error message. -* -***************************************************************/ - -void error_handler(short a_siRetCode, char *pszMessage) -{ - const char *pszErrorMessage[] = { "pass", - "verification fail", - "can't find the file", - "wrong file type", - "file error", - "option error", - "crc verification error" }; - - strcpy(pszMessage, pszErrorMessage[-a_siRetCode]); -} -/*************************************************************** -* -* ispVM -* -* The entry point of the ispVM embedded. If the version and CRC -* are verified, then the VME will be processed. -* -***************************************************************/ - -signed char ispVM(const char *a_pszFilename) -{ - char szFileVersion[9] = { 0 }; - signed char cRetCode = 0; - signed char cIndex = 0; - signed char cVersionIndex = 0; - unsigned char ucReadByte = 0; - - /*************************************************************** - * - * Global variables initialization. - * - * 09/11/07 NN Added - ***************************************************************/ - g_pucHeapMemory = NULL; - g_iHeapCounter = 0; - g_iHEAPSize = 0; - g_usIntelDataIndex = 0; - g_usIntelBufferSize = 0; - g_usPreviousSize = 0; - - /*************************************************************** - * - * Open a file pointer to the VME file. - * - ***************************************************************/ - - - - if ((g_pVMEFile = fopen(a_pszFilename, "rb")) == NULL) { - return VME_FILE_READ_FAILURE; - } - g_usCalculatedCRC = 0; - g_usExpectedCRC = 0; - ucReadByte = GetByte(); - //dbg_print(is_debug_on, "data: 0x%x.\n", ucReadByte); - switch (ucReadByte) { - case FILE_CRC: - - /*************************************************************** - * - * Read and store the expected CRC to do the comparison at the end. - * Only versions 3.0 and higher support CRC protection. - * - ***************************************************************/ - - g_usExpectedCRC = (unsigned char)fgetc(g_pVMEFile); - g_usExpectedCRC <<= 8; - g_usExpectedCRC |= fgetc(g_pVMEFile); - - /*************************************************************** - * - * Read and store the version of the VME file. - * - ***************************************************************/ - - - for (cIndex = 0; cIndex < 8; cIndex++) { - szFileVersion[cIndex] = GetByte(); - } - break; - default: - - /*************************************************************** - * - * Read and store the version of the VME file. Must be version 2.0. - * - ***************************************************************/ - - szFileVersion[0] = (signed char)ucReadByte; - for (cIndex = 1; cIndex < 8; cIndex++) { - szFileVersion[cIndex] = GetByte(); - } - - break; - } - - /*************************************************************** - * - * Compare the VME file version against the supported version. - * - ***************************************************************/ - /* check the file version: the value of 0x03-0x0a */ - for (cVersionIndex = 0; g_szSupportedVersions[cVersionIndex] != 0; cVersionIndex++) { - for (cIndex = 0; cIndex < 8; cIndex++) { - if (szFileVersion[cIndex] != g_szSupportedVersions[cVersionIndex][cIndex]) { - cRetCode = VME_VERSION_FAILURE; - break; - } - cRetCode = 0; - } - - if (cRetCode == 0) { - - /*************************************************************** - * - * Found matching version, break. - * - ***************************************************************/ - - break; - } - } - - if (cRetCode < 0) { - - /*************************************************************** - * - * VME file version failed to match the supported versions. - * - ***************************************************************/ - - fclose(g_pVMEFile); - g_pVMEFile = NULL; - return VME_VERSION_FAILURE; - } - - /*************************************************************** - * - * Enable the JTAG port to communicate with the device. - * Set the JTAG state machine to the Test-Logic/Reset State. - * - ***************************************************************/ - ispVMStart(); - - - /*************************************************************** - * - * Process the VME file. - * - ***************************************************************/ - - cRetCode = ispVMCode(); - - /*************************************************************** - * - * Set the JTAG State Machine to Test-Logic/Reset state then disable - * the communication with the JTAG port. - * - ***************************************************************/ - - ispVMEnd(); - - fclose(g_pVMEFile); - g_pVMEFile = NULL; - - ispVMFreeMem(); - - /*************************************************************** - * - * Compare the expected CRC versus the calculated CRC. - * - ***************************************************************/ - - if (cRetCode == 0 && g_usExpectedCRC != 0 && (g_usExpectedCRC != g_usCalculatedCRC)) { - printf("Expected CRC: 0x%.4X\n", g_usExpectedCRC); - printf("Calculated CRC: 0x%.4X\n", g_usCalculatedCRC); - return VME_CRC_FAILURE; - } - - return (cRetCode); -} - -/*************************************************************** -* -* main -* -***************************************************************/ -extern int g_file_fd; -int ispvme_main(int argc, char *argv[]) -{ - unsigned short iCommandLineIndex = 0; - short siRetCode = 0; - char szExtension[5] = { 0 }; - char szCommandLineArg[300] = { 0 }; - short sicalibrate = 0; - - /* 08/28/08 NN Added Calculate checksum support. */ - g_usChecksum = 0; - g_uiChecksumIndex = 0; - - g_file_fd = open("/dev/firmware_cpld_ispvme0", O_RDWR); - if (g_file_fd < 0) { - printf("can't open device\r\n"); - return -1; - } - - vme_out_string(" Lattice Semiconductor Corp.\n"); - vme_out_string("\n ispVME(tm) V"); - vme_out_string(VME_VERSION_NUMBER); - vme_out_string(" Copyright 1998-2011.\n"); - vme_out_string("\nFor daisy chain programming of all in-system programmable devices\n\n"); - - if (argc < 2) { - vme_out_string("\nUsage: vme [option] vme_file [vme_file]\n"); - vme_out_string("Example: vme vme_file1.vme vme_file2.vme\n"); - vme_out_string("option -c: do the calibration.\n"); - vme_out_string("Example: vme -c\n"); - vme_out_string("Example: vme -c vme_file1.vme vme_file2.vme\n"); - vme_out_string("\n\n"); - close(g_file_fd); - return -1; /* Used by superiors to judge whether the upgrade is successful */ - //exit(1); - } - for (iCommandLineIndex = 1; iCommandLineIndex < argc; iCommandLineIndex++) { - strcpy(szCommandLineArg, argv[iCommandLineIndex]); - if (!strcmp(strlwr(szCommandLineArg), "-c") && (iCommandLineIndex == 1)) { - sicalibrate = 1; - } else if (!strcmp(strlwr(szCommandLineArg), "-c") && (iCommandLineIndex != 1)) { - vme_out_string("Error: calibrate option -c must be the first argument\n\n"); - close(g_file_fd); - return -1; /* Used by superiors to judge whether the upgrade is successful */ - //exit(1); - } else { - strcpy(szExtension, &szCommandLineArg[strlen(szCommandLineArg) - 4]); - strlwr(szExtension); - if (strcmp(szExtension, ".vme")) { - vme_out_string("Error: VME files must end with the extension *.vme\n\n"); - close(g_file_fd); - return -1; /* Used by superiors to judge whether the upgrade is successful */ - //exit(1); - } - } - } - siRetCode = 0; - - if (sicalibrate) { - calibration(); - } - for (iCommandLineIndex = 1; iCommandLineIndex < argc; iCommandLineIndex++) { /* Process all VME files sequentially */ - strcpy(szCommandLineArg, argv[iCommandLineIndex]); - if (!strcmp(strlwr(szCommandLineArg), "-c") && (iCommandLineIndex == 1)) { - - } else if (!strcmp(strlwr(szCommandLineArg), "-checksum")) { - - } else { - vme_out_string("Processing virtual machine file ("); - vme_out_string(szCommandLineArg); - vme_out_string(")......\n\n"); - siRetCode = ispVM(szCommandLineArg); - if (siRetCode < 0) { - break; - } - } - } - - if (siRetCode < 0) { - error_handler(siRetCode, szCommandLineArg); - vme_out_string("Failed due to "); - vme_out_string(szCommandLineArg); - vme_out_string("\n\n"); - vme_out_string("+=======+\n"); - vme_out_string("| FAIL! |\n"); - vme_out_string("+=======+\n\n"); - } else { - vme_out_string("+=======+\n"); - vme_out_string("| PASS! |\n"); - vme_out_string("+=======+\n\n"); - /* 08/28/08 NN Added Calculate checksum support. */ - if (g_usChecksum != 0) { - g_usChecksum &= 0xFFFF; - printf("Data Checksum: %.4X\n\n", (unsigned int)g_usChecksum); - g_usChecksum = 0; - } - } - close(g_file_fd); - return siRetCode; /* Used by superiors to judge whether the upgrade is successful */ - //exit(siRetCode); -} - -/** -* function:CPLD online upgrade channel test program -* input parameters: None -* output parameters:None -* return: 0 means test successfully -1 means test failed -*/ -int ispvme_test(void) -{ - int ret = 0; - unsigned char index = 0; - unsigned char indata = 0,outdata = 0; - unsigned char datasize = 8; - unsigned int tmpdata = 0; - char curbit = 0; - int nDevices = 0; - - g_file_fd = open("/dev/firmware_cpld_ispvme0", O_RDWR); - if (g_file_fd < 0) { - printf("can't open device\r\n"); - return -1; - } - - /* go to Shift-IR */ - ispVMStart(); - ispVMStateMachine(IDLE); - ispVMStateMachine(IRPAUSE); - ispVMStateMachine(SHIFTIR); - - /* Send plenty of ones into the IR registers,that makes sure all devices are in BYPASS! */ - for (index = 0; index < 100; index++) { - writePort(JTAG_TDI, 1); - sclock(); - } - - /* exit Shift-IR,and go to Shift-DR */ - ispVMStateMachine(IRPAUSE); - ispVMStateMachine(DRPAUSE); - ispVMStateMachine(SHIFTDR); - - /* Send plenty of zeros into the DR registers to flush them */ - for (index = 0; index < 100; index++) { - writePort(JTAG_TDI, 0); - sclock(); - } - - /* now send ones until we receive one back,to find out number of device(s) */ - for(index = 0; index < 100; index++){ - writePort(JTAG_TDI, 1); - sclock(); - curbit = readPort(); - if(1 == curbit){ - nDevices = index + 1; - break; - } - } - - /*flush again */ - for (index = 0; index < 100; index++) { - writePort(JTAG_TDI, 0); - sclock(); - } - - /* test data probe */ - indata = 0x5a; - for (index = 0; index < datasize + nDevices; index++) { - tmpdata <<= 1; - curbit = readPort(); - tmpdata |= curbit; - writePort(JTAG_TDI, ((indata << index) & 0x80) ? 0x01:0x00); - sclock(); - } - outdata = (tmpdata & 0xFF); - if(outdata != indata){ - ret = -1; - } - - /* go to Test-Logic-Reset */ - ispVMStateMachine(IDLE); - ispVMStart(); - - /* close ispvme */ - close(g_file_fd); - return ret; -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/ivm_core.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/ivm_core.c deleted file mode 100644 index 7d4f0ba137..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/ivm_core.c +++ /dev/null @@ -1,3033 +0,0 @@ -/*************************************************************** -* -* Lattice Semiconductor Corp. Copyright 2009 -* -* ispVME Embedded allows programming of Lattice's suite of FPGA -* devices on embedded systems through the JTAG port. The software -* is distributed in source code form and is open to re - distribution -* and modification where applicable. -* -* Revision History of ivm_core.c module: -* 4/25/06 ht Change some variables from unsigned short or int -* to long int to make the code compiler independent. -* 5/24/06 ht Support using RESET (TRST) pin as a special purpose -* control pin such as triggering the loading of known -* state exit. -* 3/6/07 ht added functions to support output to terminals -* -* 09/24/07 NN Type cast mismatch variables -* Moved the sclock() function to hardware.c -* 08/28/08 NN Added Calculate checksum support. -* 4/1/09 Nguyen replaced the recursive function call codes on -* the ispVMLCOUNT function -* -***************************************************************/ - -#include -#include -#include "vmopcode.h" -#include "common.h" - -/*************************************************************** -* -* Global variables used to specify the flow control and data type. -* -* g_usFlowControl: flow control register. Each bit in the -* register can potentially change the -* personality of the embedded engine. -* g_usDataType: holds the data type of the current row. -* -***************************************************************/ - -unsigned short g_usFlowControl = 0x0000; -unsigned short g_usDataType = 0x0000; - -/*************************************************************** -* -* Global variables used to specify the ENDDR and ENDIR. -* -* g_ucEndDR: the state that the device goes to after SDR. -* g_ucEndIR: the state that the device goes to after SIR. -* -***************************************************************/ - -unsigned char g_ucEndDR = DRPAUSE; -unsigned char g_ucEndIR = IRPAUSE; - -/*************************************************************** -* -* Global variables used to support header/trailer. -* -* g_usHeadDR: the number of lead devices in bypass. -* g_usHeadIR: the sum of IR length of lead devices. -* g_usTailDR: the number of tail devices in bypass. -* g_usTailIR: the sum of IR length of tail devices. -* -***************************************************************/ - -unsigned short g_usHeadDR = 0; -unsigned short g_usHeadIR = 0; -unsigned short g_usTailDR = 0; -unsigned short g_usTailIR = 0; - -/*************************************************************** -* -* Global variable to store the number of bits of data or instruction -* to be shifted into or out from the device. -* -***************************************************************/ - -unsigned short g_usiDataSize = 0; - -/*************************************************************** -* -* Stores the frequency. Default to 1 MHz. -* -***************************************************************/ - -int g_iFrequency = 1000; - -/*************************************************************** -* -* Stores the maximum amount of ram needed to hold a row of data. -* -***************************************************************/ - -unsigned short g_usMaxSize = 0; - -/*************************************************************** -* -* Stores the LSH or RSH value. -* -***************************************************************/ - -unsigned short g_usShiftValue = 0; - -/*************************************************************** -* -* Stores the current repeat loop value. -* -***************************************************************/ - -unsigned short g_usRepeatLoops = 0; - -/*************************************************************** -* -* Stores the current vendor. -* -***************************************************************/ - -signed char g_cVendor = LATTICE; - -/*************************************************************** -* -* Stores the VME file CRC. -* -***************************************************************/ - -unsigned short g_usCalculatedCRC = 0; - -/*************************************************************** -* -* Stores the Device Checksum. -* -***************************************************************/ -//08/28/08 NN Added Calculate checksum support. -unsigned long g_usChecksum = 0; -unsigned int g_uiChecksumIndex = 0; - -/*************************************************************** -* -* Stores the current state of the JTAG state machine. -* -***************************************************************/ - -signed char g_cCurrentJTAGState = 0; - -/*************************************************************** -* -* Global variables used to support looping. -* -* g_pucHeapMemory: holds the entire repeat loop. -* g_iHeapCounter: points to the current byte in the repeat loop. -* g_iHEAPSize: the current size of the repeat in bytes. -* -***************************************************************/ - -unsigned char *g_pucHeapMemory = NULL; -unsigned short g_iHeapCounter = 0; -unsigned short g_iHEAPSize = 0; - -/*************************************************************** -* -* Global variables used to support intelligent programming. -* -* g_usIntelDataIndex: points to the current byte of the -* intelligent buffer. -* g_usIntelBufferSize: holds the size of the intelligent -* buffer. -* -***************************************************************/ - -unsigned short g_usIntelDataIndex = 0; -unsigned short g_usIntelBufferSize = 0; - -/**************************************************************************** -* -* Holds the maximum size of each respective buffer. These variables are used -* to write the HEX files when converting VME to HEX. -* -*****************************************************************************/ - -unsigned short g_usTDOSize = 0; -unsigned short g_usMASKSize = 0; -unsigned short g_usTDISize = 0; -unsigned short g_usDMASKSize = 0; -unsigned short g_usLCOUNTSize = 0; -unsigned short g_usHDRSize = 0; -unsigned short g_usTDRSize = 0; -unsigned short g_usHIRSize = 0; -unsigned short g_usTIRSize = 0; -unsigned short g_usHeapSize = 0; - -/*************************************************************** -* -* Global variables used to store data. -* -* g_pucOutMaskData: local RAM to hold one row of MASK data. -* g_pucInData: local RAM to hold one row of TDI data. -* g_pucOutData: local RAM to hold one row of TDO data. -* g_pucHIRData: local RAM to hold the current SIR header. -* g_pucTIRData: local RAM to hold the current SIR trailer. -* g_pucHDRData: local RAM to hold the current SDR header. -* g_pucTDRData: local RAM to hold the current SDR trailer. -* g_pucIntelBuffer: local RAM to hold the current intelligent buffer. -* g_pucOutDMaskData: local RAM to hold one row of DMASK data. -* -***************************************************************/ - -unsigned char *g_pucOutMaskData = NULL, -*g_pucInData = NULL, -*g_pucOutData = NULL, -*g_pucHIRData = NULL, -*g_pucTIRData = NULL, -*g_pucHDRData = NULL, -*g_pucTDRData = NULL, -*g_pucIntelBuffer = NULL, -*g_pucOutDMaskData = NULL; - -/*************************************************************** -* -* JTAG state machine transition table. -* -***************************************************************/ - -struct { - unsigned char CurState; /* From this state */ - unsigned char NextState; /* Step to this state */ - unsigned char Pattern; /* The tragetory of TMS */ - unsigned char Pulses; /* The number of steps */ -} g_JTAGTransistions[25] = { - { RESET, RESET, 0xFC, 6 }, /* Transitions from RESET */ - { RESET, IDLE, 0x00, 1 }, - { RESET, DRPAUSE, 0x50, 5 }, - { RESET, IRPAUSE, 0x68, 6 }, - { IDLE, RESET, 0xE0, 3 }, /* Transitions from IDLE */ - { IDLE, DRPAUSE, 0xA0, 4 }, - { IDLE, IRPAUSE, 0xD0, 5 }, - { DRPAUSE, RESET, 0xF8, 5 }, /* Transitions from DRPAUSE */ - { DRPAUSE, IDLE, 0xC0, 3 }, - { DRPAUSE, IRPAUSE, 0xF4, 7 }, - { DRPAUSE, DRPAUSE, 0xE8, 6 }, /* 06/14/06 Support POLING STATUS LOOP*/ - { IRPAUSE, RESET, 0xF8, 5 }, /* Transitions from IRPAUSE */ - { IRPAUSE, IDLE, 0xC0, 3 }, - { IRPAUSE, DRPAUSE, 0xE8, 6 }, - { DRPAUSE, SHIFTDR, 0x80, 2 }, /* Extra transitions using SHIFTDR */ - { IRPAUSE, SHIFTDR, 0xE0, 5 }, - { SHIFTDR, DRPAUSE, 0x80, 2 }, - { SHIFTDR, IDLE, 0xC0, 3 }, - { IRPAUSE, SHIFTIR, 0x80, 2 }, /* Extra transitions using SHIFTIR */ - { SHIFTIR, IRPAUSE, 0x80, 2 }, - { SHIFTIR, IDLE, 0xC0, 3 }, - { DRPAUSE, DRCAPTURE, 0xE0, 4 }, /* 11/15/05 Support DRCAPTURE*/ - { DRCAPTURE, DRPAUSE, 0x80, 2 }, - { IDLE, DRCAPTURE, 0x80, 2 }, - { IRPAUSE, DRCAPTURE, 0xE0, 4 } -}; - -/*************************************************************** -* -* List to hold all LVDS pairs. -* -***************************************************************/ - -LVDSPair *g_pLVDSList = NULL; -unsigned short g_usLVDSPairCount = 0; - -/*************************************************************** -* -* Function prototypes. -* -***************************************************************/ - -signed char ispVMCode(); -signed char ispVMDataCode(); -long int ispVMDataSize(); -void ispVMData(unsigned char *Data); -signed char ispVMShift(signed char Code); -signed char ispVMAmble(signed char Code); -signed char ispVMLoop(unsigned short a_usLoopCount); -signed char ispVMBitShift(signed char mode, unsigned short bits); -void ispVMComment(unsigned short a_usCommentSize); -void ispVMHeader(unsigned short a_usHeaderSize); -signed char ispVMLCOUNT(unsigned short a_usCountSize); -void ispVMClocks(unsigned short Clocks); -void ispVMBypass(signed char ScanType, unsigned short Bits); -void ispVMStateMachine(signed char NextState); -void ispVMStart(); -void ispVMEnd(); -signed char ispVMSend(unsigned short int); -signed char ispVMRead(unsigned short int); -signed char ispVMReadandSave(unsigned short int); -signed char ispVMProcessLVDS(unsigned short a_usLVDSCount); - -/*************************************************************** -* -* External variables and functions in ispvm_ui.c module -* -***************************************************************/ -extern void vme_out_char(unsigned char charOut); -extern void vme_out_hex(unsigned char hexOut); -extern void vme_out_string(char *stringOut); -extern unsigned char GetByte(); -extern void ispVMMemManager(signed char types, unsigned short size); - -/*************************************************************** -* -* External variables and functions in hardware.c module -* -***************************************************************/ -extern void ispVMDelay(unsigned short int a_usMicroSecondDelay); -extern unsigned char readPort(); -extern void writePort(unsigned char pins, unsigned char value); -extern void sclock(); -extern signed char g_cCurrentJTAGState; -#ifdef VME_DEBUG - -/*************************************************************** -* -* GetState -* -* Returns the state as a string based on the opcode. Only used -* for debugging purposes. -* -***************************************************************/ - -const char* GetState(unsigned char a_ucState) -{ - switch (a_ucState) { - case RESET: - return ("RESET"); - case IDLE: - return ("IDLE"); - case IRPAUSE: - return ("IRPAUSE"); - case DRPAUSE: - return ("DRPAUSE"); - case SHIFTIR: - return ("SHIFTIR"); - case SHIFTDR: - return ("SHIFTDR"); - case DRCAPTURE: /* 11/15/05 support DRCAPTURE*/ - return ("DRCAPTURE"); - default: - break; - } - - return 0; -} - -/*************************************************************** -* -* PrintData -* -* Prints the data. Only used for debugging purposes. -* -***************************************************************/ - -void PrintData(unsigned short a_iDataSize, unsigned char *a_pucData) -{ - //09/11/07 NN added local variables initialization - unsigned short usByteSize = 0; - unsigned short usBitIndex = 0; - signed short usByteIndex = 0; - unsigned char ucByte = 0; - unsigned char ucFlipByte = 0; - - if (a_iDataSize % 8) { - //09/11/07 NN Type cast mismatch variables - usByteSize = (unsigned short)(a_iDataSize / 8 + 1); - } else { - //09/11/07 NN Type cast mismatch variables - usByteSize = (unsigned short)(a_iDataSize / 8);// 4 - } - printf("("); - //09/11/07 NN Type cast mismatch variables - for (usByteIndex = (signed short)(usByteSize - 1); usByteIndex >= 0; usByteIndex--) { - ucByte = a_pucData[usByteIndex]; - ucFlipByte = 0x00; - - /*************************************************************** - * - * Flip each byte. - * - ***************************************************************/ - - for (usBitIndex = 0; usBitIndex < 8; usBitIndex++) { - ucFlipByte <<= 1; - if (ucByte & 0x1) { - ucFlipByte |= 0x1; - } - - ucByte >>= 1; - } - - /*************************************************************** - * - * Print the flipped byte. - * - ***************************************************************/ - - printf("%.02X", ucFlipByte); - if ((usByteSize - usByteIndex) % 40 == 39) { - printf("\n\t\t"); - } - if (usByteIndex < 0) - break; - } - printf(")"); -} -#endif /* VME_DEBUG */ - -/*************************************************************** -* -* ispVMDataSize -* -* Returns a VME-encoded number, usually used to indicate the -* bit length of an SIR/SDR command. -* -***************************************************************/ - -long int ispVMDataSize() -{ - /* 09/11/07 NN added local variables initialization */ - long int iSize = 0; - signed char cCurrentByte = 0; - signed char cIndex = 0; - cIndex = 0; - - while ((cCurrentByte = GetByte()) & 0x80) { - iSize |= ((long int)(cCurrentByte & 0x7F)) << cIndex; - cIndex += 7; - } - iSize |= ((long int)(cCurrentByte & 0x7F)) << cIndex; - - return iSize; -} - -/*************************************************************** -* -* ispVMCode -* -* This is the heart of the embedded engine. All the high-level opcodes -* are extracted here. Once they have been identified, then it -* will call other functions to handle the processing. -* -***************************************************************/ - -signed char ispVMCode() -{ - /* 09/11/07 NN added local variables initialization */ - unsigned short iRepeatSize = 0; - signed char cOpcode = 0; - signed char cRetCode = 0; - unsigned char ucState = 0; - unsigned short usDelay = 0; - unsigned short usToggle = 0; - unsigned char usByte = 0; - - /*************************************************************** - * - * Check the compression flag only if this is the first time - * this function is entered. Do not check the compression flag if - * it is being called recursively from other functions within - * the embedded engine. - * - ***************************************************************/ - - if (!(g_usDataType & LHEAP_IN) && !(g_usDataType & HEAP_IN)) { - usByte = GetByte(); - if (usByte == 0xf1) { - g_usDataType |= COMPRESS; - } else if (usByte == 0xf2) { - g_usDataType &= ~COMPRESS; - } else { - return VME_INVALID_FILE; - } - } - - - /*************************************************************** - * - * Begin looping through all the VME opcodes. - * - ***************************************************************/ - while ((cOpcode = GetByte()) >= 0) { - switch (cOpcode) { - case STATE: - - /*************************************************************** - * - * Step the JTAG state machine. - * - ***************************************************************/ - - ucState = GetByte(); - /*************************************************************** - * - * Step the JTAG state machine to DRCAPTURE to support Looping. - * - ***************************************************************/ - - if ((g_usDataType & LHEAP_IN) && - (ucState == DRPAUSE) && - (g_cCurrentJTAGState == ucState)) { - ispVMStateMachine(DRCAPTURE); - } - - ispVMStateMachine(ucState); - -#ifdef VME_DEBUG - if (g_usDataType & LHEAP_IN) { - printf("LDELAY %s ", GetState(ucState)); - } else { - printf("STATE %s;\n", GetState(ucState)); - } -#endif /* VME_DEBUG */ - break; - case SIR: - case SDR: - case XSDR: - -#ifdef VME_DEBUG - switch (cOpcode) { - case SIR: - printf("SIR "); - break; - case SDR: - case XSDR: - if (g_usDataType & LHEAP_IN) { - printf("LSDR "); - } else { - printf("SDR "); - } - break; - } -#endif /* VME_DEBUG */ - /*************************************************************** - * - * Shift in data into the device. - * - ***************************************************************/ - cRetCode = ispVMShift(cOpcode); - if (cRetCode != 0) { - return (cRetCode); - } - break; - case WAIT: - - /*************************************************************** - * - * Observe delay. - * - ***************************************************************/ - - /* 9/11/07 NN Type cast mismatch variables */ - usDelay = (unsigned short)ispVMDataSize(); - ispVMDelay(usDelay); - -#ifdef VME_DEBUG - if (usDelay & 0x8000) { - - /*************************************************************** - * - * Since MSB is set, the delay time must be decoded to - * millisecond. The SVF2VME encodes the MSB to represent - * millisecond. - * - ***************************************************************/ - - usDelay &= ~0x8000; - if (g_usDataType & LHEAP_IN) { - printf("%.2E SEC;\n", (float)usDelay / 1000); - } else { - printf("RUNTEST %.2E SEC;\n", (float)usDelay / 1000); - } - } else { - - /*************************************************************** - * - * Since MSB is not set, the delay time is given as microseconds. - * - ***************************************************************/ - - if (g_usDataType & LHEAP_IN) { - printf("%.2E SEC;\n", (float)usDelay / 1000000); - } else { - printf("RUNTEST %.2E SEC;\n", (float)usDelay / 1000000); - } - } -#endif /* VME_DEBUG */ - break; - case TCK: - - /*************************************************************** - * - * Issue clock toggles. - * - ***************************************************************/ - - /* 09/11/07 NN Type cast mismatch variables */ - usToggle = (unsigned short)ispVMDataSize(); - ispVMClocks(usToggle); - -#ifdef VME_DEBUG - printf("RUNTEST %d TCK;\n", usToggle); -#endif /* VME_DEBUG */ - break; - case ENDDR: - - /*************************************************************** - * - * Set the ENDDR. - * - ***************************************************************/ - - g_ucEndDR = GetByte(); - -#ifdef VME_DEBUG - printf("ENDDR %s;\n", GetState(g_ucEndDR)); -#endif /* VME_DEBUG */ - break; - case ENDIR: - - /*************************************************************** - * - * Set the ENDIR. - * - ***************************************************************/ - - g_ucEndIR = GetByte(); - -#ifdef VME_DEBUG - printf("ENDIR %s;\n", GetState(g_ucEndIR)); -#endif /* VME_DEBUG */ - break; - case HIR: - case TIR: - case HDR: - case TDR: - -#ifdef VME_DEBUG - switch (cOpcode) { - case HIR: - printf("HIR "); - break; - case TIR: - printf("TIR "); - break; - case HDR: - printf("HDR "); - break; - case TDR: - printf("TDR "); - break; - } -#endif /* VME_DEBUG */ - - /*************************************************************** - * - * Set the header/trailer of the device in order to bypass - * successfully. - * - ***************************************************************/ - - cRetCode = ispVMAmble(cOpcode); - if (cRetCode != 0) { - return (cRetCode); - } - -#ifdef VME_DEBUG - printf(";\n"); -#endif /* VME_DEBUG */ - break; - case MEM: - - /*************************************************************** - * - * The maximum RAM required to support processing one row of the - * VME file. - * - ***************************************************************/ - - //09/11/07 NN Type cast mismatch variables - g_usMaxSize = (unsigned short)ispVMDataSize(); - -#ifdef VME_DEBUG - printf("// MEMSIZE %d\n", g_usMaxSize); -#endif /* VME_DEBUG */ - break; - case VENDOR: - - /*************************************************************** - * - * Set the VENDOR type. - * - ***************************************************************/ - - cOpcode = GetByte(); - switch (cOpcode) { - case LATTICE: -#ifdef VME_DEBUG - printf("// VENDOR LATTICE\n"); -#endif /* VME_DEBUG */ - g_cVendor = LATTICE; - break; - case ALTERA: -#ifdef VME_DEBUG - printf("// VENDOR ALTERA\n"); -#endif /* VME_DEBUG */ - g_cVendor = ALTERA; - break; - case XILINX: -#ifdef VME_DEBUG - printf("// VENDOR XILINX\n"); -#endif /* VME_DEBUG */ - g_cVendor = XILINX; - break; - default: - break; - } - break; - case SETFLOW: - - /*************************************************************** - * - * Set the flow control. Flow control determines the personality - * of the embedded engine. - * - ***************************************************************/ - - /* 09/11/07 NN Type cast mismatch variables */ - g_usFlowControl |= (unsigned short)ispVMDataSize(); - break; - case RESETFLOW: - - /*************************************************************** - * - * Unset the flow control. - * - ***************************************************************/ - - /* 09/11/07 NN Type cast mismatch variables */ - g_usFlowControl &= (unsigned short)~(ispVMDataSize()); - break; - case HEAP: - - /*************************************************************** - * - * Allocate heap size to store loops. - * - ***************************************************************/ - - cRetCode = GetByte(); - if (cRetCode != SECUREHEAP) { - return VME_INVALID_FILE; - } - /* 09/11/07 NN Type cast mismatch variables */ - g_iHEAPSize = (unsigned short)ispVMDataSize(); - - /**************************************************************************** - * - * Store the maximum size of the HEAP buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_iHEAPSize > g_usHeapSize) { - g_usHeapSize = g_iHEAPSize; - } - - ispVMMemManager(HEAP, (unsigned short)g_iHEAPSize); - break; - case REPEAT: - - /*************************************************************** - * - * Execute loops. - * - ***************************************************************/ - - g_usRepeatLoops = 0; - - /* 09/11/07 NN Type cast mismatch variables */ - iRepeatSize = (unsigned short)ispVMDataSize(); - - cRetCode = ispVMLoop((unsigned short)iRepeatSize); - if (cRetCode != 0) { - return (cRetCode); - } - break; - case ENDLOOP: - - /*************************************************************** - * - * Exit point from processing loops. - * - ***************************************************************/ - - return (cRetCode); - case ENDVME: - - /*************************************************************** - * - * The only valid exit point that indicates end of programming. - * - ***************************************************************/ - - return (cRetCode); - case SHR: - - /*************************************************************** - * - * Right-shift address. - * - ***************************************************************/ - - g_usFlowControl |= SHIFTRIGHT; - - /* 09/11/07 NN Type cast mismatch variables */ - g_usShiftValue = (unsigned short)(g_usRepeatLoops * (unsigned short)GetByte()); - break; - case SHL: - - /*************************************************************** - * - * Left-shift address. - * - ***************************************************************/ - - g_usFlowControl |= SHIFTLEFT; - - /* 09/11/07 NN Type cast mismatch variables */ - g_usShiftValue = (unsigned short)(g_usRepeatLoops * (unsigned short)GetByte()); - break; - case FREQUENCY: - - /*************************************************************** - * - * Set the frequency. - * - ***************************************************************/ - - /* 09/11/07 NN Type cast mismatch variables */ - g_iFrequency = (int)(ispVMDataSize()); - /* 10/23/08 NN changed to check if the frequency smaller than 1000 */ - if (g_iFrequency >= 1000) { - g_iFrequency = g_iFrequency / 1000; - if (g_iFrequency == 1) - g_iFrequency = 1000; -#ifdef VME_DEBUG - printf("FREQUENCY %.2E HZ;\n", (float)g_iFrequency * 1000); -#endif /* VME_DEBUG */ - } else { - if (g_iFrequency == 0) - g_iFrequency = 1000; -#ifdef VME_DEBUG - printf("FREQUENCY %.2E HZ;\n", (float)g_iFrequency); -#endif /* VME_DEBUG */ - } - break; - case LCOUNT: - - /*************************************************************** - * - * Process LCOUNT command. - * - ***************************************************************/ - - cRetCode = ispVMLCOUNT((unsigned short)ispVMDataSize()); - if (cRetCode != 0) { - return (cRetCode); - } - break; - case VUES: - - /*************************************************************** - * - * Set the flow control to verify USERCODE. - * - ***************************************************************/ - - g_usFlowControl |= VERIFYUES; - break; - case COMMENT: - - /*************************************************************** - * - * Display comment. - * - ***************************************************************/ - - ispVMComment((unsigned short)ispVMDataSize()); - break; - case LVDS: - - /*************************************************************** - * - * Process LVDS command. - * - ***************************************************************/ - - ispVMProcessLVDS((unsigned short)ispVMDataSize()); - break; - case HEADER: - - /*************************************************************** - * - * Discard header. - * - ***************************************************************/ - - ispVMHeader((unsigned short)ispVMDataSize()); - break; - /* 03/14/06 Support Toggle ispENABLE signal */ - case ispEN: - ucState = GetByte(); - if ((ucState == ON) || (ucState == 0x01)) - writePort(JTAG_ENABLE, 0x01); - else - writePort(JTAG_ENABLE, 0x00); - ispVMDelay(1); - break; - /* 05/24/06 support Toggle TRST pin */ - case TRST: - ucState = GetByte(); - if (ucState == 0x01) - writePort(JTAG_TRST, 0x01); - else - writePort(JTAG_TRST, 0x00); - ispVMDelay(1); - break; - default: - - /*************************************************************** - * - * Invalid opcode encountered. - * - ***************************************************************/ - -#ifdef VME_DEBUG - printf("\nINVALID OPCODE: 0x%.2X\n", cOpcode); -#endif /* VME_DEBUG */ - - return VME_INVALID_FILE; - } - } - - /*************************************************************** - * - * Invalid exit point. Processing the token 'ENDVME' is the only - * valid way to exit the embedded engine. - * - ***************************************************************/ - - return (VME_INVALID_FILE); -} - -/*************************************************************** -* -* ispVMDataCode -* -* Processes the TDI/TDO/MASK/DMASK etc of an SIR/SDR command. -* -***************************************************************/ - -signed char ispVMDataCode() -{ - /* 09/11/07 NN added local variables initialization */ - signed char cDataByte = 0; - signed char siDataSource = 0; /* source of data from file by default */ - - if (g_usDataType & HEAP_IN) { - siDataSource = 1; /* the source of data from memory */ - } - - /**************************************************************************** - * - * Clear the data type register. - * - *****************************************************************************/ - - g_usDataType &= ~(MASK_DATA + TDI_DATA + TDO_DATA + DMASK_DATA + CMASK_DATA); - - /**************************************************************************** - * - * Iterate through SIR/SDR command and look for TDI, TDO, MASK, etc. - * - *****************************************************************************/ - - while ((cDataByte = GetByte()) >= 0) { - - ispVMMemManager(cDataByte, g_usMaxSize); - switch (cDataByte) { - case TDI: - - /**************************************************************************** - * - * Store the maximum size of the TDI buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_usiDataSize > g_usTDISize) { - g_usTDISize = g_usiDataSize; - } - /**************************************************************************** - * - * Updated data type register to indicate that TDI data is currently being - * used. Process the data in the VME file into the TDI buffer. - * - *****************************************************************************/ - - g_usDataType |= TDI_DATA; - ispVMData(g_pucInData); - break; - case XTDO: - - /**************************************************************************** - * - * Store the maximum size of the TDO buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_usiDataSize > g_usTDOSize) { - g_usTDOSize = g_usiDataSize; - } - - /**************************************************************************** - * - * Updated data type register to indicate that TDO data is currently being - * used. - * - *****************************************************************************/ - - g_usDataType |= TDO_DATA; - break; - case TDO: - - /**************************************************************************** - * - * Store the maximum size of the TDO buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_usiDataSize > g_usTDOSize) { - g_usTDOSize = g_usiDataSize; - } - - /**************************************************************************** - * - * Updated data type register to indicate that TDO data is currently being - * used. Process the data in the VME file into the TDO buffer. - * - *****************************************************************************/ - - g_usDataType |= TDO_DATA; - ispVMData(g_pucOutData); - break; - case MASK: - - /**************************************************************************** - * - * Store the maximum size of the MASK buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_usiDataSize > g_usMASKSize) { - g_usMASKSize = g_usiDataSize; - } - - /**************************************************************************** - * - * Updated data type register to indicate that MASK data is currently being - * used. Process the data in the VME file into the MASK buffer. - * - *****************************************************************************/ - - g_usDataType |= MASK_DATA; - ispVMData(g_pucOutMaskData); - break; - case DMASK: - - /**************************************************************************** - * - * Store the maximum size of the DMASK buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_usiDataSize > g_usDMASKSize) { - g_usDMASKSize = g_usiDataSize; - } - - /**************************************************************************** - * - * Updated data type register to indicate that DMASK data is currently being - * used. Process the data in the VME file into the DMASK buffer. - * - *****************************************************************************/ - - g_usDataType |= DMASK_DATA; - ispVMData(g_pucOutDMaskData); - break; - case CMASK: - - /**************************************************************************** - * - * Updated data type register to indicate that CMASK data is currently being - * used. Process the data in the VME file into the CMASK buffer. - * - *****************************************************************************/ - - g_usDataType |= CMASK_DATA; - ispVMData(g_pucOutMaskData); - break; - case CONTINUE: - return (0); - default: - - /**************************************************************************** - * - * Encountered invalid opcode. - * - *****************************************************************************/ - - return (VME_INVALID_FILE); - } - - switch (cDataByte) { - case TDI: - - /**************************************************************************** - * - * Left bit shift. Used when performing algorithm looping. - * - *****************************************************************************/ - - if (g_usFlowControl & SHIFTLEFT) { - ispVMBitShift(SHL, g_usShiftValue); - g_usFlowControl &= ~SHIFTLEFT; - } - - /**************************************************************************** - * - * Right bit shift. Used when performing algorithm looping. - * - *****************************************************************************/ - - if (g_usFlowControl & SHIFTRIGHT) { - ispVMBitShift(SHR, g_usShiftValue); - g_usFlowControl &= ~SHIFTRIGHT; - } - default: - break; - } - - if (siDataSource) { - g_usDataType |= HEAP_IN; /*restore data from memory*/ - } - } - - if (siDataSource) { /*fetch data from heap memory upon return*/ - g_usDataType |= HEAP_IN; - } - - if (cDataByte < 0) { - - /**************************************************************************** - * - * Encountered invalid opcode. - * - *****************************************************************************/ - - return (VME_INVALID_FILE); - } else { - return (0); - } -} - -/*************************************************************** -* -* ispVMData -* Extract one row of data operand from the current data type opcode. Perform -* the decompression if necessary. Extra RAM is not required for the -* decompression process. The decompression scheme employed in this module -* is on row by row basis. The format of the data stream: -* [compression code][compressed data stream] -* 0x00 --No compression -* 0x01 --Compress by 0x00. -* Example: -* Original stream: 0x000000000000000000000001 -* Compressed stream: 0x01000901 -* Detail: 0x01 is the code, 0x00 is the key, -* 0x09 is the count of 0x00 bytes, -* 0x01 is the uncompressed byte. -* 0x02 --Compress by 0xFF. -* Example: -* Original stream: 0xFFFFFFFFFFFFFFFFFFFFFF01 -* Compressed stream: 0x02FF0901 -* Detail: 0x02 is the code, 0xFF is the key, -* 0x09 is the count of 0xFF bytes, -* 0x01 is the uncompressed byte. -* 0x03 -* : : -* 0xFE -- Compress by nibble blocks. -* Example: -* Original stream: 0x84210842108421084210 -* Compressed stream: 0x0584210 -* Detail: 0x05 is the code, means 5 nibbles block. -* 0x84210 is the 5 nibble blocks. -* The whole row is 80 bits given by g_usiDataSize. -* The number of times the block repeat itself -* is found by g_usiDataSize/(4*0x05) which is 4. -* 0xFF -- Compress by the most frequently happen byte. -* Example: -* Original stream: 0x04020401030904040404 -* Compressed stream: 0xFF04(0,1,0x02,0,1,0x01,1,0x03,1,0x09,0,0,0) -* or: 0xFF044090181C240 -* Detail: 0xFF is the code, 0x04 is the key. -* a bit of 0 represent the key shall be put into -* the current bit position and a bit of 1 -* represent copying the next of 8 bits of data -* in. -* -***************************************************************/ - -void ispVMData(unsigned char *ByteData) -{ - /* 09/11/07 NN added local variables initialization */ - unsigned short size = 0; - unsigned short i, j, m, getData = 0; - unsigned char cDataByte = 0; - unsigned char compress = 0; - unsigned short FFcount = 0; - unsigned char compr_char = 0xFF; - unsigned short index = 0; - signed char compression = 0; - - /* convert number in bits to bytes */ - if (g_usiDataSize % 8 > 0) { - /* 09/11/07 NN Type cast mismatch variables */ - size = (unsigned short)(g_usiDataSize / 8 + 1); - } else { - /* 09/11/07 NN Type cast mismatch variables */ - size = (unsigned short)(g_usiDataSize / 8); - } - - /* If there is compression, then check if compress by key of 0x00 or 0xFF - or by other keys or by nibble blocks*/ - - if (g_usDataType & COMPRESS) { - compression = 1; - if (((compress = GetByte()) == VAR) && (g_usDataType & HEAP_IN)) { - getData = 1; - g_usDataType &= ~(HEAP_IN); - compress = GetByte(); - } - - switch (compress) { - case 0x00: - /* No compression */ - compression = 0; - break; - case 0x01: - /* Compress by byte 0x00 */ - compr_char = 0x00; - break; - case 0x02: - /* Compress by byte 0xFF */ - compr_char = 0xFF; - break; - case 0xFF: - /* Huffman encoding */ - compr_char = GetByte(); - i = 8; - for (index = 0; index < size; index++) { - ByteData[index] = 0x00; - if (i > 7) { - cDataByte = GetByte(); - i = 0; - } - if ((cDataByte << i++) & 0x80) - m = 8; - else { - ByteData[index] = compr_char; - m = 0; - } - - for (j = 0; j < m; j++) { - if (i > 7) { - cDataByte = GetByte(); - i = 0; - } - ByteData[index] |= ((cDataByte << i++) & 0x80) >> j; - } - } - size = 0; - break; - default: - for (index = 0; index < size; index++) - ByteData[index] = 0x00; - for (index = 0; index < compress; index++) { - if (index % 2 == 0) - cDataByte = GetByte(); - for (i = 0; i < size * 2 / compress; i++) { - /* 09/11/07 NN Type cast mismatch variables */ - j = (unsigned short)(index + (i * (unsigned short)compress)); - /* clear the nibble to zero first */ - if (j % 2) { - if (index % 2) - ByteData[j / 2] |= cDataByte & 0x0F; - else - ByteData[j / 2] |= cDataByte >> 4; - } else { - if (index % 2) - ByteData[j / 2] |= cDataByte << 4; - else - ByteData[j / 2] |= cDataByte & 0xF0; - } - } - } - size = 0; - break; - } - } - - FFcount = 0; - - /* Decompress by byte 0x00 or 0xFF */ - for (index = 0; index < size; index++) { - if (FFcount <= 0) { - cDataByte = GetByte(); - if ((cDataByte == VAR) && (g_usDataType & HEAP_IN) && !getData && !(g_usDataType & COMPRESS)) { - getData = 1; - g_usDataType &= ~(HEAP_IN); - cDataByte = GetByte(); - } - ByteData[index] = cDataByte; - if ((compression) && (cDataByte == compr_char)) /* decompression is on */ - /* 09/11/07 NN Type cast mismatch variables */ - FFcount = (unsigned short)ispVMDataSize(); /* The number of 0xFF or 0x00 bytes */ - } else { - FFcount--; /* Use up the 0xFF chain first */ - ByteData[index] = compr_char; - } - } - - if (getData) { - g_usDataType |= HEAP_IN; - getData = 0; - } -} - -/*************************************************************** -* -* ispVMShift -* -* Processes the SDR/XSDR/SIR commands. -* -***************************************************************/ - -signed char ispVMShift(signed char a_cCode) -{ - /* 09/11/07 NN added local variables initialization */ - unsigned short iDataIndex = 0; - unsigned short iReadLoop = 0; - signed char cRetCode = 0; - - cRetCode = 0; - /* 09/11/07 NN Type cast mismatch variables */ - g_usiDataSize = (unsigned short)ispVMDataSize(); - - g_usDataType &= ~(SIR_DATA + EXPRESS + SDR_DATA); /* clear the flags first */ - - switch (a_cCode) { - case SIR: - g_usDataType |= SIR_DATA; - /* 1/15/04 If performing cascading, then go directly to SHIFTIR. Else, - go to IRPAUSE before going to SHIFTIR */ - if (g_usFlowControl & CASCADE) { - ispVMStateMachine(SHIFTIR); - } else { - ispVMStateMachine(IRPAUSE); - ispVMStateMachine(SHIFTIR); - if (g_usHeadIR > 0) { - ispVMBypass(HIR, g_usHeadIR); - sclock(); - } - } - break; - case XSDR: - g_usDataType |= EXPRESS; /* mark simultaneous in and out */ - case SDR: - g_usDataType |= SDR_DATA; - /* 1/15/04 If already in SHIFTDR, then do not move state or shift in header. - This would imply that the previously shifted frame was a cascaded frame. */ - if (g_cCurrentJTAGState != SHIFTDR) { - /* 1/15/04 If performing cascading, then go directly to SHIFTDR. Else, - go to DRPAUSE before going to SHIFTDR */ - if (g_usFlowControl & CASCADE) { - if (g_cCurrentJTAGState == DRPAUSE) { - ispVMStateMachine(SHIFTDR); - /* 1/15/04 If cascade flag has been set and the current state is - DRPAUSE, this implies that the first cascaded frame is about to - be shifted in. The header must be shifted prior to shifting - the first cascaded frame. */ - if (g_usHeadDR > 0) { - ispVMBypass(HDR, g_usHeadDR); - sclock(); - } - } else { - ispVMStateMachine(SHIFTDR); - } - } else { - ispVMStateMachine(DRPAUSE); - ispVMStateMachine(SHIFTDR); - if (g_usHeadDR > 0) { - ispVMBypass(HDR, g_usHeadDR); - sclock(); - } - } - } - break; - default: - return (VME_INVALID_FILE); - } - - cRetCode = ispVMDataCode(); - if (cRetCode != 0) { - return (VME_INVALID_FILE); - } - -#ifdef VME_DEBUG - if (g_usDataType & TDI_DATA) { - printf("\n\t\tTDI "); - PrintData(g_usiDataSize, g_pucInData); - } - - if (g_usDataType & TDO_DATA) { - printf("\n\t\tTDO "); - PrintData(g_usiDataSize, g_pucOutData); - } - - if (g_usDataType & MASK_DATA) { - printf("\n\t\tMASK "); - PrintData(g_usiDataSize, g_pucOutMaskData); - } - - if (g_usDataType & DMASK_DATA) { - printf("\n\t\tDMASK "); - PrintData(g_usiDataSize, g_pucOutDMaskData); - } - - printf(";\n"); -#endif /* VME_DEBUG */ - if (g_usDataType & TDO_DATA || g_usDataType & DMASK_DATA) { - if (g_usDataType & DMASK_DATA) { - - cRetCode = ispVMReadandSave(g_usiDataSize); - - if (!cRetCode) { - if (g_usTailDR > 0) { - sclock(); - ispVMBypass(TDR, g_usTailDR); - } - ispVMStateMachine(DRPAUSE); - ispVMStateMachine(SHIFTDR); - if (g_usHeadDR > 0) { - ispVMBypass(HDR, g_usHeadDR); - sclock(); - } - for (iDataIndex = 0; iDataIndex < g_usiDataSize / 8 + 1; iDataIndex++) - g_pucInData[iDataIndex] = g_pucOutData[iDataIndex]; - g_usDataType &= ~(TDO_DATA + DMASK_DATA); - cRetCode = ispVMSend(g_usiDataSize); - } - } else { - - cRetCode = ispVMRead(g_usiDataSize); - if (cRetCode == -1 && g_cVendor == XILINX) { - for (iReadLoop = 0; iReadLoop < 30; iReadLoop++) { - cRetCode = ispVMRead(g_usiDataSize); - if (!cRetCode) { - break; - } else { - ispVMStateMachine(DRPAUSE); /*Always DRPAUSE*/ - /*Bypass other devices when appropriate*/ - ispVMBypass(TDR, g_usTailDR); - ispVMStateMachine(g_ucEndDR); - ispVMStateMachine(IDLE); - ispVMDelay(1000); - } - } - } - } - } else { /* TDI only */ - cRetCode = ispVMSend(g_usiDataSize); - - } - - /* transfer the input data to the output buffer for the next verify */ - if ((g_usDataType & EXPRESS) || (a_cCode == SDR)) { - if (g_pucOutData) { - for (iDataIndex = 0; iDataIndex < g_usiDataSize / 8 + 1; iDataIndex++) - g_pucOutData[iDataIndex] = g_pucInData[iDataIndex]; - } - } - - switch (a_cCode) { - case SIR: - /* 1/15/04 If not performing cascading, then shift ENDIR */ - if (!(g_usFlowControl & CASCADE)) { - if (g_usTailIR > 0) { - sclock(); - ispVMBypass(TIR, g_usTailIR); - } - ispVMStateMachine(g_ucEndIR); - } - break; - case XSDR: - case SDR: - /* 1/15/04 If not performing cascading, then shift ENDDR */ - if (!(g_usFlowControl & CASCADE)) { - if (g_usTailDR > 0) { - sclock(); - ispVMBypass(TDR, g_usTailDR); - } - ispVMStateMachine(g_ucEndDR); - } - break; - default: - break; - } - - return (cRetCode); -} - -/*************************************************************** -* -* ispVMAmble -* -* This routine is to extract Header and Trailer parameter for SIR and -* SDR operations. -* -* The Header and Trailer parameter are the pre-amble and post-amble bit -* stream need to be shifted into TDI or out of TDO of the devices. Mostly -* is for the purpose of bypassing the leading or trailing devices. ispVM -* supports only shifting data into TDI to bypass the devices. -* -* For a single device, the header and trailer parameters are all set to 0 -* as default by ispVM. If it is for multiple devices, the header and trailer -* value will change as specified by the VME file. -* -***************************************************************/ - -signed char ispVMAmble(signed char Code) -{ - signed char compress = 0; - /* 09/11/07 NN Type cast mismatch variables */ - g_usiDataSize = (unsigned short)ispVMDataSize(); - -#ifdef VME_DEBUG - printf("%d", g_usiDataSize); -#endif /* VME_DEBUG */ - - if (g_usiDataSize) { - - /**************************************************************************** - * - * Discard the TDI byte and set the compression bit in the data type register - * to false if compression is set because TDI data after HIR/HDR/TIR/TDR is not - * compressed. - * - *****************************************************************************/ - - GetByte(); - if (g_usDataType & COMPRESS) { - g_usDataType &= ~(COMPRESS); - compress = 1; - } - } - - switch (Code) { - case HIR: - - /**************************************************************************** - * - * Store the maximum size of the HIR buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_usiDataSize > g_usHIRSize) { - g_usHIRSize = g_usiDataSize; - } - - /**************************************************************************** - * - * Assign the HIR value and allocate memory. - * - *****************************************************************************/ - - g_usHeadIR = g_usiDataSize; - if (g_usHeadIR) { - ispVMMemManager(HIR, g_usHeadIR); - ispVMData(g_pucHIRData); - -#ifdef VME_DEBUG - printf(" TDI "); - PrintData(g_usHeadIR, g_pucHIRData); -#endif /* VME_DEBUG */ - } - break; - case TIR: - - /**************************************************************************** - * - * Store the maximum size of the TIR buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_usiDataSize > g_usTIRSize) { - g_usTIRSize = g_usiDataSize; - } - - /**************************************************************************** - * - * Assign the TIR value and allocate memory. - * - *****************************************************************************/ - - g_usTailIR = g_usiDataSize; - if (g_usTailIR) { - ispVMMemManager(TIR, g_usTailIR); - ispVMData(g_pucTIRData); - -#ifdef VME_DEBUG - printf(" TDI "); - PrintData(g_usTailIR, g_pucTIRData); -#endif /* VME_DEBUG */ - } - break; - case HDR: - - /**************************************************************************** - * - * Store the maximum size of the HDR buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_usiDataSize > g_usHDRSize) { - g_usHDRSize = g_usiDataSize; - } - - /**************************************************************************** - * - * Assign the HDR value and allocate memory. - * - *****************************************************************************/ - - g_usHeadDR = g_usiDataSize; - if (g_usHeadDR) { - ispVMMemManager(HDR, g_usHeadDR); - ispVMData(g_pucHDRData); - -#ifdef VME_DEBUG - printf(" TDI "); - PrintData(g_usHeadDR, g_pucHDRData); -#endif /* VME_DEBUG */ - } - break; - case TDR: - - /**************************************************************************** - * - * Store the maximum size of the TDR buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_usiDataSize > g_usTDRSize) { - g_usTDRSize = g_usiDataSize; - } - - /**************************************************************************** - * - * Assign the TDR value and allocate memory. - * - *****************************************************************************/ - - g_usTailDR = g_usiDataSize; - if (g_usTailDR) { - ispVMMemManager(TDR, g_usTailDR); - ispVMData(g_pucTDRData); - -#ifdef VME_DEBUG - printf(" TDI "); - PrintData(g_usTailDR, g_pucTDRData); -#endif /* VME_DEBUG */ - } - break; - default: - break; - } - - /**************************************************************************** - * - * Re-enable compression if it was previously set. - * - *****************************************************************************/ - - if (compress) { - g_usDataType |= COMPRESS; - } - - if (g_usiDataSize) { - Code = GetByte(); - if (Code == CONTINUE) { - return 0; - } else { - - /**************************************************************************** - * - * Encountered invalid opcode. - * - *****************************************************************************/ - - return VME_INVALID_FILE; - } - } - - return 0; -} - -/*************************************************************** -* -* ispVMLoop -* -* Perform the function call upon by the REPEAT opcode. -* Memory is to be allocated to store the entire loop from REPEAT to ENDLOOP. -* After the loop is stored then execution begin. The REPEATLOOP flag is set -* on the g_usFlowControl register to indicate the repeat loop is in session -* and therefore fetch opcode from the memory instead of from the file. -* -***************************************************************/ - -signed char ispVMLoop(unsigned short a_usLoopCount) -{ - /* 09/11/07 NN added local variables initialization */ - signed char cRetCode = 0; - unsigned short iHeapIndex = 0; - unsigned short iLoopIndex = 0; - - g_usShiftValue = 0; - for (iHeapIndex = 0; iHeapIndex < g_iHEAPSize; iHeapIndex++) { - g_pucHeapMemory[iHeapIndex] = GetByte(); - } - - if (g_pucHeapMemory[iHeapIndex - 1] != ENDLOOP) { - return (VME_INVALID_FILE); - } - - g_usFlowControl |= REPEATLOOP; - g_usDataType |= HEAP_IN; - - for (iLoopIndex = 0; iLoopIndex < a_usLoopCount; iLoopIndex++) { - g_iHeapCounter = 0; - cRetCode = ispVMCode(); - g_usRepeatLoops++; - if (cRetCode < 0) { - break; - } - } - - g_usDataType &= ~(HEAP_IN); - g_usFlowControl &= ~(REPEATLOOP); - return (cRetCode); -} - -/*************************************************************** -* -* ispVMBitShift -* -* Shift the TDI stream left or right by the number of bits. The data in -* *g_pucInData is of the VME format, so the actual shifting is the reverse of -* IEEE 1532 or SVF format. -* -***************************************************************/ - -signed char ispVMBitShift(signed char mode, unsigned short bits) -{ - /* 09/11/07 NN added local variables initialization */ - unsigned short i = 0; - unsigned short size = 0; - unsigned short tmpbits = 0; - - if (g_usiDataSize % 8 > 0) { - /* 09/11/07 NN Type cast mismatch variables */ - size = (unsigned short)(g_usiDataSize / 8 + 1); - } else { - /* 09/11/07 NN Type cast mismatch variables */ - size = (unsigned short)(g_usiDataSize / 8); - } - - switch (mode) { - case SHR: - for (i = 0; i < size; i++) { - if (g_pucInData[i] != 0) { - tmpbits = bits; - while (tmpbits > 0) { - g_pucInData[i] <<= 1; - if (g_pucInData[i] == 0) { - i--; - g_pucInData[i] = 1; - } - tmpbits--; - } - } - } - break; - case SHL: - for (i = 0; i < size; i++) { - if (g_pucInData[i] != 0) { - tmpbits = bits; - while (tmpbits > 0) { - g_pucInData[i] >>= 1; - if (g_pucInData[i] == 0) { - i--; - g_pucInData[i] = 8; - } - tmpbits--; - } - } - } - break; - default: - return (VME_INVALID_FILE); - } - - return (0); -} - -/*************************************************************** -* -* ispVMComment -* -* Displays the SVF comments. -* -***************************************************************/ - -void ispVMComment(unsigned short a_usCommentSize) -{ - char cCurByte = 0; - int count = 0; - for (; a_usCommentSize > 0; a_usCommentSize--) { - /**************************************************************************** - * - * Print character to the terminal. - * - *****************************************************************************/ - cCurByte = GetByte(); - vme_out_char(cCurByte); - count ++ ; - } - cCurByte = '\n'; - vme_out_char(cCurByte); -} - -/*************************************************************** -* -* ispVMHeader -* -* Iterate the length of the header and discard it. -* -***************************************************************/ - -void ispVMHeader(unsigned short a_usHeaderSize) -{ - for (; a_usHeaderSize > 0; a_usHeaderSize--) { - GetByte(); - } -} - -/*************************************************************** -* -* ispVMCalculateCRC32 -* -* Calculate the 32-bit CRC. -* -***************************************************************/ - -void ispVMCalculateCRC32(unsigned char a_ucData) -{ - /* 09/11/07 NN added local variables initialization */ - unsigned char ucIndex = 0; - unsigned char ucFlipData = 0; - unsigned short usCRCTableEntry = 0; - unsigned int crc_table[16] = { - 0x0000, 0xCC01, 0xD801, - 0x1400, 0xF001, 0x3C00, - 0x2800, 0xE401, 0xA001, - 0x6C00, 0x7800, 0xB401, - 0x5000, 0x9C01, 0x8801, - 0x4400 - }; - - for (ucIndex = 0; ucIndex < 8; ucIndex++) { - ucFlipData <<= 1; - if (a_ucData & 0x01) { - ucFlipData |= 0x01; - } - a_ucData >>= 1; - } - - /* 09/11/07 NN Type cast mismatch variables */ - usCRCTableEntry = (unsigned short)(crc_table[g_usCalculatedCRC & 0xF]); - g_usCalculatedCRC = (unsigned short)((g_usCalculatedCRC >> 4) & 0x0FFF); - g_usCalculatedCRC = (unsigned short)(g_usCalculatedCRC ^ usCRCTableEntry ^ crc_table[ucFlipData & 0xF]); - usCRCTableEntry = (unsigned short)(crc_table[g_usCalculatedCRC & 0xF]); - g_usCalculatedCRC = (unsigned short)((g_usCalculatedCRC >> 4) & 0x0FFF); - g_usCalculatedCRC = (unsigned short)(g_usCalculatedCRC ^ usCRCTableEntry ^ crc_table[(ucFlipData >> 4) & 0xF]); -} - -/*************************************************************** -* -* ispVMLCOUNT -* -* Process the intelligent programming loops. -* -***************************************************************/ - -signed char ispVMLCOUNT(unsigned short a_usCountSize) -{ - unsigned short usContinue = 1; - unsigned short usIntelBufferIndex = 0; - unsigned short usCountIndex = 0; - signed char cRetCode = 0; - signed char cRepeatHeap = 0; - signed char cOpcode = 0; - unsigned char ucState = 0; - unsigned short usDelay = 0; - unsigned short usToggle = 0; - unsigned char usByte = 0; - - g_usIntelBufferSize = (unsigned short)ispVMDataSize(); - - /**************************************************************************** - * - * Allocate memory for intel buffer. - * - *****************************************************************************/ - - ispVMMemManager(LHEAP, g_usIntelBufferSize); - - /**************************************************************************** - * - * Store the maximum size of the intelligent buffer. Used to convert VME to HEX. - * - *****************************************************************************/ - - if (g_usIntelBufferSize > g_usLCOUNTSize) { - g_usLCOUNTSize = g_usIntelBufferSize; - } - - /**************************************************************************** - * - * Copy intel data to the buffer. - * - *****************************************************************************/ - - for (usIntelBufferIndex = 0; usIntelBufferIndex < g_usIntelBufferSize; usIntelBufferIndex++) { - g_pucIntelBuffer[usIntelBufferIndex] = GetByte(); - } - - /**************************************************************************** - * - * Set the data type register to get data from the intelligent data buffer. - * - *****************************************************************************/ - - g_usDataType |= LHEAP_IN; - - /**************************************************************************** - * - * If the HEAP_IN flag is set, temporarily unset the flag so data will be - * retrieved from the status buffer. - * - *****************************************************************************/ - - if (g_usDataType & HEAP_IN) { - g_usDataType &= ~HEAP_IN; - cRepeatHeap = 1; - } - -#ifdef VME_DEBUG - printf("LCOUNT %d;\n", a_usCountSize); -#endif /* VME_DEBUG */ - - /**************************************************************************** - * - * Iterate through the intelligent programming command. - * - *****************************************************************************/ - - for (usCountIndex = 0; usCountIndex < a_usCountSize; usCountIndex++) { - - /**************************************************************************** - * - * Initialize the intel data index to 0 before each iteration. - * - *****************************************************************************/ - - g_usIntelDataIndex = 0; - cOpcode = 0; - ucState = 0; - usDelay = 0; - usToggle = 0; - usByte = 0; - usContinue = 1; - - /*************************************************************** - * - * Begin looping through all the VME opcodes. - * - ***************************************************************/ - /*************************************************************** - * 4/1/09 Nguyen replaced the recursive function call codes on - * the ispVMLCOUNT function - * - ***************************************************************/ - while (usContinue) { - cOpcode = GetByte(); - switch (cOpcode) { - case HIR: - case TIR: - case HDR: - case TDR: - /*************************************************************** - * - * Set the header/trailer of the device in order to bypass - * successfully. - * - ***************************************************************/ - - ispVMAmble(cOpcode); - break; - case STATE: - - /*************************************************************** - * - * Step the JTAG state machine. - * - ***************************************************************/ - - ucState = GetByte(); - /*************************************************************** - * - * Step the JTAG state machine to DRCAPTURE to support Looping. - * - ***************************************************************/ - - if ((g_usDataType & LHEAP_IN) && - (ucState == DRPAUSE) && - (g_cCurrentJTAGState == ucState)) { - ispVMStateMachine(DRCAPTURE); - } - ispVMStateMachine(ucState); -#ifdef VME_DEBUG - printf("LDELAY %s ", GetState(ucState)); -#endif /* VME_DEBUG */ - break; - case SIR: -#ifdef VME_DEBUG - printf("SIR "); -#endif /* VME_DEBUG */ - /*************************************************************** - * - * Shift in data into the device. - * - ***************************************************************/ - - cRetCode = ispVMShift(cOpcode); - break; - case SDR: - -#ifdef VME_DEBUG - printf("LSDR "); -#endif /* VME_DEBUG */ - /*************************************************************** - * - * Shift in data into the device. - * - ***************************************************************/ - - cRetCode = ispVMShift(cOpcode); - break; - case WAIT: - - /*************************************************************** - * - * Observe delay. - * - ***************************************************************/ - - usDelay = (unsigned short)ispVMDataSize(); - ispVMDelay(usDelay); - -#ifdef VME_DEBUG - if (usDelay & 0x8000) { - - /*************************************************************** - * - * Since MSB is set, the delay time must be decoded to - * millisecond. The SVF2VME encodes the MSB to represent - * millisecond. - * - ***************************************************************/ - - usDelay &= ~0x8000; - printf("%.2E SEC;\n", (float)usDelay / 1000); - } else { - - /*************************************************************** - * - * Since MSB is not set, the delay time is given as microseconds. - * - ***************************************************************/ - - printf("%.2E SEC;\n", (float)usDelay / 1000000); - } -#endif /* VME_DEBUG */ - break; - case TCK: - - /*************************************************************** - * - * Issue clock toggles. - * - ***************************************************************/ - - usToggle = (unsigned short)ispVMDataSize(); - ispVMClocks(usToggle); - -#ifdef VME_DEBUG - printf("RUNTEST %d TCK;\n", usToggle); -#endif /* VME_DEBUG */ - break; - case ENDLOOP: - - /*************************************************************** - * - * Exit point from processing loops. - * - ***************************************************************/ - usContinue = 0; - break; - - case COMMENT: - - /*************************************************************** - * - * Display comment. - * - ***************************************************************/ - - ispVMComment((unsigned short)ispVMDataSize()); - break; - case ispEN: - ucState = GetByte(); - if ((ucState == ON) || (ucState == 0x01)) - writePort(JTAG_ENABLE, 0x01); - else - writePort(JTAG_ENABLE, 0x00); - ispVMDelay(1); - break; - case TRST: - if (GetByte() == 0x01) - writePort(JTAG_TRST, 0x01); - else - writePort(JTAG_TRST, 0x00); - ispVMDelay(1); - break; - default: - - /*************************************************************** - * - * Invalid opcode encountered. - * - ***************************************************************/ - -#ifdef VME_DEBUG - printf("\nINVALID OPCODE: 0x%.2X\n", cOpcode); -#endif /* VME_DEBUG */ - - return VME_INVALID_FILE; - } - } - if (cRetCode >= 0) { - /**************************************************************************** - * - * Break if intelligent programming is successful. - * - *****************************************************************************/ - - break; - } - - } - /**************************************************************************** - * - * If HEAP_IN flag was temporarily disabled, re-enable it before exiting. - * - *****************************************************************************/ - - if (cRepeatHeap) { - g_usDataType |= HEAP_IN; - } - - /**************************************************************************** - * - * Set the data type register to not get data from the intelligent data buffer. - * - *****************************************************************************/ - - g_usDataType &= ~LHEAP_IN; - return cRetCode; -} - -/*************************************************************** -* -* ispVMClocks -* -* Applies the specified number of pulses to TCK. -* -***************************************************************/ - -void ispVMClocks(unsigned short Clocks) -{ - unsigned short iClockIndex = 0; - for (iClockIndex = 0; iClockIndex < Clocks; iClockIndex++) { - sclock(); - } -} - -/*************************************************************** -* -* ispVMBypass -* -* This procedure takes care of the HIR, HDR, TIR, TDR for the -* purpose of putting the other devices into Bypass mode. The -* current state is checked to find out if it is at DRPAUSE or -* IRPAUSE. If it is at DRPAUSE, perform bypass register scan. -* If it is at IRPAUSE, scan into instruction registers the bypass -* instruction. -* -***************************************************************/ - -void ispVMBypass(signed char ScanType, unsigned short Bits) -{ - /* 09/11/07 NN added local variables initialization */ - unsigned short iIndex = 0; - unsigned short iSourceIndex = 0; - unsigned char cBitState = 0; - unsigned char cCurByte = 0; - unsigned char *pcSource = NULL; - - if (Bits <= 0) { - return; - } - - switch (ScanType) { - case HIR: - pcSource = g_pucHIRData; - break; - case TIR: - pcSource = g_pucTIRData; - break; - case HDR: - pcSource = g_pucHDRData; - break; - case TDR: - pcSource = g_pucTDRData; - break; - default: - break; - } - if (pcSource) { - iSourceIndex = 0; - cBitState = 0; - for (iIndex = 0; iIndex < Bits - 1; iIndex++) { - /* Scan instruction or bypass register */ - if (iIndex % 8 == 0) { - cCurByte = pcSource[iSourceIndex++]; - } - cBitState = (unsigned char)(((cCurByte << iIndex % 8) & 0x80) ? 0x01 : 0x00); - writePort(JTAG_TDI, cBitState); - sclock(); - } - - if (iIndex % 8 == 0) { - cCurByte = pcSource[iSourceIndex++]; - } - - cBitState = (unsigned char)(((cCurByte << iIndex % 8) & 0x80) ? 0x01 : 0x00); - writePort(JTAG_TDI, cBitState); - } -} - -/*************************************************************** -* -* ispVMStateMachine -* -* This procedure steps all devices in the daisy chain from a given -* JTAG state to the next desirable state. If the next state is TLR, -* the JTAG state machine is brute forced into TLR by driving TMS -* high and pulse TCK 6 times. -* -***************************************************************/ - -void ispVMStateMachine(signed char cNextJTAGState) -{ - /* 09/11/07 NN added local variables initialization */ - signed char cPathIndex = 0; - signed char cStateIndex = 0; - short int found = 0; - - if ((g_cCurrentJTAGState == cNextJTAGState) && (cNextJTAGState != RESET)) { - return; - } - - for (cStateIndex = 0; cStateIndex < 25; cStateIndex++) { - if ((g_cCurrentJTAGState == g_JTAGTransistions[cStateIndex].CurState) && (cNextJTAGState == g_JTAGTransistions[cStateIndex].NextState)) { - found = 1; - break; - } - } - if (found) { - g_cCurrentJTAGState = cNextJTAGState; - for (cPathIndex = 0; cPathIndex < g_JTAGTransistions[cStateIndex].Pulses; cPathIndex++) { - if ((g_JTAGTransistions[cStateIndex].Pattern << cPathIndex) & 0x80) { - writePort(JTAG_TMS, (unsigned char)0x01); - } else { - writePort(JTAG_TMS, (unsigned char)0x00); - } - sclock(); - } - - writePort(JTAG_TDI, 0x00); - writePort(JTAG_TMS, 0x00); - } -} - -/*************************************************************** -* -* ispVMStart -* -* Enable the port to the device and set the state to RESET (TLR). -* -***************************************************************/ - -void ispVMStart() -{ -#ifdef VME_DEBUG - printf("// ISPVM EMBEDDED ADDED\n"); - printf("STATE RESET;\n"); -#endif - - ispVMStateMachine(RESET); /* step devices to RESET state */ - -} - -/*************************************************************** -* -* ispVMEnd -* -* Set the state of devices to RESET to enable the devices and disable -* the port. -* -***************************************************************/ - -void ispVMEnd() -{ -#ifdef VME_DEBUG - printf("// ISPVM EMBEDDED ADDED\n"); - printf("STATE RESET;\n"); - printf("RUNTEST 1.00E-001 SEC;\n"); -#endif - - ispVMStateMachine(RESET); /* step devices to RESET state */ - ispVMDelay(1000); /* wake up devices */ -} - -/*************************************************************** -* -* ispVMSend -* -* Send the TDI data stream to devices. The data stream can be -* instructions or data. -* -***************************************************************/ - -signed char ispVMSend(unsigned short a_usiDataSize) -{ - /* 09/11/07 NN added local variables initialization */ - unsigned short iIndex = 0; - unsigned short iInDataIndex = 0; - unsigned char cCurByte = 0; - unsigned char cBitState = 0; - - for (iIndex = 0; iIndex < a_usiDataSize - 1; iIndex++) { - if (iIndex % 8 == 0) { - cCurByte = g_pucInData[iInDataIndex++]; - } - cBitState = (unsigned char)(((cCurByte << iIndex % 8) & 0x80) ? 0x01 : 0x00); - writePort(JTAG_TDI, cBitState); - sclock(); - } - - if (iIndex % 8 == 0) { - /* Take care of the last bit */ - cCurByte = g_pucInData[iInDataIndex]; - } - - cBitState = (unsigned char)(((cCurByte << iIndex % 8) & 0x80) ? 0x01 : 0x00); - - writePort(JTAG_TDI, cBitState); - if (g_usFlowControl & CASCADE) { - /* 1/15/04 Clock in last bit for the first n-1 cascaded frames */ - sclock(); - } - - return 0; -} - -/*************************************************************** -* -* ispVMRead -* -* Read the data stream from devices and verify. -* -***************************************************************/ - -signed char ispVMRead(unsigned short a_usiDataSize) -{ - /* 09/11/07 NN added local variables initialization */ - unsigned short usDataSizeIndex = 0; - unsigned short usErrorCount = 0; - unsigned short usLastBitIndex = 0; - unsigned char cDataByte = 0; - unsigned char cMaskByte = 0; - unsigned char cInDataByte = 0; - unsigned char cCurBit = 0; - unsigned char cByteIndex = 0; - unsigned short usBufferIndex = 0; - unsigned char ucDisplayByte = 0x00; - unsigned char ucDisplayFlag = 0x01; - char StrChecksum[256] = { 0 }; - unsigned char g_usCalculateChecksum = 0x00; - - /* 09/11/07 NN Type cast mismatch variables */ - usLastBitIndex = (unsigned short)(a_usiDataSize - 1); - - /**************************************************************************** - * - * If mask is not all zeros, then set the display flag to 0x00, otherwise - * it shall be set to 0x01 to indicate that data read from the device shall - * be displayed. If VME_DEBUG is defined, always display data. - * - *****************************************************************************/ - - - for (usDataSizeIndex = 0; usDataSizeIndex < (a_usiDataSize + 7) / 8; usDataSizeIndex++) { - - if (g_usDataType & MASK_DATA) { - if (g_pucOutMaskData[usDataSizeIndex] != 0x00) { - ucDisplayFlag = 0x00; - break; - } - } else if (g_usDataType & CMASK_DATA) { - g_usCalculateChecksum = 0x01; - ucDisplayFlag = 0x00; - break; - } else { - ucDisplayFlag = 0x00; - break; - } - } - - /**************************************************************************** - * - * Begin shifting data in and out of the device. - * - *****************************************************************************/ - for (usDataSizeIndex = 0; usDataSizeIndex < a_usiDataSize; usDataSizeIndex++) { - if (cByteIndex == 0) { - - /*************************************************************** - * - * Grab byte from TDO buffer. - * - ***************************************************************/ - - if (g_usDataType & TDO_DATA) { - cDataByte = g_pucOutData[usBufferIndex]; - } - - /*************************************************************** - * - * Grab byte from MASK buffer. - * - ***************************************************************/ - - if (g_usDataType & MASK_DATA) { - cMaskByte = g_pucOutMaskData[usBufferIndex]; - } else { - cMaskByte = 0xFF; - } - - /*************************************************************** - * - * Grab byte from CMASK buffer. - * - ***************************************************************/ - - if (g_usDataType & CMASK_DATA) { - cMaskByte = 0x00; - g_usCalculateChecksum = 0x01; - } - - /*************************************************************** - * - * Grab byte from TDI buffer. - * - ***************************************************************/ - - if (g_usDataType & TDI_DATA) { - cInDataByte = g_pucInData[usBufferIndex]; - } - - usBufferIndex++; - } - - cCurBit = readPort(); - - if (ucDisplayFlag) { - ucDisplayByte <<= 1; - ucDisplayByte |= cCurBit; - } - - /**************************************************************************** - * - * Check if data read from port matches with expected TDO. - * - *****************************************************************************/ - - - if (g_usDataType & TDO_DATA) { - /* 08/28/08 NN Added Calculate checksum support. */ - if (g_usCalculateChecksum) { - if (cCurBit == 0x01) - g_usChecksum += (1 << (g_uiChecksumIndex % 8)); - g_uiChecksumIndex++; - } else { - if ((((cMaskByte << cByteIndex) & 0x80) ? 0x01 : 0x00)) { - if (cCurBit != (unsigned char)(((cDataByte << cByteIndex) & 0x80) ? 0x01 : 0x00)) { - usErrorCount++; - } - } - } - } - - /**************************************************************************** - * - * Write TDI data to the port. - * - *****************************************************************************/ - - writePort(JTAG_TDI, (unsigned char)(((cInDataByte << cByteIndex) & 0x80) ? 0x01 : 0x00)); - - if (usDataSizeIndex < usLastBitIndex) { - - /**************************************************************************** - * - * Clock data out from the data shift register. - * - *****************************************************************************/ - - sclock(); - } else if (g_usFlowControl & CASCADE) { - - /**************************************************************************** - * - * Clock in last bit for the first N - 1 cascaded frames. - * - *****************************************************************************/ - - sclock(); - } - - /*************************************************************** - * - * Increment the byte index. If it exceeds 7, then reset it back - * to zero. - * - ***************************************************************/ - - cByteIndex++; - if (cByteIndex >= 8) { - if (ucDisplayFlag) { - - /*************************************************************** - * - * Store displayed data in the TDO buffer. By reusing the TDO - * buffer to store displayed data, there is no need to allocate - * a buffer simply to hold display data. This will not cause any - * false verification errors because the true TDO byte has already - * been consumed. - * - ***************************************************************/ - - g_pucOutData[usBufferIndex - 1] = ucDisplayByte; - ucDisplayByte = 0; - } - - cByteIndex = 0; - } - /* 09/12/07 Nguyen changed to display the 1 bit expected data */ - else if (a_usiDataSize == 1) { - if (ucDisplayFlag) { - - /*************************************************************** - * - * Store displayed data in the TDO buffer. By reusing the TDO - * buffer to store displayed data, there is no need to allocate - * a buffer simply to hold display data. This will not cause any - * false verification errors because the true TDO byte has already - * been consumed. - * - ***************************************************************/ - - /**************************************************************************** - * - * Flip ucDisplayByte and store it in cDataByte. - * - *****************************************************************************/ - cDataByte = 0x00; - for (usBufferIndex = 0; usBufferIndex < 8; usBufferIndex++) { - cDataByte <<= 1; - if (ucDisplayByte & 0x01) { - cDataByte |= 0x01; - } - ucDisplayByte >>= 1; - } - g_pucOutData[0] = cDataByte; - ucDisplayByte = 0; - } - - cByteIndex = 0; - } - } - if (ucDisplayFlag) { - - /**************************************************************************** - * - * Display data read from the device. - * - *****************************************************************************/ - -#ifdef VME_DEBUG - printf("RECIEVED TDO ("); -#else - vme_out_string("Display Data: 0x"); -#endif /* VME_DEBUG */ - - /* 09/11/07 NN Type cast mismatch variables */ - for (usDataSizeIndex = (unsigned short)((a_usiDataSize + 7) / 8); usDataSizeIndex > 0; usDataSizeIndex--) { - cMaskByte = g_pucOutData[usDataSizeIndex - 1]; - cDataByte = 0x00; - - /**************************************************************************** - * - * Flip cMaskByte and store it in cDataByte. - * - *****************************************************************************/ - - for (usBufferIndex = 0; usBufferIndex < 8; usBufferIndex++) { - cDataByte <<= 1; - if (cMaskByte & 0x01) { - cDataByte |= 0x01; - } - cMaskByte >>= 1; - } -#ifdef VME_DEBUG - printf("%.2X", cDataByte); - if ((((a_usiDataSize + 7) / 8) - usDataSizeIndex) % 40 == 39) { - printf("\n\t\t"); - } -#else - vme_out_hex(cDataByte); -#endif /* VME_DEBUG */ - } - -#ifdef VME_DEBUG - printf(")\n\n"); -#else - vme_out_string("\n\n"); -#endif /* VME_DEBUG */ - /* 09/02/08 Nguyen changed to display the data Checksum */ - vme_out_string("g_usChecksum:"); - sprintf(StrChecksum, "%.4X\n\n", (unsigned int)g_usChecksum); - vme_out_string(StrChecksum); - vme_out_string("\n\n"); - if (g_usChecksum != 0) { - g_usChecksum &= 0xFFFF; - sprintf(StrChecksum, "Data Checksum: %.4X\n\n", (unsigned int)g_usChecksum); - vme_out_string(StrChecksum); - g_usChecksum = 0; - } - } - - if (usErrorCount > 0) { - - if (g_usFlowControl & VERIFYUES) { - vme_out_string("USERCODE verification failed. Continue programming......\n\n"); - g_usFlowControl &= ~(VERIFYUES); - return 0; - } else { - -#ifdef VME_DEBUG - printf("TOTAL ERRORS: %d\n", usErrorCount); -#endif /* VME_DEBUG */ - - return VME_VERIFICATION_FAILURE; - } - } else { - if (g_usFlowControl & VERIFYUES) { - vme_out_string("USERCODE verification passed. Programming aborted. \n\n"); - g_usFlowControl &= ~(VERIFYUES); - return 1; - } else { - return 0; - } - } -} - -/*************************************************************** -* -* ispVMReadandSave -* -* Support dynamic I/O. -* -***************************************************************/ - -signed char ispVMReadandSave(unsigned short int a_usiDataSize) -{ - /* 09/11/07 NN added local variables initialization */ - unsigned short int usDataSizeIndex = 0; - unsigned short int usLastBitIndex = 0; - unsigned short int usBufferIndex = 0; - unsigned short int usOutBitIndex = 0; - unsigned short int usLVDSIndex = 0; - unsigned char cDataByte = 0; - unsigned char cDMASKByte = 0; - unsigned char cInDataByte = 0; - unsigned char cCurBit = 0; - unsigned char cByteIndex = 0; - signed char cLVDSByteIndex = 0; - - /* 09/11/07 NN Type cast mismatch variables */ - usLastBitIndex = (unsigned short)(a_usiDataSize - 1); - - /*************************************************************** - * - * Iterate through the data bits. - * - ***************************************************************/ - - for (usDataSizeIndex = 0; usDataSizeIndex < a_usiDataSize; usDataSizeIndex++) { - if (cByteIndex == 0) { - - /*************************************************************** - * - * Grab byte from DMASK buffer. - * - ***************************************************************/ - - if (g_usDataType & DMASK_DATA) { - cDMASKByte = g_pucOutDMaskData[usBufferIndex]; - } else { - cDMASKByte = 0x00; - } - - /*************************************************************** - * - * Grab byte from TDI buffer. - * - ***************************************************************/ - - if (g_usDataType & TDI_DATA) { - cInDataByte = g_pucInData[usBufferIndex]; - } - - usBufferIndex++; - } - - cCurBit = readPort(); - cDataByte = (unsigned char)(((cInDataByte << cByteIndex) & 0x80) ? 0x01 : 0x00); - - /*************************************************************** - * - * Initialize the byte to be zero. - * - ***************************************************************/ - - if (usOutBitIndex % 8 == 0) { - g_pucOutData[usOutBitIndex / 8] = 0x00; - } - - /*************************************************************** - * - * Use TDI, DMASK, and device TDO to create new TDI (actually - * stored in g_pucOutData). - * - ***************************************************************/ - - if ((((cDMASKByte << cByteIndex) & 0x80) ? 0x01 : 0x00)) { - - if (g_pLVDSList) { - for (usLVDSIndex = 0; usLVDSIndex < g_usLVDSPairCount; usLVDSIndex++) { - if (g_pLVDSList[usLVDSIndex].usNegativeIndex == usDataSizeIndex) { - g_pLVDSList[usLVDSIndex].ucUpdate = 0x01; - break; - } - } - } - - /*************************************************************** - * - * DMASK bit is 1, use TDI. - * - ***************************************************************/ - - g_pucOutData[usOutBitIndex / 8] |= (unsigned char)(((cDataByte & 0x1) ? 0x01 : 0x00) << (7 - usOutBitIndex % 8)); - } else { - - /*************************************************************** - * - * DMASK bit is 0, use device TDO. - * - ***************************************************************/ - - g_pucOutData[usOutBitIndex / 8] |= (unsigned char)(((cCurBit & 0x1) ? 0x01 : 0x00) << (7 - usOutBitIndex % 8)); - } - - /*************************************************************** - * - * Shift in TDI in order to get TDO out. - * - ***************************************************************/ - - usOutBitIndex++; - writePort(JTAG_TDI, cDataByte); - if (usDataSizeIndex < usLastBitIndex) { - sclock(); - } - - /*************************************************************** - * - * Increment the byte index. If it exceeds 7, then reset it back - * to zero. - * - ***************************************************************/ - - cByteIndex++; - if (cByteIndex >= 8) { - cByteIndex = 0; - } - } - - /*************************************************************** - * - * If g_pLVDSList exists and pairs need updating, then update - * the negative-pair to receive the flipped positive-pair value. - * - ***************************************************************/ - - if (g_pLVDSList) { - for (usLVDSIndex = 0; usLVDSIndex < g_usLVDSPairCount; usLVDSIndex++) { - if (g_pLVDSList[usLVDSIndex].ucUpdate) { - - /*************************************************************** - * - * Read the positive value and flip it. - * - ***************************************************************/ - - cDataByte = (unsigned char)(((g_pucOutData[g_pLVDSList[usLVDSIndex].usPositiveIndex / 8] << (g_pLVDSList[usLVDSIndex].usPositiveIndex % 8)) & 0x80) ? 0x01 : 0x00); - //09/11/07 NN Type cast mismatch variables - cDataByte = (unsigned char)(!cDataByte); - - /*************************************************************** - * - * Get the byte that needs modification. - * - ***************************************************************/ - - cInDataByte = g_pucOutData[g_pLVDSList[usLVDSIndex].usNegativeIndex / 8]; - - if (cDataByte) { - - /*************************************************************** - * - * Copy over the current byte and set the negative bit to 1. - * - ***************************************************************/ - - cDataByte = 0x00; - for (cLVDSByteIndex = 7; cLVDSByteIndex >= 0; cLVDSByteIndex--) { - cDataByte <<= 1; - if (7 - (g_pLVDSList[usLVDSIndex].usNegativeIndex % 8) == cLVDSByteIndex) { - - /*************************************************************** - * - * Set negative bit to 1. - * - ***************************************************************/ - - cDataByte |= 0x01; - } else if (cInDataByte & 0x80) { - cDataByte |= 0x01; - } - - cInDataByte <<= 1; - } - - /*************************************************************** - * - * Store the modified byte. - * - ***************************************************************/ - - g_pucOutData[g_pLVDSList[usLVDSIndex].usNegativeIndex / 8] = cDataByte; - } else { - - /*************************************************************** - * - * Copy over the current byte and set the negative bit to 0. - * - ***************************************************************/ - - cDataByte = 0x00; - for (cLVDSByteIndex = 7; cLVDSByteIndex >= 0; cLVDSByteIndex--) { - cDataByte <<= 1; - if (7 - (g_pLVDSList[usLVDSIndex].usNegativeIndex % 8) == cLVDSByteIndex) { - - /*************************************************************** - * - * Set negative bit to 0. - * - ***************************************************************/ - - cDataByte |= 0x00; - } else if (cInDataByte & 0x80) { - cDataByte |= 0x01; - } - - cInDataByte <<= 1; - } - - /*************************************************************** - * - * Store the modified byte. - * - ***************************************************************/ - - g_pucOutData[g_pLVDSList[usLVDSIndex].usNegativeIndex / 8] = cDataByte; - } - - break; - } - } - } - - return (0); -} - -signed char ispVMProcessLVDS(unsigned short a_usLVDSCount) -{ - unsigned short usLVDSIndex = 0; - - /*************************************************************** - * - * Allocate memory to hold LVDS pairs. - * - ***************************************************************/ - - ispVMMemManager(LVDS, a_usLVDSCount); - g_usLVDSPairCount = a_usLVDSCount; - -#ifdef VME_DEBUG - printf("LVDS %d (", a_usLVDSCount); -#endif /* VME_DEBUG */ - - /*************************************************************** - * - * Iterate through each given LVDS pair. - * - ***************************************************************/ - - for (usLVDSIndex = 0; usLVDSIndex < g_usLVDSPairCount; usLVDSIndex++) { - - /*************************************************************** - * - * Assign the positive and negative indices of the LVDS pair. - * - ***************************************************************/ - - /* 09/11/07 NN Type cast mismatch variables */ - g_pLVDSList[usLVDSIndex].usPositiveIndex = (unsigned short)ispVMDataSize(); - /* 09/11/07 NN Type cast mismatch variables */ - g_pLVDSList[usLVDSIndex].usNegativeIndex = (unsigned short)ispVMDataSize(); - -#ifdef VME_DEBUG - if (usLVDSIndex < g_usLVDSPairCount - 1) { - printf("%d:%d, ", g_pLVDSList[usLVDSIndex].usPositiveIndex, g_pLVDSList[usLVDSIndex].usNegativeIndex); - } else { - printf("%d:%d", g_pLVDSList[usLVDSIndex].usPositiveIndex, g_pLVDSList[usLVDSIndex].usNegativeIndex); - } -#endif /* VME_DEBUG */ - - } - -#ifdef VME_DEBUG - printf(") -- %d;\n", a_usLVDSCount); -#endif /* VME_DEBUG */ - - return (0); -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/vmopcode.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/vmopcode.h deleted file mode 100644 index 1c0277306b..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/firmware_upgrade/firmware_upgrade_ispvme/vmopcode.h +++ /dev/null @@ -1,192 +0,0 @@ -/*************************************************************** -* -* This is the include file for Lattice Semiconductor's ispVM -* Embedded software application. -* -***************************************************************/ - -/*************************************************************** -* -* VME version. -* -* History: -* -***************************************************************/ - -#define VME_VERSION_NUMBER "12.2" - -/*************************************************************** -* -* Maximum declarations. -* -***************************************************************/ - -#define VMEHEXMAX 60000L /* The hex file is split 60K per file. */ -#define SCANMAX 64000L /* The maximum SDR/SIR burst. */ - -/*************************************************************** -* -* Supported JTAG state transitions. -* -***************************************************************/ - -#define RESET 0x00 -#define IDLE 0x01 -#define IRPAUSE 0x02 -#define DRPAUSE 0x03 -#define SHIFTIR 0x04 -#define SHIFTDR 0x05 -#define DRCAPTURE 0x06 - -/*************************************************************** -* -* Flow control register bit definitions. A set bit indicates -* that the register currently exhibits the corresponding mode. -* -***************************************************************/ - -#define INTEL_PRGM 0x0001 /* Intelligent programming is in effect. */ -#define CASCADE 0x0002 /* Currently splitting large SDR. */ -#define REPEATLOOP 0x0008 /* Currently executing a repeat loop. */ -#define SHIFTRIGHT 0x0080 /* The next data stream needs a right shift. */ -#define SHIFTLEFT 0x0100 /* The next data stream needs a left shift. */ -#define VERIFYUES 0x0200 /* Continue if fail is in effect. */ - -/*************************************************************** -* -* DataType register bit definitions. A set bit indicates -* that the register currently holds the corresponding type of data. -* -***************************************************************/ - -#define EXPRESS 0x0001 /* Simultaneous program and verify. */ -#define SIR_DATA 0x0002 /* SIR is the active SVF command. */ -#define SDR_DATA 0x0004 /* SDR is the active SVF command. */ -#define COMPRESS 0x0008 /* Data is compressed. */ -#define TDI_DATA 0x0010 /* TDI data is present. */ -#define TDO_DATA 0x0020 /* TDO data is present. */ -#define MASK_DATA 0x0040 /* MASK data is present. */ -#define HEAP_IN 0x0080 /* Data is from the heap. */ -#define LHEAP_IN 0x0200 /* Data is from intel data buffer. */ -#define VARIABLE 0x0400 /* Data is from a declared variable. */ -#define CRC_DATA 0x0800 /* CRC data is pressent. */ -#define CMASK_DATA 0x1000 /* CMASK data is pressent. */ -#define RMASK_DATA 0x2000 /* RMASK data is pressent. */ -#define READ_DATA 0x4000 /* READ data is pressent. */ -#define DMASK_DATA 0x8000 /* DMASK data is pressent. */ - -/*************************************************************** -* -* Pin opcodes. -* -***************************************************************/ - -#define signalENABLE 0x1C /* ispENABLE pin. */ -#define signalTMS 0x1D /* TMS pin. */ -#define signalTCK 0x1E /* TCK pin. */ -#define signalTDI 0x1F /* TDI pin. */ -#define signalTRST 0x20 /* TRST pin. */ - -/*************************************************************** -* -* Supported vendors. -* -***************************************************************/ - -#define VENDOR 0x56 -#define LATTICE 0x01 -#define ALTERA 0x02 -#define XILINX 0x03 - -/*************************************************************** -* -* Opcode definitions. -* -* Note: opcodes must be unique. -* -***************************************************************/ - -#define ENDDATA 0x00 /* The end of the current SDR data stream. */ -#define RUNTEST 0x01 /* The duration to stay at the stable state. */ -#define ENDDR 0x02 /* The stable state after SDR. */ -#define ENDIR 0x03 /* The stable state after SIR. */ -#define ENDSTATE 0x04 /* The stable state after RUNTEST. */ -#define TRST 0x05 /* Assert the TRST pin. */ -#define HIR 0x06 /* The sum of the IR bits of the leading devices. */ -#define TIR 0x07 /* The sum of the IR bits of the trailing devices. */ -#define HDR 0x08 /* The number of leading devices. */ -#define TDR 0x09 /* The number of trailing devices. */ -#define ispEN 0x0A /* Assert the ispEN pin. */ -#define FREQUENCY 0x0B /* The maximum clock rate to run the JTAG state machine. */ -#define STATE 0x10 /* Move to the next stable state. */ -#define SIR 0x11 /* The instruction stream follows. */ -#define SDR 0x12 /* The data stream follows. */ -#define TDI 0x13 /* The following data stream feeds into the device. */ -#define TDO 0x14 /* The following data stream is compared against the device. */ -#define MASK 0x15 /* The following data stream is used as mask. */ -#define XSDR 0x16 /* The following data stream is for simultaneous program and verify. */ -#define XTDI 0x17 /* The following data stream is for shift in only. It must be stored for the next XSDR. */ -#define XTDO 0x18 /* There is not data stream. The data stream was stored from the previous XTDI. */ -#define MEM 0x19 /* The maximum memory needed to allocate in order hold one row of data. */ -#define WAIT 0x1A /* The duration of delay to observe. */ -#define TCK 0x1B /* The number of TCK pulses. */ -#define SHR 0x23 /* Set the flow control register for right shift. */ -#define SHL 0x24 /* Set the flow control register for left shift. */ -#define HEAP 0x32 /* The memory size needed to hold one loop. */ -#define REPEAT 0x33 /* The beginning of the loop. */ -#define LEFTPAREN 0x35 /* The beginning of data following the loop. */ -#define VAR 0x55 /* Plac holder for loop data. */ -#define SEC 0x1C /* The delay time in seconds that must be observed. */ -#define SMASK 0x1D /* The mask for TDI data. */ -#define MAX 0x1E /* The absolute maximum wait time. */ -#define ON 0x1F /* Assert the targeted pin. */ -#define OFF 0x20 /* Dis-assert the targeted pin. */ -#define SETFLOW 0x30 /* Change the flow control register. */ -#define RESETFLOW 0x31 /* Clear the flow control register. */ -#define CRC 0x47 /* The following data stream is used for CRC calculation. */ -#define CMASK 0x48 /* The following data stream is used as mask for CRC calculation. */ -#define RMASK 0x49 /* The following data stream is used as mask for read and save. */ -#define READ 0x50 /* The following data stream is used for read and save. */ -#define ENDLOOP 0x59 /* The end of the repeat loop. */ -#define SECUREHEAP 0x60 /* Used to secure the HEAP opcode. */ -#define VUES 0x61 /* Support continue if fail. */ -#define DMASK 0x62 /* The following data stream is used for dynamic I/O. */ -#define COMMENT 0x63 /* Support SVF comments in the VME file. */ -#define HEADER 0x64 /* Support header in VME file. */ -#define FILE_CRC 0x65 /* Support crc-protected VME file. */ -#define LCOUNT 0x66 /* Support intelligent programming. */ -#define LDELAY 0x67 /* Support intelligent programming. */ -#define LSDR 0x68 /* Support intelligent programming. */ -#define LHEAP 0x69 /* Memory needed to hold intelligent data buffer */ -#define CONTINUE 0x70 /* Allow continuation. */ -#define LVDS 0x71 /* Support LVDS. */ -#define ENDVME 0x7F /* End of the VME file. */ -#define HIGH 0x80 /* Assert the targeted pin. */ -#define LOW 0x81 /* Dis-assert the targeted pin. */ -#define ENDFILE 0xFF /* End of file. */ - -/*************************************************************** -* -* ispVM Embedded Return Codes. -* -***************************************************************/ - -#define VME_VERIFICATION_FAILURE -1 -#define VME_FILE_READ_FAILURE -2 -#define VME_VERSION_FAILURE -3 -#define VME_INVALID_FILE -4 -#define VME_ARGUMENT_FAILURE -5 -#define VME_CRC_FAILURE -6 - -/*************************************************************** -* -* Type definitions. -* -***************************************************************/ - -/* Support LVDS */ -typedef struct { - unsigned short usPositiveIndex; - unsigned short usNegativeIndex; - unsigned char ucUpdate; -} LVDSPair; \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/app/libextphy.so b/platform/centec-arm64/sonic-platform-modules-ragile/common/app/libextphy.so deleted file mode 100644 index 1ca09deac2582032912a9aefb650480abcdc0834..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 632408 zcma%k3s?=`7xr}3<>;me;gnJlLI}m_rci{CBvC0!LI~k>6+#q3x)4GLA%r9(A%qZ; z5JD0{_|`sa&HwpzKECH$&-1qDyl0)Y*Is+go;@>rrj-uP!)0Y;I9}wqQylxG@ftZ1 zeW9DK%&TxB&XQ{df7^4q5?zJ=ee-{Bh`ZtM_>z5a?LQ?uMZ zU3PymCx09JWh+n|0Hqkv8lWO8E97K3C7E%znpHbD{t?r9$~@BmHBBZnXl$%1@y7JUr;0~(C%s~*PauL z#A3U69mA{7Ib}EP;odTK0@+d-&Z3KAbwaFg_@j*)s=fib;}n!sdMs%@RF{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z)coCwUxzuVKgMclrG88{1^g=Up|gR*Zlgsk2=)f zd6a0gAJyknpV3vv_1E87)L{)Nho9D8r=!C;xJKV_)aUv;jyfzRX8cHh!f5@8M!$0W z>1%YZzZ+gq#6n|8;2Rh$6U0p6O zf|nqgzb0RHt~L2m|6sxk+BCloI}-TycUzBKEBSHD-}cjdI{bA4zkYvb%cmrN#f>)h zc>U4T-y%Y?wEpZVH8^-m^5-7cNEzyMHFX~%%0!wZL&aZUr^@k+g=V##h0F>R|65if I;)!YfFBWcQ-v9sr diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/__init__.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/fantlv.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/fantlv.py deleted file mode 100644 index fa480bb50a..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/fantlv.py +++ /dev/null @@ -1,210 +0,0 @@ -#!/usr/bin/python3 -# -*- coding: utf-8 -*- -class FantlvException(Exception): - def __init__(self, message='fantlverror', code=-100): - err = 'errcode: {0} message:{1}'.format(code, message) - Exception.__init__(self, err) - self.code = code - self.message = message - -class fan_tlv(object): - HEAD_INFO = "\x01\x7e\x01\xf1" - VERSION = 0x01 # E2PROM file init version is 0x01 - FLAG = 0x7E # new version E2PROM mark as 0x7E - HW_VER = 0X01 # consists of master version and revised version - TYPE = 0xf1 # hardware type define - TLV_LEN = 00 # vaild data length(16bit) - _FAN_TLV_HDR_LEN = 6 - _FAN_TLV_CRC_LEN = 2 - - _FAN_TLV_TYPE_NAME = 0x02 - _FAN_TLV_TYPE_SN = 0x03 - _FAN_TLV_TYPE_HW_INFO = 0x05 - _FAN_TLV_TYPE_DEV_TYPE = 0x06 - - _fandecodetime = 0 - - @property - def dstatus(self): - return self._dstatus - - @property - def typename(self): - return self._typename - - @property - def typesn(self): - return self._typesn - - @property - def typehwinfo(self): - return self._typehwinfo - - @property - def typedevtype(self): - return self._typedevtype - - @property - def fanbus(self): - return self._fanbus - - @property - def fanloc(self): - return self._fanloc - - @property - def fandecodetime(self): - return self._fandecodetime - - def __init__(self): - self._typename = "" - self._typesn = "" - self._typehwinfo = "" - self._typedevtype = "" - self._dstatus = 0 - - def strtoarr(self, str): - s = [] - if str is not None: - for index in range(len(str)): - s.append(str[index]) - return s - - def str_to_hex(self,rest_v): - value = 0 - for index in range(len(rest_v)): - value |= ord(rest_v[index]) << ((len(rest_v) - index - 1) * 8) - return value - - def hex_to_str(self,s): - len_t = len(s) - if len_t % 2 != 0: - return 0 - ret = "" - for t in range(0, int(len_t / 2)): - ret += chr(int(s[2 * t:2 * t + 2], 16)) - return ret - - def generate_fan_value(self): - bin_buffer = [chr(0xff)] * 256 - bin_buffer[0] = chr(self.VERSION) - bin_buffer[1] = chr(self.FLAG) - bin_buffer[2] = chr(self.HW_VER) - bin_buffer[3] = chr(self.TYPE) - - temp_t = "%08x" % self.typedevtype # handle devtype first - typedevtype_t = self.hex_to_str(temp_t) - total_len = len(self.typename) + len(self.typesn) + \ - len(self.typehwinfo) + len(typedevtype_t) + 8 - - bin_buffer[4] = chr(total_len >> 8) - bin_buffer[5] = chr(total_len & 0x00FF) - - index_start = 6 - bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_NAME) - bin_buffer[index_start + 1] = chr(len(self.typename)) - bin_buffer[index_start + 2: index_start + 2 + - len(self.typename)] = self.strtoarr(self.typename) - index_start = index_start + 2 + len(self.typename) - - bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_SN) - bin_buffer[index_start + 1] = chr(len(self.typesn)) - bin_buffer[index_start + 2:index_start + 2 + - len(self.typesn)] = self.strtoarr(self.typesn) - index_start = index_start + 2 + len(self.typesn) - - bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_HW_INFO) - bin_buffer[index_start + 1] = chr(len(self.typehwinfo)) - bin_buffer[index_start + 2:index_start + 2 + - len(self.typehwinfo)] = self.strtoarr(self.typehwinfo) - index_start = index_start + 2 + len(self.typehwinfo) - - bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_DEV_TYPE) - bin_buffer[index_start + 1] = chr(len(typedevtype_t)) - bin_buffer[index_start + 2:index_start + 2 + - len(typedevtype_t)] = self.strtoarr(typedevtype_t) - index_start = index_start + 2 + len(typedevtype_t) - - crcs = fan_tlv.fancrc(''.join(bin_buffer[0:index_start])) # 2bytes checking - bin_buffer[index_start] = chr(crcs >> 8) - bin_buffer[index_start + 1] = chr(crcs & 0x00ff) - # printvalue(bin_buffer) - return bin_buffer - - def decode(self, e2): - if e2[0:4] != self.HEAD_INFO: - raise FantlvException("Fan tlv head info error,not fan tlv type", -10) - ret = [] - self.VERSION = ord(e2[0]) - self.FLAG = ord(e2[1]) - self.HW_VER = ord(e2[2]) - self.TYPE = ord(e2[3]) - self.TLV_LEN = (ord(e2[4]) << 8) | ord(e2[5]) - - tlv_index = self._FAN_TLV_HDR_LEN - tlv_end = self._FAN_TLV_HDR_LEN + self.TLV_LEN - - # check sum - if len(e2) < self._FAN_TLV_HDR_LEN + self.TLV_LEN + 2: - raise FantlvException("Fan tlv eeprom len error!", -2) - sumcrc = fan_tlv.fancrc(e2[0:self._FAN_TLV_HDR_LEN + self.TLV_LEN]) - readcrc = ord(e2[self._FAN_TLV_HDR_LEN + self.TLV_LEN] - ) << 8 | ord(e2[self._FAN_TLV_HDR_LEN + self.TLV_LEN + 1]) - if sumcrc != readcrc: - raise FantlvException("Fan tlv eeprom checksum error!", -1) - else: - self._dstatus = 0 - while (tlv_index + 2) < len(e2) and tlv_index < tlv_end: - s = self.decoder( - e2[tlv_index:tlv_index + 2 + ord(e2[tlv_index + 1])]) - tlv_index += ord(e2[tlv_index + 1]) + 2 - ret.append(s) - - return ret - - @staticmethod - def fancrc(t): - sum = 0 - for index in range(len(t)): - sum += ord(t[index]) - return sum - - def decoder(self, t): - try: - name = "" - value = "" - _len = ord(t[1]) - if ord(t[0]) == self._FAN_TLV_TYPE_NAME: - name = "Product Name" - value = t[2:2 + ord(t[1])] - self._typename = value - elif ord(t[0]) == self._FAN_TLV_TYPE_SN: - name = "serial Number" - value = t[2:2 + ord(t[1])] - self._typesn = value - elif ord(t[0]) == self._FAN_TLV_TYPE_HW_INFO: - name = "hardware info" - value = t[2:2 + ord(t[1])] - self._typehwinfo = value - elif ord(t[0]) == self._FAN_TLV_TYPE_DEV_TYPE: - name = "dev type" - value = "0x" - for c in t[2:2 + ord(t[1])]: - value += "%02X" % (ord(c),) - self._typedevtype = int(value,16) - return {"name": name, "code": ord(t[0]), "value": value,"lens": _len} - except Exception as e: - print(e) - return None - - def __str__(self): - formatstr = "VERSION : 0x%02x \n" \ - " FLAG : 0x%02x \n" \ - " HW_VER : 0x%02x \n" \ - " TYPE : 0x%02x \n" \ - "typename : %s \n" \ - "typesn : %s \n" \ - "typehwinfo : %s \n" - return formatstr % (self.VERSION, self.FLAG, self.HW_VER, self.TYPE, self.typename, self.typesn, self.typehwinfo) - - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/fru.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/fru.py deleted file mode 100644 index 4848530a8e..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/eepromutil/fru.py +++ /dev/null @@ -1,957 +0,0 @@ -#!/usr/bin/python3 -# -*- coding: utf-8 -*- -import collections -from bitarray import bitarray -from datetime import datetime, timedelta -import sys - -__all__ = ["FruException", "FruUtil", "BaseArea", "BoardInfoArea", "ProductInfoArea", - "MultiRecordArea", "Field", "ipmifru"] - -__DEBUG__ = "N" - - -class FruException(Exception): - def __init__(self, message='fruerror', code=-100): - err = 'errcode: {0} message:{1}'.format(code, message) - Exception.__init__(self, err) - self.code = code - self.message = message - - -def e_print(err): - print("ERROR: " + err) - - -def d_print(debug_info): - if(__DEBUG__ == "Y"): - print(debug_info) - - -class FruUtil(): - @staticmethod - def decodeLength(value): - a = bitarray(8) - a.setall(True) - a[0:1] = 0 - a[1:2] = 0 - x = ord(a.tobytes()) - return x & ord(value) - - @staticmethod - def minToData(): - starttime = datetime(1996, 1, 1, 0, 0, 0) - endtime = datetime.now() - seconds = (endtime - starttime).total_seconds() - mins = seconds / 60 - m = int(round(mins)) - return m - - @staticmethod - def getTimeFormat(): - return datetime.now().strftime('%Y-%m-%d') - - @staticmethod - def getTypeLength(value): - if value is None: - return 0 - a = bitarray(8) - a.setall(False) - a[0:1] = 1 - a[1:2] = 1 - x = ord(a.tobytes()) - return x | len(value) - - @staticmethod - def checksum(b): - result = 0 - for i in range(len(b)): - result += ord(b[i]) - return (0x100 - (result & 0xff)) & 0xff - - -class BaseArea(object): - SUGGESTED_SIZE_COMMON_HEADER = 8 - SUGGESTED_SIZE_INTERNAL_USE_AREA = 72 - SUGGESTED_SIZE_CHASSIS_INFO_AREA = 32 - SUGGESTED_SIZE_BOARD_INFO_AREA = 80 - SUGGESTED_SIZE_PRODUCT_INFO_AREA = 80 - - INITVALUE = b'\x00' - resultvalue = INITVALUE * 256 - COMMON_HEAD_VERSION = b'\x01' - __childList = None - - def __init__(self, name="", size=0, offset=0): - self.__childList = [] - self._offset = offset - self.name = name - self._size = size - self._isPresent = False - self._data = b'\x00' * size - self.__dataoffset = 0 - - @property - def childList(self): - return self.__childList - - @childList.setter - def childList(self, value): - self.__childList = value - - @property - def offset(self): - return self._offset - - @offset.setter - def offset(self, value): - self._offset = value - - @property - def size(self): - return self._size - - @size.setter - def size(self, value): - self._size = value - - @property - def data(self): - return self._data - - @data.setter - def data(self, value): - self._data = value - - @property - def isPresent(self): - return self._isPresent - - @isPresent.setter - def isPresent(self, value): - self._isPresent = value - - -class InternalUseArea(BaseArea): - pass - - -class ChassisInfoArea(BaseArea): - pass - - -class BoardInfoArea(BaseArea): - _boardTime = None - _fields = None - _mfg_date = None - - def __str__(self): - formatstr = "version : %x\n" \ - "length : %d \n" \ - "language : %x \n" \ - "mfg_date : %s \n" \ - "boardManufacturer : %s \n" \ - "boardProductName : %s \n" \ - "boardSerialNumber : %s \n" \ - "boardPartNumber : %s \n" \ - "fruFileId : %s \n" - - tmpstr = formatstr % (ord(self.boardversion), self.size, - self.language, self.getMfgRealData(), - self.boardManufacturer, self.boardProductName, - self.boardSerialNumber, self.boardPartNumber, - self.fruFileId) - for i in range(1, 11): - valtmp = "boardextra%d" % i - if hasattr(self, valtmp): - valtmpval = getattr(self, valtmp) - tmpstr += "boardextra%d : %s \n" % (i, valtmpval) - else: - break - - return tmpstr - - def todict(self): - dic = collections.OrderedDict() - dic["boardversion"] = ord(self.boardversion) - dic["boardlength"] = self.size - dic["boardlanguage"] = self.language - dic["boardmfg_date"] = self.getMfgRealData() - dic["boardManufacturer"] = self.boardManufacturer - dic["boardProductName"] = self.boardProductName - dic["boardSerialNumber"] = self.boardSerialNumber - dic["boardPartNumber"] = self.boardPartNumber - dic["boardfruFileId"] = self.fruFileId - for i in range(1, 11): - valtmp = "boardextra%d" % i - if hasattr(self, valtmp): - valtmpval = getattr(self, valtmp) - dic[valtmp] = valtmpval - else: - break - return dic - - def decodedata(self): - index = 0 - self.areaversion = self.data[index] - index += 1 - d_print("decode length :%d class size:%d" % - ((ord(self.data[index]) * 8), self.size)) - index += 2 - - timetmp = self.data[index: index + 3] - self.mfg_date = ord(timetmp[0]) | ( - ord(timetmp[1]) << 8) | (ord(timetmp[2]) << 16) - d_print("decode getMfgRealData :%s" % self.getMfgRealData()) - index += 3 - - templen = FruUtil.decodeLength(self.data[index]) - self.boardManufacturer = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode boardManufacturer:%s" % self.boardManufacturer) - - templen = FruUtil.decodeLength(self.data[index]) - self.boardProductName = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode boardProductName:%s" % self.boardProductName) - - templen = FruUtil.decodeLength(self.data[index]) - self.boardSerialNumber = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode boardSerialNumber:%s" % self.boardSerialNumber) - - templen = FruUtil.decodeLength(self.data[index]) - self.boardPartNumber = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode boardPartNumber:%s" % self.boardPartNumber) - - templen = FruUtil.decodeLength(self.data[index]) - self.fruFileId = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode fruFileId:%s" % self.fruFileId) - - - for i in range(1, 11): - valtmp = "boardextra%d" % i - if self.data[index] != chr(0xc1): - templen = FruUtil.decodeLength(self.data[index]) - tmpval = self.data[index + 1: index + templen + 1] - setattr(self, valtmp, tmpval) - index += templen + 1 - d_print("decode boardextra%d:%s" % (i, tmpval)) - else: - break - - def recalcute(self): - d_print("boardInfoArea version:%x" % ord(self.boardversion)) - d_print("boardInfoArea length:%d" % self.size) - d_print("boardInfoArea language:%x" % self.language) - self.mfg_date = FruUtil.minToData() - d_print("boardInfoArea mfg_date:%x" % self.mfg_date) - - self.data = chr(ord(self.boardversion)) + \ - chr(self.size / 8) + chr(self.language) - - self.data += chr(self.mfg_date & 0xFF) - self.data += chr((self.mfg_date >> 8) & 0xFF) - self.data += chr((self.mfg_date >> 16) & 0xFF) - - d_print("boardInfoArea boardManufacturer:%s" % self.boardManufacturer) - typelength = FruUtil.getTypeLength(self.boardManufacturer) - self.data += chr(typelength) - self.data += self.boardManufacturer - - d_print("boardInfoArea boardProductName:%s" % self.boardProductName) - self.data += chr(FruUtil.getTypeLength(self.boardProductName)) - self.data += self.boardProductName - - d_print("boardInfoArea boardSerialNumber:%s" % self.boardSerialNumber) - self.data += chr(FruUtil.getTypeLength(self.boardSerialNumber)) - self.data += self.boardSerialNumber - - d_print("boardInfoArea boardPartNumber:%s" % self.boardPartNumber) - self.data += chr(FruUtil.getTypeLength(self.boardPartNumber)) - self.data += self.boardPartNumber - - d_print("boardInfoArea fruFileId:%s" % self.fruFileId) - self.data += chr(FruUtil.getTypeLength(self.fruFileId)) - self.data += self.fruFileId - - for i in range(1, 11): - valtmp = "boardextra%d" % i - if hasattr(self, valtmp): - valtmpval = getattr(self, valtmp) - d_print("boardInfoArea boardextra%d:%s" % (i, valtmpval)) - self.data += chr(FruUtil.getTypeLength(valtmpval)) - if valtmpval is None: - pass - else: - self.data += valtmpval - else: - break - - self.data += chr(0xc1) - - if len(self.data) > (self.size - 1): - incr = (len(self.data) - self.size) / 8 + 1 - self.size += incr * 8 - - self.data = self.data[0:1] + chr(self.size / 8) + self.data[2:] - d_print("self data:%d" % len(self.data)) - d_print("self size:%d" % self.size) - d_print("adjust size:%d" % (self.size - len(self.data) - 1)) - self.data = self.data.ljust((self.size - 1), self.INITVALUE) - - # checksum - checksum = FruUtil.checksum(self.data) - d_print("board info checksum:%x" % checksum) - self.data += chr(checksum) - - def getMfgRealData(self): - starttime = datetime(1996, 1, 1, 0, 0, 0) - mactime = starttime + timedelta(minutes=self.mfg_date) - return mactime - - @property - def language(self): - self._language = 25 - return self._language - - @property - def mfg_date(self): - return self._mfg_date - - @mfg_date.setter - def mfg_date(self, val): - self._mfg_date = val - - @property - def boardversion(self): - self._boardversion = self.COMMON_HEAD_VERSION - return self._boardversion - - @property - def fruFileId(self): - return self._FRUFileID - - @fruFileId.setter - def fruFileId(self, val): - self._FRUFileID = val - - @property - def boardPartNumber(self): - return self._boardPartNumber - - @boardPartNumber.setter - def boardPartNumber(self, val): - self._boardPartNumber = val - - @property - def boardSerialNumber(self): - return self._boardSerialNumber - - @boardSerialNumber.setter - def boardSerialNumber(self, val): - self._boardSerialNumber = val - - @property - def boardProductName(self): - return self._boradProductName - - @boardProductName.setter - def boardProductName(self, val): - self._boradProductName = val - - @property - def boardManufacturer(self): - return self._boardManufacturer - - @boardManufacturer.setter - def boardManufacturer(self, val): - self._boardManufacturer = val - - @property - def boardTime(self): - return self._boardTime - - @boardTime.setter - def boardTime(self, val): - self._boardTime = val - - @property - def fields(self): - return self._fields - - @fields.setter - def fields(self, val): - self._fields = val - - -class ProductInfoArea(BaseArea): - _productManufacturer = None - _productAssetTag = None - _FRUFileID = None - - def __str__(self): - formatstr = "version : %x\n" \ - "length : %d \n" \ - "language : %x \n" \ - "productManufacturer : %s \n" \ - "productName : %s \n" \ - "productPartModelName: %s \n" \ - "productVersion : %s \n" \ - "productSerialNumber : %s \n" \ - "productAssetTag : %s \n" \ - "fruFileId : %s \n" - - tmpstr = formatstr % (ord(self.areaversion), self.size, - self.language, self.productManufacturer, - self.productName, self.productPartModelName, - self.productVersion, self.productSerialNumber, - self.productAssetTag, self.fruFileId) - - for i in range(1, 11): - valtmp = "productextra%d" % i - if hasattr(self, valtmp): - valtmpval = getattr(self, valtmp) - tmpstr += "productextra%d : %s \n" % (i, valtmpval) - else: - break - - return tmpstr - - def todict(self): - dic = collections.OrderedDict() - dic["productversion"] = ord(self.areaversion) - dic["productlength"] = self.size - dic["productlanguage"] = self.language - dic["productManufacturer"] = self.productManufacturer - dic["productName"] = self.productName - dic["productPartModelName"] = self.productPartModelName - dic["productVersion"] = int(self.productVersion, 16) - dic["productSerialNumber"] = self.productSerialNumber - dic["productAssetTag"] = self.productAssetTag - dic["productfruFileId"] = self.fruFileId - for i in range(1, 11): - valtmp = "productextra%d" % i - if hasattr(self, valtmp): - valtmpval = getattr(self, valtmp) - dic[valtmp] = valtmpval - else: - break - return dic - - def decodedata(self): - index = 0 - self.areaversion = self.data[index] # 0 - index += 1 - d_print("decode length %d" % (ord(self.data[index]) * 8)) - d_print("class size %d" % self.size) - index += 2 - - templen = FruUtil.decodeLength(self.data[index]) - self.productManufacturer = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productManufacturer:%s" % self.productManufacturer) - - templen = FruUtil.decodeLength(self.data[index]) - self.productName = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productName:%s" % self.productName) - - templen = FruUtil.decodeLength(self.data[index]) - self.productPartModelName = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productPartModelName:%s" % self.productPartModelName) - - templen = FruUtil.decodeLength(self.data[index]) - self.productVersion = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productVersion:%s" % self.productVersion) - - templen = FruUtil.decodeLength(self.data[index]) - self.productSerialNumber = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productSerialNumber:%s" % self.productSerialNumber) - - templen = FruUtil.decodeLength(self.data[index]) - self.productAssetTag = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productAssetTag:%s" % self.productAssetTag) - - templen = FruUtil.decodeLength(self.data[index]) - self.fruFileId = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode fruFileId:%s" % self.fruFileId) - - for i in range(1, 11): - valtmp = "productextra%d" % i - if self.data[index] != chr(0xc1) and index < self.size - 1: - templen = FruUtil.decodeLength(self.data[index]) - if templen == 0: - break - tmpval = self.data[index + 1: index + templen + 1] - d_print("decode boardextra%d:%s" % (i, tmpval)) - setattr(self, valtmp, tmpval) - index += templen + 1 - else: - break - - @property - def productVersion(self): - return self._productVersion - - @productVersion.setter - def productVersion(self, name): - self._productVersion = name - - @property - def areaversion(self): - self._areaversion = self.COMMON_HEAD_VERSION - return self._areaversion - - @areaversion.setter - def areaversion(self, name): - self._areaversion = name - - @property - def language(self): - self._language = 25 - return self._language - - @property - def productManufacturer(self): - return self._productManufacturer - - @productManufacturer.setter - def productManufacturer(self, name): - self._productManufacturer = name - - @property - def productName(self): - return self._productName - - @productName.setter - def productName(self, name): - self._productName = name - - @property - def productPartModelName(self): - return self._productPartModelName - - @productPartModelName.setter - def productPartModelName(self, name): - self._productPartModelName = name - - @property - def productSerialNumber(self): - return self._productSerialNumber - - @productSerialNumber.setter - def productSerialNumber(self, name): - self._productSerialNumber = name - - @property - def productAssetTag(self): - return self._productAssetTag - - @productAssetTag.setter - def productAssetTag(self, name): - self._productAssetTag = name - - @property - def fruFileId(self): - return self._FRUFileID - - @fruFileId.setter - def fruFileId(self, name): - self._FRUFileID = name - - def recalcute(self): - d_print("product version:%x" % ord(self.areaversion)) - d_print("product length:%d" % self.size) - d_print("product language:%x" % self.language) - self.data = chr(ord(self.areaversion)) + \ - chr(self.size / 8) + chr(self.language) - - typelength = FruUtil.getTypeLength(self.productManufacturer) - self.data += chr(typelength) - self.data += self.productManufacturer - - self.data += chr(FruUtil.getTypeLength(self.productName)) - self.data += self.productName - - self.data += chr(FruUtil.getTypeLength(self.productPartModelName)) - self.data += self.productPartModelName - - self.data += chr(FruUtil.getTypeLength(self.productVersion)) - self.data += self.productVersion - - self.data += chr(FruUtil.getTypeLength(self.productSerialNumber)) - self.data += self.productSerialNumber - - self.data += chr(FruUtil.getTypeLength(self.productAssetTag)) - if self.productAssetTag is not None: - self.data += self.productAssetTag - - self.data += chr(FruUtil.getTypeLength(self.fruFileId)) - self.data += self.fruFileId - - # whether the extended field exists or not - for i in range(1, 11): - valtmp = "productextra%d" % i - if hasattr(self, valtmp): - valtmpval = getattr(self, valtmp) - d_print("boardInfoArea productextra%d:%s" % (i, valtmpval)) - self.data += chr(FruUtil.getTypeLength(valtmpval)) - if valtmpval is None: - pass - else: - self.data += valtmpval - else: - break - - self.data += chr(0xc1) - if len(self.data) > (self.size - 1): - incr = (len(self.data) - self.size) / 8 + 1 - self.size += incr * 8 - d_print("self.data:%d" % len(self.data)) - d_print("self.size:%d" % self.size) - - self.data = self.data[0:1] + chr(self.size / 8) + self.data[2:] - self.data = self.data.ljust((self.size - 1), self.INITVALUE) - checksum = FruUtil.checksum(self.data) - d_print("board info checksum:%x" % checksum) - self.data += chr(checksum) - - -class MultiRecordArea(BaseArea): - pass - - -class Field(object): - - def __init__(self, fieldType="ASCII", fieldData=""): - self.fieldData = fieldData - self.fieldType = fieldType - - @property - def data(self): - return self._data - - @property - def fieldType(self): - return self._fieldType - - @property - def fieldData(self): - return self._fieldData - - -class ipmifru(BaseArea): - _BoardInfoArea = None - _ProductInfoArea = None - _InternalUseArea = None - _ChassisInfoArea = None - _multiRecordArea = None - _productinfoAreaOffset = BaseArea.INITVALUE - _boardInfoAreaOffset = BaseArea.INITVALUE - _internalUserAreaOffset = BaseArea.INITVALUE - _chassicInfoAreaOffset = BaseArea.INITVALUE - _multiRecordAreaOffset = BaseArea.INITVALUE - _bindata = None - _bodybin = None - _version = BaseArea.COMMON_HEAD_VERSION - _zeroCheckSum = None - _frusize = 256 - - def __str__(self): - tmpstr = "" - if self.boardInfoArea.isPresent: - tmpstr += "\nboardinfoarea: \n" - tmpstr += self.boardInfoArea.__str__() - if self.productInfoArea.isPresent: - tmpstr += "\nproductinfoarea: \n" - tmpstr += self.productInfoArea.__str__() - return tmpstr - - def decodeBin(self, eeprom): - commonHead = eeprom[0:8] - d_print("decode version %x" % ord(commonHead[0])) - if self.COMMON_HEAD_VERSION != commonHead[0]: - raise FruException("HEAD VERSION error,not Fru format!", -10) - if FruUtil.checksum(commonHead[0:7]) != ord(commonHead[7]): - strtemp = "check header checksum error [cal:%02x data:%02x]" % ( - FruUtil.checksum(commonHead[0:7]), ord(commonHead[7])) - raise FruException(strtemp, -3) - if commonHead[1] != self.INITVALUE: - d_print("Internal Use Area is present") - self.internalUseArea = InternalUseArea( - name="Internal Use Area", size=self.SUGGESTED_SIZE_INTERNAL_USE_AREA) - self.internalUseArea.isPresent = True - self.internalUserAreaOffset = ord(commonHead[1]) - self.internalUseArea.data = eeprom[self.internalUserAreaOffset * 8: ( - self.internalUserAreaOffset * 8 + self.internalUseArea.size)] - if commonHead[2] != self.INITVALUE: - d_print("Chassis Info Area is present") - self.chassisInfoArea = ChassisInfoArea( - name="Chassis Info Area", size=self.SUGGESTED_SIZE_CHASSIS_INFO_AREA) - self.chassisInfoArea.isPresent = True - self.chassicInfoAreaOffset = ord(commonHead[2]) - self.chassisInfoArea.data = eeprom[self.chassicInfoAreaOffset * 8: ( - self.chassicInfoAreaOffset * 8 + self.chassisInfoArea.size)] - if commonHead[3] != self.INITVALUE: - self.boardInfoArea = BoardInfoArea( - name="Board Info Area", size=self.SUGGESTED_SIZE_BOARD_INFO_AREA) - self.boardInfoArea.isPresent = True - self.boardInfoAreaOffset = ord(commonHead[3]) - self.boardInfoArea.size = ord( - eeprom[self.boardInfoAreaOffset * 8 + 1]) * 8 - d_print("Board Info Area is present size:%d" % - (self.boardInfoArea.size)) - self.boardInfoArea.data = eeprom[self.boardInfoAreaOffset * 8: ( - self.boardInfoAreaOffset * 8 + self.boardInfoArea.size)] - if FruUtil.checksum(self.boardInfoArea.data[:-1]) != ord(self.boardInfoArea.data[-1:]): - strtmp = "check boardInfoArea checksum error[cal:%02x data:%02x]" % \ - (FruUtil.checksum( - self.boardInfoArea.data[:-1]), ord(self.boardInfoArea.data[-1:])) - raise FruException(strtmp, -3) - self.boardInfoArea.decodedata() - if commonHead[4] != self.INITVALUE: - d_print("Product Info Area is present") - self.productInfoArea = ProductInfoArea( - name="Product Info Area ", size=self.SUGGESTED_SIZE_PRODUCT_INFO_AREA) - self.productInfoArea.isPresent = True - self.productinfoAreaOffset = ord(commonHead[4]) - d_print("length offset value: %02x" % - ord(eeprom[self.productinfoAreaOffset * 8 + 1])) - self.productInfoArea.size = ord( - eeprom[self.productinfoAreaOffset * 8 + 1]) * 8 - d_print("Product Info Area is present size:%d" % - (self.productInfoArea.size)) - - self.productInfoArea.data = eeprom[self.productinfoAreaOffset * 8: ( - self.productinfoAreaOffset * 8 + self.productInfoArea.size)] - if FruUtil.checksum(self.productInfoArea.data[:-1]) != ord(self.productInfoArea.data[-1:]): - strtmp = "check productInfoArea checksum error [cal:%02x data:%02x]" % ( - FruUtil.checksum(self.productInfoArea.data[:-1]), ord(self.productInfoArea.data[-1:])) - raise FruException(strtmp, -3) - self.productInfoArea.decodedata() - if commonHead[5] != self.INITVALUE: - self.multiRecordArea = MultiRecordArea( - name="MultiRecord record Area ") - d_print("MultiRecord record present") - self.multiRecordArea.isPresent = True - self.multiRecordAreaOffset = ord(commonHead[5]) - self.multiRecordArea.data = eeprom[self.multiRecordAreaOffset * 8: ( - self.multiRecordAreaOffset * 8 + self.multiRecordArea.size)] - - def initDefault(self): - self.version = self.COMMON_HEAD_VERSION - self.internalUserAreaOffset = self.INITVALUE - self.chassicInfoAreaOffset = self.INITVALUE - self.boardInfoAreaOffset = self.INITVALUE - self.productinfoAreaOffset = self.INITVALUE - self.multiRecordAreaOffset = self.INITVALUE - self.PAD = self.INITVALUE - self.zeroCheckSum = self.INITVALUE - self.offset = self.SUGGESTED_SIZE_COMMON_HEADER - self.productInfoArea = None - self.internalUseArea = None - self.boardInfoArea = None - self.chassisInfoArea = None - self.multiRecordArea = None - # self.recalcute() - - @property - def version(self): - return self._version - - @version.setter - def version(self, name): - self._version = name - - @property - def internalUserAreaOffset(self): - return self._internalUserAreaOffset - - @internalUserAreaOffset.setter - def internalUserAreaOffset(self, obj): - self._internalUserAreaOffset = obj - - @property - def chassicInfoAreaOffset(self): - return self._chassicInfoAreaOffset - - @chassicInfoAreaOffset.setter - def chassicInfoAreaOffset(self, obj): - self._chassicInfoAreaOffset = obj - - @property - def productinfoAreaOffset(self): - return self._productinfoAreaOffset - - @productinfoAreaOffset.setter - def productinfoAreaOffset(self, obj): - self._productinfoAreaOffset = obj - - @property - def boardInfoAreaOffset(self): - return self._boardInfoAreaOffset - - @boardInfoAreaOffset.setter - def boardInfoAreaOffset(self, obj): - self._boardInfoAreaOffset = obj - - @property - def multiRecordAreaOffset(self): - return self._multiRecordAreaOffset - - @multiRecordAreaOffset.setter - def multiRecordAreaOffset(self, obj): - self._multiRecordAreaOffset = obj - - @property - def zeroCheckSum(self): - return self._zeroCheckSum - - @zeroCheckSum.setter - def zeroCheckSum(self, obj): - self._zeroCheckSum = obj - - @property - def productInfoArea(self): - return self._ProductInfoArea - - @productInfoArea.setter - def productInfoArea(self, obj): - self._ProductInfoArea = obj - - @property - def internalUseArea(self): - return self._InternalUseArea - - @internalUseArea.setter - def internalUseArea(self, obj): - self.internalUseArea = obj - - @property - def boardInfoArea(self): - return self._BoardInfoArea - - @boardInfoArea.setter - def boardInfoArea(self, obj): - self._BoardInfoArea = obj - - @property - def chassisInfoArea(self): - return self._ChassisInfoArea - - @chassisInfoArea.setter - def chassisInfoArea(self, obj): - self._ChassisInfoArea = obj - - @property - def multiRecordArea(self): - return self._multiRecordArea - - @multiRecordArea.setter - def multiRecordArea(self, obj): - self._multiRecordArea = obj - - @property - def bindata(self): - return self._bindata - - @bindata.setter - def bindata(self, obj): - self._bindata = obj - - @property - def bodybin(self): - return self._bodybin - - @bodybin.setter - def bodybin(self, obj): - self._bodybin = obj - - def recalcuteCommonHead(self): - self.bindata = "" - self.offset = self.SUGGESTED_SIZE_COMMON_HEADER - d_print("common Header %d" % self.offset) - d_print("fru eeprom size %d" % self._frusize) - if self.internalUseArea is not None and self.internalUseArea.isPresent: - self.internalUserAreaOffset = self.offset / 8 - self.offset += self.internalUseArea.size - d_print("internalUseArea is present offset:%d" % self.offset) - - if self.chassisInfoArea is not None and self.chassisInfoArea.isPresent: - self.chassicInfoAreaOffset = self.offset / 8 - self.offset += self.chassisInfoArea.size - d_print("chassisInfoArea is present offset:%d" % self.offset) - - if self.boardInfoArea is not None and self.boardInfoArea.isPresent: - self.boardInfoAreaOffset = self.offset / 8 - self.offset += self.boardInfoArea.size - d_print("boardInfoArea is present offset:%d" % self.offset) - d_print("boardInfoArea is present size:%d" % - self.boardInfoArea.size) - - if self.productInfoArea is not None and self.productInfoArea.isPresent: - self.productinfoAreaOffset = self.offset / 8 - self.offset += self.productInfoArea.size - d_print("productInfoArea is present offset:%d" % self.offset) - - if self.multiRecordArea is not None and self.multiRecordArea.isPresent: - self.multiRecordAreaOffset = self.offset / 8 - d_print("multiRecordArea is present offset:%d" % self.offset) - - if self.internalUserAreaOffset == self.INITVALUE: - self.internalUserAreaOffset = 0 - if self.productinfoAreaOffset == self.INITVALUE: - self.productinfoAreaOffset = 0 - if self.chassicInfoAreaOffset == self.INITVALUE: - self.chassicInfoAreaOffset = 0 - if self.boardInfoAreaOffset == self.INITVALUE: - self.boardInfoAreaOffset = 0 - if self.multiRecordAreaOffset == self.INITVALUE: - self.multiRecordAreaOffset = 0 - - self.zeroCheckSum = (0x100 - ord(self.version) - self.internalUserAreaOffset - self.chassicInfoAreaOffset - self.productinfoAreaOffset - - self.boardInfoAreaOffset - self.multiRecordAreaOffset) & 0xff - d_print("zerochecksum:%x" % self.zeroCheckSum) - self.data = self.version + chr(self.internalUserAreaOffset) + chr(self.chassicInfoAreaOffset) + chr( - self.boardInfoAreaOffset) + chr(self.productinfoAreaOffset) + chr(self.multiRecordAreaOffset) + self.INITVALUE + chr(self.zeroCheckSum) - - self.bindata = self.data + self.bodybin - totallen = len(self.bindata) - d_print("totallen %d" % totallen) - if (totallen < self._frusize): - self.bindata = self.bindata.ljust(self._frusize, self.INITVALUE) - else: - raise FruException('bin data more than %d' % self._frusize, -2) - - def recalcutebin(self): - self.bodybin = "" - if self.internalUseArea is not None and self.internalUseArea.isPresent: - d_print("internalUseArea present") - self.bodybin += self.internalUseArea.data - if self.chassisInfoArea is not None and self.chassisInfoArea.isPresent: - d_print("chassisInfoArea present") - self.bodybin += self.chassisInfoArea.data - if self.boardInfoArea is not None and self.boardInfoArea.isPresent: - d_print("boardInfoArea present") - self.boardInfoArea.recalcute() - self.bodybin += self.boardInfoArea.data - if self.productInfoArea is not None and self.productInfoArea.isPresent: - d_print("productInfoAreapresent") - self.productInfoArea.recalcute() - self.bodybin += self.productInfoArea.data - if self.multiRecordArea is not None and self.multiRecordArea.isPresent: - d_print("multiRecordArea present") - self.bodybin += self.productInfoArea.data - - def recalcute(self, fru_eeprom_size = 256): - self._frusize = fru_eeprom_size - self.recalcutebin() - self.recalcuteCommonHead() diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/__init__.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/baseutil.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/baseutil.py deleted file mode 100755 index 1cf74d32d2..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/baseutil.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: UTF-8 -*- -import os - -def get_machine_info(): - if not os.path.isfile('/host/machine.conf'): - return None - machine_vars = {} - with open('/host/machine.conf') as machine_file: - for line in machine_file: - tokens = line.split('=') - if len(tokens) < 2: - continue - machine_vars[tokens[0]] = tokens[1].strip() - return machine_vars - -def get_platform_info(machine_info): - if machine_info != None: - if 'onie_platform' in machine_info: - return machine_info['onie_platform'] - elif 'aboot_platform' in machine_info: - return machine_info['aboot_platform'] - return None - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/logutil.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/logutil.py deleted file mode 100755 index 2b001f21d7..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/logutil.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: UTF-8 -*- - -import logging -from syslog import ( - syslog, - openlog, - LOG_WARNING, - LOG_CRIT, - LOG_DEBUG, - LOG_ERR, - LOG_PID, - LOG_INFO, -) - -class Logger(): - def __init__(self, prefix, filepath=None, syslog=False, dbg_mask=0x0): - self.logger = None - if syslog is False: - if filepath is None: - raise AttributeError("filepath needed") - - # init logging - formatter = logging.Formatter( "%(asctime)s %(levelname)s %(filename)s[%(funcName)s][%(lineno)s]: %(message)s") - handler = logging.FileHandler(self.filepath) - handler.setFormatter(formatter) - self.logger = logging.getLogger(__name__) - self.logger.setLevel(logging.DEBUG) - self.logger.addHandler(handler) - - self.prefix = prefix - self.use_syslog = syslog - self.dbg_mask = dbg_mask - - def info(self, s): - if self.use_syslog: - self._syslog(s, LOG_INFO) - else: - self.logger.info(s) - - def debug(self, dbg_lvl, s): - if dbg_lvl & self.dbg_mask: - if self.use_syslog: - self._syslog(s, LOG_DEBUG) - else: - self.logger.debug(s) - - def warn(self, s): - if self.use_syslog: - self._syslog(s, LOG_WARNING) - else: - self.logger.warning(s) - - def error(self, s): - if self.use_syslog: - self._syslog(s, LOG_ERR) - else: - self.logger.error(s) - - def crit(self, s): - if self.use_syslog: - self._syslog(s, LOG_CRIT) - else: - self.logger.critical(s) - - def _syslog(self, s, t): - openlog(self.prefix, LOG_PID) - syslog(t, s) diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/smbus.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/smbus.py deleted file mode 100755 index cfef713c3b..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/lib/rgutil/smbus.py +++ /dev/null @@ -1,774 +0,0 @@ -"""smbus2 - A drop-in replacement for smbus-cffi/smbus-python""" -# The MIT License (MIT) -# Copyright (c) 2017 Karl-Petter Lindegaard -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -import os -import sys -from fcntl import ioctl -from ctypes import c_uint32, c_uint8, c_uint16, c_char, POINTER, Structure, Array, Union, create_string_buffer, string_at - - -# Commands from uapi/linux/i2c-dev.h -I2C_SLAVE = 0x0703 # Use this slave address -I2C_SLAVE_FORCE = 0x0706 # Use this slave address, even if it is already in use by a driver! -I2C_FUNCS = 0x0705 # Get the adapter functionality mask -I2C_RDWR = 0x0707 # Combined R/W transfer (one STOP only) -I2C_SMBUS = 0x0720 # SMBus transfer. Takes pointer to i2c_smbus_ioctl_data -I2C_PEC = 0x0708 - -# SMBus transfer read or write markers from uapi/linux/i2c.h -I2C_SMBUS_WRITE = 0 -I2C_SMBUS_READ = 1 - -# Size identifiers uapi/linux/i2c.h -I2C_SMBUS_QUICK = 0 -I2C_SMBUS_BYTE = 1 -I2C_SMBUS_BYTE_DATA = 2 -I2C_SMBUS_WORD_DATA = 3 -I2C_SMBUS_PROC_CALL = 4 -I2C_SMBUS_BLOCK_DATA = 5 # This isn't supported by Pure-I2C drivers with SMBUS emulation, like those in RaspberryPi, OrangePi, etc :( -I2C_SMBUS_BLOCK_PROC_CALL = 7 # Like I2C_SMBUS_BLOCK_DATA, it isn't supported by Pure-I2C drivers either. -I2C_SMBUS_I2C_BLOCK_DATA = 8 -I2C_SMBUS_BLOCK_MAX = 32 - -# To determine what functionality is present (uapi/linux/i2c.h) -try: - from enum import IntFlag -except ImportError: - IntFlag = int - - -class I2cFunc(IntFlag): - """ - These flags identify the operations supported by an I2C/SMBus device. - - You can test these flags on your `smbus.funcs` - - On newer python versions, I2cFunc is an IntFlag enum, but it - falls back to class with a bunch of int constants on older releases. - """ - I2C = 0x00000001 - ADDR_10BIT = 0x00000002 - PROTOCOL_MANGLING = 0x00000004 # I2C_M_IGNORE_NAK etc. - SMBUS_PEC = 0x00000008 - NOSTART = 0x00000010 # I2C_M_NOSTART - SLAVE = 0x00000020 - SMBUS_BLOCK_PROC_CALL = 0x00008000 # SMBus 2.0 - SMBUS_QUICK = 0x00010000 - SMBUS_READ_BYTE = 0x00020000 - SMBUS_WRITE_BYTE = 0x00040000 - SMBUS_READ_BYTE_DATA = 0x00080000 - SMBUS_WRITE_BYTE_DATA = 0x00100000 - SMBUS_READ_WORD_DATA = 0x00200000 - SMBUS_WRITE_WORD_DATA = 0x00400000 - SMBUS_PROC_CALL = 0x00800000 - SMBUS_READ_BLOCK_DATA = 0x01000000 - SMBUS_WRITE_BLOCK_DATA = 0x02000000 - SMBUS_READ_I2C_BLOCK = 0x04000000 # I2C-like block xfer - SMBUS_WRITE_I2C_BLOCK = 0x08000000 # w/ 1-byte reg. addr. - SMBUS_HOST_NOTIFY = 0x10000000 - - SMBUS_BYTE = 0x00060000 - SMBUS_BYTE_DATA = 0x00180000 - SMBUS_WORD_DATA = 0x00600000 - SMBUS_BLOCK_DATA = 0x03000000 - SMBUS_I2C_BLOCK = 0x0c000000 - SMBUS_EMUL = 0x0eff0008 - - -# i2c_msg flags from uapi/linux/i2c.h -I2C_M_RD = 0x0001 - -# Pointer definitions -LP_c_uint8 = POINTER(c_uint8) -LP_c_uint16 = POINTER(c_uint16) -LP_c_uint32 = POINTER(c_uint32) - - -############################################################# -# Type definitions as in i2c.h - - -class i2c_smbus_data(Array): - """ - Adaptation of the i2c_smbus_data union in ``i2c.h``. - - Data for SMBus messages. - """ - _length_ = I2C_SMBUS_BLOCK_MAX + 2 - _type_ = c_uint8 - - -class union_i2c_smbus_data(Union): - _fields_ = [ - ("byte", c_uint8), - ("word", c_uint16), - ("block", i2c_smbus_data) - ] - - -union_pointer_type = POINTER(union_i2c_smbus_data) - - -class i2c_smbus_ioctl_data(Structure): - """ - As defined in ``i2c-dev.h``. - """ - _fields_ = [ - ('read_write', c_uint8), - ('command', c_uint8), - ('size', c_uint32), - ('data', union_pointer_type)] - __slots__ = [name for name, type in _fields_] - - @staticmethod - def create(read_write=I2C_SMBUS_READ, command=0, size=I2C_SMBUS_BYTE_DATA): - u = union_i2c_smbus_data() - return i2c_smbus_ioctl_data( - read_write=read_write, command=command, size=size, - data=union_pointer_type(u)) - - -############################################################# -# Type definitions for i2c_rdwr combined transactions - - -class i2c_msg(Structure): - """ - As defined in ``i2c.h``. - """ - _fields_ = [ - ('addr', c_uint16), - ('flags', c_uint16), - ('len', c_uint16), - ('buf', POINTER(c_char))] - - def __iter__(self): - """ Iterator / Generator - - :return: iterates over :py:attr:`buf` - :rtype: :py:class:`generator` which returns int values - """ - idx = 0 - while idx < self.len: - yield ord(self.buf[idx]) - idx += 1 - - def __len__(self): - return self.len - - def __bytes__(self): - return string_at(self.buf, self.len) - - def __repr__(self): - return 'i2c_msg(%d,%d,%r)' % (self.addr, self.flags, self.__bytes__()) - - def __str__(self): - s = self.__bytes__() - if sys.version_info.major >= 3: - s = ''.join(map(chr, s)) - return s - - @staticmethod - def read(address, length): - """ - Prepares an i2c read transaction. - - :param address: Slave address. - :type: address: int - :param length: Number of bytes to read. - :type: length: int - :return: New :py:class:`i2c_msg` instance for read operation. - :rtype: :py:class:`i2c_msg` - """ - arr = create_string_buffer(length) - return i2c_msg( - addr=address, flags=I2C_M_RD, len=length, - buf=arr) - - @staticmethod - def write(address, buf): - """ - Prepares an i2c write transaction. - - :param address: Slave address. - :type address: int - :param buf: Bytes to write. Either list of values or str. - :type buf: list - :return: New :py:class:`i2c_msg` instance for write operation. - :rtype: :py:class:`i2c_msg` - """ - if sys.version_info.major >= 3: - if type(buf) is str: - buf = bytes(map(ord, buf)) - else: - buf = bytes(buf) - else: - if type(buf) is not str: - buf = ''.join([chr(x) for x in buf]) - arr = create_string_buffer(buf, len(buf)) - return i2c_msg( - addr=address, flags=0, len=len(arr), - buf=arr) - - -class i2c_rdwr_ioctl_data(Structure): - """ - As defined in ``i2c-dev.h``. - """ - _fields_ = [ - ('msgs', POINTER(i2c_msg)), - ('nmsgs', c_uint32) - ] - __slots__ = [name for name, type in _fields_] - - @staticmethod - def create(*i2c_msg_instances): - """ - Factory method for creating a i2c_rdwr_ioctl_data struct that can - be called with ``ioctl(fd, I2C_RDWR, data)``. - - :param i2c_msg_instances: Up to 42 i2c_msg instances - :rtype: i2c_rdwr_ioctl_data - """ - n_msg = len(i2c_msg_instances) - msg_array = (i2c_msg * n_msg)(*i2c_msg_instances) - return i2c_rdwr_ioctl_data( - msgs=msg_array, - nmsgs=n_msg - ) - - -############################################################# - - -class SMBus(object): - - def __init__(self, bus=None, force=False): - """ - Initialize and (optionally) open an i2c bus connection. - - :param bus: i2c bus number (e.g. 0 or 1) - or an absolute file path (e.g. `/dev/i2c-42`). - If not given, a subsequent call to ``open()`` is required. - :type bus: int or str - :param force: force using the slave address even when driver is - already using it. - :type force: boolean - """ - self.fd = None - self.funcs = I2cFunc(0) - if bus is not None: - self.open(bus) - self.address = None - self.force = force - self._force_last = None - - def __enter__(self): - """Enter handler.""" - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - """Exit handler.""" - self.close() - - def open(self, bus): - """ - Open a given i2c bus. - - :param bus: i2c bus number (e.g. 0 or 1) - or an absolute file path (e.g. '/dev/i2c-42'). - :type bus: int or str - :raise TypeError: if type(bus) is not in (int, str) - """ - if isinstance(bus, int): - filepath = "/dev/i2c-{}".format(bus) - elif isinstance(bus, str): - filepath = bus - else: - raise TypeError("Unexpected type(bus)={}".format(type(bus))) - - self.fd = os.open(filepath, os.O_RDWR) - self.funcs = self._get_funcs() - - def close(self): - """ - Close the i2c connection. - """ - if self.fd: - os.close(self.fd) - self.fd = None - - def _set_address(self, address, force=None): - """ - Set i2c slave address to use for subsequent calls. - - :param address: - :type address: int - :param force: - :type force: Boolean - """ - force = force if force is not None else self.force - if self.address != address or self._force_last != force: - if force is True: - ioctl(self.fd, I2C_SLAVE_FORCE, address) - else: - ioctl(self.fd, I2C_SLAVE, address) - self.address = address - self._force_last = force - - def _get_funcs(self): - """ - Returns a 32-bit value stating supported I2C functions. - - :rtype: int - """ - f = c_uint32() - ioctl(self.fd, I2C_FUNCS, f) - return f.value - - def write_quick(self, i2c_addr, force=None): - """ - Perform quick transaction. Throws IOError if unsuccessful. - :param i2c_addr: i2c address - :type i2c_addr: int - :param force: - :type force: Boolean - """ - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_WRITE, command=0, size=I2C_SMBUS_QUICK) - ioctl(self.fd, I2C_SMBUS, msg) - - def read_byte(self, i2c_addr, force=None): - """ - Read a single byte from a device. - - :rtype: int - :param i2c_addr: i2c address - :type i2c_addr: int - :param force: - :type force: Boolean - :return: Read byte value - """ - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_READ, command=0, size=I2C_SMBUS_BYTE - ) - ioctl(self.fd, I2C_SMBUS, msg) - return msg.data.contents.byte - - def write_byte(self, i2c_addr, value, force=None): - """ - Write a single byte to a device. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param value: value to write - :type value: int - :param force: - :type force: Boolean - """ - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_WRITE, command=value, size=I2C_SMBUS_BYTE - ) - ioctl(self.fd, I2C_SMBUS, msg) - - def read_byte_data(self, i2c_addr, register, force=None): - """ - Read a single byte from a designated register. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Register to read - :type register: int - :param force: - :type force: Boolean - :return: Read byte value - :rtype: int - """ - val_t = -1 - returnmsg="" - try: - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_READ, command=register, size=I2C_SMBUS_BYTE_DATA - ) - val_t = ioctl(self.fd, I2C_SMBUS, msg) - except Exception as e: - self.close() - returnmsg = str(e) - if val_t < 0: - return False, returnmsg - else: - return True, msg.data.contents.byte - - def write_byte_data(self, i2c_addr, register, value, force=None): - """ - Write a byte to a given register. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Register to write to - :type register: int - :param value: Byte value to transmit - :type value: int - :param force: - :type force: Boolean - :rtype: None - """ - val_t = -1 - returnmsg = "" - try: - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_BYTE_DATA - ) - msg.data.contents.byte = value - val_t = ioctl(self.fd, I2C_SMBUS, msg) - except Exception as e: - returnmsg = str(e) - self.close() - if val_t < 0: - return False, returnmsg or "" - else: - return True, "" - - def write_byte_data_pec(self, i2c_addr, register, value, force=None): - """ - Write a byte to a given register. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Register to write to - :type register: int - :param value: Byte value to transmit - :type value: int - :param force: - :type force: Boolean - :rtype: None - """ - val_t = -1 - returnmsg = "" - try: - val_t = ioctl(self.fd, I2C_PEC, 1) - if val_t < 0: - raise Exception("set pec mod error") - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_BYTE_DATA - ) - msg.data.contents.byte = value - val_t = ioctl(self.fd, I2C_SMBUS, msg) - except Exception as e: - returnmsg = str(e) - self.close() - if val_t < 0: - return False, returnmsg or "" - else: - return True, "" - - def read_word_data(self, i2c_addr, register, force=None): - """ - Read a single word (2 bytes) from a given register. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Register to read - :type register: int - :param force: - :type force: Boolean - :return: 2-byte word - :rtype: int - """ - val_t = -1 - returnmsg = "" - try: - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_READ, command=register, size=I2C_SMBUS_WORD_DATA - ) - val_t = ioctl(self.fd, I2C_SMBUS, msg) - except Exception as e: - returnmsg = str(e) - self.close() - if val_t < 0: - return False, returnmsg or "" - else: - return True, msg.data.contents.word - - def write_word_data_pec(self, i2c_addr, register, value, force=None): - """ - Write a byte to a given register. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Register to write to - :type register: int - :param value: Word value to transmit - :type value: int - :param force: - :type force: Boolean - :rtype: None - """ - val_t = -1 - returnmsg = "" - try: - val_t = ioctl(self.fd, I2C_PEC, 1) - if val_t < 0: - raise Exception("set pec mod error") - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_WORD_DATA - ) - msg.data.contents.word = value - val_t = ioctl(self.fd, I2C_SMBUS, msg) - except Exception as e: - returnmsg = str(e) - self.close() - if val_t < 0: - return False, returnmsg or "" - else: - return True, "" - - def write_word_data(self, i2c_addr, register, value, force=None): - """ - Write a byte to a given register. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Register to write to - :type register: int - :param value: Word value to transmit - :type value: int - :param force: - :type force: Boolean - :rtype: None - """ - val_t = -1 - returnmsg = "" - try: - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_WORD_DATA - ) - msg.data.contents.word = value - val_t = ioctl(self.fd, I2C_SMBUS, msg) - except Exception as e: - returnmsg = str(e) - self.close() - if val_t < 0: - return False, returnmsg or "" - else: - return True, "" - - def process_call(self, i2c_addr, register, value, force=None): - """ - Executes a SMBus Process Call, sending a 16-bit value and receiving a 16-bit response - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Register to read/write to - :type register: int - :param value: Word value to transmit - :type value: int - :param force: - :type force: Boolean - :rtype: int - """ - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_PROC_CALL - ) - msg.data.contents.word = value - ioctl(self.fd, I2C_SMBUS, msg) - return msg.data.contents.word - - def read_block_data(self, i2c_addr, register, force=None): - """ - Read a block of up to 32-bytes from a given register. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Start register - :type register: int - :param force: - :type force: Boolean - :return: List of bytes - :rtype: list - """ - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_READ, command=register, size=I2C_SMBUS_BLOCK_DATA - ) - ioctl(self.fd, I2C_SMBUS, msg) - length = msg.data.contents.block[0] - return msg.data.contents.block[1:length + 1] - - def write_block_data(self, i2c_addr, register, data, force=None): - """ - Write a block of byte data to a given register. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Start register - :type register: int - :param data: List of bytes - :type data: list - :param force: - :type force: Boolean - :rtype: None - """ - length = len(data) - if length > I2C_SMBUS_BLOCK_MAX: - raise ValueError("Data length cannot exceed %d bytes" % I2C_SMBUS_BLOCK_MAX) - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_BLOCK_DATA - ) - msg.data.contents.block[0] = length - msg.data.contents.block[1:length + 1] = data - ioctl(self.fd, I2C_SMBUS, msg) - - def block_process_call(self, i2c_addr, register, data, force=None): - """ - Executes a SMBus Block Process Call, sending a variable-size data - block and receiving another variable-size response - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Register to read/write to - :type register: int - :param data: List of bytes - :type data: list - :param force: - :type force: Boolean - :return: List of bytes - :rtype: list - """ - length = len(data) - if length > I2C_SMBUS_BLOCK_MAX: - raise ValueError("Data length cannot exceed %d bytes" % I2C_SMBUS_BLOCK_MAX) - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_BLOCK_PROC_CALL - ) - msg.data.contents.block[0] = length - msg.data.contents.block[1:length + 1] = data - ioctl(self.fd, I2C_SMBUS, msg) - length = msg.data.contents.block[0] - return msg.data.contents.block[1:length + 1] - - def read_i2c_block_data(self, i2c_addr, register, length, force=None): - """ - Read a block of byte data from a given register. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Start register - :type register: int - :param length: Desired block length - :type length: int - :param force: - :type force: Boolean - :return: List of bytes - :rtype: list - """ - if length > I2C_SMBUS_BLOCK_MAX: - raise ValueError("Desired block length over %d bytes" % I2C_SMBUS_BLOCK_MAX) - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_READ, command=register, size=I2C_SMBUS_I2C_BLOCK_DATA - ) - msg.data.contents.byte = length - ioctl(self.fd, I2C_SMBUS, msg) - return msg.data.contents.block[1:length + 1] - - def write_i2c_block_data(self, i2c_addr, register, data, force=None): - """ - Write a block of byte data to a given register. - - :param i2c_addr: i2c address - :type i2c_addr: int - :param register: Start register - :type register: int - :param data: List of bytes - :type data: list - :param force: - :type force: Boolean - :rtype: None - """ - length = len(data) - if length > I2C_SMBUS_BLOCK_MAX: - raise ValueError("Data length cannot exceed %d bytes" % I2C_SMBUS_BLOCK_MAX) - self._set_address(i2c_addr, force=force) - msg = i2c_smbus_ioctl_data.create( - read_write=I2C_SMBUS_WRITE, command=register, size=I2C_SMBUS_I2C_BLOCK_DATA - ) - msg.data.contents.block[0] = length - msg.data.contents.block[1:length + 1] = data - ioctl(self.fd, I2C_SMBUS, msg) - - def i2c_rdwr(self, *i2c_msgs): - """ - Combine a series of i2c read and write operations in a single - transaction (with repeated start bits but no stop bits in between). - - This method takes i2c_msg instances as input, which must be created - first with :py:meth:`i2c_msg.read` or :py:meth:`i2c_msg.write`. - - :param i2c_msgs: One or more i2c_msg class instances. - :type i2c_msgs: i2c_msg - :rtype: None - """ - ioctl_data = i2c_rdwr_ioctl_data.create(*i2c_msgs) - ioctl(self.fd, I2C_RDWR, ioctl_data) - - -class SMBusWrapper: - """ - Wrapper class around the SMBus. - Deprecated as of version 0.3.0. Please replace with :py:class:`SMBus`. - - Enables the user to wrap access to the :py:class:`SMBus` class in a - "with" statement. If auto_cleanup is True (default), the - :py:class:`SMBus` handle will be automatically closed - upon exit of the ``with`` block. - """ - def __init__(self, bus_number=0, auto_cleanup=True, force=False): - """ - :param auto_cleanup: Close bus when leaving scope. - :type auto_cleanup: Boolean - :param force: Force using the slave address even when driver is already using it. - :type force: Boolean - """ - self.bus_number = bus_number - self.auto_cleanup = auto_cleanup - self.force = force - - def __enter__(self): - self.bus = SMBus(bus=self.bus_number, force=self.force) - return self.bus - - def __exit__(self, exc_type, exc_val, exc_tb): - if self.auto_cleanup: - self.bus.close() diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/Makefile b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/Makefile deleted file mode 100644 index 78ef5b8b81..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -PWD = $(shell pwd) -EXTRA_CFLAGS:= -I$(M)/include -EXTRA_CFLAGS+= -Wall -KVERSION ?= $(shell uname -r) -KERNEL_SRC ?= /lib/modules/$(KVERSION) - -module_out_put_dir := $(PWD)/build -export module_out_put_dir - -ragile_common-objs := ragile_common_module.o dfd_tlveeprom.o -obj-m += ragile_platform.o -obj-m += i2c-mux-pca9641.o -obj-m += i2c-mux-pca954x.o -obj-m += ragile_common.o -obj-m += rtcpcf85063.o -#obj-m += tpm_tis_core.o -#obj-m += rg_spi_gpio.o -#obj-m += spi-gpio.o -#obj-m += tpm_tis_spi.o -obj-m += optoe.o -obj-m += rg_at24.o - -all : - $(MAKE) -C $(KERNEL_SRC)/build M=$(PWD) modules - @if [ ! -d $(module_out_put_dir) ]; then mkdir -p $(module_out_put_dir) ;fi - cp -p $(PWD)/*.ko $(module_out_put_dir) - -clean : - rm -rf $(module_out_put_dir) - rm -f ${PWD}/*.o ${PWD}/*.ko ${PWD}/*.mod.c ${PWD}/.*.cmd ${PWD}/.*.o.d - rm -f ${PWD}/Module.markers ${PWD}/Module.symvers ${PWD}/modules.order - rm -rf ${PWD}/.tmp_versions diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/dfd_tlveeprom.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/dfd_tlveeprom.c deleted file mode 100644 index 99bf3eed80..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/dfd_tlveeprom.c +++ /dev/null @@ -1,521 +0,0 @@ -/* - * Copyright (C) 2003-2014 FreeIPMI Core Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -/*****************************************************************************\ - * Copyright (C) 2007-2014 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Albert Chu - * UCRL-CODE-232183 - * - * This file is part of Ipmi-fru, a tool used for retrieving - * motherboard field replaceable unit (FRU) information. For details, - * see http://www.llnl.gov/linux/. - * - * Ipmi-fru is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. - * - * Ipmi-fru is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with Ipmi-fru. If not, see . -\*****************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ragile.h" -#include "dfd_tlveeprom.h" - -/* using in is_valid_tlvinfo_header */ -static u_int32_t eeprom_size; - -/* - * List of TLV codes and names. - */ -static const struct tlv_code_desc tlv_code_list[] = { - { TLV_CODE_PRODUCT_NAME , "Product Name"}, - { TLV_CODE_PART_NUMBER , "Part Number"}, - { TLV_CODE_SERIAL_NUMBER , "Serial Number"}, - { TLV_CODE_MAC_BASE , "Base MAC Address"}, - { TLV_CODE_MANUF_DATE , "Manufacture Date"}, - { TLV_CODE_DEVICE_VERSION , "Device Version"}, - { TLV_CODE_LABEL_REVISION , "Label Revision"}, - { TLV_CODE_PLATFORM_NAME , "Platform Name"}, - { TLV_CODE_ONIE_VERSION , "ONIE Version"}, - { TLV_CODE_MAC_SIZE , "MAC Addresses"}, - { TLV_CODE_MANUF_NAME , "Manufacturer"}, - { TLV_CODE_MANUF_COUNTRY , "Country Code"}, - { TLV_CODE_VENDOR_NAME , "Vendor Name"}, - { TLV_CODE_DIAG_VERSION , "Diag Version"}, - { TLV_CODE_SERVICE_TAG , "Service Tag"}, - { TLV_CODE_VENDOR_EXT , "Vendor Extension"}, - { TLV_CODE_CRC_32 , "CRC-32"}, -}; - -#if 0 -#define OPENBMC_VPD_KEY_INVAIL_VAL 0 - -static const tlv_code_map_t tlv_code_map[] = { - { TLV_CODE_PRODUCT_NAME , OPENBMC_VPD_KEY_PRODUCT_NAME}, - { TLV_CODE_PART_NUMBER , OPENBMC_VPD_KEY_PRODUCT_PART_MODEL_NUM}, - { TLV_CODE_SERIAL_NUMBER , OPENBMC_VPD_KEY_PRODUCT_SERIAL_NUM}, - { TLV_CODE_MAC_BASE , OPENBMC_VPD_KEY_INVAIL_VAL}, - { TLV_CODE_MANUF_DATE , OPENBMC_VPD_KEY_BOARD_MFG_DATE}, - { TLV_CODE_DEVICE_VERSION , OPENBMC_VPD_KEY_PRODUCT_VER}, - { TLV_CODE_LABEL_REVISION , OPENBMC_VPD_KEY_PRODUCT_CUSTOM7}, - { TLV_CODE_PLATFORM_NAME , OPENBMC_VPD_KEY_PRODUCT_CUSTOM1}, - { TLV_CODE_ONIE_VERSION , OPENBMC_VPD_KEY_PRODUCT_CUSTOM2}, - { TLV_CODE_MAC_SIZE , OPENBMC_VPD_KEY_INVAIL_VAL}, - { TLV_CODE_MANUF_NAME , OPENBMC_VPD_KEY_PRODUCT_MFR}, - { TLV_CODE_MANUF_COUNTRY , OPENBMC_VPD_KEY_PRODUCT_CUSTOM3}, - { TLV_CODE_VENDOR_NAME , OPENBMC_VPD_KEY_PRODUCT_CUSTOM4}, - { TLV_CODE_DIAG_VERSION , OPENBMC_VPD_KEY_PRODUCT_CUSTOM8}, - { TLV_CODE_SERVICE_TAG , OPENBMC_VPD_KEY_PRODUCT_CUSTOM5}, - { TLV_CODE_VENDOR_EXT , OPENBMC_VPD_KEY_PRODUCT_CUSTOM6}, - { TLV_CODE_CRC_32 , OPENBMC_VPD_KEY_INVAIL_VAL}, -}; -#endif - -#define TLV_CODE_NUM (sizeof(tlv_code_list) / sizeof(tlv_code_list[0])) - -#if 0 -#define TLV_CODE_MAP_NUM (sizeof(tlv_code_map) / sizeof(tlv_code_map[0])) -#endif - -const unsigned long crc_table[] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, - 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, - 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, - 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, - 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, - 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, - 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, - 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, - 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, - 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, - 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, - 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, - 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, - 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, - 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, - 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, - 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, - 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, -}; - -static unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned len) -{ - unsigned i; - if (len < 1) - return 0xffffffff; - - for (i = 0; i != len; ++i) - { - crc = crc_table[(crc ^ buf[i]) & 0xff] ^ (crc >> 8); - } - - crc = crc ^ 0xffffffff; - - return crc; -} - -/* - * is_valid_tlv - * - * Perform basic sanity checks on a TLV field. The TLV is pointed to - * by the parameter provided. - * 1. The type code is not reserved (0x00 or 0xFF) - */ -static inline bool is_valid_tlv(tlvinfo_tlv_t *tlv) -{ - return ((tlv->type != 0x00) && (tlv->type != 0xFF)); -} - -/* - * is_valid_tlvinfo_header - * - * Perform sanity checks on the first 11 bytes of the TlvInfo EEPROM - * data pointed to by the parameter: - * 1. First 8 bytes contain null-terminated ASCII string "TlvInfo" - * 2. Version byte is 1 - * 3. Total length bytes contain value which is less than or equal - * to the allowed maximum (2048-11) - * - */ -static inline bool is_valid_tlvinfo_header(tlvinfo_header_t *hdr) -{ - int max_size = eeprom_size; - return((strcmp(hdr->signature, TLV_INFO_ID_STRING) == 0) && - (hdr->version == TLV_INFO_VERSION) && - (be16_to_cpu(hdr->totallen) <= max_size) ); -} - -/* - * decode_tlv_value - * - * Decode a single TLV value into a string. - - * The validity of EEPROM contents and the TLV field have been verified - * prior to calling this function. - */ -static void decode_tlv_value(tlvinfo_tlv_t *tlv, tlv_decode_value_t *decode_value) -{ - int i; - char *value; - u_int32_t length; - - value = (char *)decode_value->value; - - switch (tlv->type) { - case TLV_CODE_PRODUCT_NAME: - case TLV_CODE_PART_NUMBER: - case TLV_CODE_SERIAL_NUMBER: - case TLV_CODE_MANUF_DATE: - case TLV_CODE_LABEL_REVISION: - case TLV_CODE_PLATFORM_NAME: - case TLV_CODE_ONIE_VERSION: - case TLV_CODE_MANUF_NAME: - case TLV_CODE_MANUF_COUNTRY: - case TLV_CODE_VENDOR_NAME: - case TLV_CODE_DIAG_VERSION: - case TLV_CODE_SERVICE_TAG: - case TLV_CODE_VENDOR_EXT: - memcpy(value, tlv->value, tlv->length); - value[tlv->length] = 0; - length = tlv->length; - break; - case TLV_CODE_MAC_BASE: - length = sprintf(value, "%02X:%02X:%02X:%02X:%02X:%02X", - tlv->value[0], tlv->value[1], tlv->value[2], - tlv->value[3], tlv->value[4], tlv->value[5]); - break; - case TLV_CODE_DEVICE_VERSION: - length = sprintf(value, "%u", tlv->value[0]); - break; - case TLV_CODE_MAC_SIZE: - length = sprintf(value, "%u", (tlv->value[0] << 8) | tlv->value[1]); - break; - #if 0 - case TLV_CODE_VENDOR_EXT: - value[0] = 0; - length = 0; - for (i = 0; (i < (TLV_DECODE_VALUE_MAX_LEN/5)) && (i < tlv->length); i++) { - length += sprintf(value, "%s 0x%02X", value, tlv->value[i]); - } - break; - #endif - case TLV_CODE_CRC_32: - length = sprintf(value, "0x%02X%02X%02X%02X", tlv->value[0], - tlv->value[1], tlv->value[2], tlv->value[3]); - break; - default: - value[0] = 0; - length = 0; - for (i = 0; (i < (TLV_DECODE_VALUE_MAX_LEN/5)) && (i < tlv->length); i++) { - length += sprintf(value, "%s 0x%02X", value, tlv->value[i]); - } - break; - } - - decode_value->length = length; -} - -/* - * is_checksum_valid - * - * Validate the checksum in the provided TlvInfo EEPROM data. First, - * verify that the TlvInfo header is valid, then make sure the last - * TLV is a CRC-32 TLV. Then calculate the CRC over the EEPROM data - * and compare it to the value stored in the EEPROM CRC-32 TLV. - */ -static bool is_checksum_valid(u_int8_t *eeprom) -{ - tlvinfo_header_t *eeprom_hdr; - tlvinfo_tlv_t *eeprom_crc; - unsigned int calc_crc; - unsigned int stored_crc; - - eeprom_hdr = (tlvinfo_header_t *) eeprom; - - /* Is the eeprom header valid? */ - if (!is_valid_tlvinfo_header(eeprom_hdr)) { - return false; - } - - /* Is the last TLV a CRC? */ - eeprom_crc = (tlvinfo_tlv_t *) &eeprom[sizeof(tlvinfo_header_t) + - be16_to_cpu(eeprom_hdr->totallen) - (sizeof(tlvinfo_tlv_t) + 4)]; - if ((eeprom_crc->type != TLV_CODE_CRC_32) || (eeprom_crc->length != 4)) { - return false; - } - - /* Calculate the checksum */ - calc_crc = crc32(0xffffffffL, (const unsigned char *)eeprom, sizeof(tlvinfo_header_t) + - be16_to_cpu(eeprom_hdr->totallen) - 4); - stored_crc = ((eeprom_crc->value[0] << 24) | (eeprom_crc->value[1] << 16) | - (eeprom_crc->value[2] << 8) | eeprom_crc->value[3]); - - return (calc_crc == stored_crc); -} - -/* - * tlvinfo_find_tlv - * - * This function finds the TLV with the supplied code in the EERPOM. - * An offset from the beginning of the EEPROM is returned in the - * eeprom_index parameter if the TLV is found. - */ -static bool tlvinfo_find_tlv(u_int8_t *eeprom, u_int8_t tcode, int *eeprom_index) -{ - tlvinfo_header_t *eeprom_hdr; - tlvinfo_tlv_t *eeprom_tlv; - int eeprom_end; - - eeprom_hdr = (tlvinfo_header_t *) eeprom; - - /* Search through the TLVs, looking for the first one which matches the - supplied type code. */ - *eeprom_index = sizeof(tlvinfo_header_t); - eeprom_end = sizeof(tlvinfo_header_t) + be16_to_cpu(eeprom_hdr->totallen); - while (*eeprom_index < eeprom_end) { - eeprom_tlv = (tlvinfo_tlv_t *) &eeprom[*eeprom_index]; - if (!is_valid_tlv(eeprom_tlv)) { - return false; - } - - if (eeprom_tlv->type == tcode) { - return true; - } - - *eeprom_index += sizeof(tlvinfo_tlv_t) + eeprom_tlv->length; - } - - return false; -} - -/* - * tlvinfo_decode_tlv - * - * This function finds the TLV with the supplied code in the EERPOM - * and decodes the value into the buffer provided. - */ -static bool tlvinfo_decode_tlv(u_int8_t *eeprom, u_int8_t tcode, tlv_decode_value_t *decode_value) -{ - int eeprom_index; - tlvinfo_tlv_t *eeprom_tlv; - - /* Find the TLV and then decode it */ - if (tlvinfo_find_tlv(eeprom, tcode, &eeprom_index)) { - eeprom_tlv = (tlvinfo_tlv_t *) &eeprom[eeprom_index]; - decode_tlv_value(eeprom_tlv, decode_value); - return true; - } - - return false; -} - -/* - * parse_tlv_eeprom - * - * parse the EEPROM into memory, if it hasn't already been read. - */ -int parse_tlv_eeprom(u_int8_t *eeprom, u_int32_t size) -{ - unsigned int i; - bool ret; - tlvinfo_header_t *eeprom_hdr; - //tlv_info_vec_t tlv_info; - tlv_decode_value_t decode_value; - int j; - - eeprom_hdr = (tlvinfo_header_t *) eeprom; - eeprom_size = size; /* eeprom real size */ - - if (!is_valid_tlvinfo_header(eeprom_hdr)) { - DBG_ERROR("Failed to check tlv header.\n"); - return -1; - } - - if (!is_checksum_valid(eeprom)) { - DBG_ERROR("Failed to check tlv crc.\n"); - return -1; - } - - for (i = 0; i < TLV_CODE_NUM; i++) { - mem_clear((void *)&decode_value, sizeof(tlv_decode_value_t)); - ret = tlvinfo_decode_tlv(eeprom, tlv_code_list[i].m_code, &decode_value); - if (!ret) { - DBG_ERROR("No found type: %s\n", tlv_code_list[i].m_name); - continue; - } - - DBG_DEBUG("i: %d,Found type: %s tlv[%d]:%s\n", i, tlv_code_list[i].m_name, tlv_code_list[i].m_code, - decode_value.value); - for (j = 0; j < decode_value.length; j++) { - if ((j % 16) == 0) { - DBG_DEBUG("\n"); - } - DBG_DEBUG("%02x ", decode_value.value[j]); - } - DBG_DEBUG("\n\n"); - } - return 0; -} -static int dfd_parse_tlv_eeprom(u_int8_t *eeprom, u_int32_t size, u_int8_t main_type, tlv_decode_value_t *decode_value) -{ - bool ret; - tlvinfo_header_t *eeprom_hdr; - /* tlv_info_vec_t tlv_info; */ - int j; - - eeprom_hdr = (tlvinfo_header_t *) eeprom; - eeprom_size = size; /* eeprom real size */ - - if (!is_valid_tlvinfo_header(eeprom_hdr)) { - DBG_ERROR("Failed to check tlv header.\n"); - return -1; - } - - if (!is_checksum_valid(eeprom)) { - DBG_ERROR("Failed to check tlv crc.\n"); - return -1; - } - - ret = tlvinfo_decode_tlv(eeprom, main_type, decode_value); - if (!ret) { - DBG_ERROR("No found type: %d\n", main_type); - return -1; - } - - DBG_DEBUG("Found type: %d, value: %s\n", main_type,decode_value->value); - for (j = 0; j < decode_value->length; j++) { - if ((j % 16) == 0) { - DBG_DEBUG("\n"); - } - DBG_DEBUG("%02x ", decode_value->value[j]); - } - DBG_DEBUG("\n\n"); - - return 0; -} - -/* analyze the extended custom TLV format */ -static int tlvinfo_find_rg_ext_tlv(tlv_decode_value_t *ext_tlv_value, u_int8_t ext_type, - u_int8_t *buf, u_int8_t *buf_len) -{ - tlvinfo_tlv_t *eeprom_tlv; - int eeprom_end, eeprom_index; - - /* Search through the TLVs, looking for the first one which matches the - supplied type code. */ - DBG_DEBUG("ext_tlv_value->length: %d.\n", ext_tlv_value->length); - for (eeprom_index = 0; eeprom_index < ext_tlv_value->length; eeprom_index++) { - if ((eeprom_index % 16) == 0) { - DBG_DEBUG("\n"); - } - DBG_DEBUG("%02x ", ext_tlv_value->value[eeprom_index]); - } - - DBG_DEBUG("\n"); - - eeprom_index = 0; - eeprom_end = ext_tlv_value->length; - while (eeprom_index < eeprom_end) { - eeprom_tlv = (tlvinfo_tlv_t *) &(ext_tlv_value->value[eeprom_index]); - if (!is_valid_tlv(eeprom_tlv)) { - DBG_ERROR("tlv is not valid, eeprom_tlv->type 0x%x.\n", eeprom_tlv->type); - return -1; - } - - DBG_DEBUG("eeprom_tlv->length %d.\n", eeprom_tlv->length); - if (eeprom_tlv->type == ext_type) { - if (*buf_len >= eeprom_tlv->length) { - memcpy(buf, eeprom_tlv->value, eeprom_tlv->length); - DBG_DEBUG("eeprom_tlv->length %d.\n", eeprom_tlv->length); - *buf_len = eeprom_tlv->length; - return 0; - } - DBG_ERROR("buf_len %d small than info_len %d.\n", *buf_len, eeprom_tlv->length); - return -1; - } - - eeprom_index += sizeof(tlvinfo_tlv_t) + eeprom_tlv->length; - } - - DBG_ERROR("ext_type %d: tlv is not found.\n", ext_type); - return -1; -} - -/* get EEPROM information */ -int dfd_tlvinfo_get_e2prom_info(u_int8_t *eeprom, u_int32_t size, dfd_tlv_type_t *tlv_type, u_int8_t* buf, u_int8_t *buf_len) -{ - tlv_decode_value_t decode_value; - int ret; - - if (eeprom == NULL || tlv_type == NULL || buf == NULL) { - DBG_ERROR("Input para invalid.\n"); - return -1; - } - - mem_clear((void *)&decode_value, sizeof(tlv_decode_value_t)); - ret = dfd_parse_tlv_eeprom(eeprom, size, tlv_type->main_type, &decode_value); - if (ret) { - DBG_ERROR("dfd_parse_tlv_eeprom failed ret %d.\n", ret); - return ret; - } - - /* For non-extended types, return data directly */ - if (tlv_type->main_type != TLV_CODE_VENDOR_EXT) { - if (*buf_len >= decode_value.length) { - memcpy(buf, decode_value.value, decode_value.length); - *buf_len = decode_value.length; - return 0; - } - DBG_ERROR("buf_len %d small than info_len %d.\n", *buf_len, decode_value.length); - return -1; - } - DBG_DEBUG("info_len %d.\n", decode_value.length); - - /* For the extended type, continue with the secondary TLV analysis to obtain - the data corresponding to the sub-TLV type */ - return tlvinfo_find_rg_ext_tlv(&decode_value, tlv_type->ext_type, buf, buf_len); -} diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/dfd_tlveeprom.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/dfd_tlveeprom.h deleted file mode 100644 index 6c5b2e98be..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/dfd_tlveeprom.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef DFD_OPENBMC_TLVEEPROM_H -#define DFD_OPENBMC_TLVEEPROM_H - -#ifndef u_int8_t -#define u_int8_t unsigned char -#endif - -#ifndef u_int16_t -#define u_int16_t unsigned short -#endif - -#ifndef u_int32_t -#define u_int32_t unsigned int -#endif - -#ifndef be16_to_cpu -#define be16_to_cpu(x) ntohs(x) -#endif - -#ifndef cpu_to_be16 -#define cpu_to_be16(x) htons(x) -#endif - -/** - * The TLV Types. - * - * Keep these in sync with tlv_code_list in cmd_sys_eeprom.c - */ -#define TLV_CODE_PRODUCT_NAME 0x21 -#define TLV_CODE_PART_NUMBER 0x22 -#define TLV_CODE_SERIAL_NUMBER 0x23 -#define TLV_CODE_MAC_BASE 0x24 -#define TLV_CODE_MANUF_DATE 0x25 -#define TLV_CODE_DEVICE_VERSION 0x26 -#define TLV_CODE_LABEL_REVISION 0x27 -#define TLV_CODE_PLATFORM_NAME 0x28 -#define TLV_CODE_ONIE_VERSION 0x29 -#define TLV_CODE_MAC_SIZE 0x2A -#define TLV_CODE_MANUF_NAME 0x2B -#define TLV_CODE_MANUF_COUNTRY 0x2C -#define TLV_CODE_VENDOR_NAME 0x2D -#define TLV_CODE_DIAG_VERSION 0x2E -#define TLV_CODE_SERVICE_TAG 0x2F -#define TLV_CODE_VENDOR_EXT 0xFD -#define TLV_CODE_CRC_32 0xFE - -#define TLV_CODE_NAME_LEN 64 -/* - * Struct for displaying the TLV codes and names. - */ -struct tlv_code_desc { - u_int8_t m_code; - char m_name[TLV_CODE_NAME_LEN]; -}; -/* ONIE TLV Type and Extended TLV Type Definition */ -typedef struct dfd_tlv_type_s { - u_int8_t main_type;/* ONIE standard TLV TYPE type */ - u_int8_t ext_type; /* Extended TLV TYPE type */ -} dfd_tlv_type_t; - -/* Header Field Constants */ -#define TLV_INFO_ID_STRING "TlvInfo" -#define TLV_INFO_VERSION 0x01 -/*#define TLV_TOTAL_LEN_MAX (XXXXXXXX - sizeof(tlvinfo_header_t))*/ - -struct __attribute__ ((__packed__)) tlvinfo_header_s { - char signature[8]; /* 0x00 - 0x07 EEPROM Tag "TlvInfo" */ - u_int8_t version; /* 0x08 Structure version */ - u_int16_t totallen; /* 0x09 - 0x0A Length of all data which follows */ -}; -typedef struct tlvinfo_header_s tlvinfo_header_t; - -/* - * TlvInfo TLV: Layout of a TLV field - */ -struct __attribute__ ((__packed__)) tlvinfo_tlv_s { - u_int8_t type; - u_int8_t length; - u_int8_t value[0]; -}; -typedef struct tlvinfo_tlv_s tlvinfo_tlv_t; - -#define TLV_VALUE_MAX_LEN 255 -/* - * The max decode value is currently for the 'raw' type or the 'vendor - * extension' type, both of which have the same decode format. The - * max decode string size is computed as follows: - * - * strlen(" 0xFF") * TLV_VALUE_MAX_LEN + 1 - * - */ -#define TLV_DECODE_VALUE_MAX_LEN ((5 * TLV_VALUE_MAX_LEN) + 1) - -typedef struct tlv_decode_value_s { - u_int8_t value[TLV_DECODE_VALUE_MAX_LEN]; - u_int32_t length; -} tlv_decode_value_t; - -typedef enum dfd_tlvinfo_ext_tlv_type_e { - DFD_TLVINFO_EXT_TLV_TYPE_DEV_TYPE = 1, -} dfd_tlvinfo_ext_tlv_type_t; - -#if 0 -#define TLV_TIME_LEN 64 - -int ipmi_tlv_validate_fru_area(const uint8_t fruid, const char *fru_file_name, - sd_bus *bus_type, const bool bmc_fru); - -extern const char *get_vpd_key_names(int key_id); -extern std::string getService(sdbusplus::bus::bus& bus, - const std::string& intf, - const std::string& path); -extern std::string getFRUValue(const std::string& section, - const std::string& key, - const std::string& delimiter, - IPMIFruInfo& fruData); -#endif - -int dfd_tlvinfo_get_e2prom_info(u_int8_t *eeprom, u_int32_t size, dfd_tlv_type_t *tlv_type, u_int8_t* buf, u_int8_t *buf_len); - -#endif /* endif DFD_OPENBMC_TLVEEPROM_H */ diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c deleted file mode 100644 index 4a2ffe136b..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c +++ /dev/null @@ -1,3817 +0,0 @@ -/* - * I2C multiplexer - * - * Copyright (c) 2008-2009 Rodolfo Giometti - * Copyright (c) 2008-2009 Eurotech S.p.A. - * - * This module supports the PCA954x series of I2C multiplexer/switch chips - * made by Philips Semiconductors. - * This includes the: - * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547 - * and PCA9548. - * - * These chips are all controlled via the I2C bus itself, and all have a - * single 8-bit register. The upstream "parent" bus fans out to two, - * four, or eight downstream busses or channels; which of these - * are selected is determined by the chip type and register contents. A - * mux can select only one sub-bus at a time; a switch can select any - * combination simultaneously. - * - * Based on: - * pca954x.c from Kumar Gala - * Copyright (C) 2006 - * - * Based on: - * pca954x.c from Ken Harrenstien - * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) - * - * Based on: - * i2c-virtual_cb.c from Brian Kuschak - * and - * pca9540.c from Jean Delvare . - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#include -#include - -#define mem_clear(data, size) memset((data), 0, (size)) - -#if LINUX_VERSION_CODE > KERNEL_VERSION(4,0,36) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define PCA954X_MAX_NCHANS 8 - -#define PCA954X_IRQ_OFFSET 4 - -extern int pca9641_setmuxflag(int nr, int flag); - -int force_create_bus = 0; -module_param(force_create_bus, int, S_IRUGO | S_IWUSR); - -enum pca_type { - pca_9540, - pca_9542, - pca_9543, - pca_9544, - pca_9545, - pca_9546, - pca_9547, - pca_9548, -}; - -struct chip_desc { - u8 nchans; - u8 enable; /* used for muxes only */ - u8 has_irq; - enum muxtype { - pca954x_ismux = 0, - pca954x_isswi - } muxtype; -}; - -struct pca954x { - const struct chip_desc *chip; - - u8 last_chan; /* last register value */ - s32 idle_state; - u8 deselect; - struct i2c_client *client; - - struct irq_domain *irq; - unsigned int irq_mask; - raw_spinlock_t lock; -}; - -/* Provide specs for the PCA954x types we know about */ -static const struct chip_desc chips[] = { - [pca_9540] = { - .nchans = 2, - .enable = 0x4, - .muxtype = pca954x_ismux, - }, - [pca_9542] = { - .nchans = 2, - .enable = 0x4, - .has_irq = 1, - .muxtype = pca954x_ismux, - }, - [pca_9543] = { - .nchans = 2, - .has_irq = 1, - .muxtype = pca954x_isswi, - }, - [pca_9544] = { - .nchans = 4, - .enable = 0x4, - .has_irq = 1, - .muxtype = pca954x_ismux, - }, - [pca_9545] = { - .nchans = 4, - .has_irq = 1, - .muxtype = pca954x_isswi, - }, - [pca_9546] = { - .nchans = 4, - .muxtype = pca954x_isswi, - }, - [pca_9547] = { - .nchans = 8, - .enable = 0x8, - .muxtype = pca954x_ismux, - }, - [pca_9548] = { - .nchans = 8, - .muxtype = pca954x_isswi, - }, -}; - -static const struct i2c_device_id pca954x_id[] = { - { "pca9540", pca_9540 }, - { "pca9542", pca_9542 }, - { "pca9543", pca_9543 }, - { "pca9544", pca_9544 }, - { "pca9545", pca_9545 }, - { "pca9546", pca_9546 }, - { "pca9547", pca_9547 }, - { "pca9548", pca_9548 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, pca954x_id); - -#ifdef CONFIG_OF -static const struct of_device_id pca954x_of_match[] = { - { .compatible = "nxp,pca9540", .data = &chips[pca_9540] }, - { .compatible = "nxp,pca9542", .data = &chips[pca_9542] }, - { .compatible = "nxp,pca9543", .data = &chips[pca_9543] }, - { .compatible = "nxp,pca9544", .data = &chips[pca_9544] }, - { .compatible = "nxp,pca9545", .data = &chips[pca_9545] }, - { .compatible = "nxp,pca9546", .data = &chips[pca_9546] }, - { .compatible = "nxp,pca9547", .data = &chips[pca_9547] }, - { .compatible = "nxp,pca9548", .data = &chips[pca_9548] }, - {} -}; -MODULE_DEVICE_TABLE(of, pca954x_of_match); -#endif - -/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() - for this as they will try to lock adapter a second time */ -static int pca954x_reg_write(struct i2c_adapter *adap, - struct i2c_client *client, u8 val) -{ - int ret = -ENODEV; - - if (adap->algo->master_xfer) { - struct i2c_msg msg; - char buf[1]; - - msg.addr = client->addr; - msg.flags = 0; - msg.len = 1; - buf[0] = val; - msg.buf = buf; - ret = __i2c_transfer(adap, &msg, 1); - - if (ret >= 0 && ret != 1) - ret = -EREMOTEIO; - } else { - union i2c_smbus_data data; - ret = adap->algo->smbus_xfer(adap, client->addr, - client->flags, - I2C_SMBUS_WRITE, - val, I2C_SMBUS_BYTE, &data); - } - - return ret; -} - -static u8 pca954x_regval(struct pca954x *data, u8 chan) -{ - /* We make switches look like muxes, not sure how to be smarter. */ - if (data->chip->muxtype == pca954x_ismux) - return chan | data->chip->enable; - else - return 1 << chan; -} - static int pca954x_setmuxflag(struct i2c_client *client, int flag) - { - struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); - pca9641_setmuxflag(adap->nr, flag); - return 0; - } - -static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) -{ - struct pca954x *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - u8 regval; - int ret = 0; - regval = pca954x_regval(data, chan); - - /* we make switches look like muxes, not sure how to be smarter */ - - /* Only select the channel if its different from the last channel */ - if (data->last_chan != regval) { - pca954x_setmuxflag(client, 0); - ret = pca954x_reg_write(muxc->parent, client, regval); - data->last_chan = ret < 0 ? 0 : regval; - } - - return ret; -} - -typedef void (*pca954x_hw_do_reset_func_t)(int busid, int addr); -pca954x_hw_do_reset_func_t g_notify_to_do_reset = NULL; - -void pca954x_hw_do_reset_func_register(void* func) -{ - if (func == NULL) { - return ; - } - g_notify_to_do_reset = func; - return; -} -EXPORT_SYMBOL(pca954x_hw_do_reset_func_register); - -static int pca954x_hw_do_reset(int busid, int addr) -{ - if (g_notify_to_do_reset != NULL) { - (*g_notify_to_do_reset)(busid, addr); - return 0; - } - - return 0; -} -/***************************************9548 reset*****************************************/ -#define DEV_TYPE 0x4040 /* BT2575 */ -#define PCA9548_MAX_CPLD_NUM (32) /* PCA9548 max number */ -#define PCA9548_MAX_CPLD_LAYER (8) /* PCA9548 max layer */ -#define DFD_PID_BUF_LEN (32) -#define DFD_PRODUCT_ID_LENGTH (8) -#define CPLD_PCA9548_RESET 0x023500b0 /* bus:2, addr:0x35, offset:0xb0 */ -#define B6510_32CQ_CPLD_PCA9548_RESET 0x060d0060 /* bus:6, addr:0x0d, offset:0x60 */ - -#define DFD_PUB_CARDTYPE_FILE "/sys/module/ragile_common/parameters/dfd_my_type" -#define DFD_MAX_PRODUCT_NUM (32) - -#define I2C_RETRY_TIMES 5 -#define I2C_RETRY_WAIT_TIMES 10 /*delay 10ms*/ - -#define PCA9548_I2C_GET_BUS(addr) (((addr) >> 24) & 0x00ff) -#define PCA9548_I2C_GET_CLIENT(addr) (((addr) >> 16) & 0x00ff) -#define PCA9548_I2C_GET_OFFSET(addr) (addr & 0xffff) - -typedef enum pca9548_reset_type { - PCA9548_RESET_FUNC = 0, - PCA9548_RESET_GPIO = 1, -} pca9548_reset_type_t; - -typedef void (*pca954x_hw_do_reset_func_t_new)(int io_port, u8 value); -typedef u8 (*pca954x_get_umask_func_t)(int io_port); - -void pca954x_hw_do_reset_by_i2c(int addr, u8 value); -u8 pca954x_get_umask_by_i2c(int addr); -void pca954x_hw_do_reset_by_lpc(int io_port, u8 value); -u8 pca954x_get_umask_by_lpc(int io_port); - -typedef struct func_attr_s { - int cfg_offset[PCA9548_MAX_CPLD_LAYER]; - int umask[PCA9548_MAX_CPLD_LAYER]; - pca954x_hw_do_reset_func_t_new reset_func; /* 9548 reset function */ - pca954x_get_umask_func_t get_umask_func; /* get reset mask */ -} func_attr_t; - -typedef struct gpio_attr_s { - int gpio; - int gpio_init; - u8 reset_on; - u8 reset_off; -} gpio_attr_t; - -typedef struct pca9548_cfg_info_s { - int pca9548_reset_type; - int pca9548_bus; - int pca9548_addr; - int rst_delay_b; /* delay time before reset(us) */ - int rst_delay; /* reset time(us) */ - int rst_delay_a; /* delay time after reset(us) */ - union { - func_attr_t func_attr; - gpio_attr_t gpio_attr; - } attr; -} pca9548_cfg_info_t; - -typedef struct fpga_pcie_card_info_s { - int dev_type[DFD_MAX_PRODUCT_NUM]; /* dev type */ - pca9548_cfg_info_t pca9548_cfg_info[PCA9548_MAX_CPLD_NUM]; -} pca9548_card_info_t; - -static pca9548_card_info_t g_pca9548_card_info[] = { - { - .dev_type = {0x4040,0x4061,0x4071}, /*B6510,BT2575,TCS81*/ - .pca9548_cfg_info = { - /* psu fan */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 2, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 7, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 1, - .gpio_attr.reset_off = 0, - }, - }, - /* sff1 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* sff2 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - /* sff3 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - /* sff4 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - /* sff5 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - /* sff6 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x75, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(5), -1}, - }, - }, - /* sff7 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x76, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(6), -1}, - }, - }, - }, - }, - { - .dev_type = {0x4041}, /*B6520*/ - .pca9548_cfg_info = { - /* psu fan */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 2, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 7, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 1, - .gpio_attr.reset_off = 0, - }, - }, - /* sff1 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* sff2 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - /* sff3 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - /* sff4 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - /* sff5 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - /* sff6 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x75, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(5), -1}, - }, - }, - /* sff7 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x76, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(6), -1}, - }, - }, - /* sff8 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(7), -1}, - }, - }, - }, - }, - { - .dev_type = {0x4044,0x4072,0x4048}, /*B6920,TCS83,BS100R0*/ - .pca9548_cfg_info = { - /* 9548 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 2, - .pca9548_addr = 0x76, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x936, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - /* base board */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 8, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - /* sff1 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 9, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* sff2 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 12, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - /* sff3 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 11, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - /* sff4 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 7, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - /* fanA */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 14, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb10, -1}, - .func_attr.umask = {BIT(5), -1}, - }, - }, - /* fanB */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 13, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb10, -1}, - .func_attr.umask = {BIT(7), -1}, - }, - }, - /* sff1 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* sff2 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - /* sff3 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - /* sff4 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - }, - }, - { - .dev_type = {0x4058,0x4073}, /* B6510-32CQ, TCS82 */ - .pca9548_cfg_info = { - /* psu */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x960, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* fan */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 2, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x960, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - }, - }, - { - .dev_type = {0x4065}, /* AS61-48E4T */ - .pca9548_cfg_info = { - /* SOC */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 0, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP+ */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - }, - }, - { - .dev_type = {0x4066}, /* AS61-48X4T */ - .pca9548_cfg_info = { - /* SOC */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 0, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP1 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 7, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP2 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 7, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP3 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 7, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP4 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP5 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP6 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP+ */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - }, - }, - { - .dev_type = {0x4087}, /* AS61-48E4T-LC */ - .pca9548_cfg_info = { - /* SOC */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 0, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP+ */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - }, - }, - { - .dev_type = {0x4088}, /* AS61-48E4T-LD */ - .pca9548_cfg_info = { - /* SOC */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 0, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP+ */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - }, - }, -}; -int g_pca954x_debug = 0; -module_param(g_pca954x_debug, int, S_IRUGO | S_IWUSR); - -#define PCA954X_DEBUG(fmt, args...) do { \ - if (g_pca954x_debug) { \ - printk(KERN_ERR "[PCA95x][VER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ - } \ -} while (0) - -/* x86 device get type method */ -static int dfd_get_my_dev_type_by_file(void) -{ - struct file *fp; - /* mm_segment_t fs;*/ - loff_t pos; - static int card_type; - char buf[DFD_PID_BUF_LEN]; - - if (card_type != 0) { - return card_type; - } - - fp= filp_open(DFD_PUB_CARDTYPE_FILE, O_RDONLY, 0); - if (IS_ERR(fp)) { - PCA954X_DEBUG("open file fail!\r\n"); - return -1; - } - /* fs = get_fs(); */ - /* set_fs(KERNEL_DS); */ - mem_clear(buf, DFD_PID_BUF_LEN); - pos = 0; - kernel_read(fp, buf, DFD_PRODUCT_ID_LENGTH + 1, &pos); - if (pos < 0) { - PCA954X_DEBUG("read file fail!\r\n"); - goto exit; - } - - card_type = simple_strtoul(buf, NULL, 10); - PCA954X_DEBUG("card_type 0x%x.\n", card_type); - -exit: - /* set_fs(fs); */ - filp_close(fp, NULL); - return card_type; -} - -static int drv_get_my_dev_type(void) -{ - static int type = -1; - - if (type > 0) { - return type; - } - type = dfd_get_my_dev_type_by_file(); - PCA954X_DEBUG("ko board type %d\r\n", type); - - return type; -} - -pca9548_card_info_t* pca9548_get_card_info(int dev_type) -{ - int i, j; - int size; - - size = ARRAY_SIZE(g_pca9548_card_info); - - PCA954X_DEBUG("Enter dev_type 0x%x size %d.\n", dev_type, size); - for (i = 0; i < size; i++) { - for(j = 0; j < DFD_MAX_PRODUCT_NUM; j++) { - if (g_pca9548_card_info[i].dev_type[j] == dev_type) { - PCA954X_DEBUG("match dev_type 0x%x.\n", dev_type); - return &g_pca9548_card_info[i]; - } - } - } - - PCA954X_DEBUG("dismatch dev_type 0x%x.\n", dev_type); - return NULL; -} - -pca9548_cfg_info_t* get_pca9548_cfg_info(int bus, int addr) -{ - int dev_type; - pca9548_card_info_t *info; - pca9548_cfg_info_t *pca9548_cfg_info; - int i; - int size; - - dev_type = drv_get_my_dev_type(); - if (dev_type < 0) { - PCA954X_DEBUG("drv_get_my_dev_type failed ret %d.\n", dev_type); - return NULL; - } - - info = pca9548_get_card_info(dev_type); - if (info == NULL) { - PCA954X_DEBUG("fpga_pcie_get_card_info dev_type %d failed.\n", dev_type); - return NULL; - } - - size = PCA9548_MAX_CPLD_NUM; - for (i = 0; i < size; i++) { - pca9548_cfg_info = &(info->pca9548_cfg_info[i]); - if ((pca9548_cfg_info->pca9548_bus == bus) && (pca9548_cfg_info->pca9548_addr == addr)) { - PCA954X_DEBUG("match dev_type 0x%x bus %d addr 0x%x.\n", dev_type, bus, addr); - return pca9548_cfg_info; - } - } - - PCA954X_DEBUG("dismatch dev_type 0x%x bus %d addr 0x%x.\n", dev_type, bus, addr); - return NULL; -} - -static void pca9548_gpio_init(gpio_attr_t *gpio_attr) -{ - if (gpio_attr->gpio_init == 0) { - PCA954X_DEBUG("gpio%d init.\n", gpio_attr->gpio); - gpio_request(gpio_attr->gpio, "pca9548_reset"); - gpio_direction_output(gpio_attr->gpio, gpio_attr->reset_off); - gpio_attr->gpio_init = 1; - } -} - -static void pca9548_gpio_free(gpio_attr_t *gpio_attr) -{ - if (gpio_attr == NULL) { - PCA954X_DEBUG("pca9548_gpio_free,params error\n"); - return ; - } - if (gpio_attr->gpio_init == 1) { - PCA954X_DEBUG("gpio%d release.\n", gpio_attr->gpio); - gpio_free(gpio_attr->gpio); - gpio_attr->gpio_init = 0; - } -} - -static int pca954x_do_gpio_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) -{ - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca954x *data = i2c_mux_priv(muxc); - int ret = -1; - gpio_attr_t *tmp_gpio_attr; - int timeout; - int val; - struct i2c_adapter *adapter; - int adapter_timeout; - - if (cfg_info == NULL) { - PCA954X_DEBUG("pca9548 cfg info is null.\n"); - return ret; - } - - if (cfg_info->pca9548_reset_type == PCA9548_RESET_GPIO) { - tmp_gpio_attr = &(cfg_info->attr.gpio_attr); - timeout = cfg_info->rst_delay_a; - - pca9548_gpio_init(tmp_gpio_attr); - udelay(cfg_info->rst_delay_b); - /* reset on */ - PCA954X_DEBUG("set gpio%d %d.\n", tmp_gpio_attr->gpio, tmp_gpio_attr->reset_on); - __gpio_set_value(tmp_gpio_attr->gpio, tmp_gpio_attr->reset_on); - udelay(cfg_info->rst_delay); - /* reset off */ - PCA954X_DEBUG("set gpio%d %d.\n", tmp_gpio_attr->gpio, tmp_gpio_attr->reset_off); - __gpio_set_value(tmp_gpio_attr->gpio, tmp_gpio_attr->reset_off); - - while (timeout > 0) { - udelay(1); - val = __gpio_get_value(tmp_gpio_attr->gpio); - if (val == tmp_gpio_attr->reset_off) { - adapter = adap; - /* get bus info */ - while(i2c_parent_is_i2c_adapter(adapter)){ - adapter = to_i2c_adapter(adapter->dev.parent); - } - - adapter_timeout = adapter->timeout; - adapter->timeout = msecs_to_jiffies(50); - pca954x_reg_write(adap, client, data->last_chan); - adapter->timeout = adapter_timeout; - ret = 0; - PCA954X_DEBUG("pca954x_do_gpio_reset success.\n"); - break; - } - - if (timeout >= 1000 && (timeout % 1000 == 0)) { - /* 1MS schedule*/ - schedule(); - } - timeout--; - } - - if (ret) { - PCA954X_DEBUG("pca954x_do_gpio_reset failed.\n"); - } - pca9548_gpio_free(&(cfg_info->attr.gpio_attr)); - } else { - PCA954X_DEBUG("pca9548_reset_type invalid, pca954x_do_gpio_reset failed.\n"); - } - - return ret; -} - -static int pca954x_do_func_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) -{ - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca954x *data = i2c_mux_priv(muxc); - int ret = -1; - func_attr_t *tmp_func_attr; - int timeout; - int val; - struct i2c_adapter *adapter; - int adapter_timeout; - int i; - u8 old_value; - - if (cfg_info == NULL) { - PCA954X_DEBUG("pca9548 cfg info is null.\n"); - return ret; - } - - if (cfg_info->pca9548_reset_type == PCA9548_RESET_FUNC) { - tmp_func_attr = &(cfg_info->attr.func_attr); - timeout = cfg_info->rst_delay_a; - - if ((tmp_func_attr->reset_func == NULL) || (tmp_func_attr->get_umask_func == NULL)) { - PCA954X_DEBUG("pca954x hw do reset func or get umask func is null.\n"); - return ret; - } - - for(i = 0; (i < PCA9548_MAX_CPLD_LAYER) && (tmp_func_attr->cfg_offset[i] != -1) - && (tmp_func_attr->umask[i] != -1); i++) { - old_value = (*tmp_func_attr->get_umask_func)(tmp_func_attr->cfg_offset[i]); - PCA954X_DEBUG("cfg info: offset:0x%x umask:0x%x, old_value:0x%x\n", - tmp_func_attr->cfg_offset[i], tmp_func_attr->umask[i],old_value); - (*tmp_func_attr->reset_func)(tmp_func_attr->cfg_offset[i], old_value & ~tmp_func_attr->umask[i]); - udelay(cfg_info->rst_delay); - (*tmp_func_attr->reset_func)(tmp_func_attr->cfg_offset[i], old_value | tmp_func_attr->umask[i]); - } - - while (timeout > 0) { - udelay(1); - val = (*tmp_func_attr->get_umask_func)(tmp_func_attr->cfg_offset[i - 1]); - val &= (tmp_func_attr->umask[i - 1]); - if (val == tmp_func_attr->umask[i - 1]) { - adapter = adap; - /* get bus info */ - while(i2c_parent_is_i2c_adapter(adapter)){ - adapter = to_i2c_adapter(adapter->dev.parent); - } - - adapter_timeout = adapter->timeout; - adapter->timeout = msecs_to_jiffies(50); - pca954x_reg_write(adap, client, data->last_chan); - adapter->timeout = adapter_timeout; - ret = 0; - PCA954X_DEBUG("pca954x_do_func_reset success.\n"); - break; - } - - if (timeout >= 1000 && (timeout % 1000 == 0)) { - /* 1MS schedule*/ - schedule(); - } - timeout--; - } - - if (ret) { - PCA954X_DEBUG("pca954x_do_func_reset failed.\n"); - } - } else { - PCA954X_DEBUG("pca9548_reset_type invalid, pca954x_do_func_reset failed.\n"); - } - - return ret; -} - -static int pca9548_reset_ctrl(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) -{ - int ret = -1; - - if (cfg_info == NULL) { - PCA954X_DEBUG("pca9548 cfg info is null.\n"); - return ret; - } - - if (cfg_info->pca9548_reset_type == PCA9548_RESET_FUNC) { - ret = pca954x_do_func_reset(cfg_info, adap, client, chan); - } else if (cfg_info->pca9548_reset_type == PCA9548_RESET_GPIO) { - ret = pca954x_do_gpio_reset(cfg_info, adap, client, chan); - } - - if (ret < 0) { - PCA954X_DEBUG("pca9548_reset_ctrl failed.\n"); - } - return ret; -} - -static int pca954x_reset_i2c_read(uint32_t bus, uint32_t addr, uint32_t offset_addr, - unsigned char *buf, uint32_t size) -{ - struct file *fp; - /* mm_segment_t fs; */ - struct i2c_client client; - char i2c_path[32]; - int i ,j ; - int rv; - - rv = 0; - mem_clear(i2c_path, sizeof(i2c_path)); - snprintf(i2c_path, sizeof(i2c_path), "/dev/i2c-%d", bus); - fp = filp_open(i2c_path, O_RDWR, S_IRUSR | S_IWUSR); - if (IS_ERR(fp)) { - PCA954X_DEBUG("i2c open fail.\n"); - return -1; - } - memcpy(&client, fp->private_data, sizeof(struct i2c_client)); - client.addr = addr; - /* fs = get_fs(); */ - /* set_fs(KERNEL_DS); */ - for (j = 0 ;j < size ;j++){ - for (i = 0; i < I2C_RETRY_TIMES; i++) { - rv = i2c_smbus_read_byte_data(&client, (offset_addr + j)); - if (rv < 0) { - PCA954X_DEBUG("i2c read failed, try again.\n"); - msleep(I2C_RETRY_WAIT_TIMES); - if (i >= (I2C_RETRY_TIMES - 1)) { - goto out; - } - continue; - } - *(buf + j) = (unsigned char)rv; - break; - } - } -out: - filp_close(fp, NULL); - /* set_fs(fs); */ - return rv; -} - -static int pca954x_reset_i2c_write(uint32_t bus, uint32_t dev_addr, uint32_t offset_addr, - uint8_t write_buf) -{ - struct file *fp; - /* mm_segment_t fs; */ - struct i2c_client client; - char i2c_path[32]; - int i; - int rv; - - rv = 0; - mem_clear(i2c_path, sizeof(i2c_path)); - snprintf(i2c_path, sizeof(i2c_path), "/dev/i2c-%d", bus); - fp = filp_open(i2c_path, O_RDWR, S_IRUSR | S_IWUSR); - if (IS_ERR(fp)) { - PCA954X_DEBUG("i2c open fail.\n"); - return -1; - } - memcpy(&client, fp->private_data, sizeof(struct i2c_client)); - client.addr = dev_addr; - /* fs = get_fs(); */ - /* set_fs(KERNEL_DS); */ - for (i = 0; i < I2C_RETRY_TIMES; i++) { - rv = i2c_smbus_write_byte_data(&client, offset_addr, write_buf); - if (rv < 0) { - PCA954X_DEBUG("i2c write failed, try again.\n"); - msleep(I2C_RETRY_WAIT_TIMES); - if (i >= (I2C_RETRY_TIMES - 1)) { - goto out; - } - continue; - } - break; - } -out: - filp_close(fp, NULL); - /* set_fs(fs); */ - return rv; -} - -int pca954x_reset_reg_i2c_read_byte(int addr, u8 *value) -{ - int bus; - int client_addr; - int offset; - int ret; - - bus = PCA9548_I2C_GET_BUS(addr); - client_addr = PCA9548_I2C_GET_CLIENT(addr); - offset = PCA9548_I2C_GET_OFFSET(addr); - - ret = pca954x_reset_i2c_read(bus, client_addr, offset, value, 1); - if (ret < 0) { - PCA954X_DEBUG(" 0x%x read fail\r\n", addr); - goto end; - } -end: - return ret; -} - -int pca954x_reset_reg_i2c_write_byte(int addr, u8 value) -{ - int bus; - int client_addr; - int offset; - int ret; - - bus = PCA9548_I2C_GET_BUS(addr); - client_addr = PCA9548_I2C_GET_CLIENT(addr); - offset = PCA9548_I2C_GET_OFFSET(addr); - - ret = pca954x_reset_i2c_write(bus, client_addr, offset, value); - if (ret < 0) { - PCA954X_DEBUG(" 0x%x write fail\r\n", addr); - goto end; - } -end: - return ret; -} - -void pca954x_hw_do_reset_by_i2c(int addr, u8 value) -{ - int ret; - - PCA954X_DEBUG("write i2c cpld[0x%x], value[%d]\n", addr, value); - ret = pca954x_reset_reg_i2c_write_byte(addr, value); - if (ret < 0) { - PCA954X_DEBUG("write cpld pca9548 reset reg failed, ret = %d \n", ret); - } -} - -u8 pca954x_get_umask_by_i2c(int addr) -{ - u8 value = 0xFF; - int ret; - - ret = pca954x_reset_reg_i2c_read_byte(addr, &value); - PCA954X_DEBUG("read i2c cpld[0x%x], value[%d], ret = %d\n", addr, value, ret); - - return value; -} - -void pca954x_hw_do_reset_by_lpc(int io_port, u8 value) -{ - PCA954X_DEBUG("write lpc offset[0x%x], value[%d]\n", (u16)io_port, value); - outb(value, (u16)io_port); -} - -u8 pca954x_get_umask_by_lpc(int io_port) -{ - u8 value; - - value = inb(io_port); - PCA954X_DEBUG("read lpc offset[0x%x], value[%d]\n", (u16)io_port, value); - - return value; -} - -int pca954x_hw_do_reset_new(struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) -{ - pca9548_cfg_info_t *cfg_info; - int ret = -1; - - cfg_info = get_pca9548_cfg_info(adap->nr, client->addr); - if (cfg_info == NULL && g_notify_to_do_reset == NULL) { - PCA954X_DEBUG("fpga_do_pca954x_reset_func do nothing.\n"); - return ret; - } - if(cfg_info != NULL) { - ret = pca9548_reset_ctrl(cfg_info, adap, client, chan); - } else { - ret = pca954x_hw_do_reset(adap->nr, client->addr); - } - if (ret < 0) { - PCA954X_DEBUG("pca954x_hw_do_reset failed.\n"); - } - return ret; -} -/******************************end 9548 reset***********************************/ - -static int pca954x_do_reset(struct i2c_adapter *adap, - void *client, u32 chan) -{ - struct i2c_client *new_client; - int ret = -1; - - PCA954X_DEBUG("do pca954x reset x86\n"); - new_client =(struct i2c_client *) client; - ret = pca954x_hw_do_reset_new(adap, new_client, chan); - if (ret < 0) { - PCA954X_DEBUG("pca954x_do_reset failed.\n"); - return ret; - } - - PCA954X_DEBUG("pca954x_do_reset success.\n"); - ret = 0; - return ret; -} -static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) -{ - struct pca954x *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - s32 idle_state; - int ret, rv; - struct i2c_client * new_client; - - idle_state = READ_ONCE(data->idle_state); - if (idle_state >= 0) - /* Set the mux back to a predetermined channel */ - return pca954x_select_chan(muxc, idle_state); - - if (idle_state == MUX_IDLE_DISCONNECT) { - /* Deselect active channel */ - data->last_chan = 0; - ret = pca954x_reg_write(muxc->parent, client, - data->last_chan); - if (ret < 0) { - new_client =(struct i2c_client *) client; - dev_warn(&new_client->dev, "pca954x close chn failed, do reset.\n"); - rv = pca954x_do_reset(client->adapter, client, chan); - if (rv == 0) { - ret = 0; - } - } - return ret; - } - - /* otherwise leave as-is */ - - return 0; -} - -static ssize_t idle_state_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct i2c_client *client = to_i2c_client(dev); - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca954x *data = i2c_mux_priv(muxc); - - return sprintf(buf, "%d\n", READ_ONCE(data->idle_state)); -} - -static ssize_t idle_state_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca954x *data = i2c_mux_priv(muxc); - int val; - int ret; - - ret = kstrtoint(buf, 0, &val); - if (ret < 0) - return ret; - - if (val != MUX_IDLE_AS_IS && val != MUX_IDLE_DISCONNECT && - (val < 0 || val >= data->chip->nchans)) - return -EINVAL; - - i2c_lock_bus(muxc->parent, I2C_LOCK_SEGMENT); - - WRITE_ONCE(data->idle_state, val); - /* - * Set the mux into a state consistent with the new - * idle_state. - */ - if (data->last_chan || val != MUX_IDLE_DISCONNECT) - ret = pca954x_deselect_mux(muxc, 0); - - i2c_unlock_bus(muxc->parent, I2C_LOCK_SEGMENT); - - return ret < 0 ? ret : count; -} - -static DEVICE_ATTR_RW(idle_state); - -static irqreturn_t pca954x_irq_handler(int irq, void *dev_id) -{ - struct pca954x *data = dev_id; - unsigned long pending; - int ret, i; - - ret = i2c_smbus_read_byte(data->client); - if (ret < 0) - return IRQ_NONE; - - pending = (ret >> PCA954X_IRQ_OFFSET) & (BIT(data->chip->nchans) - 1); - for_each_set_bit(i, &pending, data->chip->nchans) - handle_nested_irq(irq_linear_revmap(data->irq, i)); - - return IRQ_RETVAL(pending); -} - -static int pca954x_init(struct i2c_client *client, struct pca954x *data) -{ - int ret; - - if (data->idle_state >= 0) - data->last_chan = pca954x_regval(data, data->idle_state); - else - data->last_chan = 0; /* Disconnect multiplexer */ - - ret = i2c_smbus_write_byte(client, data->last_chan); - if (ret < 0) - data->last_chan = 0; - return ret; -} - -static void pca954x_irq_mask(struct irq_data *idata) -{ - struct pca954x *data = irq_data_get_irq_chip_data(idata); - unsigned int pos = idata->hwirq; - unsigned long flags; - - raw_spin_lock_irqsave(&data->lock, flags); - - data->irq_mask &= ~BIT(pos); - if (!data->irq_mask) - disable_irq(data->client->irq); - - raw_spin_unlock_irqrestore(&data->lock, flags); -} - -static void pca954x_irq_unmask(struct irq_data *idata) -{ - struct pca954x *data = irq_data_get_irq_chip_data(idata); - unsigned int pos = idata->hwirq; - unsigned long flags; - - raw_spin_lock_irqsave(&data->lock, flags); - - if (!data->irq_mask) - enable_irq(data->client->irq); - data->irq_mask |= BIT(pos); - - raw_spin_unlock_irqrestore(&data->lock, flags); -} - -static int pca954x_irq_set_type(struct irq_data *idata, unsigned int type) -{ - if ((type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_LEVEL_LOW) - return -EINVAL; - return 0; -} - -static struct irq_chip pca954x_irq_chip = { - .name = "i2c-mux-pca954x", - .irq_mask = pca954x_irq_mask, - .irq_unmask = pca954x_irq_unmask, - .irq_set_type = pca954x_irq_set_type, -}; - -static int pca954x_irq_setup(struct i2c_mux_core *muxc) -{ - struct pca954x *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - int c, err, irq; - - if (!data->chip->has_irq || client->irq <= 0) - return 0; - - raw_spin_lock_init(&data->lock); - - data->irq = irq_domain_add_linear(client->dev.of_node, - data->chip->nchans, - &irq_domain_simple_ops, data); - if (!data->irq) - return -ENODEV; - - for (c = 0; c < data->chip->nchans; c++) { - irq = irq_create_mapping(data->irq, c); - irq_set_chip_data(irq, data); - irq_set_chip_and_handler(irq, &pca954x_irq_chip, - handle_simple_irq); - } - - err = devm_request_threaded_irq(&client->dev, data->client->irq, NULL, - pca954x_irq_handler, - IRQF_ONESHOT | IRQF_SHARED, - "pca954x", data); - if (err) - goto err_req_irq; - - disable_irq(data->client->irq); - - return 0; -err_req_irq: - for (c = 0; c < data->chip->nchans; c++) { - irq = irq_find_mapping(data->irq, c); - irq_dispose_mapping(irq); - } - irq_domain_remove(data->irq); - - return err; -} - -/* - * I2C init/probing/exit functions - */ -static int pca954x_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); - struct device_node *of_node = client->dev.of_node; - bool idle_disconnect_dt; - struct gpio_desc *gpio; - int num; - struct i2c_mux_core *muxc; - struct pca954x *data; - const struct of_device_id *match; - int ret; - - if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) - return -ENODEV; - - muxc = i2c_mux_alloc(adap, &client->dev, - PCA954X_MAX_NCHANS, sizeof(*data), 0, - pca954x_select_chan, pca954x_deselect_mux); - if (!muxc) - return -ENOMEM; - data = i2c_mux_priv(muxc); - - i2c_set_clientdata(client, muxc); - data->client = client; - - /* Get the mux out of reset if a reset GPIO is specified. */ - gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(gpio)) - return PTR_ERR(gpio); - data->idle_state = MUX_IDLE_AS_IS; - if (device_property_read_u32(&client->dev, "idle-state", &data->idle_state)) { - if (device_property_read_bool(&client->dev, "i2c-mux-idle-disconnect")) - data->idle_state = MUX_IDLE_DISCONNECT; - } - - /* - * Write the mux register at addr to verify - * that the mux is in fact present. This also - * initializes the mux to a channel - * or disconnected state. - */ - ret = pca954x_init(client, data); - if (ret < 0) { - dev_warn(&client->dev, "probe failed\n"); - return -ENODEV; - } - - match = of_match_device(of_match_ptr(pca954x_of_match), &client->dev); - if (match) - data->chip = of_device_get_match_data(&client->dev); - else - data->chip = &chips[id->driver_data]; - - data->last_chan = 0; /* force the first selection */ - - idle_disconnect_dt = of_node && - of_property_read_bool(of_node, "i2c-mux-idle-disconnect"); - - ret = pca954x_irq_setup(muxc); - if (ret) - goto fail_del_adapters; - - /* Now create an adapter for each channel */ - for (num = 0; num < data->chip->nchans; num++) { - ret = i2c_mux_add_adapter(muxc, 0, num, 0); - if (ret) - goto fail_del_adapters; - } - - device_create_file(&client->dev, &dev_attr_idle_state); - dev_info(&client->dev, - "registered %d multiplexed busses for I2C %s %s\n", - num, data->chip->muxtype == pca954x_ismux - ? "mux" : "switch", client->name); - - return 0; - -fail_del_adapters: - i2c_mux_del_adapters(muxc); - return ret; -} - -static int pca954x_remove(struct i2c_client *client) -{ - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca954x *data = i2c_mux_priv(muxc); - int c, irq; - - if (data->irq) { - for (c = 0; c < data->chip->nchans; c++) { - irq = irq_find_mapping(data->irq, c); - irq_dispose_mapping(irq); - } - irq_domain_remove(data->irq); - } - device_remove_file(&client->dev, &dev_attr_idle_state); - - i2c_mux_del_adapters(muxc); - return 0; -} - -#ifdef CONFIG_PM_SLEEP -static int pca954x_resume(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca954x *data = i2c_mux_priv(muxc); - int ret; - - ret = pca954x_init(client, data); - if (ret < 0) - dev_err(&client->dev, "failed to verify mux presence\n"); - - return ret; -} -#endif - -static SIMPLE_DEV_PM_OPS(pca954x_pm, NULL, pca954x_resume); - -static struct i2c_driver pca954x_driver = { - .driver = { - .name = "pca954x", - .pm = &pca954x_pm, - .of_match_table = of_match_ptr(pca954x_of_match), - }, - .probe = pca954x_probe, - .remove = pca954x_remove, - .id_table = pca954x_id, -}; - -module_i2c_driver(pca954x_driver); - -#else -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern int pca9641_setmuxflag(int nr, int flag); - -int force_create_bus = 0; -module_param(force_create_bus, int, S_IRUGO | S_IWUSR); - -#define PCA954X_MAX_NCHANS 8 - -enum pca_type { - pca_9540, - pca_9542, - pca_9543, - pca_9544, - pca_9545, - pca_9546, - pca_9547, - pca_9548, -}; - -struct pca954x { - enum pca_type type; - struct i2c_adapter *virt_adaps[PCA954X_MAX_NCHANS]; - - u8 last_chan; /* last register value */ -}; - -struct chip_desc { - u8 nchans; - u8 enable; /* used for muxes only */ - enum muxtype { - pca954x_ismux = 0, - pca954x_isswi - } muxtype; -}; - -/* Provide specs for the PCA954x types we know about */ -static const struct chip_desc chips[] = { - [pca_9540] = { - .nchans = 2, - .enable = 0x4, - .muxtype = pca954x_ismux, - }, - [pca_9543] = { - .nchans = 2, - .muxtype = pca954x_isswi, - }, - [pca_9544] = { - .nchans = 4, - .enable = 0x4, - .muxtype = pca954x_ismux, - }, - [pca_9545] = { - .nchans = 4, - .muxtype = pca954x_isswi, - }, - [pca_9547] = { - .nchans = 8, - .enable = 0x8, - .muxtype = pca954x_ismux, - }, - [pca_9548] = { - .nchans = 8, - .muxtype = pca954x_isswi, - }, -}; - -static const struct i2c_device_id pca954x_id[] = { - { "pca9540", pca_9540 }, - { "pca9542", pca_9540 }, - { "pca9543", pca_9543 }, - { "pca9544", pca_9544 }, - { "pca9545", pca_9545 }, - { "pca9546", pca_9545 }, - { "pca9547", pca_9547 }, - { "pca9548", pca_9548 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, pca954x_id); - -/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() - for this as they will try to lock adapter a second time */ -static int pca954x_reg_write(struct i2c_adapter *adap, - struct i2c_client *client, u8 val) -{ - int ret = -ENODEV; - - if (adap->algo->master_xfer) { - struct i2c_msg msg; - char buf[1]; - - msg.addr = client->addr; - msg.flags = 0; - msg.len = 1; - buf[0] = val; - msg.buf = buf; - ret = adap->algo->master_xfer(adap, &msg, 1); - - if (ret >= 0 && ret != 1) - ret = -EREMOTEIO; - } else { - union i2c_smbus_data data; - ret = adap->algo->smbus_xfer(adap, client->addr, - client->flags, - I2C_SMBUS_WRITE, - val, I2C_SMBUS_BYTE, &data); - } - - return ret; -} - -static int pca954x_setmuxflag(struct i2c_adapter *adap, int flag) -{ - pca9641_setmuxflag(adap->nr, flag); - return 0; -} - -static int pca954x_select_chan(struct i2c_adapter *adap, - void *client, u32 chan) -{ - struct pca954x *data = i2c_get_clientdata(client); - const struct chip_desc *chip = &chips[data->type]; - u8 regval; - int ret = 0; - - /* we make switches look like muxes, not sure how to be smarter */ - if (chip->muxtype == pca954x_ismux) - regval = chan | chip->enable; - else - regval = 1 << chan; - - /* Only select the channel if its different from the last channel */ - if (data->last_chan != regval) { - pca954x_setmuxflag(adap, 0); - ret = pca954x_reg_write(adap, client, regval); - data->last_chan = ret < 0 ? 0 : regval; - } - - return ret; -} - -typedef void (*pca954x_hw_do_reset_func_t)(int busid, int addr); -pca954x_hw_do_reset_func_t g_notify_to_do_reset = NULL; - -void pca954x_hw_do_reset_func_register(void* func) -{ - if (func == NULL) { - return ; - } - g_notify_to_do_reset = func; - return; -} -EXPORT_SYMBOL(pca954x_hw_do_reset_func_register); - -static int pca954x_hw_do_reset(int busid, int addr) -{ - if (g_notify_to_do_reset != NULL) { - (*g_notify_to_do_reset)(busid, addr); - return 0; - } - return 0; -} -/***************************************9548 reset*****************************************/ -#define DEV_TYPE 0x4040 /* BT2575 */ -#define PCA9548_MAX_CPLD_NUM (32) /* PCA9548 max number */ -#define PCA9548_MAX_CPLD_LAYER (8) /* PCA9548 max layer */ -#define DFD_PID_BUF_LEN (32) -#define DFD_PRODUCT_ID_LENGTH (8) -#define CPLD_PCA9548_RESET 0x023500b0 /* bus:2, addr:0x35, offset:0xb0 */ -#define B6510_32CQ_CPLD_PCA9548_RESET 0x060d0060 /* bus:6, addr:0x0d, offset:0x60 */ -#define DFD_PUB_CARDTYPE_FILE "/sys/module/ragile_common/parameters/dfd_my_type" -#define DFD_MAX_PRODUCT_NUM (32) - -#define I2C_RETRY_TIMES 5 -#define I2C_RETRY_WAIT_TIMES 10 /*delay 10ms*/ - -#define PCA9548_I2C_GET_BUS(addr) (((addr) >> 24) & 0x00ff) -#define PCA9548_I2C_GET_CLIENT(addr) (((addr) >> 16) & 0x00ff) -#define PCA9548_I2C_GET_OFFSET(addr) (addr & 0xffff) - -typedef enum pca9548_reset_type { - PCA9548_RESET_FUNC = 0, - PCA9548_RESET_GPIO = 1, -} pca9548_reset_type_t; - -typedef void (*pca954x_hw_do_reset_func_t_new)(int io_port, u8 value); -typedef u8 (*pca954x_get_umask_func_t)(int io_port); - -void pca954x_hw_do_reset_by_i2c(int addr, u8 value); -u8 pca954x_get_umask_by_i2c(int addr); -void pca954x_hw_do_reset_by_lpc(int io_port, u8 value); -u8 pca954x_get_umask_by_lpc(int io_port); - -typedef struct func_attr_s { - int cfg_offset[PCA9548_MAX_CPLD_LAYER]; - int umask[PCA9548_MAX_CPLD_LAYER]; - pca954x_hw_do_reset_func_t_new reset_func; /* 9548 reset function */ - pca954x_get_umask_func_t get_umask_func; /* get reset mask */ -} func_attr_t; - -typedef struct gpio_attr_s { - int gpio; - int gpio_init; - u8 reset_on; - u8 reset_off; -} gpio_attr_t; - -typedef struct pca9548_cfg_info_s { - int pca9548_reset_type; - int pca9548_bus; - int pca9548_addr; - int rst_delay_b; /* delay time before reset(us) */ - int rst_delay; /* reset time(us) */ - int rst_delay_a; /* delay time after reset(us) */ - union { - func_attr_t func_attr; - gpio_attr_t gpio_attr; - } attr; -} pca9548_cfg_info_t; - -typedef struct fpga_pcie_card_info_s { - int dev_type[DFD_MAX_PRODUCT_NUM]; /* dev type */ - pca9548_cfg_info_t pca9548_cfg_info[PCA9548_MAX_CPLD_NUM]; -} pca9548_card_info_t; - -static pca9548_card_info_t g_pca9548_card_info[] = { - { - .dev_type = {0x4040,0x4061,0x4071}, /*B6510,BT2575,TCS81*/ - .pca9548_cfg_info = { - /* psu fan */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 2, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 7, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 1, - .gpio_attr.reset_off = 0, - }, - }, - /* sff1 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* sff2 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - /* sff3 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - /* sff4 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - /* sff5 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - /* sff6 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x75, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(5), -1}, - }, - }, - /* sff7 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x76, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(6), -1}, - }, - }, - }, - }, - { - .dev_type = {0x4041}, /*B6520*/ - .pca9548_cfg_info = { - /* psu fan */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 2, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 7, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 1, - .gpio_attr.reset_off = 0, - }, - }, - /* sff1 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* sff2 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - /* sff3 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - /* sff4 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - /* sff5 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - /* sff6 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x75, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(5), -1}, - }, - }, - /* sff7 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x76, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(6), -1}, - }, - }, - /* sff8 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(7), -1}, - }, - }, - }, - }, - { - .dev_type = {0x4044,0x4072,0x4048}, /*B6920,TCS83,BS100R0*/ - .pca9548_cfg_info = { - /* 9548 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 2, - .pca9548_addr = 0x76, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x936, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - /* base board */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 8, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - /* sff1 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 9, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* sff2 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 12, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - /* sff3 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 11, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - /* sff4 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 7, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - /* fanA */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 14, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb10, -1}, - .func_attr.umask = {BIT(5), -1}, - }, - }, - /* fanB */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 13, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb10, -1}, - .func_attr.umask = {BIT(7), -1}, - }, - }, - /* sff1 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* sff2 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - /* sff3 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - /* sff4 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - }, - }, - { - .dev_type = {0x4058,0x4073}, /* B6510-32CQ, TCS82 */ - .pca9548_cfg_info = { - /* psu */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x960, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* fan */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 2, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x960, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - }, - }, - { - .dev_type = {0x4065}, /* AS61-48E4T */ - .pca9548_cfg_info = { - /* SOC */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 0, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP+ */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - }, - }, - { - .dev_type = {0x4066}, /* AS61-48X4T */ - .pca9548_cfg_info = { - /* SOC */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 0, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP1 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 7, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP2 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 7, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP3 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 7, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP4 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP5 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP6 */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP+ */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - }, - }, - { - .dev_type = {0x4087}, /* AS61-48E4T-LC */ - .pca9548_cfg_info = { - /* SOC */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 0, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP+ */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - }, - }, - { - .dev_type = {0x4088}, /* AS61-48E4T-LD */ - .pca9548_cfg_info = { - /* SOC */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 0, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - /* SFP+ */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 8, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 509, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 0, - .gpio_attr.reset_off = 1, - }, - }, - }, - }, -}; - -int g_pca954x_debug = 0; -module_param(g_pca954x_debug, int, S_IRUGO | S_IWUSR); - -#define PCA954X_DEBUG(fmt, args...) do { \ - if (g_pca954x_debug) { \ - printk(KERN_ERR "[PCA95x][VER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ - } \ -} while (0) - -/* x86 device get card method */ -static int dfd_get_my_dev_type_by_file(void) -{ - struct file *fp; - mm_segment_t fs; - loff_t pos; - static int card_type; - char buf[DFD_PID_BUF_LEN]; - - if (card_type != 0) { - return card_type; - } - - fp= filp_open(DFD_PUB_CARDTYPE_FILE, O_RDONLY, 0); - if (IS_ERR(fp)) { - PCA954X_DEBUG("open file fail!\r\n"); - return -1; - } - fs = get_fs(); - set_fs(KERNEL_DS); - mem_clear(buf, DFD_PID_BUF_LEN); - pos = 0; - vfs_read(fp, buf, DFD_PRODUCT_ID_LENGTH + 1, &pos); - if (pos < 0) { - PCA954X_DEBUG("read file fail!\r\n"); - goto exit; - } - - card_type = simple_strtoul(buf, NULL, 10); - PCA954X_DEBUG("card_type 0x%x.\n", card_type); - -exit: - set_fs(fs); - filp_close(fp, NULL); - return card_type; -} - -static int drv_get_my_dev_type(void) -{ - static int type = -1; - - if (type > 0) { - return type; - } - type = dfd_get_my_dev_type_by_file(); - PCA954X_DEBUG("ko board type %d\r\n", type); - - return type; -} - -pca9548_card_info_t* pca9548_get_card_info(int dev_type) -{ - int i, j; - int size; - - size = ARRAY_SIZE(g_pca9548_card_info); - - PCA954X_DEBUG("Enter dev_type 0x%x size %d.\n", dev_type, size); - for (i = 0; i < size; i++) { - for(j = 0; j < DFD_MAX_PRODUCT_NUM; j++) { - if (g_pca9548_card_info[i].dev_type[j] == dev_type) { - PCA954X_DEBUG("match dev_type 0x%x.\n", dev_type); - return &g_pca9548_card_info[i]; - } - } - } - - PCA954X_DEBUG("dismatch dev_type 0x%x.\n", dev_type); - return NULL; -} - -pca9548_cfg_info_t* get_pca9548_cfg_info(int bus, int addr) -{ - int dev_type; - pca9548_card_info_t *info; - pca9548_cfg_info_t *pca9548_cfg_info; - int i; - int size; - - dev_type = drv_get_my_dev_type(); - if (dev_type < 0) { - PCA954X_DEBUG("drv_get_my_dev_type failed ret %d.\n", dev_type); - return NULL; - } - - info = pca9548_get_card_info(dev_type); - if (info == NULL) { - PCA954X_DEBUG("fpga_pcie_get_card_info dev_type %d failed.\n", dev_type); - return NULL; - } - - size = PCA9548_MAX_CPLD_NUM; - for (i = 0; i < size; i++) { - pca9548_cfg_info = &(info->pca9548_cfg_info[i]); - if ((pca9548_cfg_info->pca9548_bus == bus) && (pca9548_cfg_info->pca9548_addr == addr)) { - PCA954X_DEBUG("match dev_type 0x%x bus %d addr 0x%x.\n", dev_type, bus, addr); - return pca9548_cfg_info; - } - } - - PCA954X_DEBUG("dismatch dev_type 0x%x bus %d addr 0x%x.\n", dev_type, bus, addr); - return NULL; -} - -static void pca9548_gpio_init(gpio_attr_t *gpio_attr) -{ - if (gpio_attr->gpio_init == 0) { - PCA954X_DEBUG("gpio%d init.\n", gpio_attr->gpio); - gpio_request(gpio_attr->gpio, "pca9548_reset"); - gpio_direction_output(gpio_attr->gpio, gpio_attr->reset_off); - gpio_attr->gpio_init = 1; - } -} - -static void pca9548_gpio_free(gpio_attr_t *gpio_attr) -{ - if (gpio_attr == NULL) { - PCA954X_DEBUG("pca9548_gpio_free,params error\n"); - return ; - } - if (gpio_attr->gpio_init == 1) { - PCA954X_DEBUG("gpio%d release.\n", gpio_attr->gpio); - gpio_free(gpio_attr->gpio); - gpio_attr->gpio_init = 0; - } -} - -static int pca954x_do_gpio_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) -{ - struct pca954x *data = i2c_get_clientdata(client); - int ret = -1; - gpio_attr_t *tmp_gpio_attr; - int timeout; - int val; - struct i2c_adapter *adapter; - int adapter_timeout; - - if (cfg_info == NULL) { - PCA954X_DEBUG("pca9548 cfg info is null.\n"); - return ret; - } - - if (cfg_info->pca9548_reset_type == PCA9548_RESET_GPIO) { - tmp_gpio_attr = &(cfg_info->attr.gpio_attr); - timeout = cfg_info->rst_delay_a; - - pca9548_gpio_init(tmp_gpio_attr); - udelay(cfg_info->rst_delay_b); - /* reset on */ - PCA954X_DEBUG("set gpio%d %d.\n", tmp_gpio_attr->gpio, tmp_gpio_attr->reset_on); - __gpio_set_value(tmp_gpio_attr->gpio, tmp_gpio_attr->reset_on); - udelay(cfg_info->rst_delay); - /* reset off */ - PCA954X_DEBUG("set gpio%d %d.\n", tmp_gpio_attr->gpio, tmp_gpio_attr->reset_off); - __gpio_set_value(tmp_gpio_attr->gpio, tmp_gpio_attr->reset_off); - - while (timeout > 0) { - udelay(1); - val = __gpio_get_value(tmp_gpio_attr->gpio); - if (val == tmp_gpio_attr->reset_off) { - adapter = adap; - /* get bus info */ - while(i2c_parent_is_i2c_adapter(adapter)){ - adapter = to_i2c_adapter(adapter->dev.parent); - } - - adapter_timeout = adapter->timeout; - adapter->timeout = msecs_to_jiffies(50); - pca954x_reg_write(adap, client, data->last_chan); - adapter->timeout = adapter_timeout; - ret = 0; - PCA954X_DEBUG("pca954x_do_gpio_reset success.\n"); - break; - } - - if (timeout >= 1000 && (timeout % 1000 == 0)) { - /* 1MS schedule*/ - schedule(); - } - timeout--; - } - - if (ret) { - PCA954X_DEBUG("pca954x_do_gpio_reset failed.\n"); - } - pca9548_gpio_free(&(cfg_info->attr.gpio_attr)); - } else { - PCA954X_DEBUG("pca9548_reset_type invalid, pca954x_do_gpio_reset failed.\n"); - } - - return ret; -} - -static int pca954x_do_func_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) -{ - struct pca954x *data = i2c_get_clientdata(client); - int ret = -1; - func_attr_t *tmp_func_attr; - int timeout; - int val; - struct i2c_adapter *adapter; - int adapter_timeout; - int i; - u8 old_value; - - if (cfg_info == NULL) { - PCA954X_DEBUG("pca9548 cfg info is null.\n"); - return ret; - } - - if (cfg_info->pca9548_reset_type == PCA9548_RESET_FUNC) { - tmp_func_attr = &(cfg_info->attr.func_attr); - timeout = cfg_info->rst_delay_a; - - if ((tmp_func_attr->reset_func == NULL) || (tmp_func_attr->get_umask_func == NULL)) { - PCA954X_DEBUG("pca954x hw do reset func or get umask func is null.\n"); - return ret; - } - - for(i = 0; (i < PCA9548_MAX_CPLD_LAYER) && (tmp_func_attr->cfg_offset[i] != -1) - && (tmp_func_attr->umask[i] != -1); i++) { - old_value = (*tmp_func_attr->get_umask_func)(tmp_func_attr->cfg_offset[i]); - PCA954X_DEBUG("cfg info: offset:0x%x umask:0x%x, old_value:0x%x\n", - tmp_func_attr->cfg_offset[i], tmp_func_attr->umask[i],old_value); - (*tmp_func_attr->reset_func)(tmp_func_attr->cfg_offset[i], old_value & ~tmp_func_attr->umask[i]); - udelay(cfg_info->rst_delay); - (*tmp_func_attr->reset_func)(tmp_func_attr->cfg_offset[i], old_value | tmp_func_attr->umask[i]); - } - - while (timeout > 0) { - udelay(1); - val = (*tmp_func_attr->get_umask_func)(tmp_func_attr->cfg_offset[i - 1]); - val &= (tmp_func_attr->umask[i - 1]); - if (val == tmp_func_attr->umask[i - 1]) { - adapter = adap; - /* get bus info */ - while(i2c_parent_is_i2c_adapter(adapter)){ - adapter = to_i2c_adapter(adapter->dev.parent); - } - - adapter_timeout = adapter->timeout; - adapter->timeout = msecs_to_jiffies(50); - pca954x_reg_write(adap, client, data->last_chan); - adapter->timeout = adapter_timeout; - ret = 0; - PCA954X_DEBUG("pca954x_do_func_reset success.\n"); - break; - } - - if (timeout >= 1000 && (timeout % 1000 == 0)) { - /* 1MS schedule*/ - schedule(); - } - timeout--; - } - - if (ret) { - PCA954X_DEBUG("pca954x_do_func_reset failed.\n"); - } - } else { - PCA954X_DEBUG("pca9548_reset_type invalid, pca954x_do_func_reset failed.\n"); - } - - return ret; -} - -static int pca9548_reset_ctrl(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) -{ - int ret = -1; - - if (cfg_info == NULL) { - PCA954X_DEBUG("pca9548 cfg info is null.\n"); - return ret; - } - - if (cfg_info->pca9548_reset_type == PCA9548_RESET_FUNC) { - ret = pca954x_do_func_reset(cfg_info, adap, client, chan); - } else if (cfg_info->pca9548_reset_type == PCA9548_RESET_GPIO) { - ret = pca954x_do_gpio_reset(cfg_info, adap, client, chan); - } - - if (ret < 0) { - PCA954X_DEBUG("pca9548_reset_ctrl failed.\n"); - } - return ret; -} - -static int pca954x_reset_i2c_read(uint32_t bus, uint32_t addr, uint32_t offset_addr, - unsigned char *buf, uint32_t size) -{ - struct file *fp; - mm_segment_t fs; - struct i2c_client client; - char i2c_path[32]; - int i ,j ; - int rv; - - rv = 0; - mem_clear(i2c_path, sizeof(i2c_path)); - snprintf(i2c_path, sizeof(i2c_path), "/dev/i2c-%d", bus); - fp = filp_open(i2c_path, O_RDWR, S_IRUSR | S_IWUSR); - if (IS_ERR(fp)) { - PCA954X_DEBUG("i2c open fail.\n"); - return -1; - } - memcpy(&client, fp->private_data, sizeof(struct i2c_client)); - client.addr = addr; - fs = get_fs(); - set_fs(KERNEL_DS); - for (j = 0 ;j < size ;j++){ - for (i = 0; i < I2C_RETRY_TIMES; i++) { - rv = i2c_smbus_read_byte_data(&client, (offset_addr + j)); - if (rv < 0) { - PCA954X_DEBUG("i2c read failed, try again.\n"); - msleep(I2C_RETRY_WAIT_TIMES); - if (i >= (I2C_RETRY_TIMES - 1)) { - goto out; - } - continue; - } - *(buf + j) = (unsigned char)rv; - break; - } - } -out: - filp_close(fp, NULL); - set_fs(fs); - return rv; -} - -static int pca954x_reset_i2c_write(uint32_t bus, uint32_t dev_addr, uint32_t offset_addr, - uint8_t write_buf) -{ - struct file *fp; - mm_segment_t fs; - struct i2c_client client; - char i2c_path[32]; - int i; - int rv; - - rv = 0; - mem_clear(i2c_path, sizeof(i2c_path)); - snprintf(i2c_path, sizeof(i2c_path), "/dev/i2c-%d", bus); - fp = filp_open(i2c_path, O_RDWR, S_IRUSR | S_IWUSR); - if (IS_ERR(fp)) { - PCA954X_DEBUG("i2c open fail.\n"); - return -1; - } - memcpy(&client, fp->private_data, sizeof(struct i2c_client)); - client.addr = dev_addr; - fs = get_fs(); - set_fs(KERNEL_DS); - for (i = 0; i < I2C_RETRY_TIMES; i++) { - rv = i2c_smbus_write_byte_data(&client, offset_addr, write_buf); - if (rv < 0) { - PCA954X_DEBUG("i2c write failed, try again.\n"); - msleep(I2C_RETRY_WAIT_TIMES); - if (i >= (I2C_RETRY_TIMES - 1)) { - goto out; - } - continue; - } - break; - } -out: - filp_close(fp, NULL); - set_fs(fs); - return rv; -} - -int pca954x_reset_reg_i2c_read_byte(int addr, u8 *value) -{ - int bus; - int client_addr; - int offset; - int ret; - - bus = PCA9548_I2C_GET_BUS(addr); - client_addr = PCA9548_I2C_GET_CLIENT(addr); - offset = PCA9548_I2C_GET_OFFSET(addr); - - ret = pca954x_reset_i2c_read(bus, client_addr, offset, value, 1); - if (ret < 0) { - PCA954X_DEBUG(" 0x%x read fail\r\n", addr); - goto end; - } -end: - return ret; -} - -int pca954x_reset_reg_i2c_write_byte(int addr, u8 value) -{ - int bus; - int client_addr; - int offset; - int ret; - - bus = PCA9548_I2C_GET_BUS(addr); - client_addr = PCA9548_I2C_GET_CLIENT(addr); - offset = PCA9548_I2C_GET_OFFSET(addr); - - ret = pca954x_reset_i2c_write(bus, client_addr, offset, value); - if (ret < 0) { - PCA954X_DEBUG(" 0x%x write fail\r\n", addr); - goto end; - } -end: - return ret; -} - -void pca954x_hw_do_reset_by_i2c(int addr, u8 value) -{ - int ret; - - PCA954X_DEBUG("write i2c cpld[0x%x], value[%d]\n", addr, value); - ret = pca954x_reset_reg_i2c_write_byte(addr, value); - if (ret < 0) { - PCA954X_DEBUG("write cpld pca9548 reset reg failed, ret = %d \n", ret); - } -} - -u8 pca954x_get_umask_by_i2c(int addr) -{ - u8 value = 0xFF; - int ret; - - ret = pca954x_reset_reg_i2c_read_byte(addr, &value); - PCA954X_DEBUG("read i2c cpld[0x%x], value[%d], ret = %d\n", addr, value, ret); - - return value; -} - -void pca954x_hw_do_reset_by_lpc(int io_port, u8 value) -{ - PCA954X_DEBUG("write lpc offset[0x%x], value[%d]\n", (u16)io_port, value); - outb(value, (u16)io_port); -} - -u8 pca954x_get_umask_by_lpc(int io_port) -{ - u8 value; - - value = inb(io_port); - PCA954X_DEBUG("read lpc offset[0x%x], value[%d]\n", (u16)io_port, value); - - return value; -} - -int pca954x_hw_do_reset_new(struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) -{ - pca9548_cfg_info_t *cfg_info; - int ret = -1; - - cfg_info = get_pca9548_cfg_info(adap->nr, client->addr); - if (cfg_info == NULL && g_notify_to_do_reset == NULL) { - PCA954X_DEBUG("fpga_do_pca954x_reset_func do nothing.\n"); - return ret; - } - if (cfg_info != NULL) { - ret = pca9548_reset_ctrl(cfg_info, adap, client, chan); - } else { - ret = pca954x_hw_do_reset(adap->nr, client->addr); - } - - if (ret < 0) { - PCA954X_DEBUG("pca954x_hw_do_reset failed.\n"); - } - return ret; -} -/******************************end 9548 reset***********************************/ - -static int pca954x_do_reset(struct i2c_adapter *adap, - void *client, u32 chan) -{ - struct i2c_client *new_client; - int ret = -1; - - PCA954X_DEBUG("do pca954x reset x86\n"); - new_client =(struct i2c_client *) client; - ret = pca954x_hw_do_reset_new(adap, new_client, chan); - if (ret < 0) { - PCA954X_DEBUG("pca954x_do_reset failed.\n"); - return ret; - } - - PCA954X_DEBUG("pca954x_do_reset success.\n"); - ret = 0; - return ret; -} - -static int pca954x_deselect_mux(struct i2c_adapter *adap, - void *client, u32 chan) -{ - struct pca954x *data = i2c_get_clientdata(client); - int ret, rv; - struct i2c_client * new_client; - - /* Deselect active channel */ - data->last_chan = 0; - - ret = pca954x_reg_write(adap, client, data->last_chan); - - if (ret < 0) { - new_client =(struct i2c_client *) client; - dev_warn(&new_client->dev, "pca954x close chn failed, do reset.\n"); - rv = pca954x_do_reset(adap, client, chan); - if (rv == 0) { - ret = 0; - } - - } - - pca954x_setmuxflag(adap, 1); - (void)pca954x_reg_write(adap, client, data->last_chan); - - return ret; -} - -/* - * I2C init/probing/exit functions - */ -static int pca954x_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); - struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); - struct gpio_desc *gpio; - int num, force, class; - struct pca954x *data; - int ret; - - if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) - return -ENODEV; - - data = devm_kzalloc(&client->dev, sizeof(struct pca954x), GFP_KERNEL); - if (!data) - return -ENOMEM; - - i2c_set_clientdata(client, data); - - /* Get the mux out of reset if a reset GPIO is specified. */ - gpio = devm_gpiod_get(&client->dev, "reset"); - if (!IS_ERR(gpio)) - gpiod_direction_output(gpio, 0); - - /* Write the mux register at addr to verify - * that the mux is in fact present. This also - * initializes the mux to disconnected state. - */ - if ((i2c_smbus_write_byte(client, 0) < 0) && (force_create_bus == 0)) { - dev_warn(&client->dev, "probe failed\n"); - return -ENODEV; - } - - data->type = id->driver_data; - data->last_chan = 0; /* force the first selection */ - - /* Now create an adapter for each channel */ - for (num = 0; num < chips[data->type].nchans; num++) { - force = 0; /* dynamic adap number */ - class = 0; /* no class by default */ - if (pdata) { - if (num < pdata->num_modes) { - /* force static number */ - force = pdata->modes[num].adap_id; - class = pdata->modes[num].class; - } else - /* discard unconfigured channels */ - break; - } - - data->virt_adaps[num] = - i2c_add_mux_adapter(adap, &client->dev, client, - force, num, class, pca954x_select_chan, pca954x_deselect_mux); - - if (data->virt_adaps[num] == NULL) { - ret = -ENODEV; - dev_err(&client->dev, - "failed to register multiplexed adapter" - " %d as bus %d\n", num, force); - goto virt_reg_failed; - } - } - - dev_info(&client->dev, - "registered %d multiplexed busses for I2C %s %s\n", - num, chips[data->type].muxtype == pca954x_ismux - ? "mux" : "switch", client->name); - - return 0; - -virt_reg_failed: - for (num--; num >= 0; num--) - i2c_del_mux_adapter(data->virt_adaps[num]); - return ret; -} - -static int pca954x_remove(struct i2c_client *client) -{ - struct pca954x *data = i2c_get_clientdata(client); - const struct chip_desc *chip = &chips[data->type]; - int i; - - for (i = 0; i < chip->nchans; ++i) - if (data->virt_adaps[i]) { - i2c_del_mux_adapter(data->virt_adaps[i]); - data->virt_adaps[i] = NULL; - } - - return 0; -} - -static struct i2c_driver pca954x_driver = { - .driver = { - .name = "pca954x", - .owner = THIS_MODULE, - }, - .probe = pca954x_probe, - .remove = pca954x_remove, - .id_table = pca954x_id, -}; - -module_i2c_driver(pca954x_driver); -#endif - -MODULE_AUTHOR("Rodolfo Giometti "); -MODULE_DESCRIPTION("PCA954x I2C mux/switch driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c deleted file mode 100644 index b3f70bf140..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c +++ /dev/null @@ -1,643 +0,0 @@ -/* - * I2C multiplexer driver for PCA9541 bus master selector - * - * Copyright (c) 2010 Ericsson AB. - * - * Author: Guenter Roeck - * - * Derived from: - * pca954x.c - * - * Copyright (c) 2008-2009 Rodolfo Giometti - * Copyright (c) 2008-2009 Eurotech S.p.A. - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * The PCA9541 is a bus master selector. It supports two I2C masters connected - * to a single slave bus. - * - * Before each bus transaction, a master has to acquire bus ownership. After the - * transaction is complete, bus ownership has to be released. This fits well - * into the I2C multiplexer framework, which provides select and release - * functions for this purpose. For this reason, this driver is modeled as - * single-channel I2C bus multiplexer. - * - * This driver assumes that the two bus masters are controlled by two different - * hosts. If a single host controls both masters, platform code has to ensure - * that only one of the masters is instantiated at any given time. - */ - -#define PCA9541_CONTROL 0x01 -#define PCA9541_ISTAT 0x02 - -#define PCA9541_CTL_MYBUS (1 << 0) -#define PCA9541_CTL_NMYBUS (1 << 1) -#define PCA9541_CTL_BUSON (1 << 2) -#define PCA9541_CTL_NBUSON (1 << 3) -#define PCA9541_CTL_BUSINIT (1 << 4) -#define PCA9541_CTL_TESTON (1 << 6) -#define PCA9541_CTL_NTESTON (1 << 7) -#define PCA9541_ISTAT_INTIN (1 << 0) -#define PCA9541_ISTAT_BUSINIT (1 << 1) -#define PCA9541_ISTAT_BUSOK (1 << 2) -#define PCA9541_ISTAT_BUSLOST (1 << 3) -#define PCA9541_ISTAT_MYTEST (1 << 6) -#define PCA9541_ISTAT_NMYTEST (1 << 7) -#define PCA9641_ID 0x00 -#define PCA9641_ID_MAGIC 0x38 -#define PCA9641_CONTROL 0x01 -#define PCA9641_STATUS 0x02 -#define PCA9641_TIME 0x03 -#define PCA9641_CTL_LOCK_REQ BIT(0) -#define PCA9641_CTL_LOCK_GRANT BIT(1) -#define PCA9641_CTL_BUS_CONNECT BIT(2) -#define PCA9641_CTL_BUS_INIT BIT(3) -#define PCA9641_CTL_SMBUS_SWRST BIT(4) -#define PCA9641_CTL_IDLE_TIMER_DIS BIT(5) -#define PCA9641_CTL_SMBUS_DIS BIT(6) -#define PCA9641_CTL_PRIORITY BIT(7) -#define PCA9641_STS_OTHER_LOCK BIT(0) -#define PCA9641_STS_BUS_INIT_FAIL BIT(1) -#define PCA9641_STS_BUS_HUNG BIT(2) -#define PCA9641_STS_MBOX_EMPTY BIT(3) -#define PCA9641_STS_MBOX_FULL BIT(4) -#define PCA9641_STS_TEST_INT BIT(5) -#define PCA9641_STS_SCL_IO BIT(6) -#define PCA9641_STS_SDA_IO BIT(7) -#define PCA9641_RES_TIME 0x03 -#define BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON) -#define MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS) -#define mybus(x) (!((x) & MYBUS) || ((x) & MYBUS) == MYBUS) -#define busoff(x) (!((x) & BUSON) || ((x) & BUSON) == BUSON) -#define BUSOFF(x, y) (!((x) & PCA9641_CTL_LOCK_GRANT) && \ - !((y) & PCA9641_STS_OTHER_LOCK)) -#define other_lock(x) ((x) & PCA9641_STS_OTHER_LOCK) -#define lock_grant(x) ((x) & PCA9641_CTL_LOCK_GRANT) - -#define PCA9641_RETRY_TIME 8 - -typedef struct i2c_muxs_struct_flag -{ - int nr; - char name[48]; - struct mutex update_lock; - int flag; -}i2c_mux_flag; - -i2c_mux_flag pca_flag = { - .flag = -1, -}; - -int pca9641_setmuxflag(int nr, int flag) -{ - if (pca_flag.nr == nr) { - pca_flag.flag = flag; - } - return 0; -} -EXPORT_SYMBOL(pca9641_setmuxflag); - -int g_debug = 0; -module_param(g_debug, int, S_IRUGO | S_IWUSR); - -#define PCA_DEBUG(fmt, args...) do { \ - if (g_debug) { \ - printk(KERN_ERR "[pca9641][VER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ - } \ -} while (0) - -/* arbitration timeouts, in jiffies */ -#define ARB_TIMEOUT (HZ / 8) /* 125 ms until forcing bus ownership */ -#define ARB2_TIMEOUT (HZ / 4) /* 250 ms until acquisition failure */ - -/* arbitration retry delays, in us */ -#define SELECT_DELAY_SHORT 50 -#define SELECT_DELAY_LONG 1000 - -struct pca9541 { - struct i2c_client *client; - unsigned long select_timeout; - unsigned long arb_timeout; -}; - -static const struct i2c_device_id pca9541_id[] = { - {"pca9541", 0}, - {"pca9641", 1}, - {} -}; - -MODULE_DEVICE_TABLE(i2c, pca9541_id); - -#ifdef CONFIG_OF -static const struct of_device_id pca9541_of_match[] = { - { .compatible = "nxp,pca9541" }, - { .compatible = "nxp,pca9641" }, - {} -}; -MODULE_DEVICE_TABLE(of, pca9541_of_match); -#endif - -/* - * Write to chip register. Don't use i2c_transfer()/i2c_smbus_xfer() - * as they will try to lock the adapter a second time. - */ -static int pca9541_reg_write(struct i2c_client *client, u8 command, u8 val) -{ - struct i2c_adapter *adap = client->adapter; - int ret; - - if (adap->algo->master_xfer) { - struct i2c_msg msg; - char buf[2]; - - msg.addr = client->addr; - msg.flags = 0; - msg.len = 2; - buf[0] = command; - buf[1] = val; - msg.buf = buf; - ret = __i2c_transfer(adap, &msg, 1); - } else { - union i2c_smbus_data data; - - data.byte = val; - ret = adap->algo->smbus_xfer(adap, client->addr, - client->flags, - I2C_SMBUS_WRITE, - command, - I2C_SMBUS_BYTE_DATA, &data); - } - - return ret; -} - -/* - * Read from chip register. Don't use i2c_transfer()/i2c_smbus_xfer() - * as they will try to lock adapter a second time. - */ -static int pca9541_reg_read(struct i2c_client *client, u8 command) -{ - struct i2c_adapter *adap = client->adapter; - int ret; - u8 val; - - if (adap->algo->master_xfer) { - struct i2c_msg msg[2] = { - { - .addr = client->addr, - .flags = 0, - .len = 1, - .buf = &command - }, - { - .addr = client->addr, - .flags = I2C_M_RD, - .len = 1, - .buf = &val - } - }; - ret = __i2c_transfer(adap, msg, 2); - if (ret == 2) - ret = val; - else if (ret >= 0) - ret = -EIO; - } else { - union i2c_smbus_data data; - - ret = adap->algo->smbus_xfer(adap, client->addr, - client->flags, - I2C_SMBUS_READ, - command, - I2C_SMBUS_BYTE_DATA, &data); - if (!ret) - ret = data.byte; - } - return ret; -} - -/* - * Arbitration management functions - */ - -/* Release bus. Also reset NTESTON and BUSINIT if it was set. */ -static void pca9541_release_bus(struct i2c_client *client) -{ - int reg; - - reg = pca9541_reg_read(client, PCA9541_CONTROL); - if (reg >= 0 && !busoff(reg) && mybus(reg)) - pca9541_reg_write(client, PCA9541_CONTROL, - (reg & PCA9541_CTL_NBUSON) >> 1); -} - -/* - * Arbitration is defined as a two-step process. A bus master can only activate - * the slave bus if it owns it; otherwise it has to request ownership first. - * This multi-step process ensures that access contention is resolved - * gracefully. - * - * Bus Ownership Other master Action - * state requested access - * ---------------------------------------------------- - * off - yes wait for arbitration timeout or - * for other master to drop request - * off no no take ownership - * off yes no turn on bus - * on yes - done - * on no - wait for arbitration timeout or - * for other master to release bus - * - * The main contention point occurs if the slave bus is off and both masters - * request ownership at the same time. In this case, one master will turn on - * the slave bus, believing that it owns it. The other master will request - * bus ownership. Result is that the bus is turned on, and master which did - * _not_ own the slave bus before ends up owning it. - */ - -/* Control commands per PCA9541 datasheet */ -static const u8 pca9541_control[16] = { - 4, 0, 1, 5, 4, 4, 5, 5, 0, 0, 1, 1, 0, 4, 5, 1 -}; - -/* - * Channel arbitration - * - * Return values: - * <0: error - * 0 : bus not acquired - * 1 : bus acquired - */ -static int pca9541_arbitrate(struct i2c_client *client) -{ - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca9541 *data = i2c_mux_priv(muxc); - int reg; - - reg = pca9541_reg_read(client, PCA9541_CONTROL); - if (reg < 0) - return reg; - - if (busoff(reg)) { - int istat; - /* - * Bus is off. Request ownership or turn it on unless - * other master requested ownership. - */ - istat = pca9541_reg_read(client, PCA9541_ISTAT); - if (!(istat & PCA9541_ISTAT_NMYTEST) - || time_is_before_eq_jiffies(data->arb_timeout)) { - /* - * Other master did not request ownership, - * or arbitration timeout expired. Take the bus. - */ - pca9541_reg_write(client, - PCA9541_CONTROL, - pca9541_control[reg & 0x0f] - | PCA9541_CTL_NTESTON); - data->select_timeout = SELECT_DELAY_SHORT; - } else { - /* - * Other master requested ownership. - * Set extra long timeout to give it time to acquire it. - */ - data->select_timeout = SELECT_DELAY_LONG * 2; - } - } else if (mybus(reg)) { - /* - * Bus is on, and we own it. We are done with acquisition. - * Reset NTESTON and BUSINIT, then return success. - */ - if (reg & (PCA9541_CTL_NTESTON | PCA9541_CTL_BUSINIT)) - pca9541_reg_write(client, - PCA9541_CONTROL, - reg & ~(PCA9541_CTL_NTESTON - | PCA9541_CTL_BUSINIT)); - return 1; - } else { - /* - * Other master owns the bus. - * If arbitration timeout has expired, force ownership. - * Otherwise request it. - */ - data->select_timeout = SELECT_DELAY_LONG; - if (time_is_before_eq_jiffies(data->arb_timeout)) { - /* Time is up, take the bus and reset it. */ - pca9541_reg_write(client, - PCA9541_CONTROL, - pca9541_control[reg & 0x0f] - | PCA9541_CTL_BUSINIT - | PCA9541_CTL_NTESTON); - } else { - /* Request bus ownership if needed */ - if (!(reg & PCA9541_CTL_NTESTON)) - pca9541_reg_write(client, - PCA9541_CONTROL, - reg | PCA9541_CTL_NTESTON); - } - } - return 0; -} - -static int pca9541_select_chan(struct i2c_mux_core *muxc, u32 chan) -{ - struct pca9541 *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - int ret; - unsigned long timeout = jiffies + ARB2_TIMEOUT; - /* give up after this time */ - - data->arb_timeout = jiffies + ARB_TIMEOUT; - /* force bus ownership after this time */ - - do { - ret = pca9541_arbitrate(client); - if (ret) - return ret < 0 ? ret : 0; - - if (data->select_timeout == SELECT_DELAY_SHORT) - udelay(data->select_timeout); - else - msleep(data->select_timeout / 1000); - } while (time_is_after_eq_jiffies(timeout)); - - return -ETIMEDOUT; -} - -static int pca9541_release_chan(struct i2c_mux_core *muxc, u32 chan) -{ - struct pca9541 *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - pca9541_release_bus(client); - return 0; -} - -/* -* Arbitration management functions -*/ -static void pca9641_release_bus(struct i2c_client *client) -{ - pca9541_reg_write(client, PCA9641_CONTROL, 0x80); /* master 0x80 */ -} - -/* -* Channel arbitration -* -* Return values: -* <0: error -* 0 : bus not acquired -* 1 : bus acquired -*/ -static int pca9641_arbitrate(struct i2c_client *client) -{ - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca9541 *data = i2c_mux_priv(muxc); - int reg_ctl, reg_sts; - - reg_ctl = pca9541_reg_read(client, PCA9641_CONTROL); - if (reg_ctl < 0) - return reg_ctl; - reg_sts = pca9541_reg_read(client, PCA9641_STATUS); - - if (BUSOFF(reg_ctl, reg_sts)) { - /* - * Bus is off. Request ownership or turn it on unless - * other master requested ownership. - */ - reg_ctl |= PCA9641_CTL_LOCK_REQ; - pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); - reg_ctl = pca9541_reg_read(client, PCA9641_CONTROL); - - if (lock_grant(reg_ctl)) { - /* - * Other master did not request ownership, - * or arbitration timeout expired. Take the bus. - */ - reg_ctl |= PCA9641_CTL_BUS_CONNECT - | PCA9641_CTL_LOCK_REQ; - pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); - data->select_timeout = SELECT_DELAY_SHORT; - - return 1; - } else { - /* - * Other master requested ownership. - * Set extra long timeout to give it time to acquire it. - */ - data->select_timeout = SELECT_DELAY_LONG * 2; - } - } else if (lock_grant(reg_ctl)) { - /* - * Bus is on, and we own it. We are done with acquisition. - */ - reg_ctl |= PCA9641_CTL_BUS_CONNECT | PCA9641_CTL_LOCK_REQ; - pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); - - return 1; - } else if (other_lock(reg_sts)) { - /* - * Other master owns the bus. - * If arbitration timeout has expired, force ownership. - * Otherwise request it. - */ - data->select_timeout = SELECT_DELAY_LONG; - reg_ctl |= PCA9641_CTL_LOCK_REQ; - pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); - } - return 0; -} - -int pca9641_select_chan(struct i2c_mux_core *muxc, u32 chan) -{ - struct pca9541 *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - int ret; - int result; - unsigned long timeout = jiffies + ARB2_TIMEOUT; - /* give up after this time */ - data->arb_timeout = jiffies + ARB_TIMEOUT; - /* force bus ownership after this time */ - for (result = 0 ; result < PCA9641_RETRY_TIME ; result ++) { - do { - ret = pca9641_arbitrate(client); - if (ret == 1) { - return 0; - } - if (data->select_timeout == SELECT_DELAY_SHORT) - udelay(data->select_timeout); - else - msleep(data->select_timeout / 1000); - } while (time_is_after_eq_jiffies(timeout)); - timeout = jiffies + ARB2_TIMEOUT; - } - return -ETIMEDOUT; -} -EXPORT_SYMBOL(pca9641_select_chan); - -static int pca9641_release_chan(struct i2c_mux_core *muxc, u32 chan) -{ - struct pca9541 *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - if (pca_flag.flag) { - pca9641_release_bus(client); - } - return 0; -} - -static int pca9641_detect_id(struct i2c_client *client) -{ - int reg; - - reg = pca9541_reg_read(client, PCA9641_ID); - if (reg == PCA9641_ID_MAGIC) - return 1; - else - return 0; -} - -/** - ** Limited: 20180827 supports one PCA9641 - **/ -static int pca9641_recordflag(struct i2c_adapter *adap) { - if (pca_flag.flag != -1) { - pr_err(" %s %d has init already!!!", __func__, __LINE__); - return -1 ; - } - pca_flag.nr = adap->nr; - PCA_DEBUG(" adap->nr:%d\n", adap->nr); - snprintf(pca_flag.name, sizeof(pca_flag.name),adap->name); - return 0; -} - -static void i2c_lock_adapter(struct i2c_adapter *adapter){ - struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); - if (parent) - i2c_lock_adapter(parent); - else - rt_mutex_lock(&adapter->bus_lock); -} - -void i2c_unlock_adapter(struct i2c_adapter *adapter) -{ - struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); - - if (parent) - i2c_unlock_adapter(parent); - else - rt_mutex_unlock(&adapter->bus_lock); -} -/* - * I2C init/probing/exit functions - */ -static int pca9541_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct i2c_adapter *adap = client->adapter; - struct i2c_mux_core *muxc; - struct pca9541 *data; - int force; - int ret = -ENODEV; - int detect_id; - - if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE_DATA)) - return -ENODEV; - - detect_id = pca9641_detect_id(client); - - /* - * I2C accesses are unprotected here. - * We have to lock the adapter before releasing the bus. - */ - #if 0 - i2c_lock_adapter(adap); - pca9541_release_bus(client); - i2c_unlock_adapter(adap); - #endif - if (detect_id == 0) { - i2c_lock_adapter(adap); - pca9541_release_bus(client); - i2c_unlock_adapter(adap); - } else { - i2c_lock_adapter(adap); - pca9641_release_bus(client); - i2c_unlock_adapter(adap); - } - - /* Create mux adapter */ - - if (detect_id == 0) { - muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), - I2C_MUX_ARBITRATOR, - pca9541_select_chan, pca9541_release_chan); - if (!muxc) - return -ENOMEM; - - data = i2c_mux_priv(muxc); - data->client = client; - - i2c_set_clientdata(client, muxc); - ret = i2c_mux_add_adapter(muxc, 0, 0, 0); - - if (ret) - return ret; - } else { - muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), - I2C_MUX_ARBITRATOR, - pca9641_select_chan, pca9641_release_chan); - if (!muxc) - return -ENOMEM; - - data = i2c_mux_priv(muxc); - data->client = client; - - i2c_set_clientdata(client, muxc); - - ret = i2c_mux_add_adapter(muxc, force, 0, 0); - if (ret) - return ret; - } - pca9641_recordflag(muxc->adapter[0]); - - dev_info(&client->dev, "registered master selector for I2C %s\n", - client->name); - - return 0; - -} - -static int pca9541_remove(struct i2c_client *client) -{ - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - - i2c_mux_del_adapters(muxc); - return 0; -} - -static struct i2c_driver pca9641_driver = { - .driver = { - .name = "pca9641", - .of_match_table = of_match_ptr(pca9541_of_match), - }, - .probe = pca9541_probe, - .remove = pca9541_remove, - .id_table = pca9541_id, -}; - -module_i2c_driver(pca9641_driver); - -MODULE_AUTHOR("Guenter Roeck "); -MODULE_DESCRIPTION("PCA9541 I2C master selector driver"); -MODULE_LICENSE("GPL v2"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/optoe.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/optoe.c deleted file mode 100644 index 22c5d335e1..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/optoe.c +++ /dev/null @@ -1,1195 +0,0 @@ -/* - * optoe.c - A driver to read and write the EEPROM on optical transceivers - * (SFP, QSFP and similar I2C based devices) - * - * Copyright (C) 2014 Cumulus networks Inc. - * Copyright (C) 2017 Finisar Corp. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Freeoftware Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* - * Description: - * a) Optical transceiver EEPROM read/write transactions are just like - * the at24 eeproms managed by the at24.c i2c driver - * b) The register/memory layout is up to 256 128 byte pages defined by - * a "pages valid" register and switched via a "page select" - * register as explained in below diagram. - * c) 256 bytes are mapped at a time. 'Lower page 00h' is the first 128 - * bytes of address space, and always references the same - * location, independent of the page select register. - * All mapped pages are mapped into the upper 128 bytes - * (offset 128-255) of the i2c address. - * d) Devices with one I2C address (eg QSFP) use I2C address 0x50 - * (A0h in the spec), and map all pages in the upper 128 bytes - * of that address. - * e) Devices with two I2C addresses (eg SFP) have 256 bytes of data - * at I2C address 0x50, and 256 bytes of data at I2C address - * 0x51 (A2h in the spec). Page selection and paged access - * only apply to this second I2C address (0x51). - * e) The address space is presented, by the driver, as a linear - * address space. For devices with one I2C client at address - * 0x50 (eg QSFP), offset 0-127 are in the lower - * half of address 50/A0h/client[0]. Offset 128-255 are in - * page 0, 256-383 are page 1, etc. More generally, offset - * 'n' resides in page (n/128)-1. ('page -1' is the lower - * half, offset 0-127). - * f) For devices with two I2C clients at address 0x50 and 0x51 (eg SFP), - * the address space places offset 0-127 in the lower - * half of 50/A0/client[0], offset 128-255 in the upper - * half. Offset 256-383 is in the lower half of 51/A2/client[1]. - * Offset 384-511 is in page 0, in the upper half of 51/A2/... - * Offset 512-639 is in page 1, in the upper half of 51/A2/... - * Offset 'n' is in page (n/128)-3 (for n > 383) - * - * One I2c addressed (eg QSFP) Memory Map - * - * 2-Wire Serial Address: 1010000x - * - * Lower Page 00h (128 bytes) - * ===================== - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * |Page Select Byte(127)| - * ===================== - * | - * | - * | - * | - * V - * ------------------------------------------------------------ - * | | | | - * | | | | - * | | | | - * | | | | - * | | | | - * | | | | - * | | | | - * | | | | - * | | | | - * V V V V - * ------------ -------------- --------------- -------------- - * | | | | | | | | - * | Upper | | Upper | | Upper | | Upper | - * | Page 00h | | Page 01h | | Page 02h | | Page 03h | - * | | | (Optional) | | (Optional) | | (Optional | - * | | | | | | | for Cable | - * | | | | | | | Assemblies) | - * | ID | | AST | | User | | | - * | Fields | | Table | | EEPROM Data | | | - * | | | | | | | | - * | | | | | | | | - * | | | | | | | | - * ------------ -------------- --------------- -------------- - * - * The SFF 8436 (QSFP) spec only defines the 4 pages described above. - * In anticipation of future applications and devices, this driver - * supports access to the full architected range, 256 pages. - * - * The CMIS (Common Management Interface Specification) defines use of - * considerably more pages (at least to page 0xAF), which this driver - * supports. - * - * NOTE: This version of the driver ONLY SUPPORTS BANK 0 PAGES on CMIS - * devices. - * - **/ - -/* #define DEBUG 1 */ - -#undef EEPROM_CLASS -#ifdef CONFIG_EEPROM_CLASS -#define EEPROM_CLASS -#endif -#ifdef CONFIG_EEPROM_CLASS_MODULE -#define EEPROM_CLASS -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef EEPROM_CLASS -#include -#endif - -#include - -/* The maximum length of a port name */ -#define MAX_PORT_NAME_LEN 20 - -struct optoe_platform_data { - u32 byte_len; /* size (sum of all addr) */ - u16 page_size; /* for writes */ - u8 flags; - void *dummy1; /* backward compatibility */ - void *dummy2; /* backward compatibility */ - -#ifdef EEPROM_CLASS - struct eeprom_platform_data *eeprom_data; -#endif - char port_name[MAX_PORT_NAME_LEN]; -}; - -/* fundamental unit of addressing for EEPROM */ -#define OPTOE_PAGE_SIZE 128 -/* - * Single address devices (eg QSFP) have 256 pages, plus the unpaged - * low 128 bytes. If the device does not support paging, it is - * only 2 'pages' long. - */ -#define OPTOE_ARCH_PAGES 256 -#define ONE_ADDR_EEPROM_SIZE ((1 + OPTOE_ARCH_PAGES) * OPTOE_PAGE_SIZE) -#define ONE_ADDR_EEPROM_UNPAGED_SIZE (2 * OPTOE_PAGE_SIZE) -/* - * Dual address devices (eg SFP) have 256 pages, plus the unpaged - * low 128 bytes, plus 256 bytes at 0x50. If the device does not - * support paging, it is 4 'pages' long. - */ -#define TWO_ADDR_EEPROM_SIZE ((3 + OPTOE_ARCH_PAGES) * OPTOE_PAGE_SIZE) -#define TWO_ADDR_EEPROM_UNPAGED_SIZE (4 * OPTOE_PAGE_SIZE) -#define TWO_ADDR_NO_0X51_SIZE (2 * OPTOE_PAGE_SIZE) - -/* a few constants to find our way around the EEPROM */ -#define OPTOE_PAGE_SELECT_REG 0x7F -#define ONE_ADDR_PAGEABLE_REG 0x02 -#define QSFP_NOT_PAGEABLE (1<<2) -#define CMIS_NOT_PAGEABLE (1<<7) -#define TWO_ADDR_PAGEABLE_REG 0x40 -#define TWO_ADDR_PAGEABLE (1<<4) -#define TWO_ADDR_0X51_REG 92 -#define TWO_ADDR_0X51_SUPP (1<<6) -#define OPTOE_ID_REG 0 -#define OPTOE_READ_OP 0 -#define OPTOE_WRITE_OP 1 -#define OPTOE_EOF 0 /* used for access beyond end of device */ - -#define mem_clear(data, size) memset((data), 0, (size)) - -struct optoe_data { - struct optoe_platform_data chip; - int use_smbus; - char port_name[MAX_PORT_NAME_LEN]; - - /* - * Lock protects against activities from other Linux tasks, - * but not from changes by other I2C masters. - */ - struct mutex lock; - struct bin_attribute bin; - struct attribute_group attr_group; - - u8 *writebuf; - unsigned int write_max; - - unsigned int num_addresses; - -#ifdef EEPROM_CLASS - struct eeprom_device *eeprom_dev; -#endif - - /* dev_class: ONE_ADDR (QSFP) or TWO_ADDR (SFP) */ - int dev_class; - - struct i2c_client *client[]; -}; - -/* - * This parameter is to help this driver avoid blocking other drivers out - * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C - * clock, one 256 byte read takes about 1/43 second which is excessive; - * but the 1/170 second it takes at 400 kHz may be quite reasonable; and - * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. - * - * This value is forced to be a power of two so that writes align on pages. - */ -static unsigned int io_limit = OPTOE_PAGE_SIZE; - -/* - * specs often allow 5 msec for a page write, sometimes 20 msec; - * it's important to recover from write timeouts. - */ -static unsigned int write_timeout = 25; - -/* - * flags to distinguish one-address (QSFP family) from two-address (SFP family) - * If the family is not known, figure it out when the device is accessed - */ -#define ONE_ADDR 1 -#define TWO_ADDR 2 -#define CMIS_ADDR 3 - -static const struct i2c_device_id optoe_ids[] = { - { "optoe1", ONE_ADDR }, - { "optoe2", TWO_ADDR }, - { "optoe3", CMIS_ADDR }, - { "sff8436", ONE_ADDR }, - { "24c04", TWO_ADDR }, - { /* END OF LIST */ } -}; -MODULE_DEVICE_TABLE(i2c, optoe_ids); - -/*-------------------------------------------------------------------------*/ -/* - * This routine computes the addressing information to be used for - * a given r/w request. - * - * Task is to calculate the client (0 = i2c addr 50, 1 = i2c addr 51), - * the page, and the offset. - * - * Handles both single address (eg QSFP) and two address (eg SFP). - * For SFP, offset 0-255 are on client[0], >255 is on client[1] - * Offset 256-383 are on the lower half of client[1] - * Pages are accessible on the upper half of client[1]. - * Offset >383 are in 128 byte pages mapped into the upper half - * - * For QSFP, all offsets are on client[0] - * offset 0-127 are on the lower half of client[0] (no paging) - * Pages are accessible on the upper half of client[1]. - * Offset >127 are in 128 byte pages mapped into the upper half - * - * Callers must not read/write beyond the end of a client or a page - * without recomputing the client/page. Hence offset (within page) - * plus length must be less than or equal to 128. (Note that this - * routine does not have access to the length of the call, hence - * cannot do the validity check.) - * - * Offset within Lower Page 00h and Upper Page 00h are not recomputed - */ - -static uint8_t optoe_translate_offset(struct optoe_data *optoe, - loff_t *offset, struct i2c_client **client) -{ - unsigned int page = 0; - - *client = optoe->client[0]; - - /* if SFP style, offset > 255, shift to i2c addr 0x51 */ - if (optoe->dev_class == TWO_ADDR) { - if (*offset > 255) { - /* like QSFP, but shifted to client[1] */ - *client = optoe->client[1]; - *offset -= 256; - } - } - - /* - * if offset is in the range 0-128... - * page doesn't matter (using lower half), return 0. - * offset is already correct (don't add 128 to get to paged area) - */ - if (*offset < OPTOE_PAGE_SIZE) - return page; - - /* note, page will always be positive since *offset >= 128 */ - page = (*offset >> 7)-1; - /* 0x80 places the offset in the top half, offset is last 7 bits */ - *offset = OPTOE_PAGE_SIZE + (*offset & 0x7f); - - return page; /* note also returning client and offset */ -} - -static ssize_t optoe_eeprom_read(struct optoe_data *optoe, - struct i2c_client *client, - char *buf, unsigned int offset, size_t count) -{ - struct i2c_msg msg[2]; - u8 msgbuf[2]; - unsigned long timeout, read_time; - int status, i; - - mem_clear(msg, sizeof(msg)); - - switch (optoe->use_smbus) { - case I2C_SMBUS_I2C_BLOCK_DATA: - /*smaller eeproms can work given some SMBus extension calls */ - if (count > I2C_SMBUS_BLOCK_MAX) - count = I2C_SMBUS_BLOCK_MAX; - break; - case I2C_SMBUS_WORD_DATA: - /* Check for odd length transaction */ - count = (count == 1) ? 1 : 2; - break; - case I2C_SMBUS_BYTE_DATA: - count = 1; - break; - default: - /* - * When we have a better choice than SMBus calls, use a - * combined I2C message. Write address; then read up to - * io_limit data bytes. msgbuf is u8 and will cast to our - * needs. - */ - i = 0; - msgbuf[i++] = offset; - - msg[0].addr = client->addr; - msg[0].buf = msgbuf; - msg[0].len = i; - - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].buf = buf; - msg[1].len = count; - } - - /* - * Reads fail if the previous write didn't complete yet. We may - * loop a few times until this one succeeds, waiting at least - * long enough for one entire page write to work. - */ - timeout = jiffies + msecs_to_jiffies(write_timeout); - do { - read_time = jiffies; - - switch (optoe->use_smbus) { - case I2C_SMBUS_I2C_BLOCK_DATA: - status = i2c_smbus_read_i2c_block_data(client, offset, - count, buf); - break; - case I2C_SMBUS_WORD_DATA: - status = i2c_smbus_read_word_data(client, offset); - if (status >= 0) { - buf[0] = status & 0xff; - if (count == 2) - buf[1] = status >> 8; - status = count; - } - break; - case I2C_SMBUS_BYTE_DATA: - status = i2c_smbus_read_byte_data(client, offset); - if (status >= 0) { - buf[0] = status; - status = count; - } - break; - default: - status = i2c_transfer(client->adapter, msg, 2); - if (status == 2) - status = count; - } - - dev_dbg(&client->dev, "eeprom read %zu@%d --> %d (%ld)\n", - count, offset, status, jiffies); - - if (status == count) /* happy path */ - return count; - - if (status == -ENXIO) /* no module present */ - return status; - - /* REVISIT: at HZ=100, this is sloooow */ - usleep_range(1000, 2000); - } while (time_before(read_time, timeout)); - - return -ETIMEDOUT; -} - -static ssize_t optoe_eeprom_write(struct optoe_data *optoe, - struct i2c_client *client, - const char *buf, - unsigned int offset, size_t count) -{ - struct i2c_msg msg; - ssize_t status; - unsigned long timeout, write_time; - unsigned int next_page_start; - int i = 0; - - /* write max is at most a page - * (In this driver, write_max is actually one byte!) - */ - if (count > optoe->write_max) - count = optoe->write_max; - - /* shorten count if necessary to avoid crossing page boundary */ - next_page_start = roundup(offset + 1, OPTOE_PAGE_SIZE); - if (offset + count > next_page_start) - count = next_page_start - offset; - - switch (optoe->use_smbus) { - case I2C_SMBUS_I2C_BLOCK_DATA: - /*smaller eeproms can work given some SMBus extension calls */ - if (count > I2C_SMBUS_BLOCK_MAX) - count = I2C_SMBUS_BLOCK_MAX; - break; - case I2C_SMBUS_WORD_DATA: - /* Check for odd length transaction */ - count = (count == 1) ? 1 : 2; - break; - case I2C_SMBUS_BYTE_DATA: - count = 1; - break; - default: - /* If we'll use I2C calls for I/O, set up the message */ - msg.addr = client->addr; - msg.flags = 0; - - /* msg.buf is u8 and casts will mask the values */ - msg.buf = optoe->writebuf; - - msg.buf[i++] = offset; - memcpy(&msg.buf[i], buf, count); - msg.len = i + count; - break; - } - - /* - * Reads fail if the previous write didn't complete yet. We may - * loop a few times until this one succeeds, waiting at least - * long enough for one entire page write to work. - */ - timeout = jiffies + msecs_to_jiffies(write_timeout); - do { - write_time = jiffies; - - switch (optoe->use_smbus) { - case I2C_SMBUS_I2C_BLOCK_DATA: - status = i2c_smbus_write_i2c_block_data(client, - offset, count, buf); - if (status == 0) - status = count; - break; - case I2C_SMBUS_WORD_DATA: - if (count == 2) { - status = i2c_smbus_write_word_data(client, - offset, (u16)((buf[0])|(buf[1] << 8))); - } else { - /* count = 1 */ - status = i2c_smbus_write_byte_data(client, - offset, buf[0]); - } - if (status == 0) - status = count; - break; - case I2C_SMBUS_BYTE_DATA: - status = i2c_smbus_write_byte_data(client, offset, - buf[0]); - if (status == 0) - status = count; - break; - default: - status = i2c_transfer(client->adapter, &msg, 1); - if (status == 1) - status = count; - break; - } - - dev_dbg(&client->dev, "eeprom write %zu@%d --> %ld (%lu)\n", - count, offset, (long int) status, jiffies); - - if (status == count) - return count; - - /* REVISIT: at HZ=100, this is sloooow */ - usleep_range(1000, 2000); - } while (time_before(write_time, timeout)); - - return -ETIMEDOUT; -} - -static ssize_t optoe_eeprom_update_client(struct optoe_data *optoe, - char *buf, loff_t off, - size_t count, int opcode) -{ - struct i2c_client *client; - ssize_t retval = 0; - uint8_t page = 0; - loff_t phy_offset = off; - int ret = 0; - - page = optoe_translate_offset(optoe, &phy_offset, &client); - dev_dbg(&client->dev, - "%s off %lld page:%d phy_offset:%lld, count:%ld, opcode:%d\n", - __func__, off, page, phy_offset, (long int) count, opcode); - if (page > 0) { - ret = optoe_eeprom_write(optoe, client, &page, - OPTOE_PAGE_SELECT_REG, 1); - if (ret < 0) { - dev_dbg(&client->dev, - "Write page register for page %d failed ret:%d!\n", - page, ret); - return ret; - } - } - - while (count) { - ssize_t status; - - if (opcode == OPTOE_READ_OP) { - status = optoe_eeprom_read(optoe, client, - buf, phy_offset, count); - } else { - status = optoe_eeprom_write(optoe, client, - buf, phy_offset, count); - } - if (status <= 0) { - if (retval == 0) - retval = status; - break; - } - buf += status; - phy_offset += status; - count -= status; - retval += status; - } - - if (page > 0) { - /* return the page register to page 0 (why?) */ - page = 0; - ret = optoe_eeprom_write(optoe, client, &page, - OPTOE_PAGE_SELECT_REG, 1); - if (ret < 0) { - dev_err(&client->dev, - "Restore page register to 0 failed:%d!\n", ret); - /* error only if nothing has been transferred */ - if (retval == 0) - retval = ret; - } - } - return retval; -} - -/* - * Figure out if this access is within the range of supported pages. - * Note this is called on every access because we don't know if the - * module has been replaced since the last call. - * If/when modules support more pages, this is the routine to update - * to validate and allow access to additional pages. - * - * Returns updated len for this access: - * - entire access is legal, original len is returned. - * - access begins legal but is too long, len is truncated to fit. - * - initial offset exceeds supported pages, return OPTOE_EOF (zero) - */ -static ssize_t optoe_page_legal(struct optoe_data *optoe, - loff_t off, size_t len) -{ - struct i2c_client *client = optoe->client[0]; - u8 regval; - int not_pageable; - int status; - size_t maxlen; - - if (off < 0) - return -EINVAL; - if (optoe->dev_class == TWO_ADDR) { - /* SFP case */ - /* if only using addr 0x50 (first 256 bytes) we're good */ - if ((off + len) <= TWO_ADDR_NO_0X51_SIZE) - return len; - /* if offset exceeds possible pages, we're not good */ - if (off >= TWO_ADDR_EEPROM_SIZE) - return OPTOE_EOF; - /* in between, are pages supported? */ - status = optoe_eeprom_read(optoe, client, ®val, - TWO_ADDR_PAGEABLE_REG, 1); - if (status < 0) - return status; /* error out (no module?) */ - if (regval & TWO_ADDR_PAGEABLE) { - /* Pages supported, trim len to the end of pages */ - maxlen = TWO_ADDR_EEPROM_SIZE - off; - } else { - /* pages not supported, trim len to unpaged size */ - if (off >= TWO_ADDR_EEPROM_UNPAGED_SIZE) - return OPTOE_EOF; - - /* will be accessing addr 0x51, is that supported? */ - /* byte 92, bit 6 implies DDM support, 0x51 support */ - status = optoe_eeprom_read(optoe, client, ®val, - TWO_ADDR_0X51_REG, 1); - if (status < 0) - return status; - if (regval & TWO_ADDR_0X51_SUPP) { - /* addr 0x51 is OK */ - maxlen = TWO_ADDR_EEPROM_UNPAGED_SIZE - off; - } else { - /* addr 0x51 NOT supported, trim to 256 max */ - if (off >= TWO_ADDR_NO_0X51_SIZE) - return OPTOE_EOF; - maxlen = TWO_ADDR_NO_0X51_SIZE - off; - } - } - len = (len > maxlen) ? maxlen : len; - dev_dbg(&client->dev, - "page_legal, SFP, off %lld len %ld\n", - off, (long int) len); - } else { - /* QSFP case, CMIS case */ - /* if no pages needed, we're good */ - if ((off + len) <= ONE_ADDR_EEPROM_UNPAGED_SIZE) - return len; - /* if offset exceeds possible pages, we're not good */ - if (off >= ONE_ADDR_EEPROM_SIZE) - return OPTOE_EOF; - /* in between, are pages supported? */ - status = optoe_eeprom_read(optoe, client, ®val, - ONE_ADDR_PAGEABLE_REG, 1); - if (status < 0) - return status; /* error out (no module?) */ - - if (optoe->dev_class == ONE_ADDR) { - not_pageable = QSFP_NOT_PAGEABLE; - } else { - not_pageable = CMIS_NOT_PAGEABLE; - } - dev_dbg(&client->dev, - "Paging Register: 0x%x; not_pageable mask: 0x%x\n", - regval, not_pageable); - - if (regval & not_pageable) { - /* pages not supported, trim len to unpaged size */ - if (off >= ONE_ADDR_EEPROM_UNPAGED_SIZE) - return OPTOE_EOF; - maxlen = ONE_ADDR_EEPROM_UNPAGED_SIZE - off; - } else { - /* Pages supported, trim len to the end of pages */ - maxlen = ONE_ADDR_EEPROM_SIZE - off; - } - len = (len > maxlen) ? maxlen : len; - dev_dbg(&client->dev, - "page_legal, QSFP, off %lld len %ld\n", - off, (long int) len); - } - return len; -} - -static ssize_t optoe_read_write(struct optoe_data *optoe, - char *buf, loff_t off, size_t len, int opcode) -{ - struct i2c_client *client = optoe->client[0]; - int chunk; - int status = 0; - ssize_t retval; - size_t pending_len = 0, chunk_len = 0; - loff_t chunk_offset = 0, chunk_start_offset = 0; - loff_t chunk_end_offset = 0; - - dev_dbg(&client->dev, - "%s: off %lld len:%ld, opcode:%s\n", - __func__, off, (long int) len, - (opcode == OPTOE_READ_OP) ? "r" : "w"); - if (unlikely(!len)) - return len; - - /* - * Read data from chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&optoe->lock); - - /* - * Confirm this access fits within the device suppored addr range - */ - status = optoe_page_legal(optoe, off, len); - if ((status == OPTOE_EOF) || (status < 0)) { - mutex_unlock(&optoe->lock); - return status; - } - len = status; - - /* - * For each (128 byte) chunk involved in this request, issue a - * separate call to sff_eeprom_update_client(), to - * ensure that each access recalculates the client/page - * and writes the page register as needed. - * Note that chunk to page mapping is confusing, is different for - * QSFP and SFP, and never needs to be done. Don't try! - */ - pending_len = len; /* amount remaining to transfer */ - retval = 0; /* amount transferred */ - for (chunk = off >> 7; chunk <= (off + len - 1) >> 7; chunk++) { - - /* - * Compute the offset and number of bytes to be read/write - * - * 1. start at an offset not equal to 0 (within the chunk) - * and read/write less than the rest of the chunk - * 2. start at an offset not equal to 0 and read/write the rest - * of the chunk - * 3. start at offset 0 (within the chunk) and read/write less - * than entire chunk - * 4. start at offset 0 (within the chunk), and read/write - * the entire chunk - */ - chunk_start_offset = chunk * OPTOE_PAGE_SIZE; - chunk_end_offset = chunk_start_offset + OPTOE_PAGE_SIZE; - - if (chunk_start_offset < off) { - chunk_offset = off; - if ((off + pending_len) < chunk_end_offset) - chunk_len = pending_len; - else - chunk_len = chunk_end_offset - off; - } else { - chunk_offset = chunk_start_offset; - if (pending_len < OPTOE_PAGE_SIZE) - chunk_len = pending_len; - else - chunk_len = OPTOE_PAGE_SIZE; - } - - dev_dbg(&client->dev, - "sff_r/w: off %lld, len %ld, chunk_start_offset %lld, chunk_offset %lld, chunk_len %ld, pending_len %ld\n", - off, (long int) len, chunk_start_offset, chunk_offset, - (long int) chunk_len, (long int) pending_len); - - /* - * note: chunk_offset is from the start of the EEPROM, - * not the start of the chunk - */ - status = optoe_eeprom_update_client(optoe, buf, - chunk_offset, chunk_len, opcode); - if (status != chunk_len) { - /* This is another 'no device present' path */ - dev_dbg(&client->dev, - "o_u_c: chunk %d c_offset %lld c_len %ld failed %d!\n", - chunk, chunk_offset, (long int) chunk_len, status); - if (status > 0) - retval += status; - if (retval == 0) - retval = status; - break; - } - buf += status; - pending_len -= status; - retval += status; - } - mutex_unlock(&optoe->lock); - - return retval; -} - -static ssize_t optoe_bin_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct i2c_client *client = to_i2c_client(container_of(kobj, - struct device, kobj)); - struct optoe_data *optoe = i2c_get_clientdata(client); - - return optoe_read_write(optoe, buf, off, count, OPTOE_READ_OP); -} - -static ssize_t optoe_bin_write(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct i2c_client *client = to_i2c_client(container_of(kobj, - struct device, kobj)); - struct optoe_data *optoe = i2c_get_clientdata(client); - - return optoe_read_write(optoe, buf, off, count, OPTOE_WRITE_OP); -} - -static int optoe_remove(struct i2c_client *client) -{ - struct optoe_data *optoe; - int i; - - optoe = i2c_get_clientdata(client); - sysfs_remove_group(&client->dev.kobj, &optoe->attr_group); - sysfs_remove_bin_file(&client->dev.kobj, &optoe->bin); - - for (i = 1; i < optoe->num_addresses; i++) - i2c_unregister_device(optoe->client[i]); - -#ifdef EEPROM_CLASS - eeprom_device_unregister(optoe->eeprom_dev); -#endif - - kfree(optoe->writebuf); - kfree(optoe); - return 0; -} - -static ssize_t show_dev_class(struct device *dev, - struct device_attribute *dattr, char *buf) -{ - struct i2c_client *client = to_i2c_client(dev); - struct optoe_data *optoe = i2c_get_clientdata(client); - ssize_t count; - - mutex_lock(&optoe->lock); - count = sprintf(buf, "%d\n", optoe->dev_class); - mutex_unlock(&optoe->lock); - - return count; -} - -static ssize_t set_dev_class(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - struct optoe_data *optoe = i2c_get_clientdata(client); - int dev_class; - - /* - * dev_class is actually the number of i2c addresses used, thus - * legal values are "1" (QSFP class) and "2" (SFP class) - * And... CMIS spec is 1 i2c address, but puts the pageable - * bit in a different location, so CMIS devices are "3" - */ - - if (kstrtoint(buf, 0, &dev_class) != 0 || - dev_class < 1 || dev_class > 3) - return -EINVAL; - - mutex_lock(&optoe->lock); - if (dev_class == TWO_ADDR) { - /* SFP family */ - /* if it doesn't exist, create 0x51 i2c address */ - if (!optoe->client[1]) { - optoe->client[1] = i2c_new_dummy_device(client->adapter, 0x51); - if (!optoe->client[1]) { - dev_err(&client->dev, - "address 0x51 unavailable\n"); - mutex_unlock(&optoe->lock); - return -EADDRINUSE; - } - } - optoe->bin.size = TWO_ADDR_EEPROM_SIZE; - optoe->num_addresses = 2; - } else { - /* one-address (eg QSFP) and CMIS family */ - /* if it exists, remove 0x51 i2c address */ - if (optoe->client[1]) - i2c_unregister_device(optoe->client[1]); - optoe->bin.size = ONE_ADDR_EEPROM_SIZE; - optoe->num_addresses = 1; - } - optoe->dev_class = dev_class; - mutex_unlock(&optoe->lock); - - return count; -} - -/* - * if using the EEPROM CLASS driver, we don't report a port_name, - * the EEPROM CLASS drive handles that. Hence all this code is - * only compiled if we are NOT using the EEPROM CLASS driver. - */ -#ifndef EEPROM_CLASS - -static ssize_t show_port_name(struct device *dev, - struct device_attribute *dattr, char *buf) -{ - struct i2c_client *client = to_i2c_client(dev); - struct optoe_data *optoe = i2c_get_clientdata(client); - ssize_t count; - - mutex_lock(&optoe->lock); - count = sprintf(buf, "%s\n", optoe->port_name); - mutex_unlock(&optoe->lock); - - return count; -} - -static ssize_t set_port_name(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - struct optoe_data *optoe = i2c_get_clientdata(client); - char port_name[MAX_PORT_NAME_LEN]; - - /* no checking, this value is not used except by show_port_name */ - - if (sscanf(buf, "%19s", port_name) != 1) - return -EINVAL; - - mutex_lock(&optoe->lock); - strcpy(optoe->port_name, port_name); - mutex_unlock(&optoe->lock); - - return count; -} - -static DEVICE_ATTR(port_name, 0644, show_port_name, set_port_name); -#endif /* if NOT defined EEPROM_CLASS, the common case */ - -static DEVICE_ATTR(dev_class, 0644, show_dev_class, set_dev_class); - -static struct attribute *optoe_attrs[] = { -#ifndef EEPROM_CLASS - &dev_attr_port_name.attr, -#endif - &dev_attr_dev_class.attr, - NULL, -}; - -static struct attribute_group optoe_attr_group = { - .attrs = optoe_attrs, -}; - -static int optoe_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int err; - int use_smbus = 0; - struct optoe_platform_data chip; - struct optoe_data *optoe; - int num_addresses = 0; - char port_name[MAX_PORT_NAME_LEN]; - - if (client->addr != 0x50) { - dev_dbg(&client->dev, "probe, bad i2c addr: 0x%x\n", - client->addr); - err = -EINVAL; - goto exit; - } - - if (client->dev.platform_data) { - chip = *(struct optoe_platform_data *)client->dev.platform_data; - /* take the port name from the supplied platform data */ -#ifdef EEPROM_CLASS - strncpy(port_name, chip.eeprom_data->label, MAX_PORT_NAME_LEN); -#else - memcpy(port_name, chip.port_name, MAX_PORT_NAME_LEN); -#endif - dev_dbg(&client->dev, - "probe, chip provided, flags:0x%x; name: %s\n", - chip.flags, client->name); - } else { - if (!id->driver_data) { - err = -ENODEV; - goto exit; - } - dev_dbg(&client->dev, "probe, building chip\n"); - strcpy(port_name, "unitialized"); - chip.flags = 0; -#ifdef EEPROM_CLASS - chip.eeprom_data = NULL; -#endif - } - - /* Use I2C operations unless we're stuck with SMBus extensions. */ - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { - if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { - use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_WORD_DATA)) { - use_smbus = I2C_SMBUS_WORD_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - use_smbus = I2C_SMBUS_BYTE_DATA; - } else { - err = -EPFNOSUPPORT; - goto exit; - } - } - - /* - * Make room for two i2c clients - */ - num_addresses = 2; - - optoe = kzalloc(sizeof(struct optoe_data) + - num_addresses * sizeof(struct i2c_client *), - GFP_KERNEL); - if (!optoe) { - err = -ENOMEM; - goto exit; - } - - mutex_init(&optoe->lock); - - /* determine whether this is a one-address or two-address module */ - if ((strcmp(client->name, "optoe1") == 0) || - (strcmp(client->name, "sff8436") == 0)) { - /* one-address (eg QSFP) family */ - optoe->dev_class = ONE_ADDR; - chip.byte_len = ONE_ADDR_EEPROM_SIZE; - num_addresses = 1; - } else if ((strcmp(client->name, "optoe2") == 0) || - (strcmp(client->name, "24c04") == 0)) { - /* SFP family */ - optoe->dev_class = TWO_ADDR; - chip.byte_len = TWO_ADDR_EEPROM_SIZE; - num_addresses = 2; - } else if (strcmp(client->name, "optoe3") == 0) { - /* CMIS spec */ - optoe->dev_class = CMIS_ADDR; - chip.byte_len = ONE_ADDR_EEPROM_SIZE; - num_addresses = 1; - } else { /* those were the only choices */ - err = -EINVAL; - goto exit; - } - - dev_dbg(&client->dev, "dev_class: %d\n", optoe->dev_class); - optoe->use_smbus = use_smbus; - optoe->chip = chip; - optoe->num_addresses = num_addresses; - memcpy(optoe->port_name, port_name, MAX_PORT_NAME_LEN); - - /* - * Export the EEPROM bytes through sysfs, since that's convenient. - * By default, only root should see the data (maybe passwords etc) - */ - sysfs_bin_attr_init(&optoe->bin); - optoe->bin.attr.name = "eeprom"; - optoe->bin.attr.mode = 0444; - optoe->bin.read = optoe_bin_read; - optoe->bin.size = chip.byte_len; - - if (!use_smbus || - (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) || - i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_WORD_DATA) || - i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { - /* - * NOTE: AN-2079 - * Finisar recommends that the host implement 1 byte writes - * only since this module only supports 32 byte page boundaries. - * 2 byte writes are acceptable for PE and Vout changes per - * Application Note AN-2071. - */ - unsigned int write_max = 1; - - optoe->bin.write = optoe_bin_write; - optoe->bin.attr.mode |= 0200; - - if (write_max > io_limit) - write_max = io_limit; - if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) - write_max = I2C_SMBUS_BLOCK_MAX; - optoe->write_max = write_max; - - /* buffer (data + address at the beginning) */ - optoe->writebuf = kmalloc(write_max + 2, GFP_KERNEL); - if (!optoe->writebuf) { - err = -ENOMEM; - goto exit_kfree; - } - } else { - dev_warn(&client->dev, - "cannot write due to controller restrictions."); - } - - optoe->client[0] = client; - - /* SFF-8472 spec requires that the second I2C address be 0x51 */ - if (num_addresses == 2) { - optoe->client[1] = i2c_new_dummy_device(client->adapter, 0x51); - if (!optoe->client[1]) { - dev_err(&client->dev, "address 0x51 unavailable\n"); - err = -EADDRINUSE; - goto err_struct; - } - } - - /* create the sysfs eeprom file */ - err = sysfs_create_bin_file(&client->dev.kobj, &optoe->bin); - if (err) - goto err_struct; - - optoe->attr_group = optoe_attr_group; - - err = sysfs_create_group(&client->dev.kobj, &optoe->attr_group); - if (err) { - dev_err(&client->dev, "failed to create sysfs attribute group.\n"); - goto err_struct; - } - -#ifdef EEPROM_CLASS - optoe->eeprom_dev = eeprom_device_register(&client->dev, - chip.eeprom_data); - if (IS_ERR(optoe->eeprom_dev)) { - dev_err(&client->dev, "error registering eeprom device.\n"); - err = PTR_ERR(optoe->eeprom_dev); - goto err_sysfs_cleanup; - } -#endif - - i2c_set_clientdata(client, optoe); - - dev_info(&client->dev, "%zu byte %s EEPROM, %s\n", - optoe->bin.size, client->name, - optoe->bin.write ? "read/write" : "read-only"); - - if (use_smbus == I2C_SMBUS_WORD_DATA || - use_smbus == I2C_SMBUS_BYTE_DATA) { - dev_notice(&client->dev, - "Falling back to %s reads, performance will suffer\n", - use_smbus == I2C_SMBUS_WORD_DATA ? "word" : "byte"); - } - - return 0; - -#ifdef EEPROM_CLASS -err_sysfs_cleanup: - sysfs_remove_group(&client->dev.kobj, &optoe->attr_group); - sysfs_remove_bin_file(&client->dev.kobj, &optoe->bin); -#endif - -err_struct: - if (num_addresses == 2) { - if (optoe->client[1]) - i2c_unregister_device(optoe->client[1]); - } - - kfree(optoe->writebuf); -exit_kfree: - kfree(optoe); -exit: - dev_dbg(&client->dev, "probe error %d\n", err); - - return err; -} - -/*-------------------------------------------------------------------------*/ - -static struct i2c_driver optoe_driver = { - .driver = { - .name = "optoe", - .owner = THIS_MODULE, - }, - .probe = optoe_probe, - .remove = optoe_remove, - .id_table = optoe_ids, -}; - -static int __init optoe_init(void) -{ - - if (!io_limit) { - pr_err("optoe: io_limit must not be 0!\n"); - return -EINVAL; - } - - io_limit = rounddown_pow_of_two(io_limit); - return i2c_add_driver(&optoe_driver); -} -module_init(optoe_init); - -static void __exit optoe_exit(void) -{ - i2c_del_driver(&optoe_driver); -} -module_exit(optoe_exit); - -MODULE_DESCRIPTION("Driver for optical transceiver (SFP, QSFP, ...) EEPROMs"); -MODULE_AUTHOR("DON BOLLINGER "); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile.h deleted file mode 100644 index b131829fe7..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile.h +++ /dev/null @@ -1,158 +0,0 @@ -#ifndef __RAGILE_H__ -#define __RAGILE_H__ - -#include -#include -#include -#include - -#define mem_clear(data, size) memset((data), 0, (size)) - -/* debug switch level */ -typedef enum { - DBG_START, - DBG_VERBOSE, - DBG_KEY, - DBG_WARN, - DBG_ERROR, - DBG_END, -} dbg_level_t; - -typedef enum dfd_cpld_id { - BCM_CPLD0 = 0, - BCM_CPLD1, - CPLD0_MAC0, - CPLD0_MAC1, - CPLD1_MAC0, - CPLD2_MAC1, -} dfd_cpld_id_t; - - typedef enum dfd_cpld_bus { - SMBUS_BUS = 0 , - GPIO_BUS = 1, - PCA9641_BUS = 2, -} dfd_cpld_bus_t; - - typedef struct dfd_i2c_dev_s { - int bus; /* bus number */ - int addr; /* bus address */ - } dfd_i2c_dev_t; - - typedef enum dfd_cpld_addr { - CPLD_ADDR_MIN = 0x31, - BCM_CPLD0_ADDR = 0x32, /* pca9641 up */ - CPLD0_MAC0_ADDR = 0x33, /* SMBUS down */ - CPLD0_MAC1_ADDR = 0x34, - CPLD1_MAC0_ADDR = 0x35, - CPLD2_MAC1_ADDR = 0x36, - BCM_CPLD1_ADDR = 0x37, - CPLD_ADDR_MAX, -} dfd_cpld_addr_t; - -typedef struct dfd_dev_head_info_s { - uint8_t ver; /* The version number defined by the E2PROM file, the initial version is 0x01 */ - uint8_t flag; /* The new version of E2PROM is identified as 0x7E */ - uint8_t hw_ver; /* It consists of two parts: the main version number and the revised version */ - uint8_t type; /* Hardware type definition information */ - int16_t tlv_len; /* Effective data length (16 bits) */ -} dfd_dev_head_info_t; - -typedef enum dfd_intf_e{ - DFD_INTF_GET_FAN_HW_VERSION, - DFD_INTF_GET_FAN_STATUS, - DFD_INTF_GET_FAN_SPEED_LEVEL, - DFD_INTF_GET_FAN_SPEED, - DFD_INTF_GET_FAN_ATTRIBUTE, - DFD_INTF_GET_FAN_SN, - DFD_INTF_GET_FAN_TYPE, - DFD_INTF_SET_FAN_SPEED_LEVEL, - DFD_INTF_GET_FAN_SUB_NUM, - DFD_INTF_GET_FAN_FAIL_BITMAP, -}dfd_intf_t; - -typedef struct dfd_dev_tlv_info_s { - uint8_t type; /* the type of data */ - uint8_t len; /* the length of data */ - uint8_t data[0]; /* data */ -} dfd_dev_tlv_info_t; - -typedef enum dfd_dev_info_type_e { - DFD_DEV_INFO_TYPE_MAC = 1, - DFD_DEV_INFO_TYPE_NAME = 2, - DFD_DEV_INFO_TYPE_SN = 3, - DFD_DEV_INFO_TYPE_PWR_CONS = 4, - DFD_DEV_INFO_TYPE_HW_INFO = 5, - DFD_DEV_INFO_TYPE_DEV_TYPE = 6, -} dfd_dev_tlv_type_t; - -struct sfp_drivers_t{ - /* addr = sff present bitmap addr, index from 0 */ - void (*get_number) (unsigned int *number); - int (*get_port_start) (void); - int (*get_port_end) (void); - bool (*is_qsfp_port) (const unsigned int port_num); - bool (*get_present) (unsigned long *bitmap); - bool (*read_sfp_eeprom) (const unsigned int port, - const unsigned char addr, - const unsigned char offset, - const uint32_t count, char *buf); - bool (*write_sfp_eeprom) (const unsigned int port, - const unsigned char addr, - const unsigned char offset, - const unsigned char count, - const char *buf); - bool (*read_sysfs) (const unsigned int bus, - const unsigned char addr, - const unsigned char offset, - const uint32_t count, char *buf); - bool (*write_sysfs) (const unsigned int bus, - const unsigned char addr, - const unsigned char offset, - const unsigned char count, - const char *buf); - bool (*read_block_sysfs) (const unsigned int bus, - const unsigned char addr, - const unsigned char offset, - const uint32_t count, char *buf); -}; - -extern int debuglevel; -extern int dfd_cpld_read_chipid(int cpldid , uint32_t addr, int32_t size, unsigned char *buf); -extern int dfd_cpld_read(int32_t addr, uint8_t *val); -extern int dfd_cpld_write(int32_t addr, uint8_t val); -extern int rg_i2c_read(uint32_t bus, uint32_t addr, uint32_t offset, uint32_t size, unsigned char *buf) ; -extern int rg_i2c_write(uint32_t bus, uint32_t addr, uint32_t offset, uint8_t buf); -extern int rg_i2c_read_block(uint32_t bus, uint32_t addr, uint32_t offset, uint32_t size, unsigned char *buf) ; -extern int ragile_setdebug(int val); -extern s32 platform_i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command); -extern s32 platform_i2c_smbus_read_i2c_block_data(const struct i2c_client *client, - u8 command, u8 length, u8 *values); -extern s32 platform_i2c_smbus_read_word_data(const struct i2c_client *client, u8 command); - -extern int sfp_drivers_register(struct sfp_drivers_t *drv); -extern int sfp_drivers_unregister(void); - -extern int sysfs_drivers_register(struct sfp_drivers_t *drv); -extern int sysfs_drivers_unregister(void); - -#define DBG_DEBUG(fmt, arg...) do { \ - if ( debuglevel > DBG_START && debuglevel < DBG_ERROR) { \ - printk(KERN_INFO "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ - } else if ( debuglevel >= DBG_ERROR ) { \ - printk(KERN_ERR "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ - } else { } \ -} while (0) - -#define DBG_INFO(fmt, arg...) do { \ - if ( debuglevel > DBG_KEY) { \ - printk(KERN_INFO "[INFO]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ - } \ - } while (0) - -#define DBG_ERROR(fmt, arg...) do { \ - if ( debuglevel > DBG_START) { \ - printk(KERN_ERR "[ERROR]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ - } \ - } while (0) - -#endif diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile_common_module.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile_common_module.c deleted file mode 100644 index b1c5a89495..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile_common_module.c +++ /dev/null @@ -1,210 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ragile.h" -#include "dfd_tlveeprom.h" - -#define PLATFORM_I2C_RETRY_TIMES 3 - -#define DFD_TLVEEPROM_I2C_BUS (0) -#define DFD_TLVEEPROM_I2C_ADDR (0x56) -#define DFD_E2PROM_MAX_LEN (256) -#define DFD_CARDTYPE_EXT_TLVLEN (4) - -#define PLATFORM_CARDTYPE_RETRY_CNT (10) -#define PLATFORM_CARDTYPE_RETRY_TIMES (1000) - -int debuglevel = 0; -module_param(debuglevel, int, S_IRUGO | S_IWUSR); - -static int dfd_my_type = 0; -module_param(dfd_my_type, int, S_IRUGO | S_IWUSR); - -int g_common_debug_error = 0; -module_param(g_common_debug_error, int, S_IRUGO | S_IWUSR); - -int g_common_debug_verbose = 0; -module_param(g_common_debug_verbose, int, S_IRUGO | S_IWUSR); - -uint32_t dfd_my_type_i2c_bus = 0; -module_param(dfd_my_type_i2c_bus, int, S_IRUGO | S_IWUSR); - -uint32_t dfd_my_type_i2c_addr = 0; -module_param(dfd_my_type_i2c_addr, int, S_IRUGO | S_IWUSR); - -#define RAGILE_COMMON_DEBUG_VERBOSE(fmt, args...) do { \ - if (g_common_debug_verbose) { \ - printk(KERN_ERR "[RAGILE_COMMON][VER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ - } \ -} while (0) - -#define RAGILE_COMMON_DEBUG_ERROR(fmt, args...) do { \ - if (g_common_debug_error) { \ - printk(KERN_ERR "[RAGILE_COMMON][ERROR][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ - } \ -} while (0) - -static int32_t dfd_i2c_read(char *dev, uint32_t addr, uint32_t offset_addr, unsigned char * -buf, int32_t size) -{ - struct file *fp; - mm_segment_t fs; - struct i2c_client client; - int i ,j ; - int rv; - s32 val_t; - - val_t = -1; - rv = 0; - fp = filp_open(dev, O_RDWR, S_IRUSR | S_IWUSR); - if (IS_ERR(fp)) { - DBG_ERROR("i2c open fail.\n"); - RAGILE_COMMON_DEBUG_ERROR("i2c open fail.\n"); - return -1; - } - memcpy(&client, fp->private_data, sizeof(struct i2c_client)); - client.addr = addr; - fs = get_fs(); - set_fs(KERNEL_DS); - for (j = 0 ;j < size ;j++){ - for (i = 0; i < PLATFORM_I2C_RETRY_TIMES; i++) { - if ((val_t = i2c_smbus_read_byte_data(&client, (offset_addr + j))) < 0) { - DBG_DEBUG("read try(%d)time offset_addr:%x \n", i, offset_addr); - continue; - } else { - * (buf + j) = val_t; - break; - } - } - if (val_t < 0) { - rv = -1; - break; - } - } - filp_close(fp, NULL); - set_fs(fs); - return rv; -} - -static int dfd_tlvinfo_get_cardtype(void) -{ - char i2c_path[16] = {0}; - int ret; - int cardtype; - u_int8_t eeprom[DFD_E2PROM_MAX_LEN]; - dfd_i2c_dev_t i2c_dev; - uint8_t buf[DFD_CARDTYPE_EXT_TLVLEN]; - uint8_t len; - dfd_tlv_type_t tlv_type; - - if (dfd_my_type_i2c_bus != 0) { - i2c_dev.bus = dfd_my_type_i2c_bus; - } else { - i2c_dev.bus = DFD_TLVEEPROM_I2C_BUS; - } - - if (dfd_my_type_i2c_addr != 0) { - i2c_dev.addr = dfd_my_type_i2c_addr; - } else { - i2c_dev.addr = DFD_TLVEEPROM_I2C_ADDR; - } - snprintf(i2c_path, sizeof(i2c_path), "/dev/i2c-%d", i2c_dev.bus); - RAGILE_COMMON_DEBUG_VERBOSE("Read device eeprom info:(dev:%s, addr:%02x).\n", i2c_path, i2c_dev.addr); - - ret = dfd_i2c_read(i2c_path, i2c_dev.addr, 0, eeprom, DFD_E2PROM_MAX_LEN); - if (ret != 0) { - DBG_ERROR("Read eeprom info error(dev: %s, addr: %02x).\n", i2c_path, i2c_dev.addr); - RAGILE_COMMON_DEBUG_ERROR("Read eeprom info error(dev: %s, addr: %02x).\n", i2c_path, i2c_dev.addr); - return ret; - } - - tlv_type.main_type = TLV_CODE_VENDOR_EXT; - tlv_type.ext_type = DFD_TLVINFO_EXT_TLV_TYPE_DEV_TYPE; - len = sizeof(buf); - mem_clear(buf, len); - ret = dfd_tlvinfo_get_e2prom_info(eeprom, DFD_E2PROM_MAX_LEN, &tlv_type, buf, &len); - if (ret) { - DBG_ERROR("dfd_tlvinfo_get_e2prom_info failed ret %d.\n", ret); - return -1; - } - for (ret = 0; ret < 4; ret++) { - DBG_DEBUG("buf 0x%02x.\n", buf[ret]); - } - - cardtype = ntohl(*((uint32_t *)buf)); - DBG_DEBUG("cardtype 0x%x.\n", cardtype); - return cardtype; -} - -static int __dfd_get_my_card_type(void) -{ - return dfd_tlvinfo_get_cardtype(); -} - -/* Get its own card type */ -int dfd_get_my_card_type(void) -{ - int type; - int cnt; - - if (dfd_my_type != 0) { - DBG_DEBUG("my_type = 0x%x\r\n", dfd_my_type); - return dfd_my_type; - } - - cnt = PLATFORM_CARDTYPE_RETRY_CNT; - while (cnt--) { - type = __dfd_get_my_card_type(); - if (type < 0) { - RAGILE_COMMON_DEBUG_ERROR("__dfd_get_my_card_type fail cnt %d, ret %d.\n", cnt, type); - msleep(PLATFORM_CARDTYPE_RETRY_TIMES); - continue; - } - RAGILE_COMMON_DEBUG_VERBOSE("success to get type 0x%x.\n", type); - break; - } - - dfd_my_type = type; - return dfd_my_type; -} -EXPORT_SYMBOL(dfd_get_my_card_type); - -static int __init ragile_common_init(void) -{ - int ret; - - RAGILE_COMMON_DEBUG_VERBOSE("Enter.\n"); - ret = dfd_get_my_card_type(); - if (ret <= 0) { - RAGILE_COMMON_DEBUG_ERROR("dfd_get_my_card_type failed, ret %d.\n", ret); - printk(KERN_ERR "Warning: Device type get failed, please check the TLV-EEPROM!\n"); - return -1; - } - - RAGILE_COMMON_DEBUG_VERBOSE("Leave success type 0x%x.\n", ret); - return 0; -} - -static void __exit ragile_common_exit(void) -{ - RAGILE_COMMON_DEBUG_VERBOSE("Exit.\n"); -} - -module_init(ragile_common_init); -module_exit(ragile_common_exit); - -MODULE_DESCRIPTION("ragile Platform Support"); -MODULE_AUTHOR("tangjiamiao "); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile_platform.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile_platform.c deleted file mode 100644 index 06edcfdcb0..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/ragile_platform.c +++ /dev/null @@ -1,79 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ragile.h" - -#define PLATFORM_I2C_RETRY_TIMES 3 - -s32 platform_i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command) -{ - int try; - s32 ret; - - ret = -1; - for (try = 0; try < PLATFORM_I2C_RETRY_TIMES; try++) { - if ((ret = i2c_smbus_read_byte_data(client, command)) >= 0 ) - break; - } - return ret; - -} -EXPORT_SYMBOL(platform_i2c_smbus_read_byte_data); - -s32 platform_i2c_smbus_read_i2c_block_data(const struct i2c_client *client, - u8 command, u8 length, u8 *values) -{ - int try; - s32 ret; - - ret = -1; - for (try = 0; try < PLATFORM_I2C_RETRY_TIMES; try++) { - if ((ret = i2c_smbus_read_i2c_block_data(client, command, length, values)) >= 0 ) - break; - } - return ret; -} -EXPORT_SYMBOL(platform_i2c_smbus_read_i2c_block_data); - -s32 platform_i2c_smbus_read_word_data(const struct i2c_client *client, u8 command) -{ - int try; - s32 ret; - - ret = -1; - for (try = 0; try < PLATFORM_I2C_RETRY_TIMES; try++) { - if ((ret = i2c_smbus_read_word_data(client, command)) >= 0 ) - break; - } - return ret; -} -EXPORT_SYMBOL(platform_i2c_smbus_read_word_data); - -static int __init ragile_platform_init(void) -{ - return 0; -} - -static void __exit ragile_platform_exit(void) -{ - -} - -module_init(ragile_platform_init); -module_exit(ragile_platform_exit); - -MODULE_DESCRIPTION("ragile Platform Support"); -MODULE_AUTHOR("tangjiamiao "); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rg_at24.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rg_at24.c deleted file mode 100755 index f5fd0bb0b3..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rg_at24.c +++ /dev/null @@ -1,858 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * at24.c - handle most I2C EEPROMs - * - * Copyright (C) 2005-2007 David Brownell - * Copyright (C) 2008 Wolfram Sang, Pengutronix - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Address pointer is 16 bit. */ -#define AT24_FLAG_ADDR16 BIT(7) -/* sysfs-entry will be read-only. */ -#define AT24_FLAG_READONLY BIT(6) -/* sysfs-entry will be world-readable. */ -#define AT24_FLAG_IRUGO BIT(5) -/* Take always 8 addresses (24c00). */ -#define AT24_FLAG_TAKE8ADDR BIT(4) -/* Factory-programmed serial number. */ -#define AT24_FLAG_SERIAL BIT(3) -/* Factory-programmed mac address. */ -#define AT24_FLAG_MAC BIT(2) -/* Does not auto-rollover reads to the next slave address. */ -#define AT24_FLAG_NO_RDROL BIT(1) - -/* - * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. - * Differences between different vendor product lines (like Atmel AT24C or - * MicroChip 24LC, etc) won't much matter for typical read/write access. - * There are also I2C RAM chips, likewise interchangeable. One example - * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). - * - * However, misconfiguration can lose data. "Set 16-bit memory address" - * to a part with 8-bit addressing will overwrite data. Writing with too - * big a page size also loses data. And it's not safe to assume that the - * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC - * uses 0x51, for just one example. - * - * Accordingly, explicit board-specific configuration data should be used - * in almost all cases. (One partial exception is an SMBus used to access - * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) - * - * So this driver uses "new style" I2C driver binding, expecting to be - * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or - * similar kernel-resident tables; or, configuration data coming from - * a bootloader. - * - * Other than binding model, current differences from "eeprom" driver are - * that this one handles write access and isn't restricted to 24c02 devices. - * It also handles larger devices (32 kbit and up) with two-byte addresses, - * which won't work on pure SMBus systems. - */ - -struct at24_client { - struct i2c_client *client; - struct regmap *regmap; -}; - -struct at24_data { - /* - * Lock protects against activities from other Linux tasks, - * but not from changes by other I2C masters. - */ - struct mutex lock; - - unsigned int write_max; - unsigned int num_addresses; - unsigned int offset_adj; - - u32 byte_len; - u16 page_size; - u8 flags; - - struct nvmem_device *nvmem; - struct regulator *vcc_reg; - void (*read_post)(unsigned int off, char *buf, size_t count); - - /* - * Some chips tie up multiple I2C addresses; dummy devices reserve - * them for us, and we'll use them with SMBus calls. - */ - struct at24_client client[]; -}; - -/* - * This parameter is to help this driver avoid blocking other drivers out - * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C - * clock, one 256 byte read takes about 1/43 second which is excessive; - * but the 1/170 second it takes at 400 kHz may be quite reasonable; and - * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. - * - * This value is forced to be a power of two so that writes align on pages. - */ -static unsigned int at24_io_limit = 128; -module_param_named(io_limit, at24_io_limit, uint, 0); -MODULE_PARM_DESC(at24_io_limit, "Maximum bytes per I/O (default 128)"); - -/* - * Specs often allow 5 msec for a page write, sometimes 20 msec; - * it's important to recover from write timeouts. - */ -static unsigned int at24_write_timeout = 25; -module_param_named(write_timeout, at24_write_timeout, uint, 0); -MODULE_PARM_DESC(at24_write_timeout, "Time (in ms) to try writes (default 25)"); - -struct at24_chip_data { - u32 byte_len; - u8 flags; - void (*read_post)(unsigned int off, char *buf, size_t count); -}; - -#define AT24_CHIP_DATA(_name, _len, _flags) \ - static const struct at24_chip_data _name = { \ - .byte_len = _len, .flags = _flags, \ - } - -#define AT24_CHIP_DATA_CB(_name, _len, _flags, _read_post) \ - static const struct at24_chip_data _name = { \ - .byte_len = _len, .flags = _flags, \ - .read_post = _read_post, \ - } - -static void at24_read_post_vaio(unsigned int off, char *buf, size_t count) -{ - int i; - - if (capable(CAP_SYS_ADMIN)) - return; - - /* - * Hide VAIO private settings to regular users: - * - BIOS passwords: bytes 0x00 to 0x0f - * - UUID: bytes 0x10 to 0x1f - * - Serial number: 0xc0 to 0xdf - */ - for (i = 0; i < count; i++) { - if ((off + i <= 0x1f) || - (off + i >= 0xc0 && off + i <= 0xdf)) - buf[i] = 0; - } -} - -/* needs 8 addresses as A0-A2 are ignored */ -AT24_CHIP_DATA(at24_data_24c00, 128 / 8, AT24_FLAG_TAKE8ADDR); -/* old variants can't be handled with this generic entry! */ -AT24_CHIP_DATA(at24_data_24c01, 1024 / 8, 0); -AT24_CHIP_DATA(at24_data_24cs01, 16, - AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24c02, 2048 / 8, AT24_FLAG_IRUGO); -AT24_CHIP_DATA(at24_data_24cs02, 16, - AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24mac402, 48 / 8, - AT24_FLAG_MAC | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24mac602, 64 / 8, - AT24_FLAG_MAC | AT24_FLAG_READONLY); -/* spd is a 24c02 in memory DIMMs */ -AT24_CHIP_DATA(at24_data_spd, 2048 / 8, - AT24_FLAG_READONLY | AT24_FLAG_IRUGO); -/* 24c02_vaio is a 24c02 on some Sony laptops */ -AT24_CHIP_DATA_CB(at24_data_24c02_vaio, 2048 / 8, - AT24_FLAG_READONLY | AT24_FLAG_IRUGO, - at24_read_post_vaio); -AT24_CHIP_DATA(at24_data_24c04, 4096 / 8, 0); -AT24_CHIP_DATA(at24_data_24cs04, 16, - AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -/* 24rf08 quirk is handled at i2c-core */ -AT24_CHIP_DATA(at24_data_24c08, 8192 / 8, 0); -AT24_CHIP_DATA(at24_data_24cs08, 16, - AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24c16, 16384 / 8, 0); -AT24_CHIP_DATA(at24_data_24cs16, 16, - AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24c32, 32768 / 8, AT24_FLAG_ADDR16); -AT24_CHIP_DATA(at24_data_24cs32, 16, - AT24_FLAG_ADDR16 | AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24c64, 65536 / 8, AT24_FLAG_ADDR16 | AT24_FLAG_IRUGO); -AT24_CHIP_DATA(at24_data_24cs64, 16, - AT24_FLAG_ADDR16 | AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24c128, 131072 / 8, AT24_FLAG_ADDR16); -AT24_CHIP_DATA(at24_data_24c256, 262144 / 8, AT24_FLAG_ADDR16); -AT24_CHIP_DATA(at24_data_24c512, 524288 / 8, AT24_FLAG_ADDR16); -AT24_CHIP_DATA(at24_data_24c1024, 1048576 / 8, AT24_FLAG_ADDR16); -AT24_CHIP_DATA(at24_data_24c2048, 2097152 / 8, AT24_FLAG_ADDR16); -/* identical to 24c08 ? */ -AT24_CHIP_DATA(at24_data_INT3499, 8192 / 8, 0); - -static const struct i2c_device_id at24_ids[] = { - { "rg_24c00", (kernel_ulong_t)&at24_data_24c00 }, - { "rg_24c01", (kernel_ulong_t)&at24_data_24c01 }, - { "rg_24cs01", (kernel_ulong_t)&at24_data_24cs01 }, - { "rg_24c02", (kernel_ulong_t)&at24_data_24c02 }, - { "rg_24cs02", (kernel_ulong_t)&at24_data_24cs02 }, - { "rg_24mac402", (kernel_ulong_t)&at24_data_24mac402 }, - { "rg_24mac602", (kernel_ulong_t)&at24_data_24mac602 }, - { "rg_spd", (kernel_ulong_t)&at24_data_spd }, - { "rg_24c02-vaio", (kernel_ulong_t)&at24_data_24c02_vaio }, - { "rg_24c04", (kernel_ulong_t)&at24_data_24c04 }, - { "rg_24cs04", (kernel_ulong_t)&at24_data_24cs04 }, - { "rg_24c08", (kernel_ulong_t)&at24_data_24c08 }, - { "rg_24cs08", (kernel_ulong_t)&at24_data_24cs08 }, - { "rg_24c16", (kernel_ulong_t)&at24_data_24c16 }, - { "rg_24cs16", (kernel_ulong_t)&at24_data_24cs16 }, - { "rg_24c32", (kernel_ulong_t)&at24_data_24c32 }, - { "rg_24cs32", (kernel_ulong_t)&at24_data_24cs32 }, - { "rg_24c64", (kernel_ulong_t)&at24_data_24c64 }, - { "rg_24cs64", (kernel_ulong_t)&at24_data_24cs64 }, - { "rg_24c128", (kernel_ulong_t)&at24_data_24c128 }, - { "rg_24c256", (kernel_ulong_t)&at24_data_24c256 }, - { "rg_24c512", (kernel_ulong_t)&at24_data_24c512 }, - { "rg_24c1024", (kernel_ulong_t)&at24_data_24c1024 }, - { "rg_24c2048", (kernel_ulong_t)&at24_data_24c2048 }, - { "rg_at24", 0 }, - { /* END OF LIST */ } -}; -MODULE_DEVICE_TABLE(i2c, at24_ids); - -static const struct of_device_id at24_of_match[] = { - { .compatible = "atmel,24c00", .data = &at24_data_24c00 }, - { .compatible = "atmel,24c01", .data = &at24_data_24c01 }, - { .compatible = "atmel,24cs01", .data = &at24_data_24cs01 }, - { .compatible = "atmel,24c02", .data = &at24_data_24c02 }, - { .compatible = "atmel,24cs02", .data = &at24_data_24cs02 }, - { .compatible = "atmel,24mac402", .data = &at24_data_24mac402 }, - { .compatible = "atmel,24mac602", .data = &at24_data_24mac602 }, - { .compatible = "atmel,spd", .data = &at24_data_spd }, - { .compatible = "atmel,24c04", .data = &at24_data_24c04 }, - { .compatible = "atmel,24cs04", .data = &at24_data_24cs04 }, - { .compatible = "atmel,24c08", .data = &at24_data_24c08 }, - { .compatible = "atmel,24cs08", .data = &at24_data_24cs08 }, - { .compatible = "atmel,24c16", .data = &at24_data_24c16 }, - { .compatible = "atmel,24cs16", .data = &at24_data_24cs16 }, - { .compatible = "atmel,24c32", .data = &at24_data_24c32 }, - { .compatible = "atmel,24cs32", .data = &at24_data_24cs32 }, - { .compatible = "atmel,24c64", .data = &at24_data_24c64 }, - { .compatible = "atmel,24cs64", .data = &at24_data_24cs64 }, - { .compatible = "atmel,24c128", .data = &at24_data_24c128 }, - { .compatible = "atmel,24c256", .data = &at24_data_24c256 }, - { .compatible = "atmel,24c512", .data = &at24_data_24c512 }, - { .compatible = "atmel,24c1024", .data = &at24_data_24c1024 }, - { .compatible = "atmel,24c2048", .data = &at24_data_24c2048 }, - { /* END OF LIST */ }, -}; -MODULE_DEVICE_TABLE(of, at24_of_match); - -static const struct acpi_device_id __maybe_unused at24_acpi_ids[] = { - { "INT3499", (kernel_ulong_t)&at24_data_INT3499 }, - { "TPF0001", (kernel_ulong_t)&at24_data_24c1024 }, - { /* END OF LIST */ } -}; -MODULE_DEVICE_TABLE(acpi, at24_acpi_ids); - -/* - * This routine supports chips which consume multiple I2C addresses. It - * computes the addressing information to be used for a given r/w request. - * Assumes that sanity checks for offset happened at sysfs-layer. - * - * Slave address and byte offset derive from the offset. Always - * set the byte address; on a multi-master board, another master - * may have changed the chip's "current" address pointer. - */ -static struct at24_client *at24_translate_offset(struct at24_data *at24, - unsigned int *offset) -{ - unsigned int i; - - if (at24->flags & AT24_FLAG_ADDR16) { - i = *offset >> 16; - *offset &= 0xffff; - } else { - i = *offset >> 8; - *offset &= 0xff; - } - - return &at24->client[i]; -} - -static struct device *at24_base_client_dev(struct at24_data *at24) -{ - return &at24->client[0].client->dev; -} - -static size_t at24_adjust_read_count(struct at24_data *at24, - unsigned int offset, size_t count) -{ - unsigned int bits; - size_t remainder; - - /* - * In case of multi-address chips that don't rollover reads to - * the next slave address: truncate the count to the slave boundary, - * so that the read never straddles slaves. - */ - if (at24->flags & AT24_FLAG_NO_RDROL) { - bits = (at24->flags & AT24_FLAG_ADDR16) ? 16 : 8; - remainder = BIT(bits) - offset; - if (count > remainder) - count = remainder; - } - - if (count > at24_io_limit) - count = at24_io_limit; - - return count; -} - -static ssize_t at24_regmap_read(struct at24_data *at24, char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, read_time; - struct at24_client *at24_client; - struct i2c_client *client; - struct regmap *regmap; - int ret; - - at24_client = at24_translate_offset(at24, &offset); - regmap = at24_client->regmap; - client = at24_client->client; - count = at24_adjust_read_count(at24, offset, count); - - /* adjust offset for mac and serial read ops */ - offset += at24->offset_adj; - - timeout = jiffies + msecs_to_jiffies(at24_write_timeout); - do { - /* - * The timestamp shall be taken before the actual operation - * to avoid a premature timeout in case of high CPU load. - */ - read_time = jiffies; - - ret = regmap_bulk_read(regmap, offset, buf, count); - dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", - count, offset, ret, jiffies); - if (!ret) - return count; - - usleep_range(1000, 1500); - } while (time_before(read_time, timeout)); - - return -ETIMEDOUT; -} - -/* - * Note that if the hardware write-protect pin is pulled high, the whole - * chip is normally write protected. But there are plenty of product - * variants here, including OTP fuses and partial chip protect. - * - * We only use page mode writes; the alternative is sloooow. These routines - * write at most one page. - */ - -static size_t at24_adjust_write_count(struct at24_data *at24, - unsigned int offset, size_t count) -{ - unsigned int next_page; - - /* write_max is at most a page */ - if (count > at24->write_max) - count = at24->write_max; - - /* Never roll over backwards, to the start of this page */ - next_page = roundup(offset + 1, at24->page_size); - if (offset + count > next_page) - count = next_page - offset; - - return count; -} - -static ssize_t at24_regmap_write(struct at24_data *at24, const char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, write_time; - struct at24_client *at24_client; - struct i2c_client *client; - struct regmap *regmap; - int ret; - - at24_client = at24_translate_offset(at24, &offset); - regmap = at24_client->regmap; - client = at24_client->client; - count = at24_adjust_write_count(at24, offset, count); - timeout = jiffies + msecs_to_jiffies(at24_write_timeout); - - do { - /* - * The timestamp shall be taken before the actual operation - * to avoid a premature timeout in case of high CPU load. - */ - write_time = jiffies; - - ret = regmap_bulk_write(regmap, offset, buf, count); - dev_dbg(&client->dev, "write %zu@%d --> %d (%ld)\n", - count, offset, ret, jiffies); - if (!ret) - return count; - - usleep_range(1000, 1500); - } while (time_before(write_time, timeout)); - - return -ETIMEDOUT; -} - -static int at24_read(void *priv, unsigned int off, void *val, size_t count) -{ - struct at24_data *at24; - struct device *dev; - char *buf = val; - int i, ret; - - at24 = priv; - dev = at24_base_client_dev(at24); - - if (unlikely(!count)) - return count; - - if (off + count > at24->byte_len) - return -EINVAL; - - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put_noidle(dev); - return ret; - } - - /* - * Read data from chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&at24->lock); - - for (i = 0; count; i += ret, count -= ret) { - ret = at24_regmap_read(at24, buf + i, off + i, count); - if (ret < 0) { - mutex_unlock(&at24->lock); - pm_runtime_put(dev); - return ret; - } - } - - mutex_unlock(&at24->lock); - - pm_runtime_put(dev); - - if (unlikely(at24->read_post)) - at24->read_post(off, buf, i); - - return 0; -} - -static int at24_write(void *priv, unsigned int off, void *val, size_t count) -{ - struct at24_data *at24; - struct device *dev; - char *buf = val; - int ret; - - at24 = priv; - dev = at24_base_client_dev(at24); - - if (unlikely(!count)) - return -EINVAL; - - if (off + count > at24->byte_len) - return -EINVAL; - - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put_noidle(dev); - return ret; - } - - /* - * Write data to chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&at24->lock); - - while (count) { - ret = at24_regmap_write(at24, buf, off, count); - if (ret < 0) { - mutex_unlock(&at24->lock); - pm_runtime_put(dev); - return ret; - } - buf += ret; - off += ret; - count -= ret; - } - - mutex_unlock(&at24->lock); - - pm_runtime_put(dev); - - return 0; -} - -static const struct at24_chip_data *at24_get_chip_data(struct device *dev) -{ - struct device_node *of_node = dev->of_node; - const struct at24_chip_data *cdata; - const struct i2c_device_id *id; - - id = i2c_match_id(at24_ids, to_i2c_client(dev)); - - /* - * The I2C core allows OF nodes compatibles to match against the - * I2C device ID table as a fallback, so check not only if an OF - * node is present but also if it matches an OF device ID entry. - */ - if (of_node && of_match_device(at24_of_match, dev)) - cdata = of_device_get_match_data(dev); - else if (id) - cdata = (void *)id->driver_data; - else - cdata = acpi_device_get_match_data(dev); - - if (!cdata) - return ERR_PTR(-ENODEV); - - return cdata; -} - -static int at24_make_dummy_client(struct at24_data *at24, unsigned int index, - struct regmap_config *regmap_config) -{ - struct i2c_client *base_client, *dummy_client; - struct regmap *regmap; - struct device *dev; - - base_client = at24->client[0].client; - dev = &base_client->dev; - - dummy_client = devm_i2c_new_dummy_device(dev, base_client->adapter, - base_client->addr + index); - if (IS_ERR(dummy_client)) - return PTR_ERR(dummy_client); - - regmap = devm_regmap_init_i2c(dummy_client, regmap_config); - if (IS_ERR(regmap)) - return PTR_ERR(regmap); - - at24->client[index].client = dummy_client; - at24->client[index].regmap = regmap; - - return 0; -} - -static unsigned int at24_get_offset_adj(u8 flags, unsigned int byte_len) -{ - if (flags & AT24_FLAG_MAC) { - /* EUI-48 starts from 0x9a, EUI-64 from 0x98 */ - return 0xa0 - byte_len; - } else if (flags & AT24_FLAG_SERIAL && flags & AT24_FLAG_ADDR16) { - /* - * For 16 bit address pointers, the word address must contain - * a '10' sequence in bits 11 and 10 regardless of the - * intended position of the address pointer. - */ - return 0x0800; - } else if (flags & AT24_FLAG_SERIAL) { - /* - * Otherwise the word address must begin with a '10' sequence, - * regardless of the intended address. - */ - return 0x0080; - } else { - return 0; - } -} - -static int at24_probe(struct i2c_client *client) -{ - struct regmap_config regmap_config = { }; - struct nvmem_config nvmem_config = { }; - u32 byte_len, page_size, flags, addrw; - const struct at24_chip_data *cdata; - struct device *dev = &client->dev; - bool i2c_fn_i2c, i2c_fn_block; - unsigned int i, num_addresses; - struct at24_data *at24; - struct regmap *regmap; - bool writable; - u8 test_byte; - int err; - - i2c_fn_i2c = i2c_check_functionality(client->adapter, I2C_FUNC_I2C); - i2c_fn_block = i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_I2C_BLOCK); - - cdata = at24_get_chip_data(dev); - if (IS_ERR(cdata)) - return PTR_ERR(cdata); - - err = device_property_read_u32(dev, "pagesize", &page_size); - if (err) - /* - * This is slow, but we can't know all eeproms, so we better - * play safe. Specifying custom eeprom-types via device tree - * or properties is recommended anyhow. - */ - page_size = 1; - - flags = cdata->flags; - if (device_property_present(dev, "read-only")) - flags |= AT24_FLAG_READONLY; - if (device_property_present(dev, "no-read-rollover")) - flags |= AT24_FLAG_NO_RDROL; - - err = device_property_read_u32(dev, "address-width", &addrw); - if (!err) { - switch (addrw) { - case 8: - if (flags & AT24_FLAG_ADDR16) - dev_warn(dev, - "Override address width to be 8, while default is 16\n"); - flags &= ~AT24_FLAG_ADDR16; - break; - case 16: - flags |= AT24_FLAG_ADDR16; - break; - default: - dev_warn(dev, "Bad \"address-width\" property: %u\n", - addrw); - } - } - - err = device_property_read_u32(dev, "size", &byte_len); - if (err) - byte_len = cdata->byte_len; - - if (!i2c_fn_i2c && !i2c_fn_block) - page_size = 1; - - if (!page_size) { - dev_err(dev, "page_size must not be 0!\n"); - return -EINVAL; - } - - if (!is_power_of_2(page_size)) - dev_warn(dev, "page_size looks suspicious (no power of 2)!\n"); - - err = device_property_read_u32(dev, "num-addresses", &num_addresses); - if (err) { - if (flags & AT24_FLAG_TAKE8ADDR) - num_addresses = 8; - else - num_addresses = DIV_ROUND_UP(byte_len, - (flags & AT24_FLAG_ADDR16) ? 65536 : 256); - } - - if ((flags & AT24_FLAG_SERIAL) && (flags & AT24_FLAG_MAC)) { - dev_err(dev, - "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC."); - return -EINVAL; - } - - regmap_config.val_bits = 8; - regmap_config.reg_bits = (flags & AT24_FLAG_ADDR16) ? 16 : 8; - regmap_config.disable_locking = true; - - regmap = devm_regmap_init_i2c(client, ®map_config); - if (IS_ERR(regmap)) - return PTR_ERR(regmap); - - at24 = devm_kzalloc(dev, struct_size(at24, client, num_addresses), - GFP_KERNEL); - if (!at24) - return -ENOMEM; - - mutex_init(&at24->lock); - at24->byte_len = byte_len; - at24->page_size = page_size; - at24->flags = flags; - at24->read_post = cdata->read_post; - at24->num_addresses = num_addresses; - at24->offset_adj = at24_get_offset_adj(flags, byte_len); - at24->client[0].client = client; - at24->client[0].regmap = regmap; - - at24->vcc_reg = devm_regulator_get(dev, "vcc"); - if (IS_ERR(at24->vcc_reg)) - return PTR_ERR(at24->vcc_reg); - - writable = !(flags & AT24_FLAG_READONLY); - if (writable) { - at24->write_max = min_t(unsigned int, - page_size, at24_io_limit); - if (!i2c_fn_i2c && at24->write_max > I2C_SMBUS_BLOCK_MAX) - at24->write_max = I2C_SMBUS_BLOCK_MAX; - } - - /* use dummy devices for multiple-address chips */ - for (i = 1; i < num_addresses; i++) { - err = at24_make_dummy_client(at24, i, ®map_config); - if (err) - return err; - } - - /* - * If the 'label' property is not present for the AT24 EEPROM, - * then nvmem_config.id is initialised to NVMEM_DEVID_AUTO, - * and this will append the 'devid' to the name of the NVMEM - * device. This is purely legacy and the AT24 driver has always - * defaulted to this. However, if the 'label' property is - */ - nvmem_config.id = NVMEM_DEVID_AUTO; - - if (device_property_present(dev, "label")) { - err = device_property_read_string(dev, "label", - &nvmem_config.name); - if (err) - return err; - } else { - nvmem_config.name = dev_name(dev); - } - - nvmem_config.type = NVMEM_TYPE_EEPROM; - nvmem_config.dev = dev; - nvmem_config.read_only = !writable; - nvmem_config.root_only = !(flags & AT24_FLAG_IRUGO); - nvmem_config.owner = THIS_MODULE; - nvmem_config.compat = true; - nvmem_config.base_dev = dev; - nvmem_config.reg_read = at24_read; - nvmem_config.reg_write = at24_write; - nvmem_config.priv = at24; - nvmem_config.stride = 1; - nvmem_config.word_size = 1; - nvmem_config.size = byte_len; - - i2c_set_clientdata(client, at24); - - err = regulator_enable(at24->vcc_reg); - if (err) { - dev_err(dev, "Failed to enable vcc regulator\n"); - return err; - } - - /* enable runtime pm */ - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - - at24->nvmem = devm_nvmem_register(dev, &nvmem_config); - if (IS_ERR(at24->nvmem)) { - pm_runtime_disable(dev); - if (!pm_runtime_status_suspended(dev)) - regulator_disable(at24->vcc_reg); - return PTR_ERR(at24->nvmem); - } - - /* - * Perform a one-byte test read to verify that the - * chip is functional. - */ - err = at24_read(at24, 0, &test_byte, 1); - if (err) { - pm_runtime_disable(dev); - if (!pm_runtime_status_suspended(dev)) - regulator_disable(at24->vcc_reg); - return -ENODEV; - } - - pm_runtime_idle(dev); - - if (writable) - dev_info(dev, "%u byte %s EEPROM, writable, %u bytes/write\n", - byte_len, client->name, at24->write_max); - else - dev_info(dev, "%u byte %s EEPROM, read-only\n", - byte_len, client->name); - - return 0; -} - -static int at24_remove(struct i2c_client *client) -{ - struct at24_data *at24 = i2c_get_clientdata(client); - - pm_runtime_disable(&client->dev); - if (!pm_runtime_status_suspended(&client->dev)) - regulator_disable(at24->vcc_reg); - pm_runtime_set_suspended(&client->dev); - - return 0; -} - -static int __maybe_unused at24_suspend(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct at24_data *at24 = i2c_get_clientdata(client); - - return regulator_disable(at24->vcc_reg); -} - -static int __maybe_unused at24_resume(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct at24_data *at24 = i2c_get_clientdata(client); - - return regulator_enable(at24->vcc_reg); -} - -static const struct dev_pm_ops at24_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(at24_suspend, at24_resume, NULL) -}; - -static struct i2c_driver at24_driver = { - .driver = { - .name = "rg_at24", - .pm = &at24_pm_ops, - .of_match_table = at24_of_match, - .acpi_match_table = ACPI_PTR(at24_acpi_ids), - }, - .probe_new = at24_probe, - .remove = at24_remove, - .id_table = at24_ids, -}; - -static int __init at24_init(void) -{ - if (!at24_io_limit) { - pr_err("at24: at24_io_limit must not be 0!\n"); - return -EINVAL; - } - - at24_io_limit = rounddown_pow_of_two(at24_io_limit); - return i2c_add_driver(&at24_driver); -} -module_init(at24_init); - -static void __exit at24_exit(void) -{ - i2c_del_driver(&at24_driver); -} -module_exit(at24_exit); - -MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); -MODULE_AUTHOR("David Brownell and Wolfram Sang"); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rg_spi_gpio.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rg_spi_gpio.c deleted file mode 100644 index aadb2902ad..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rg_spi_gpio.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * EEPROMs access control driver for display configuration EEPROMs - * on DigsyMTC board. - * - * (C) 2011 DENX Software Engineering, Anatolij Gustschin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define GPIO_TPM_CLK 496 -#define GPIO_TPM_CS 500 -#define GPIO_TPM_DI 499 -#define GPIO_TPM_DO 498 - -#define EE_SPI_BUS_NUM 1 - -static struct spi_gpio_platform_data tpm_spi_gpio_data = { - .sck = GPIO_TPM_CLK, - .mosi = GPIO_TPM_DI, - .miso = GPIO_TPM_DO, - .num_chipselect = 2, -}; - -static void spi_gpio_release(struct device *dev) -{ - return; -} -static struct platform_device tpm_device = { - .name = "spi_gpio", - .id = 3, - .dev = { - .platform_data = &tpm_spi_gpio_data, - .release = spi_gpio_release, - } -}; - -static struct spi_board_info tpm_info = { - .modalias = "tpm_tis_spi", - .max_speed_hz = 1000000, - .bus_num = 3, - .chip_select = 0, /* 0 ,1 */ - .mode = SPI_MODE_0, - .controller_data = (void *)GPIO_TPM_CS, -}; - -static int __init tpm_devices_init(void) -{ - int ret; - struct spi_master *master; - - ret = platform_device_register(&tpm_device); - if (ret) { - printk("can't add spi-gpio device \n"); - return ret; - } - - master = spi_busnum_to_master(tpm_info.bus_num); - if( !master ) { - return -ENODEV; - } - printk(KERN_INFO "enter tpm_devices_init. \n"); - - spi_new_device(master, &tpm_info); - return 0 ; -} - -static void __exit tpm_devices_exit(void) -{ - platform_device_unregister(&tpm_device); -} - -module_init(tpm_devices_init); -module_exit(tpm_devices_exit); - -MODULE_DESCRIPTION("ragile spi gpio device Support"); -MODULE_AUTHOR("support@ragilenetworks.com"); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rtcpcf85063.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rtcpcf85063.c deleted file mode 100644 index bd61185036..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/rtcpcf85063.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * An I2C driver for the PCF85063 RTC - * Copyright 2014 Rose Technology - * - * Author: Sren Andersen - * Maintainers: http://www.nslu2-linux.org/ - * - * based on the other drivers in this same directory. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include -#include -#include -#include - -/* - * Information for this driver was pulled from the following datasheets. - * - * http://www.nxp.com/documents/data_sheet/PCF85063A.pdf - * http://www.nxp.com/documents/data_sheet/PCF85063TP.pdf - * -*/ - -#define PCF85063_REG_CTRL1 0x00 /* status */ -#define PCF85063_REG_CTRL1_CAP_SEL BIT(0) -#define PCF85063_REG_CTRL1_STOP BIT(5) -#define PCF85063_REG_CTRL2 0x01 -#define PCF85063_REG_CTRL2_COF 0x07 -#define PCF85063_REG_SC 0x04 /* datetime */ -#define PCF85063_REG_SC_OS 0x80 -#define PCF85063_REG_MN 0x05 -#define PCF85063_REG_HR 0x06 -#define PCF85063_REG_DM 0x07 -#define PCF85063_REG_DW 0x08 -#define PCF85063_REG_MO 0x09 -#define PCF85063_REG_YR 0x0A -#define PCF85063_SR 0x58 - -static struct i2c_driver pcf85063_driver; - -static int pcf85063_stop_clock(struct i2c_client *client, u8 *ctrl1) -{ - s32 ret; - - ret = i2c_smbus_read_byte_data(client, PCF85063_REG_CTRL1); - if (ret < 0) { - dev_err(&client->dev, "Failing to stop the clock\n"); - return -EIO; - } - - /* stop the clock */ - ret |= PCF85063_REG_CTRL1_STOP; - - ret = i2c_smbus_write_byte_data(client, PCF85063_REG_CTRL1, ret); - if (ret < 0) { - dev_err(&client->dev, "Failing to stop the clock\n"); - return -EIO; - } - - *ctrl1 = ret; - - return 0; -} - -static int pcf85063_start_clock(struct i2c_client *client, u8 ctrl1) -{ - s32 ret; - - /* start the clock */ - ctrl1 &= ~PCF85063_REG_CTRL1_STOP; - ret = i2c_smbus_write_byte_data(client, PCF85063_REG_CTRL1, ctrl1); - if (ret < 0) { - dev_err(&client->dev, "Failing to start the clock\n"); - return -EIO; - } - - return 0; -} - -static int pcf85063_get_datetime(struct i2c_client *client, struct rtc_time *tm) -{ - int rc; - u8 regs[7]; - - /* - * while reading, the time/date registers are blocked and not updated - * anymore until the access is finished. To not lose a second - * event, the access must be finished within one second. So, read all - * time/date registers in one turn. - */ - rc = i2c_smbus_read_i2c_block_data(client, PCF85063_REG_SC, - sizeof(regs), regs); - if (rc != sizeof(regs)) { - dev_err(&client->dev, "date/time register read error\n"); - return -EIO; - } - - /* if the clock has lost its power it makes no sense to use its time */ - if (regs[0] & PCF85063_REG_SC_OS) { - dev_warn(&client->dev, "Power loss detected, invalid time\n"); - return -EINVAL; - } - - tm->tm_sec = bcd2bin(regs[0] & 0x7F); - tm->tm_min = bcd2bin(regs[1] & 0x7F); - tm->tm_hour = bcd2bin(regs[2] & 0x3F); /* rtc hr 0-23 */ - tm->tm_mday = bcd2bin(regs[3] & 0x3F); - tm->tm_wday = regs[4] & 0x07; - tm->tm_mon = bcd2bin(regs[5] & 0x1F) - 1; /* rtc mn 1-12 */ - tm->tm_year = bcd2bin(regs[6]); - tm->tm_year += 100; - - return rtc_valid_tm(tm); -} - -static int pcf85063_set_datetime(struct i2c_client *client, struct rtc_time *tm) -{ - int rc; - u8 regs[7]; - u8 ctrl1; - u8 cof; - s32 err; - - cof = 0; - cof |= PCF85063_REG_CTRL2_COF; - if ((tm->tm_year < 100) || (tm->tm_year > 199)) - return -EINVAL; - - /* reset rtc-pcf85063 */ - err = i2c_smbus_write_byte_data(client, PCF85063_REG_CTRL1, PCF85063_SR); - if (err < 0) { - dev_err(&client->dev, "Failing to reset rtc-pcf85063\n"); - return EIO; - } - - /* - * to accurately set the time, reset the divider chain and keep it in - * reset state until all time/date registers are written - */ - rc = pcf85063_stop_clock(client, &ctrl1); - if (rc != 0) - return rc; - - /* set CTRL1 CAP_SEL is 12.5pF */ - ctrl1 |= PCF85063_REG_CTRL1_CAP_SEL; - err = i2c_smbus_write_byte_data(client, PCF85063_REG_CTRL1, ctrl1); - if (err < 0) { - dev_err(&client->dev, "Failing to write the PCF85063_REG_CTRL1\n"); - return -EIO; - } - /* set CTRL2 CLKOUT is LOW */ - err = i2c_smbus_write_byte_data(client, PCF85063_REG_CTRL2, cof); - if (err < 0) { - dev_err(&client->dev, "Failing to write the PCF85063_REG_CTRL2\n"); - return -EIO; - } - - /* hours, minutes and seconds */ - regs[0] = bin2bcd(tm->tm_sec) & 0x7F; /* clear OS flag */ - - regs[1] = bin2bcd(tm->tm_min); - regs[2] = bin2bcd(tm->tm_hour); - - /* Day of month, 1 - 31 */ - regs[3] = bin2bcd(tm->tm_mday); - - /* Day, 0 - 6 */ - regs[4] = tm->tm_wday & 0x07; - - /* month, 1 - 12 */ - regs[5] = bin2bcd(tm->tm_mon + 1); - - /* year and century */ - regs[6] = bin2bcd(tm->tm_year - 100); - - /* write all registers at once */ - rc = i2c_smbus_write_i2c_block_data(client, PCF85063_REG_SC, - sizeof(regs), regs); - if (rc < 0) { - dev_err(&client->dev, "date/time register write error\n"); - return rc; - } - - /* - * Write the control register as a separate action since the size of - * the register space is different between the PCF85063TP and - * PCF85063A devices. The rollover point can not be used. - */ - rc = pcf85063_start_clock(client, ctrl1); - if (rc != 0) - return rc; - - return 0; -} - -static int pcf85063_rtc_read_time(struct device *dev, struct rtc_time *tm) -{ - return pcf85063_get_datetime(to_i2c_client(dev), tm); -} - -static int pcf85063_rtc_set_time(struct device *dev, struct rtc_time *tm) -{ - return pcf85063_set_datetime(to_i2c_client(dev), tm); -} - -static const struct rtc_class_ops pcf85063_rtc_ops = { - .read_time = pcf85063_rtc_read_time, - .set_time = pcf85063_rtc_set_time -}; - -static int pcf85063_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct rtc_device *rtc; - - dev_dbg(&client->dev, "%s\n", __func__); - - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) - return -ENODEV; - - rtc = devm_rtc_device_register(&client->dev, - pcf85063_driver.driver.name, - &pcf85063_rtc_ops, THIS_MODULE); - - rtc->uie_unsupported = 1; - - return PTR_ERR_OR_ZERO(rtc); -} - -static const struct i2c_device_id pcf85063_id[] = { - { "rtcpcf85063", 0 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, pcf85063_id); - -static const struct of_device_id pcf85063_of_match[] = { - { .compatible = "nxp,rtcpcf85063" }, - {} -}; -MODULE_DEVICE_TABLE(of, pcf85063_of_match); - -static struct i2c_driver pcf85063_driver = { - .driver = { - .name = "rtcpcf85063", - .of_match_table = of_match_ptr(pcf85063_of_match), - }, - .probe = pcf85063_probe, - .id_table = pcf85063_id, -}; - -module_i2c_driver(pcf85063_driver); - -MODULE_AUTHOR("Sren Andersen "); -MODULE_DESCRIPTION("PCF85063 RTC driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/spi-bitbang-txrx.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/spi-bitbang-txrx.h deleted file mode 100644 index 47bb9b898d..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/spi-bitbang-txrx.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Mix this utility code with some glue code to get one of several types of - * simple SPI master driver. Two do polled word-at-a-time I/O: - * - * - GPIO/parport bitbangers. Provide chipselect() and txrx_word[](), - * expanding the per-word routines from the inline templates below. - * - * - Drivers for controllers resembling bare shift registers. Provide - * chipselect() and txrx_word[](), with custom setup()/cleanup() methods - * that use your controller's clock and chipselect registers. - * - * Some hardware works well with requests at spi_transfer scope: - * - * - Drivers leveraging smarter hardware, with fifos or DMA; or for half - * duplex (MicroWire) controllers. Provide chipselect() and txrx_bufs(), - * and custom setup()/cleanup() methods. - */ - -/* - * The code that knows what GPIO pins do what should have declared four - * functions, ideally as inlines, before including this header: - * - * void setsck(struct spi_device *, int is_on); - * void setmosi(struct spi_device *, int is_on); - * int getmiso(struct spi_device *); - * void spidelay(unsigned); - * - * setsck()'s is_on parameter is a zero/nonzero boolean. - * - * setmosi()'s is_on parameter is a zero/nonzero boolean. - * - * getmiso() is required to return 0 or 1 only. Any other value is invalid - * and will result in improper operation. - * - * A non-inlined routine would call bitbang_txrx_*() routines. The - * main loop could easily compile down to a handful of instructions, - * especially if the delay is a NOP (to run at peak speed). - * - * Since this is software, the timings may not be exactly what your board's - * chips need ... there may be several reasons you'd need to tweak timings - * in these routines, not just to make it faster or slower to match a - * particular CPU clock rate. - */ - -static inline u32 -bitbang_txrx_be_cpha0(struct spi_device *spi, - unsigned nsecs, unsigned cpol, unsigned flags, - u32 word, u8 bits) -{ - /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */ - - u32 oldbit = (!(word & (1<<(bits-1)))) << 31; - /* clock starts at inactive polarity */ - for (word <<= (32 - bits); likely(bits); bits--) { - - /* setup MSB (to slave) on trailing edge */ - if ((flags & SPI_MASTER_NO_TX) == 0) { - if ((word & (1 << 31)) != oldbit) { - setmosi(spi, word & (1 << 31)); - oldbit = word & (1 << 31); - } - } - spidelay(nsecs); /* T(setup) */ - - setsck(spi, !cpol); - spidelay(nsecs); - - /* sample MSB (from slave) on leading edge */ - word <<= 1; - if ((flags & SPI_MASTER_NO_RX) == 0) - word |= getmiso(spi); - setsck(spi, cpol); - } - return word; -} - -static inline u32 -bitbang_txrx_be_cpha1(struct spi_device *spi, - unsigned nsecs, unsigned cpol, unsigned flags, - u32 word, u8 bits) -{ - /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */ - - u32 oldbit = (!(word & (1<<(bits-1)))) << 31; - /* clock starts at inactive polarity */ - for (word <<= (32 - bits); likely(bits); bits--) { - - /* setup MSB (to slave) on leading edge */ - setsck(spi, !cpol); - if ((flags & SPI_MASTER_NO_TX) == 0) { - if ((word & (1 << 31)) != oldbit) { - setmosi(spi, word & (1 << 31)); - oldbit = word & (1 << 31); - } - } - spidelay(nsecs); /* T(setup) */ - - setsck(spi, cpol); - spidelay(nsecs); - - /* sample MSB (from slave) on trailing edge */ - word <<= 1; - if ((flags & SPI_MASTER_NO_RX) == 0) - word |= getmiso(spi); - } - return word; -} diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/spi-gpio.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/spi-gpio.c deleted file mode 100644 index 07d543ceeb..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/spi-gpio.c +++ /dev/null @@ -1,546 +0,0 @@ -/* - * SPI master driver using generic bitbanged GPIO - * - * Copyright (C) 2006,2008 David Brownell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/* - * This bitbanging SPI master driver should help make systems usable - * when a native hardware SPI engine is not available, perhaps because - * its driver isn't yet working or because the I/O pins it requires - * are used for other purposes. - * - * platform_device->driver_data ... points to spi_gpio - * - * spi->controller_state ... reserved for bitbang framework code - * spi->controller_data ... holds chipselect GPIO - * - * spi->master->dev.driver_data ... points to spi_gpio->bitbang - */ - -struct spi_gpio { - struct spi_bitbang bitbang; - struct spi_gpio_platform_data pdata; - struct platform_device *pdev; - unsigned long cs_gpios[0]; -}; - -/*----------------------------------------------------------------------*/ - -/* - * Because the overhead of going through four GPIO procedure calls - * per transferred bit can make performance a problem, this code - * is set up so that you can use it in either of two ways: - * - * - The slow generic way: set up platform_data to hold the GPIO - * numbers used for MISO/MOSI/SCK, and issue procedure calls for - * each of them. This driver can handle several such busses. - * - * - The quicker inlined way: only helps with platform GPIO code - * that inlines operations for constant GPIOs. This can give - * you tight (fast!) inner loops, but each such bus needs a - * new driver. You'll define a new C file, with Makefile and - * Kconfig support; the C code can be a total of six lines: - * - * #define DRIVER_NAME "myboard_spi2" - * #define SPI_MISO_GPIO 119 - * #define SPI_MOSI_GPIO 120 - * #define SPI_SCK_GPIO 121 - * #define SPI_N_CHIPSEL 4 - * #include "spi-gpio.c" - */ - -#ifndef DRIVER_NAME -#define DRIVER_NAME "spi_gpio" - -#define GENERIC_BITBANG /* vs tight inlines */ - -/* all functions referencing these symbols must define pdata */ -#define SPI_MISO_GPIO ((pdata)->miso) -#define SPI_MOSI_GPIO ((pdata)->mosi) -#define SPI_SCK_GPIO ((pdata)->sck) - -#define SPI_N_CHIPSEL ((pdata)->num_chipselect) - -#endif - -/*----------------------------------------------------------------------*/ - -static inline struct spi_gpio *__pure -spi_to_spi_gpio(const struct spi_device *spi) -{ - const struct spi_bitbang *bang; - struct spi_gpio *spi_gpio; - - bang = spi_master_get_devdata(spi->master); - spi_gpio = container_of(bang, struct spi_gpio, bitbang); - return spi_gpio; -} - -static inline struct spi_gpio_platform_data *__pure -spi_to_pdata(const struct spi_device *spi) -{ - return &spi_to_spi_gpio(spi)->pdata; -} - -/* this is #defined to avoid unused-variable warnings when inlining */ -#define pdata spi_to_pdata(spi) - -static inline void setsck(const struct spi_device *spi, int is_on) -{ - gpio_set_value_cansleep(SPI_SCK_GPIO, is_on); -} - -static inline void setmosi(const struct spi_device *spi, int is_on) -{ - gpio_set_value_cansleep(SPI_MOSI_GPIO, is_on); -} - -static inline int getmiso(const struct spi_device *spi) -{ - return !!gpio_get_value_cansleep(SPI_MISO_GPIO); -} - -#undef pdata - -/* - * NOTE: this clocks "as fast as we can". It "should" be a function of the - * requested device clock. Software overhead means we usually have trouble - * reaching even one Mbit/sec (except when we can inline bitops), so for now - * we'll just assume we never need additional per-bit slowdowns. - */ -#define spidelay(nsecs) do {} while (0) - -#include "spi-bitbang-txrx.h" - -/* - * These functions can leverage inline expansion of GPIO calls to shrink - * costs for a txrx bit, often by factors of around ten (by instruction - * count). That is particularly visible for larger word sizes, but helps - * even with default 8-bit words. - * - * REVISIT overheads calling these functions for each word also have - * significant performance costs. Having txrx_bufs() calls that inline - * the txrx_word() logic would help performance, e.g. on larger blocks - * used with flash storage or MMC/SD. There should also be ways to make - * GCC be less stupid about reloading registers inside the I/O loops, - * even without inlined GPIO calls; __attribute__((hot)) on GCC 4.3? - */ - -static u32 spi_gpio_txrx_word_mode0(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits); -} - -static u32 spi_gpio_txrx_word_mode1(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - return bitbang_txrx_be_cpha1(spi, nsecs, 0, 0, word, bits); -} - -static u32 spi_gpio_txrx_word_mode2(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - return bitbang_txrx_be_cpha0(spi, nsecs, 1, 0, word, bits); -} - -static u32 spi_gpio_txrx_word_mode3(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - return bitbang_txrx_be_cpha1(spi, nsecs, 1, 0, word, bits); -} - -/* - * These functions do not call setmosi or getmiso if respective flag - * (SPI_MASTER_NO_RX or SPI_MASTER_NO_TX) is set, so they are safe to - * call when such pin is not present or defined in the controller. - * A separate set of callbacks is defined to get highest possible - * speed in the generic case (when both MISO and MOSI lines are - * available), as optimiser will remove the checks when argument is - * constant. - */ - -static u32 spi_gpio_spec_txrx_word_mode0(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - unsigned flags = spi->master->flags; - return bitbang_txrx_be_cpha0(spi, nsecs, 0, flags, word, bits); -} - -static u32 spi_gpio_spec_txrx_word_mode1(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - unsigned flags = spi->master->flags; - return bitbang_txrx_be_cpha1(spi, nsecs, 0, flags, word, bits); -} - -static u32 spi_gpio_spec_txrx_word_mode2(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - unsigned flags = spi->master->flags; - return bitbang_txrx_be_cpha0(spi, nsecs, 1, flags, word, bits); -} - -static u32 spi_gpio_spec_txrx_word_mode3(struct spi_device *spi, - unsigned nsecs, u32 word, u8 bits) -{ - unsigned flags = spi->master->flags; - return bitbang_txrx_be_cpha1(spi, nsecs, 1, flags, word, bits); -} - -/*----------------------------------------------------------------------*/ - -static void spi_gpio_chipselect(struct spi_device *spi, int is_active) -{ - struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi); - unsigned long cs = spi_gpio->cs_gpios[spi->chip_select]; - - /* set initial clock polarity */ - if (is_active) - setsck(spi, spi->mode & SPI_CPOL); - - if (cs != SPI_GPIO_NO_CHIPSELECT) { - /* SPI is normally active-low */ - gpio_set_value_cansleep(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active); - } -} - -static int spi_gpio_setup(struct spi_device *spi) -{ - unsigned long cs; - int status = 0; - struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi); - struct device_node *np = spi->master->dev.of_node; - - if (np) { - /* - * In DT environments, the CS GPIOs have already been - * initialized from the "cs-gpios" property of the node. - */ - cs = spi_gpio->cs_gpios[spi->chip_select]; - } else { - /* - * ... otherwise, take it from spi->controller_data - */ - cs = (uintptr_t) spi->controller_data; - } - - if (!spi->controller_state) { - if (cs != SPI_GPIO_NO_CHIPSELECT) { - status = gpio_request(cs, dev_name(&spi->dev)); - if (status) - return status; - status = gpio_direction_output(cs, - !(spi->mode & SPI_CS_HIGH)); - } - } - if (!status) { - /* in case it was initialized from static board data */ - spi_gpio->cs_gpios[spi->chip_select] = cs; - status = spi_bitbang_setup(spi); - } - - if (status) { - if (!spi->controller_state && cs != SPI_GPIO_NO_CHIPSELECT) - gpio_free(cs); - } - return status; -} - -static void spi_gpio_cleanup(struct spi_device *spi) -{ - struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi); - unsigned long cs = spi_gpio->cs_gpios[spi->chip_select]; - - if (cs != SPI_GPIO_NO_CHIPSELECT) - gpio_free(cs); - spi_bitbang_cleanup(spi); -} - -static int spi_gpio_alloc(unsigned pin, const char *label, bool is_in) -{ - int value; - - value = gpio_request(pin, label); - if (value == 0) { - if (is_in) - value = gpio_direction_input(pin); - else - value = gpio_direction_output(pin, 0); - } - return value; -} - -static int spi_gpio_request(struct spi_gpio_platform_data *pdata, - const char *label, u16 *res_flags) -{ - int value; - - /* NOTE: SPI_*_GPIO symbols may reference "pdata" */ - - if (SPI_MOSI_GPIO != SPI_GPIO_NO_MOSI) { - value = spi_gpio_alloc(SPI_MOSI_GPIO, label, false); - if (value) - goto done; - } else { - /* HW configuration without MOSI pin */ - *res_flags |= SPI_MASTER_NO_TX; - } - - if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) { - value = spi_gpio_alloc(SPI_MISO_GPIO, label, true); - if (value) - goto free_mosi; - } else { - /* HW configuration without MISO pin */ - *res_flags |= SPI_MASTER_NO_RX; - } - - value = spi_gpio_alloc(SPI_SCK_GPIO, label, false); - if (value) - goto free_miso; - - goto done; - -free_miso: - if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) - gpio_free(SPI_MISO_GPIO); -free_mosi: - if (SPI_MOSI_GPIO != SPI_GPIO_NO_MOSI) - gpio_free(SPI_MOSI_GPIO); -done: - return value; -} - -#ifdef CONFIG_OF -static const struct of_device_id spi_gpio_dt_ids[] = { - { .compatible = "spi-gpio" }, - {} -}; -MODULE_DEVICE_TABLE(of, spi_gpio_dt_ids); - -static int spi_gpio_probe_dt(struct platform_device *pdev) -{ - int ret; - u32 tmp; - struct spi_gpio_platform_data *pdata; - struct device_node *np = pdev->dev.of_node; - const struct of_device_id *of_id = - of_match_device(spi_gpio_dt_ids, &pdev->dev); - - if (!of_id) - return 0; - - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return -ENOMEM; - - ret = of_get_named_gpio(np, "gpio-sck", 0); - if (ret < 0) { - dev_err(&pdev->dev, "gpio-sck property not found\n"); - goto error_free; - } - pdata->sck = ret; - - ret = of_get_named_gpio(np, "gpio-miso", 0); - if (ret < 0) { - dev_info(&pdev->dev, "gpio-miso property not found, switching to no-rx mode\n"); - pdata->miso = SPI_GPIO_NO_MISO; - } else - pdata->miso = ret; - - ret = of_get_named_gpio(np, "gpio-mosi", 0); - if (ret < 0) { - dev_info(&pdev->dev, "gpio-mosi property not found, switching to no-tx mode\n"); - pdata->mosi = SPI_GPIO_NO_MOSI; - } else - pdata->mosi = ret; - - ret = of_property_read_u32(np, "num-chipselects", &tmp); - if (ret < 0) { - dev_err(&pdev->dev, "num-chipselects property not found\n"); - goto error_free; - } - - pdata->num_chipselect = tmp; - pdev->dev.platform_data = pdata; - - return 1; - -error_free: - devm_kfree(&pdev->dev, pdata); - return ret; -} -#else -static inline int spi_gpio_probe_dt(struct platform_device *pdev) -{ - return 0; -} -#endif - -static int spi_gpio_probe(struct platform_device *pdev) -{ - int status; - struct spi_master *master; - struct spi_gpio *spi_gpio; - struct spi_gpio_platform_data *pdata; - u16 master_flags = 0; - bool use_of = 0; - int num_devices; - - status = spi_gpio_probe_dt(pdev); - if (status < 0) - return status; - if (status > 0) - use_of = 1; - - pdata = dev_get_platdata(&pdev->dev); -#ifdef GENERIC_BITBANG - if (!pdata || (!use_of && !pdata->num_chipselect)) - return -ENODEV; -#endif - - if (use_of && !SPI_N_CHIPSEL) - num_devices = 1; - else - num_devices = SPI_N_CHIPSEL; - - status = spi_gpio_request(pdata, dev_name(&pdev->dev), &master_flags); - if (status < 0) - return status; - - master = spi_alloc_master(&pdev->dev, sizeof(*spi_gpio) + - (sizeof(unsigned long) * num_devices)); - if (!master) { - status = -ENOMEM; - goto gpio_free; - } - spi_gpio = spi_master_get_devdata(master); - platform_set_drvdata(pdev, spi_gpio); - - spi_gpio->pdev = pdev; - if (pdata) - spi_gpio->pdata = *pdata; - - master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32); - master->flags = master_flags; - master->bus_num = pdev->id; - master->num_chipselect = num_devices; - master->setup = spi_gpio_setup; - master->cleanup = spi_gpio_cleanup; -#ifdef CONFIG_OF - master->dev.of_node = pdev->dev.of_node; - - if (use_of) { - int i; - struct device_node *np = pdev->dev.of_node; - - /* - * In DT environments, take the CS GPIO from the "cs-gpios" - * property of the node. - */ - - if (!SPI_N_CHIPSEL) - spi_gpio->cs_gpios[0] = SPI_GPIO_NO_CHIPSELECT; - else - for (i = 0; i < SPI_N_CHIPSEL; i++) { - status = of_get_named_gpio(np, "cs-gpios", i); - if (status < 0) { - dev_err(&pdev->dev, - "invalid cs-gpios property\n"); - goto gpio_free; - } - spi_gpio->cs_gpios[i] = status; - } - } -#endif - - spi_gpio->bitbang.master = master; - spi_gpio->bitbang.chipselect = spi_gpio_chipselect; - - if ((master_flags & (SPI_MASTER_NO_TX | SPI_MASTER_NO_RX)) == 0) { - spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_word_mode0; - spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_word_mode1; - spi_gpio->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_word_mode2; - spi_gpio->bitbang.txrx_word[SPI_MODE_3] = spi_gpio_txrx_word_mode3; - } else { - spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_spec_txrx_word_mode0; - spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_spec_txrx_word_mode1; - spi_gpio->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_spec_txrx_word_mode2; - spi_gpio->bitbang.txrx_word[SPI_MODE_3] = spi_gpio_spec_txrx_word_mode3; - } - spi_gpio->bitbang.setup_transfer = spi_bitbang_setup_transfer; - spi_gpio->bitbang.flags = SPI_CS_HIGH; - - status = spi_bitbang_start(&spi_gpio->bitbang); - if (status < 0) { -gpio_free: - if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) - gpio_free(SPI_MISO_GPIO); - if (SPI_MOSI_GPIO != SPI_GPIO_NO_MOSI) - gpio_free(SPI_MOSI_GPIO); - gpio_free(SPI_SCK_GPIO); - spi_master_put(master); - } - - return status; -} - -static int spi_gpio_remove(struct platform_device *pdev) -{ - struct spi_gpio *spi_gpio; - struct spi_gpio_platform_data *pdata; - - spi_gpio = platform_get_drvdata(pdev); - pdata = dev_get_platdata(&pdev->dev); - - /* stop() unregisters child devices too */ - spi_bitbang_stop(&spi_gpio->bitbang); - - if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) - gpio_free(SPI_MISO_GPIO); - if (SPI_MOSI_GPIO != SPI_GPIO_NO_MOSI) - gpio_free(SPI_MOSI_GPIO); - gpio_free(SPI_SCK_GPIO); - spi_master_put(spi_gpio->bitbang.master); - - return 0; -} - -MODULE_ALIAS("platform:" DRIVER_NAME); - -static struct platform_driver spi_gpio_driver = { - .driver = { - .name = DRIVER_NAME, - .of_match_table = of_match_ptr(spi_gpio_dt_ids), - }, - .probe = spi_gpio_probe, - .remove = spi_gpio_remove, -}; -module_platform_driver(spi_gpio_driver); - -MODULE_DESCRIPTION("SPI master driver using generic bitbanged GPIO "); -MODULE_AUTHOR("David Brownell"); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm.h deleted file mode 100644 index a4fc2badf6..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm.h +++ /dev/null @@ -1,543 +0,0 @@ -/* - * Copyright (C) 2004 IBM Corporation - * Copyright (C) 2015 Intel Corporation - * - * Authors: - * Leendert van Doorn - * Dave Safford - * Reiner Sailer - * Kylene Hall - * - * Maintained by: - * - * Device driver for TCG/TCPA TPM (trusted platform module). - * Specifications at www.trustedcomputinggroup.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, version 2 of the - * License. - * - */ - -#ifndef __TPM_H__ -#define __TPM_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -enum tpm_const { - TPM_MINOR = 224, /* officially assigned */ - TPM_BUFSIZE = 4096, - TPM_NUM_DEVICES = 65536, - TPM_RETRY = 50, /* 5 seconds */ -}; - -enum tpm_timeout { - TPM_TIMEOUT = 5, /* msecs */ - TPM_TIMEOUT_RETRY = 100 /* msecs */ -}; - -/* TPM addresses */ -enum tpm_addr { - TPM_SUPERIO_ADDR = 0x2E, - TPM_ADDR = 0x4E, -}; - -/* Indexes the duration array */ -enum tpm_duration { - TPM_SHORT = 0, - TPM_MEDIUM = 1, - TPM_LONG = 2, - TPM_UNDEFINED, -}; - -#define TPM_WARN_RETRY 0x800 -#define TPM_WARN_DOING_SELFTEST 0x802 -#define TPM_ERR_DEACTIVATED 0x6 -#define TPM_ERR_DISABLED 0x7 -#define TPM_ERR_INVALID_POSTINIT 38 - -#define TPM_HEADER_SIZE 10 - -enum tpm2_const { - TPM2_PLATFORM_PCR = 24, - TPM2_PCR_SELECT_MIN = ((TPM2_PLATFORM_PCR + 7) / 8), - TPM2_TIMEOUT_A = 750, - TPM2_TIMEOUT_B = 2000, - TPM2_TIMEOUT_C = 200, - TPM2_TIMEOUT_D = 30, - TPM2_DURATION_SHORT = 20, - TPM2_DURATION_MEDIUM = 750, - TPM2_DURATION_LONG = 2000, -}; - -enum tpm2_structures { - TPM2_ST_NO_SESSIONS = 0x8001, - TPM2_ST_SESSIONS = 0x8002, -}; - -enum tpm2_return_codes { - TPM2_RC_HASH = 0x0083, /* RC_FMT1 */ - TPM2_RC_INITIALIZE = 0x0100, /* RC_VER1 */ - TPM2_RC_DISABLED = 0x0120, - TPM2_RC_TESTING = 0x090A, /* RC_WARN */ -}; - -enum tpm2_algorithms { - TPM2_ALG_SHA1 = 0x0004, - TPM2_ALG_KEYEDHASH = 0x0008, - TPM2_ALG_SHA256 = 0x000B, - TPM2_ALG_SHA384 = 0x000C, - TPM2_ALG_SHA512 = 0x000D, - TPM2_ALG_NULL = 0x0010, - TPM2_ALG_SM3_256 = 0x0012, -}; - -enum tpm2_command_codes { - TPM2_CC_FIRST = 0x011F, - TPM2_CC_SELF_TEST = 0x0143, - TPM2_CC_STARTUP = 0x0144, - TPM2_CC_SHUTDOWN = 0x0145, - TPM2_CC_CREATE = 0x0153, - TPM2_CC_LOAD = 0x0157, - TPM2_CC_UNSEAL = 0x015E, - TPM2_CC_FLUSH_CONTEXT = 0x0165, - TPM2_CC_GET_CAPABILITY = 0x017A, - TPM2_CC_GET_RANDOM = 0x017B, - TPM2_CC_PCR_READ = 0x017E, - TPM2_CC_PCR_EXTEND = 0x0182, - TPM2_CC_LAST = 0x018F, -}; - -enum tpm2_permanent_handles { - TPM2_RS_PW = 0x40000009, -}; - -enum tpm2_capabilities { - TPM2_CAP_TPM_PROPERTIES = 6, -}; - -enum tpm2_startup_types { - TPM2_SU_CLEAR = 0x0000, - TPM2_SU_STATE = 0x0001, -}; - -#define TPM_VID_INTEL 0x8086 -#define TPM_VID_WINBOND 0x1050 -#define TPM_VID_STM 0x104A - -#define TPM_PPI_VERSION_LEN 3 - -enum tpm_chip_flags { - TPM_CHIP_FLAG_REGISTERED = BIT(0), - TPM_CHIP_FLAG_TPM2 = BIT(1), - TPM_CHIP_FLAG_IRQ = BIT(2), - TPM_CHIP_FLAG_VIRTUAL = BIT(3), - TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), -}; - -struct tpm_chip { - struct device dev; - struct cdev cdev; - - /* A driver callback under ops cannot be run unless ops_sem is held - * (sometimes implicitly, eg for the sysfs code). ops becomes null - * when the driver is unregistered, see tpm_try_get_ops. - */ - struct rw_semaphore ops_sem; - const struct tpm_class_ops *ops; - - unsigned int flags; - - int dev_num; /* /dev/tpm# */ - unsigned long is_open; /* only one allowed */ - - struct mutex tpm_mutex; /* tpm is processing */ - - unsigned long timeout_a; /* jiffies */ - unsigned long timeout_b; /* jiffies */ - unsigned long timeout_c; /* jiffies */ - unsigned long timeout_d; /* jiffies */ - bool timeout_adjusted; - unsigned long duration[3]; /* jiffies */ - bool duration_adjusted; - - struct dentry **bios_dir; - - const struct attribute_group *groups[3]; - unsigned int groups_cnt; -#ifdef CONFIG_ACPI - acpi_handle acpi_dev_handle; - char ppi_version[TPM_PPI_VERSION_LEN + 1]; -#endif /* CONFIG_ACPI */ -}; - -#define to_tpm_chip(d) container_of(d, struct tpm_chip, dev) - -static inline int tpm_read_index(int base, int index) -{ - outb(index, base); - return inb(base+1) & 0xFF; -} - -static inline void tpm_write_index(int base, int index, int value) -{ - outb(index, base); - outb(value & 0xFF, base+1); -} -struct tpm_input_header { - __be16 tag; - __be32 length; - __be32 ordinal; -} __packed; - -struct tpm_output_header { - __be16 tag; - __be32 length; - __be32 return_code; -} __packed; - -#define TPM_TAG_RQU_COMMAND cpu_to_be16(193) - -struct stclear_flags_t { - __be16 tag; - u8 deactivated; - u8 disableForceClear; - u8 physicalPresence; - u8 physicalPresenceLock; - u8 bGlobalLock; -} __packed; - -struct tpm_version_t { - u8 Major; - u8 Minor; - u8 revMajor; - u8 revMinor; -} __packed; - -struct tpm_version_1_2_t { - __be16 tag; - u8 Major; - u8 Minor; - u8 revMajor; - u8 revMinor; -} __packed; - -struct timeout_t { - __be32 a; - __be32 b; - __be32 c; - __be32 d; -} __packed; - -struct duration_t { - __be32 tpm_short; - __be32 tpm_medium; - __be32 tpm_long; -} __packed; - -struct permanent_flags_t { - __be16 tag; - u8 disable; - u8 ownership; - u8 deactivated; - u8 readPubek; - u8 disableOwnerClear; - u8 allowMaintenance; - u8 physicalPresenceLifetimeLock; - u8 physicalPresenceHWEnable; - u8 physicalPresenceCMDEnable; - u8 CEKPUsed; - u8 TPMpost; - u8 TPMpostLock; - u8 FIPS; - u8 operator; - u8 enableRevokeEK; - u8 nvLocked; - u8 readSRKPub; - u8 tpmEstablished; - u8 maintenanceDone; - u8 disableFullDALogicInfo; -} __packed; - -typedef union { - struct permanent_flags_t perm_flags; - struct stclear_flags_t stclear_flags; - bool owned; - __be32 num_pcrs; - struct tpm_version_t tpm_version; - struct tpm_version_1_2_t tpm_version_1_2; - __be32 manufacturer_id; - struct timeout_t timeout; - struct duration_t duration; -} cap_t; - -enum tpm_capabilities { - TPM_CAP_FLAG = cpu_to_be32(4), - TPM_CAP_PROP = cpu_to_be32(5), - CAP_VERSION_1_1 = cpu_to_be32(0x06), - CAP_VERSION_1_2 = cpu_to_be32(0x1A) -}; - -enum tpm_sub_capabilities { - TPM_CAP_PROP_PCR = cpu_to_be32(0x101), - TPM_CAP_PROP_MANUFACTURER = cpu_to_be32(0x103), - TPM_CAP_FLAG_PERM = cpu_to_be32(0x108), - TPM_CAP_FLAG_VOL = cpu_to_be32(0x109), - TPM_CAP_PROP_OWNER = cpu_to_be32(0x111), - TPM_CAP_PROP_TIS_TIMEOUT = cpu_to_be32(0x115), - TPM_CAP_PROP_TIS_DURATION = cpu_to_be32(0x120), - -}; - -struct tpm_getcap_params_in { - __be32 cap; - __be32 subcap_size; - __be32 subcap; -} __packed; - -struct tpm_getcap_params_out { - __be32 cap_size; - cap_t cap; -} __packed; - -struct tpm_readpubek_params_out { - u8 algorithm[4]; - u8 encscheme[2]; - u8 sigscheme[2]; - __be32 paramsize; - u8 parameters[12]; /*assuming RSA*/ - __be32 keysize; - u8 modulus[256]; - u8 checksum[20]; -} __packed; - -typedef union { - struct tpm_input_header in; - struct tpm_output_header out; -} tpm_cmd_header; - -struct tpm_pcrread_out { - u8 pcr_result[TPM_DIGEST_SIZE]; -} __packed; - -struct tpm_pcrread_in { - __be32 pcr_idx; -} __packed; - -struct tpm_pcrextend_in { - __be32 pcr_idx; - u8 hash[TPM_DIGEST_SIZE]; -} __packed; - -/* 128 bytes is an arbitrary cap. This could be as large as TPM_BUFSIZE - 18 - * bytes, but 128 is still a relatively large number of random bytes and - * anything much bigger causes users of struct tpm_cmd_t to start getting - * compiler warnings about stack frame size. */ -#define TPM_MAX_RNG_DATA 128 - -struct tpm_getrandom_out { - __be32 rng_data_len; - u8 rng_data[TPM_MAX_RNG_DATA]; -} __packed; - -struct tpm_getrandom_in { - __be32 num_bytes; -} __packed; - -struct tpm_startup_in { - __be16 startup_type; -} __packed; - -typedef union { - struct tpm_getcap_params_out getcap_out; - struct tpm_readpubek_params_out readpubek_out; - u8 readpubek_out_buffer[sizeof(struct tpm_readpubek_params_out)]; - struct tpm_getcap_params_in getcap_in; - struct tpm_pcrread_in pcrread_in; - struct tpm_pcrread_out pcrread_out; - struct tpm_pcrextend_in pcrextend_in; - struct tpm_getrandom_in getrandom_in; - struct tpm_getrandom_out getrandom_out; - struct tpm_startup_in startup_in; -} tpm_cmd_params; - -struct tpm_cmd_t { - tpm_cmd_header header; - tpm_cmd_params params; -} __packed; - -/* A string buffer type for constructing TPM commands. This is based on the - * ideas of string buffer code in security/keys/trusted.h but is heap based - * in order to keep the stack usage minimal. - */ - -enum tpm_buf_flags { - TPM_BUF_OVERFLOW = BIT(0), -}; - -struct tpm_buf { - struct page *data_page; - unsigned int flags; - u8 *data; -}; - -static inline int tpm_buf_init(struct tpm_buf *buf, u16 tag, u32 ordinal) -{ - struct tpm_input_header *head; - - buf->data_page = alloc_page(GFP_HIGHUSER); - if (!buf->data_page) - return -ENOMEM; - - buf->flags = 0; - buf->data = kmap(buf->data_page); - - head = (struct tpm_input_header *) buf->data; - - head->tag = cpu_to_be16(tag); - head->length = cpu_to_be32(sizeof(*head)); - head->ordinal = cpu_to_be32(ordinal); - - return 0; -} - -static inline void tpm_buf_destroy(struct tpm_buf *buf) -{ - kunmap(buf->data_page); - __free_page(buf->data_page); -} - -static inline u32 tpm_buf_length(struct tpm_buf *buf) -{ - struct tpm_input_header *head = (struct tpm_input_header *) buf->data; - - return be32_to_cpu(head->length); -} - -static inline u16 tpm_buf_tag(struct tpm_buf *buf) -{ - struct tpm_input_header *head = (struct tpm_input_header *) buf->data; - - return be16_to_cpu(head->tag); -} - -static inline void tpm_buf_append(struct tpm_buf *buf, - const unsigned char *new_data, - unsigned int new_len) -{ - struct tpm_input_header *head = (struct tpm_input_header *) buf->data; - u32 len = tpm_buf_length(buf); - - /* Return silently if overflow has already happened. */ - if (buf->flags & TPM_BUF_OVERFLOW) - return; - - if ((len + new_len) > PAGE_SIZE) { - WARN(1, "tpm_buf: overflow\n"); - buf->flags |= TPM_BUF_OVERFLOW; - return; - } - - memcpy(&buf->data[len], new_data, new_len); - head->length = cpu_to_be32(len + new_len); -} - -static inline void tpm_buf_append_u8(struct tpm_buf *buf, const u8 value) -{ - tpm_buf_append(buf, &value, 1); -} - -static inline void tpm_buf_append_u16(struct tpm_buf *buf, const u16 value) -{ - __be16 value2 = cpu_to_be16(value); - - tpm_buf_append(buf, (u8 *) &value2, 2); -} - -static inline void tpm_buf_append_u32(struct tpm_buf *buf, const u32 value) -{ - __be32 value2 = cpu_to_be32(value); - - tpm_buf_append(buf, (u8 *) &value2, 4); -} - -extern struct class *tpm_class; -extern dev_t tpm_devt; -extern const struct file_operations tpm_fops; -extern struct idr dev_nums_idr; - -enum tpm_transmit_flags { - TPM_TRANSMIT_UNLOCKED = BIT(0), -}; - -ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz, - unsigned int flags); -ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *cmd, int len, - unsigned int flags, const char *desc); -ssize_t tpm_getcap(struct tpm_chip *chip, __be32 subcap_id, cap_t *cap, - const char *desc); -int tpm_get_timeouts(struct tpm_chip *); -int tpm1_auto_startup(struct tpm_chip *chip); -int tpm_do_selftest(struct tpm_chip *chip); -unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal); -int tpm_pm_suspend(struct device *dev); -int tpm_pm_resume(struct device *dev); -int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout, - wait_queue_head_t *queue, bool check_cancel); - -struct tpm_chip *tpm_chip_find_get(int chip_num); -__must_check int tpm_try_get_ops(struct tpm_chip *chip); -void tpm_put_ops(struct tpm_chip *chip); - -struct tpm_chip *tpm_chip_alloc(struct device *dev, - const struct tpm_class_ops *ops); -struct tpm_chip *tpmm_chip_alloc(struct device *pdev, - const struct tpm_class_ops *ops); -int tpm_chip_register(struct tpm_chip *chip); -void tpm_chip_unregister(struct tpm_chip *chip); - -void tpm_sysfs_add_device(struct tpm_chip *chip); - -int tpm_pcr_read_dev(struct tpm_chip *chip, int pcr_idx, u8 *res_buf); - -#ifdef CONFIG_ACPI -extern void tpm_add_ppi(struct tpm_chip *chip); -#else -static inline void tpm_add_ppi(struct tpm_chip *chip) -{ -} -#endif - -static inline inline u32 tpm2_rc_value(u32 rc) -{ - return (rc & BIT(7)) ? rc & 0xff : rc; -} - -int tpm2_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf); -int tpm2_pcr_extend(struct tpm_chip *chip, int pcr_idx, const u8 *hash); -int tpm2_get_random(struct tpm_chip *chip, u8 *out, size_t max); -int tpm2_seal_trusted(struct tpm_chip *chip, - struct trusted_key_payload *payload, - struct trusted_key_options *options); -int tpm2_unseal_trusted(struct tpm_chip *chip, - struct trusted_key_payload *payload, - struct trusted_key_options *options); -ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, - u32 *value, const char *desc); - -int tpm2_auto_startup(struct tpm_chip *chip); -void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type); -unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal); -int tpm2_probe(struct tpm_chip *chip); -#endif diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_core.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_core.c deleted file mode 100644 index f9aa47ec7a..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_core.c +++ /dev/null @@ -1,855 +0,0 @@ -/* - * Copyright (C) 2005, 2006 IBM Corporation - * Copyright (C) 2014, 2015 Intel Corporation - * - * Authors: - * Leendert van Doorn - * Kylene Hall - * - * Maintained by: - * - * Device driver for TCG/TCPA TPM (trusted platform module). - * Specifications at www.trustedcomputinggroup.org - * - * This device driver implements the TPM interface as defined in - * the TCG TPM Interface Spec version 1.2, revision 1.0. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, version 2 of the - * License. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tpm.h" -#include "tpm_tis_core.h" - -/* Before we attempt to access the TPM we must see that the valid bit is set. - * The specification says that this bit is 0 at reset and remains 0 until the - * 'TPM has gone through its self test and initialization and has established - * correct values in the other bits.' - */ -static int wait_startup(struct tpm_chip *chip, int l) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - unsigned long stop = jiffies + chip->timeout_a; - - do { - int rc; - u8 access; - - rc = tpm_tis_read8(priv, TPM_ACCESS(l), &access); - if (rc < 0) - return rc; - - if (access & TPM_ACCESS_VALID) - return 0; - msleep(TPM_TIMEOUT); - } while (time_before(jiffies, stop)); - return -1; -} - -static int check_locality(struct tpm_chip *chip, int l) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int rc; - u8 access; - - rc = tpm_tis_read8(priv, TPM_ACCESS(l), &access); - if (rc < 0) - return rc; - - if ((access & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == - (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) - return priv->locality = l; - - return -1; -} - -static void release_locality(struct tpm_chip *chip, int l, int force) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int rc; - u8 access; - - rc = tpm_tis_read8(priv, TPM_ACCESS(l), &access); - if (rc < 0) - return; - - if (force || (access & - (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) == - (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) - tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY); - -} - -static int request_locality(struct tpm_chip *chip, int l) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - unsigned long stop, timeout; - long rc; - - if (check_locality(chip, l) >= 0) - return l; - - rc = tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_REQUEST_USE); - if (rc < 0) - return rc; - - stop = jiffies + chip->timeout_a; - - if (chip->flags & TPM_CHIP_FLAG_IRQ) { -again: - timeout = stop - jiffies; - if ((long)timeout <= 0) - return -1; - rc = wait_event_interruptible_timeout(priv->int_queue, - (check_locality - (chip, l) >= 0), - timeout); - if (rc > 0) - return l; - if (rc == -ERESTARTSYS && freezing(current)) { - clear_thread_flag(TIF_SIGPENDING); - goto again; - } - } else { - /* wait for burstcount */ - do { - if (check_locality(chip, l) >= 0) - return l; - msleep(TPM_TIMEOUT); - } while (time_before(jiffies, stop)); - } - return -1; -} - -static u8 tpm_tis_status(struct tpm_chip *chip) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int rc; - u8 status; - - rc = tpm_tis_read8(priv, TPM_STS(priv->locality), &status); - if (rc < 0) - return 0; - - return status; -} - -static void tpm_tis_ready(struct tpm_chip *chip) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - - /* this causes the current command to be aborted */ - tpm_tis_write8(priv, TPM_STS(priv->locality), TPM_STS_COMMAND_READY); -} - -static int get_burstcount(struct tpm_chip *chip) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - unsigned long stop; - int burstcnt, rc; - u32 value; - - /* wait for burstcount */ - if (chip->flags & TPM_CHIP_FLAG_TPM2) - stop = jiffies + chip->timeout_a; - else - stop = jiffies + chip->timeout_d; - do { - rc = tpm_tis_read32(priv, TPM_STS(priv->locality), &value); - if (rc < 0) - return rc; - - burstcnt = (value >> 8) & 0xFFFF; - if (burstcnt) - return burstcnt; - msleep(TPM_TIMEOUT); - } while (time_before(jiffies, stop)); - return -EBUSY; -} - -static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int size = 0, burstcnt, rc; - - while (size < count && - wait_for_tpm_stat(chip, - TPM_STS_DATA_AVAIL | TPM_STS_VALID, - chip->timeout_c, - &priv->read_queue, true) == 0) { - burstcnt = get_burstcount(chip); - if (burstcnt < 0) { - dev_err(&chip->dev, "Unable to read burstcount\n"); - return burstcnt; - } - burstcnt = min_t(int, burstcnt, count - size); - - rc = tpm_tis_read_bytes(priv, TPM_DATA_FIFO(priv->locality), - burstcnt, buf + size); - if (rc < 0) - return rc; - - size += burstcnt; - } - return size; -} - -static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int size = 0; - int status; - u32 expected; - - if (count < TPM_HEADER_SIZE) { - size = -EIO; - goto out; - } - - size = recv_data(chip, buf, TPM_HEADER_SIZE); - /* read first 10 bytes, including tag, paramsize, and result */ - if (size < TPM_HEADER_SIZE) { - dev_err(&chip->dev, "Unable to read header\n"); - goto out; - } - - expected = be32_to_cpu(*(__be32 *) (buf + 2)); - if (expected > count || expected < TPM_HEADER_SIZE) { - size = -EIO; - goto out; - } - - size += recv_data(chip, &buf[TPM_HEADER_SIZE], - expected - TPM_HEADER_SIZE); - if (size < expected) { - dev_err(&chip->dev, "Unable to read remainder of result\n"); - size = -ETIME; - goto out; - } - - wait_for_tpm_stat(chip, TPM_STS_VALID, chip->timeout_c, - &priv->int_queue, false); - status = tpm_tis_status(chip); - if (status & TPM_STS_DATA_AVAIL) { /* retry? */ - dev_err(&chip->dev, "Error left over data\n"); - size = -EIO; - goto out; - } - -out: - tpm_tis_ready(chip); - release_locality(chip, priv->locality, 0); - return size; -} - -/* - * If interrupts are used (signaled by an irq set in the vendor structure) - * tpm.c can skip polling for the data to be available as the interrupt is - * waited for here - */ -static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int rc, status, burstcnt; - size_t count = 0; - bool itpm = priv->flags & TPM_TIS_ITPM_POSSIBLE; - - if (request_locality(chip, 0) < 0) - return -EBUSY; - - status = tpm_tis_status(chip); - if ((status & TPM_STS_COMMAND_READY) == 0) { - tpm_tis_ready(chip); - if (wait_for_tpm_stat - (chip, TPM_STS_COMMAND_READY, chip->timeout_b, - &priv->int_queue, false) < 0) { - rc = -ETIME; - goto out_err; - } - } - - while (count < len - 1) { - burstcnt = get_burstcount(chip); - if (burstcnt < 0) { - dev_err(&chip->dev, "Unable to read burstcount\n"); - rc = burstcnt; - goto out_err; - } - burstcnt = min_t(int, burstcnt, len - count - 1); - rc = tpm_tis_write_bytes(priv, TPM_DATA_FIFO(priv->locality), - burstcnt, buf + count); - if (rc < 0) - goto out_err; - - count += burstcnt; - - wait_for_tpm_stat(chip, TPM_STS_VALID, chip->timeout_c, - &priv->int_queue, false); - status = tpm_tis_status(chip); - if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) { - rc = -EIO; - goto out_err; - } - } - - /* write last byte */ - rc = tpm_tis_write8(priv, TPM_DATA_FIFO(priv->locality), buf[count]); - if (rc < 0) - goto out_err; - - wait_for_tpm_stat(chip, TPM_STS_VALID, chip->timeout_c, - &priv->int_queue, false); - status = tpm_tis_status(chip); - if (!itpm && (status & TPM_STS_DATA_EXPECT) != 0) { - rc = -EIO; - goto out_err; - } - - return 0; - -out_err: - tpm_tis_ready(chip); - release_locality(chip, priv->locality, 0); - return rc; -} - -static void disable_interrupts(struct tpm_chip *chip) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - u32 intmask; - int rc; - - rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); - if (rc < 0) - intmask = 0; - - intmask &= ~TPM_GLOBAL_INT_ENABLE; - rc = tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); - - devm_free_irq(chip->dev.parent, priv->irq, chip); - priv->irq = 0; - chip->flags &= ~TPM_CHIP_FLAG_IRQ; -} - -/* - * If interrupts are used (signaled by an irq set in the vendor structure) - * tpm.c can skip polling for the data to be available as the interrupt is - * waited for here - */ -static int tpm_tis_send_main(struct tpm_chip *chip, const u8 *buf, size_t len) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int rc; - u32 ordinal; - unsigned long dur; - - rc = tpm_tis_send_data(chip, buf, len); - if (rc < 0) - return rc; - - /* go and do it */ - rc = tpm_tis_write8(priv, TPM_STS(priv->locality), TPM_STS_GO); - if (rc < 0) - goto out_err; - - if (chip->flags & TPM_CHIP_FLAG_IRQ) { - ordinal = be32_to_cpu(*((__be32 *) (buf + 6))); - - if (chip->flags & TPM_CHIP_FLAG_TPM2) - dur = tpm2_calc_ordinal_duration(chip, ordinal); - else - dur = tpm_calc_ordinal_duration(chip, ordinal); - - if (wait_for_tpm_stat - (chip, TPM_STS_DATA_AVAIL | TPM_STS_VALID, dur, - &priv->read_queue, false) < 0) { - rc = -ETIME; - goto out_err; - } - } - return len; -out_err: - tpm_tis_ready(chip); - release_locality(chip, priv->locality, 0); - return rc; -} - -static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) -{ - int rc, irq; - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - - if (!(chip->flags & TPM_CHIP_FLAG_IRQ) || priv->irq_tested) - return tpm_tis_send_main(chip, buf, len); - - /* Verify receipt of the expected IRQ */ - irq = priv->irq; - priv->irq = 0; - chip->flags &= ~TPM_CHIP_FLAG_IRQ; - rc = tpm_tis_send_main(chip, buf, len); - priv->irq = irq; - chip->flags |= TPM_CHIP_FLAG_IRQ; - if (!priv->irq_tested) - msleep(1); - if (!priv->irq_tested) - disable_interrupts(chip); - priv->irq_tested = true; - return rc; -} - -struct tis_vendor_timeout_override { - u32 did_vid; - unsigned long timeout_us[4]; -}; - -static const struct tis_vendor_timeout_override vendor_timeout_overrides[] = { - /* Atmel 3204 */ - { 0x32041114, { (TIS_SHORT_TIMEOUT*1000), (TIS_LONG_TIMEOUT*1000), - (TIS_SHORT_TIMEOUT*1000), (TIS_SHORT_TIMEOUT*1000) } }, -}; - -static bool tpm_tis_update_timeouts(struct tpm_chip *chip, - unsigned long *timeout_cap) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int i, rc; - u32 did_vid; - - rc = tpm_tis_read32(priv, TPM_DID_VID(0), &did_vid); - if (rc < 0) - return rc; - - for (i = 0; i != ARRAY_SIZE(vendor_timeout_overrides); i++) { - if (vendor_timeout_overrides[i].did_vid != did_vid) - continue; - memcpy(timeout_cap, vendor_timeout_overrides[i].timeout_us, - sizeof(vendor_timeout_overrides[i].timeout_us)); - return true; - } - - return false; -} - -/* - * Early probing for iTPM with STS_DATA_EXPECT flaw. - * Try sending command without itpm flag set and if that - * fails, repeat with itpm flag set. - */ -static int probe_itpm(struct tpm_chip *chip) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - int rc = 0; - u8 cmd_getticks[] = { - 0x00, 0xc1, 0x00, 0x00, 0x00, 0x0a, - 0x00, 0x00, 0x00, 0xf1 - }; - size_t len = sizeof(cmd_getticks); - u16 vendor; - - rc = tpm_tis_read16(priv, TPM_DID_VID(0), &vendor); - if (rc < 0) - return rc; - - /* probe only iTPMS */ - if (vendor != TPM_VID_INTEL) - return 0; - - rc = tpm_tis_send_data(chip, cmd_getticks, len); - if (rc == 0) - goto out; - - tpm_tis_ready(chip); - release_locality(chip, priv->locality, 0); - - rc = tpm_tis_send_data(chip, cmd_getticks, len); - if (rc == 0) { - dev_info(&chip->dev, "Detected an iTPM.\n"); - rc = 1; - } else - rc = -EFAULT; - -out: - tpm_tis_ready(chip); - release_locality(chip, priv->locality, 0); - - return rc; -} - -static bool tpm_tis_req_canceled(struct tpm_chip *chip, u8 status) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - - switch (priv->manufacturer_id) { - case TPM_VID_WINBOND: - return ((status == TPM_STS_VALID) || - (status == (TPM_STS_VALID | TPM_STS_COMMAND_READY))); - case TPM_VID_STM: - return (status == (TPM_STS_VALID | TPM_STS_COMMAND_READY)); - default: - return (status == TPM_STS_COMMAND_READY); - } -} - -static irqreturn_t tis_int_handler(int dummy, void *dev_id) -{ - struct tpm_chip *chip = dev_id; - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - u32 interrupt; - int i, rc; - - rc = tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &interrupt); - if (rc < 0) - return IRQ_NONE; - - if (interrupt == 0) - return IRQ_NONE; - - priv->irq_tested = true; - if (interrupt & TPM_INTF_DATA_AVAIL_INT) - wake_up_interruptible(&priv->read_queue); - if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT) - for (i = 0; i < 5; i++) - if (check_locality(chip, i) >= 0) - break; - if (interrupt & - (TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT | - TPM_INTF_CMD_READY_INT)) - wake_up_interruptible(&priv->int_queue); - - /* Clear interrupts handled with TPM_EOI */ - rc = tpm_tis_write32(priv, TPM_INT_STATUS(priv->locality), interrupt); - if (rc < 0) - return IRQ_NONE; - - tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &interrupt); - return IRQ_HANDLED; -} - -static int tpm_tis_gen_interrupt(struct tpm_chip *chip) -{ - const char *desc = "attempting to generate an interrupt"; - u32 cap2; - cap_t cap; - - if (chip->flags & TPM_CHIP_FLAG_TPM2) - return tpm2_get_tpm_pt(chip, 0x100, &cap2, desc); - else - return tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc); -} - -/* Register the IRQ and issue a command that will cause an interrupt. If an - * irq is seen then leave the chip setup for IRQ operation, otherwise reverse - * everything and leave in polling mode. Returns 0 on success. - */ -static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, - int flags, int irq) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - u8 original_int_vec; - int rc; - u32 int_status; - - if (devm_request_irq(chip->dev.parent, irq, tis_int_handler, flags, - dev_name(&chip->dev), chip) != 0) { - dev_info(&chip->dev, "Unable to request irq: %d for probe\n", - irq); - return -1; - } - priv->irq = irq; - - rc = tpm_tis_read8(priv, TPM_INT_VECTOR(priv->locality), - &original_int_vec); - if (rc < 0) - return rc; - - rc = tpm_tis_write8(priv, TPM_INT_VECTOR(priv->locality), irq); - if (rc < 0) - return rc; - - rc = tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &int_status); - if (rc < 0) - return rc; - - /* Clear all existing */ - rc = tpm_tis_write32(priv, TPM_INT_STATUS(priv->locality), int_status); - if (rc < 0) - return rc; - - /* Turn on */ - rc = tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), - intmask | TPM_GLOBAL_INT_ENABLE); - if (rc < 0) - return rc; - - priv->irq_tested = false; - - /* Generate an interrupt by having the core call through to - * tpm_tis_send - */ - rc = tpm_tis_gen_interrupt(chip); - if (rc < 0) - return rc; - - /* tpm_tis_send will either confirm the interrupt is working or it - * will call disable_irq which undoes all of the above. - */ - if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) { - rc = tpm_tis_write8(priv, original_int_vec, - TPM_INT_VECTOR(priv->locality)); - if (rc < 0) - return rc; - - return 1; - } - - return 0; -} - -/* Try to find the IRQ the TPM is using. This is for legacy x86 systems that - * do not have ACPI/etc. We typically expect the interrupt to be declared if - * present. - */ -static void tpm_tis_probe_irq(struct tpm_chip *chip, u32 intmask) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - u8 original_int_vec; - int i, rc; - - rc = tpm_tis_read8(priv, TPM_INT_VECTOR(priv->locality), - &original_int_vec); - if (rc < 0) - return; - - if (!original_int_vec) { - if (IS_ENABLED(CONFIG_X86)) - for (i = 3; i <= 15; i++) - if (!tpm_tis_probe_irq_single(chip, intmask, 0, - i)) - return; - } else if (!tpm_tis_probe_irq_single(chip, intmask, 0, - original_int_vec)) - return; -} - -void tpm_tis_remove(struct tpm_chip *chip) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - u32 reg = TPM_INT_ENABLE(priv->locality); - u32 interrupt; - int rc; - - rc = tpm_tis_read32(priv, reg, &interrupt); - if (rc < 0) - interrupt = 0; - - tpm_tis_write32(priv, reg, ~TPM_GLOBAL_INT_ENABLE & interrupt); - release_locality(chip, priv->locality, 1); -} -EXPORT_SYMBOL_GPL(tpm_tis_remove); - -static const struct tpm_class_ops tpm_tis = { - .flags = TPM_OPS_AUTO_STARTUP, - .status = tpm_tis_status, - .recv = tpm_tis_recv, - .send = tpm_tis_send, - .cancel = tpm_tis_ready, - .update_timeouts = tpm_tis_update_timeouts, - .req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID, - .req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID, - .req_canceled = tpm_tis_req_canceled, -}; - -int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, - const struct tpm_tis_phy_ops *phy_ops, - acpi_handle acpi_dev_handle) -{ - u32 vendor, intfcaps, intmask; - u8 rid; - int rc, probe; - struct tpm_chip *chip; - - chip = tpmm_chip_alloc(dev, &tpm_tis); - if (IS_ERR(chip)) - return PTR_ERR(chip); - -#ifdef CONFIG_ACPI - chip->acpi_dev_handle = acpi_dev_handle; -#endif - - /* Maximum timeouts */ - chip->timeout_a = msecs_to_jiffies(TIS_TIMEOUT_A_MAX); - chip->timeout_b = msecs_to_jiffies(TIS_TIMEOUT_B_MAX); - chip->timeout_c = msecs_to_jiffies(TIS_TIMEOUT_C_MAX); - chip->timeout_d = msecs_to_jiffies(TIS_TIMEOUT_D_MAX); - priv->phy_ops = phy_ops; - dev_set_drvdata(&chip->dev, priv); - - if (wait_startup(chip, 0) != 0) { - rc = -ENODEV; - goto out_err; - } - - /* Take control of the TPM's interrupt hardware and shut it off */ - rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); - if (rc < 0) - goto out_err; - - intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | - TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; - intmask &= ~TPM_GLOBAL_INT_ENABLE; - tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); - - if (request_locality(chip, 0) != 0) { - rc = -ENODEV; - goto out_err; - } - - rc = tpm2_probe(chip); - if (rc) - goto out_err; - - rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor); - if (rc < 0) - goto out_err; - - priv->manufacturer_id = vendor; - - rc = tpm_tis_read8(priv, TPM_RID(0), &rid); - if (rc < 0) - goto out_err; - - dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n", - (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2", - vendor >> 16, rid); - - if (!(priv->flags & TPM_TIS_ITPM_POSSIBLE)) { - probe = probe_itpm(chip); - if (probe < 0) { - rc = -ENODEV; - goto out_err; - } - - if (!!probe) - priv->flags |= TPM_TIS_ITPM_POSSIBLE; - } - - /* Figure out the capabilities */ - rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps); - if (rc < 0) - goto out_err; - - dev_dbg(dev, "TPM interface capabilities (0x%x):\n", - intfcaps); - if (intfcaps & TPM_INTF_BURST_COUNT_STATIC) - dev_dbg(dev, "\tBurst Count Static\n"); - if (intfcaps & TPM_INTF_CMD_READY_INT) - dev_dbg(dev, "\tCommand Ready Int Support\n"); - if (intfcaps & TPM_INTF_INT_EDGE_FALLING) - dev_dbg(dev, "\tInterrupt Edge Falling\n"); - if (intfcaps & TPM_INTF_INT_EDGE_RISING) - dev_dbg(dev, "\tInterrupt Edge Rising\n"); - if (intfcaps & TPM_INTF_INT_LEVEL_LOW) - dev_dbg(dev, "\tInterrupt Level Low\n"); - if (intfcaps & TPM_INTF_INT_LEVEL_HIGH) - dev_dbg(dev, "\tInterrupt Level High\n"); - if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT) - dev_dbg(dev, "\tLocality Change Int Support\n"); - if (intfcaps & TPM_INTF_STS_VALID_INT) - dev_dbg(dev, "\tSts Valid Int Support\n"); - if (intfcaps & TPM_INTF_DATA_AVAIL_INT) - dev_dbg(dev, "\tData Avail Int Support\n"); - - /* Very early on issue a command to the TPM in polling mode to make - * sure it works. May as well use that command to set the proper - * timeouts for the driver. - */ - if (tpm_get_timeouts(chip)) { - dev_err(dev, "Could not get TPM timeouts and durations\n"); - rc = -ENODEV; - goto out_err; - } - - /* INTERRUPT Setup */ - init_waitqueue_head(&priv->read_queue); - init_waitqueue_head(&priv->int_queue); - if (irq != -1) { - if (irq) { - tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, - irq); - if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) - dev_err(&chip->dev, FW_BUG - "TPM interrupt not working, polling instead\n"); - } else { - tpm_tis_probe_irq(chip, intmask); - } - } - - return tpm_chip_register(chip); -out_err: - tpm_tis_remove(chip); - return rc; -} -EXPORT_SYMBOL_GPL(tpm_tis_core_init); - -#ifdef CONFIG_PM_SLEEP -static void tpm_tis_reenable_interrupts(struct tpm_chip *chip) -{ - struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); - u32 intmask; - int rc; - - /* reenable interrupts that device may have lost or - * BIOS/firmware may have disabled - */ - rc = tpm_tis_write8(priv, TPM_INT_VECTOR(priv->locality), priv->irq); - if (rc < 0) - return; - - rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); - if (rc < 0) - return; - - intmask |= TPM_INTF_CMD_READY_INT - | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT - | TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE; - - tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); -} - -int tpm_tis_resume(struct device *dev) -{ - struct tpm_chip *chip = dev_get_drvdata(dev); - int ret; - - if (chip->flags & TPM_CHIP_FLAG_IRQ) - tpm_tis_reenable_interrupts(chip); - - ret = tpm_pm_resume(dev); - if (ret) - return ret; - - /* TPM 1.2 requires self-test on resume. This function actually returns - * an error code but for unknown reason it isn't handled. - */ - if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) - tpm_do_selftest(chip); - - return 0; -} -EXPORT_SYMBOL_GPL(tpm_tis_resume); -#endif - -MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)"); -MODULE_DESCRIPTION("TPM Driver"); -MODULE_VERSION("2.0"); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_core.h b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_core.h deleted file mode 100644 index e1c2193f2e..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_core.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2005, 2006 IBM Corporation - * Copyright (C) 2014, 2015 Intel Corporation - * - * Authors: - * Leendert van Doorn - * Kylene Hall - * - * Maintained by: - * - * Device driver for TCG/TCPA TPM (trusted platform module). - * Specifications at www.trustedcomputinggroup.org - * - * This device driver implements the TPM interface as defined in - * the TCG TPM Interface Spec version 1.2, revision 1.0. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, version 2 of the - * License. - */ - -#ifndef __TPM_TIS_CORE_H__ -#define __TPM_TIS_CORE_H__ - -#include "tpm.h" - -enum tis_access { - TPM_ACCESS_VALID = 0x80, - TPM_ACCESS_ACTIVE_LOCALITY = 0x20, - TPM_ACCESS_REQUEST_PENDING = 0x04, - TPM_ACCESS_REQUEST_USE = 0x02, -}; - -enum tis_status { - TPM_STS_VALID = 0x80, - TPM_STS_COMMAND_READY = 0x40, - TPM_STS_GO = 0x20, - TPM_STS_DATA_AVAIL = 0x10, - TPM_STS_DATA_EXPECT = 0x08, -}; - -enum tis_int_flags { - TPM_GLOBAL_INT_ENABLE = 0x80000000, - TPM_INTF_BURST_COUNT_STATIC = 0x100, - TPM_INTF_CMD_READY_INT = 0x080, - TPM_INTF_INT_EDGE_FALLING = 0x040, - TPM_INTF_INT_EDGE_RISING = 0x020, - TPM_INTF_INT_LEVEL_LOW = 0x010, - TPM_INTF_INT_LEVEL_HIGH = 0x008, - TPM_INTF_LOCALITY_CHANGE_INT = 0x004, - TPM_INTF_STS_VALID_INT = 0x002, - TPM_INTF_DATA_AVAIL_INT = 0x001, -}; - -enum tis_defaults { - TIS_MEM_LEN = 0x5000, - TIS_SHORT_TIMEOUT = 750, /* ms */ - TIS_LONG_TIMEOUT = 2000, /* 2 sec */ -}; - -/* Some timeout values are needed before it is known whether the chip is - * TPM 1.0 or TPM 2.0. - */ -#define TIS_TIMEOUT_A_MAX max(TIS_SHORT_TIMEOUT, TPM2_TIMEOUT_A) -#define TIS_TIMEOUT_B_MAX max(TIS_LONG_TIMEOUT, TPM2_TIMEOUT_B) -#define TIS_TIMEOUT_C_MAX max(TIS_SHORT_TIMEOUT, TPM2_TIMEOUT_C) -#define TIS_TIMEOUT_D_MAX max(TIS_SHORT_TIMEOUT, TPM2_TIMEOUT_D) - -#define TPM_ACCESS(l) (0x0000 | ((l) << 12)) -#define TPM_INT_ENABLE(l) (0x0008 | ((l) << 12)) -#define TPM_INT_VECTOR(l) (0x000C | ((l) << 12)) -#define TPM_INT_STATUS(l) (0x0010 | ((l) << 12)) -#define TPM_INTF_CAPS(l) (0x0014 | ((l) << 12)) -#define TPM_STS(l) (0x0018 | ((l) << 12)) -#define TPM_STS3(l) (0x001b | ((l) << 12)) -#define TPM_DATA_FIFO(l) (0x0024 | ((l) << 12)) - -#define TPM_DID_VID(l) (0x0F00 | ((l) << 12)) -#define TPM_RID(l) (0x0F04 | ((l) << 12)) - -enum tpm_tis_flags { - TPM_TIS_ITPM_POSSIBLE = BIT(0), -}; - -struct tpm_tis_data { - u16 manufacturer_id; - int locality; - int irq; - bool irq_tested; - unsigned int flags; - wait_queue_head_t int_queue; - wait_queue_head_t read_queue; - const struct tpm_tis_phy_ops *phy_ops; -}; - -struct tpm_tis_phy_ops { - int (*read_bytes)(struct tpm_tis_data *data, u32 addr, u16 len, - u8 *result); - int (*write_bytes)(struct tpm_tis_data *data, u32 addr, u16 len, - const u8 *value); - int (*read16)(struct tpm_tis_data *data, u32 addr, u16 *result); - int (*read32)(struct tpm_tis_data *data, u32 addr, u32 *result); - int (*write32)(struct tpm_tis_data *data, u32 addr, u32 src); -}; - -static inline int tpm_tis_read_bytes(struct tpm_tis_data *data, u32 addr, - u16 len, u8 *result) -{ - return data->phy_ops->read_bytes(data, addr, len, result); -} - -static inline int tpm_tis_read8(struct tpm_tis_data *data, u32 addr, u8 *result) -{ - return data->phy_ops->read_bytes(data, addr, 1, result); -} - -static inline int tpm_tis_read16(struct tpm_tis_data *data, u32 addr, - u16 *result) -{ - return data->phy_ops->read16(data, addr, result); -} - -static inline int tpm_tis_read32(struct tpm_tis_data *data, u32 addr, - u32 *result) -{ - return data->phy_ops->read32(data, addr, result); -} - -static inline int tpm_tis_write_bytes(struct tpm_tis_data *data, u32 addr, - u16 len, const u8 *value) -{ - return data->phy_ops->write_bytes(data, addr, len, value); -} - -static inline int tpm_tis_write8(struct tpm_tis_data *data, u32 addr, u8 value) -{ - return data->phy_ops->write_bytes(data, addr, 1, &value); -} - -static inline int tpm_tis_write32(struct tpm_tis_data *data, u32 addr, - u32 value) -{ - return data->phy_ops->write32(data, addr, value); -} - -void tpm_tis_remove(struct tpm_chip *chip); -int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, - const struct tpm_tis_phy_ops *phy_ops, - acpi_handle acpi_dev_handle); - -#ifdef CONFIG_PM_SLEEP -int tpm_tis_resume(struct device *dev); -#endif - -#endif diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_spi.c b/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_spi.c deleted file mode 100644 index b990acdecb..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/modules/tpm_tis_spi.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2015 Infineon Technologies AG - * Copyright (C) 2016 STMicroelectronics SAS - * - * Authors: - * Peter Huewe - * Christophe Ricard - * - * Maintained by: - * - * Device driver for TCG/TCPA TPM (trusted platform module). - * Specifications at www.trustedcomputinggroup.org - * - * This device driver implements the TPM interface as defined in - * the TCG TPM Interface Spec version 1.3, revision 27 via _raw/native - * SPI access_. - * - * It is based on the original tpm_tis device driver from Leendert van - * Dorn and Kyleen Hall and Jarko Sakkinnen. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, version 2 of the - * License. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include "tpm.h" -#include "tpm_tis_core.h" - -#define MAX_SPI_FRAMESIZE 64 -#define mem_clear(data, size) memset((data), 0, (size)) - -struct tpm_tis_spi_phy { - struct tpm_tis_data priv; - struct spi_device *spi_device; - u8 *iobuf; -}; - -static inline struct tpm_tis_spi_phy *to_tpm_tis_spi_phy(struct tpm_tis_data *data) -{ - return container_of(data, struct tpm_tis_spi_phy, priv); -} - -static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, - u8 *in, const u8 *out) -{ - struct tpm_tis_spi_phy *phy = to_tpm_tis_spi_phy(data); - int ret = 0; - int i; - struct spi_message m; - struct spi_transfer spi_xfer; - u8 transfer_len; - - spi_bus_lock(phy->spi_device->master); - - while (len) { - transfer_len = min_t(u16, len, MAX_SPI_FRAMESIZE); - - phy->iobuf[0] = (in ? 0x80 : 0) | (transfer_len - 1); - phy->iobuf[1] = 0xd4; - phy->iobuf[2] = addr >> 8; - phy->iobuf[3] = addr; - - mem_clear(&spi_xfer, sizeof(spi_xfer)); - spi_xfer.tx_buf = phy->iobuf; - spi_xfer.rx_buf = phy->iobuf; - spi_xfer.len = 4; - spi_xfer.cs_change = 1; - - spi_message_init(&m); - spi_message_add_tail(&spi_xfer, &m); - ret = spi_sync_locked(phy->spi_device, &m); - if (ret < 0) - goto exit; - - if ((phy->iobuf[3] & 0x01) == 0) { - // handle SPI wait states - phy->iobuf[0] = 0; - - for (i = 0; i < TPM_RETRY; i++) { - spi_xfer.len = 1; - spi_message_init(&m); - spi_message_add_tail(&spi_xfer, &m); - ret = spi_sync_locked(phy->spi_device, &m); - if (ret < 0) - goto exit; - if (phy->iobuf[0] & 0x01) - break; - } - - if (i == TPM_RETRY) { - ret = -ETIMEDOUT; - goto exit; - } - } - - spi_xfer.cs_change = 0; - spi_xfer.len = transfer_len; - spi_xfer.delay_usecs = 5; - - if (in) { - spi_xfer.tx_buf = NULL; - } else if (out) { - spi_xfer.rx_buf = NULL; - memcpy(phy->iobuf, out, transfer_len); - out += transfer_len; - } - - spi_message_init(&m); - spi_message_add_tail(&spi_xfer, &m); - ret = spi_sync_locked(phy->spi_device, &m); - if (ret < 0) - goto exit; - - if (in) { - memcpy(in, phy->iobuf, transfer_len); - in += transfer_len; - } - - len -= transfer_len; - } - -exit: - spi_bus_unlock(phy->spi_device->master); - return ret; -} - -static int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr, - u16 len, u8 *result) -{ - return tpm_tis_spi_transfer(data, addr, len, result, NULL); -} - -static int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr, - u16 len, const u8 *value) -{ - return tpm_tis_spi_transfer(data, addr, len, NULL, value); -} - -static int tpm_tis_spi_read16(struct tpm_tis_data *data, u32 addr, u16 *result) -{ - int rc; - - rc = data->phy_ops->read_bytes(data, addr, sizeof(u16), (u8 *)result); - if (!rc) - *result = le16_to_cpu(*result); - return rc; -} - -static int tpm_tis_spi_read32(struct tpm_tis_data *data, u32 addr, u32 *result) -{ - int rc; - - rc = data->phy_ops->read_bytes(data, addr, sizeof(u32), (u8 *)result); - if (!rc) - *result = le32_to_cpu(*result); - return rc; -} - -static int tpm_tis_spi_write32(struct tpm_tis_data *data, u32 addr, u32 value) -{ - value = cpu_to_le32(value); - return data->phy_ops->write_bytes(data, addr, sizeof(u32), - (u8 *)&value); -} - -static const struct tpm_tis_phy_ops tpm_spi_phy_ops = { - .read_bytes = tpm_tis_spi_read_bytes, - .write_bytes = tpm_tis_spi_write_bytes, - .read16 = tpm_tis_spi_read16, - .read32 = tpm_tis_spi_read32, - .write32 = tpm_tis_spi_write32, -}; - -static int tpm_tis_spi_probe(struct spi_device *dev) -{ - struct tpm_tis_spi_phy *phy; - int irq; - - phy = devm_kzalloc(&dev->dev, sizeof(struct tpm_tis_spi_phy), - GFP_KERNEL); - if (!phy) - return -ENOMEM; - - phy->spi_device = dev; - - phy->iobuf = devm_kmalloc(&dev->dev, MAX_SPI_FRAMESIZE, GFP_KERNEL); - if (!phy->iobuf) - return -ENOMEM; - - /* If the SPI device has an IRQ then use that */ - if (dev->irq > 0) - irq = dev->irq; - else - irq = -1; - - return tpm_tis_core_init(&dev->dev, &phy->priv, irq, &tpm_spi_phy_ops, - NULL); -} - -static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume); - -static int tpm_tis_spi_remove(struct spi_device *dev) -{ - struct tpm_chip *chip = spi_get_drvdata(dev); - - tpm_chip_unregister(chip); - tpm_tis_remove(chip); - return 0; -} - -static const struct spi_device_id tpm_tis_spi_id[] = { - {"tpm_tis_spi", 0}, - {} -}; -MODULE_DEVICE_TABLE(spi, tpm_tis_spi_id); - -static const struct of_device_id of_tis_spi_match[] = { - { .compatible = "st,st33htpm-spi", }, - { .compatible = "infineon,slb9670", }, - { .compatible = "tcg,tpm_tis-spi", }, - {} -}; -MODULE_DEVICE_TABLE(of, of_tis_spi_match); - -static const struct acpi_device_id acpi_tis_spi_match[] = { - {"SMO0768", 0}, - {} -}; -MODULE_DEVICE_TABLE(acpi, acpi_tis_spi_match); - -static struct spi_driver tpm_tis_spi_driver = { - .driver = { - .owner = THIS_MODULE, - .name = "tpm_tis_spi", - .pm = &tpm_tis_pm, - .of_match_table = of_match_ptr(of_tis_spi_match), - .acpi_match_table = ACPI_PTR(acpi_tis_spi_match), - }, - .probe = tpm_tis_spi_probe, - .remove = tpm_tis_spi_remove, - .id_table = tpm_tis_spi_id, -}; -module_spi_driver(tpm_tis_spi_driver); - -MODULE_DESCRIPTION("TPM Driver for native SPI access"); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/device_i2c.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/script/device_i2c.py deleted file mode 100644 index 6a1ede0f2c..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/device_i2c.py +++ /dev/null @@ -1,285 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: UTF-8 -*- -import click -import os -import time -from ragileconfig import GLOBALCONFIG, GLOBALINITPARAM, GLOBALINITCOMMAND, MAC_LED_RESET, STARTMODULE, i2ccheck_params -from ragileutil import rgpciwr, os_system - -CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) - -class AliasedGroup(click.Group): - def get_command(self, ctx, cmd_name): - rv = click.Group.get_command(self, ctx, cmd_name) - if rv is not None: - return rv - else: - return None - matches = [x for x in self.list_commands(ctx) - if x.startswith(cmd_name)] - if not matches: - return None - elif len(matches) == 1: - return click.Group.get_command(self, ctx, matches[0]) - ctx.fail('Too many matches: %s' % ', '.join(sorted(matches))) - -def log_os_system(cmd): - u'''execute shell command''' - status, output = os_system(cmd) - if status: - print(output) - return status, output - -def write_sysfs_value(reg_name, value): - u'''write sysfs file''' - mb_reg_file = "/sys/bus/i2c/devices/" + reg_name - if (not os.path.isfile(mb_reg_file)): - print(mb_reg_file, 'not found !') - return False - try: - with open(mb_reg_file, 'w') as fd: - fd.write(value) - except Exception as error: - return False - return True - -def check_driver(): - u'''whether there is driver start with rg''' - status, output = log_os_system("lsmod | grep rg | wc -l") - #System execution error - if status: - return False - if output.isdigit() and int(output) > 0: - return True - else: - return False - -def get_pid(name): - ret = [] - for dirname in os.listdir('/proc'): - if dirname == 'curproc': - continue - try: - with open('/proc/{}/cmdline'.format(dirname), mode='r') as fd: - content = fd.read() - except Exception: - continue - if name in content: - ret.append(dirname) - return ret - -def start_avs_ctrl(): - if STARTMODULE.get("avscontrol", 0) == 1: - cmd = "nohup avscontrol.py start >/dev/null 2>&1 &" - rets = get_pid("avscontrol.py") - if len(rets) == 0: - os.system(cmd) - -def stop_avs_ctrl(): - if STARTMODULE.get('avscontrol', 0) == 1: - rets = get_pid("avscontrol.py") # - for ret in rets: - cmd = "kill "+ ret - os.system(cmd) - -def start_fan_ctrl(): - if STARTMODULE.get('fancontrol', 0) == 1: - cmd = "nohup fancontrol.py start >/dev/null 2>&1 &" - rets = get_pid("fancontrol.py") - if len(rets) == 0: - os.system(cmd) - -def stop_fan_ctrl(): - u'''disable fan timer service''' - if STARTMODULE.get('fancontrol', 0) == 1: - rets = get_pid("fancontrol.py") # - for ret in rets: - cmd = "kill "+ ret - os.system(cmd) - -def rm_dev(bus, loc): - cmd = "echo 0x%02x > /sys/bus/i2c/devices/i2c-%d/delete_device" % (loc, bus) - devpath = "/sys/bus/i2c/devices/%d-%04x"%(bus, loc) - if os.path.exists(devpath): - log_os_system(cmd) - -def add_dev(name, bus, loc): - if name == "lm75": - time.sleep(0.1) - pdevpath = "/sys/bus/i2c/devices/i2c-%d/" % (bus) - for i in range(1, 100):#wait for mother-bus generation, maximum wait time is 10s - if os.path.exists(pdevpath) == True: - break - time.sleep(0.1) - if i % 10 == 0: - click.echo("%%DEVICE_I2C-INIT: %s not found, wait 0.1 second ! i %d " % (pdevpath,i)) - - cmd = "echo %s 0x%02x > /sys/bus/i2c/devices/i2c-%d/new_device" % (name, loc, bus) - devpath = "/sys/bus/i2c/devices/%d-%04x"%(bus, loc) - if os.path.exists(devpath) == False: - os.system(cmd) - -def removedevs(): - devs = GLOBALCONFIG["DEVS"] - for index in range(len(devs)-1, -1, -1 ): - rm_dev(devs[index]["bus"] , devs[index]["loc"]) - -def adddevs(): - devs = GLOBALCONFIG["DEVS"] - for dev in range(0, devs.__len__()): - add_dev(devs[dev]["name"], devs[dev]["bus"] , devs[dev]["loc"]) - -def checksignaldriver(name): - modisexistcmd = "lsmod | grep %s | wc -l" % name - status, output = log_os_system(modisexistcmd) - #System execution error - if status: - return False - if output.isdigit() and int(output) > 0: - return True - else: - return False - -def adddriver(name, delay): - cmd = "modprobe %s" % name - if delay != 0: - time.sleep(delay) - if checksignaldriver(name) != True: - log_os_system(cmd) - -def removedriver(name, delay): - realname = name.lstrip().split(" ")[0]; - cmd = "rmmod -f %s" % realname - if checksignaldriver(realname): - log_os_system(cmd) - -def removedrivers(): - u'''remove all drivers''' - if GLOBALCONFIG is None: - click.echo("%%DEVICE_I2C-INIT: load global config failed.") - return - drivers = GLOBALCONFIG.get("DRIVERLISTS", None) - if drivers is None: - click.echo("%%DEVICE_I2C-INIT: load driver list failed.") - return - for index in range(len(drivers)-1, -1, -1 ): - delay = 0 - name = "" - if type(drivers[index]) == dict and "delay" in drivers[index]: - name = drivers[index].get("name") - delay = drivers[index]["delay"] - else: - name = drivers[index] - removedriver(name, delay) - -def adddrivers(): - u'''add drivers''' - if GLOBALCONFIG is None: - click.echo("%%DEVICE_I2C-INIT: load global config failed.") - return - drivers = GLOBALCONFIG.get("DRIVERLISTS", None) - if drivers is None: - click.echo("%%DEVICE_I2C-INIT: load driver list failed.") - return - for index in range(0 ,len(drivers)): - delay = 0 - name = "" - if type(drivers[index]) == dict and "delay" in drivers[index]: - name = drivers[index].get("name") - delay = drivers[index]["delay"] - else: - name = drivers[index] - adddriver(name, delay) - -def otherinit(): - for index in GLOBALINITPARAM: - delay = index.get('delay',0) - if delay !=0 : - time.sleep(1) - write_sysfs_value(index["loc"], index["value"]) - - for index in GLOBALINITCOMMAND: - log_os_system(index) - -def unload_driver(): - u'''remove devices and drivers''' - stop_avs_ctrl() # disable avs-control - stop_fan_ctrl() # disable fan-control service - removedevs() # remove other devices - removedrivers() # remove drivers - -def reload_driver(): - u'''reload devices and drivers''' - removedevs() # remove other devices - removedrivers() # remove drivers - time.sleep(1) - adddrivers() - adddevs() - - -def i2c_check(bus,retrytime = 6): - try: - i2cpath = "/sys/bus/i2c/devices/" + bus - while retrytime and not os.path.exists(i2cpath): - click.echo("%%DEVICE_I2C-HA: i2c bus abnormal, last bus %s is not exist." % i2cpath) - reload_driver() - retrytime -= 1 - time.sleep(1) - except Exception as e: - click.echo("%%DEVICE_I2C-HA: %s" % str(e)) - return - -def set_mac_leds(data): - '''write pci register''' - pcibus = MAC_LED_RESET.get("pcibus") - slot = MAC_LED_RESET.get("slot") - fn = MAC_LED_RESET.get("fn") - bar = MAC_LED_RESET.get("bar") - offset = MAC_LED_RESET.get("offset") - val = MAC_LED_RESET.get(data, None) - if val is None: - click.echo("%%DEVICE_I2C-INIT: set_mac_leds wrong input") - return - rgpciwr(pcibus, slot, fn, bar, offset, val) - -def load_driver(): - u'''load devices and drivers''' - adddrivers() - adddevs() - if STARTMODULE.get("i2ccheck",0) == 1: #i2c HA - busend = i2ccheck_params.get("busend") - retrytime = i2ccheck_params.get("retrytime") - i2c_check(busend,retrytime) - start_fan_ctrl() # enable fan - start_avs_ctrl() # avs voltage-adjustment - otherinit(); # other initialization, QSFP initialization - if STARTMODULE.get("macledreset", 0) == 1: - set_mac_leds("reset") - -@click.group(cls=AliasedGroup, context_settings=CONTEXT_SETTINGS) -def main(): - '''device operator''' - pass - - -@main.command() -def start(): - '''load device ''' - if check_driver(): - unload_driver() - load_driver() - -@main.command() -def stop(): - '''stop device ''' - unload_driver() - -@main.command() -def restart(): - '''restart device''' - unload_driver() - load_driver() - -if __name__ == '__main__': - u'''device_i2c operation''' - main() diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/fancontrol.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/script/fancontrol.py deleted file mode 100755 index 3bddb3725d..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/fancontrol.py +++ /dev/null @@ -1,497 +0,0 @@ -#!/usr/bin/env python3.9 -# -*- coding: UTF-8 -*- -import click -import os -import time -import json -import traceback -from interface import Interface -import logging.handlers -from ragileutil import CompressedRotatingFileHandler - -CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) - -FILE_NAME = "/var/log/fancontrol.log" -MAX_LOG_BYTES = 20*1024*1024 -BACKUP_COUNT = 9 - -logger = logging.getLogger("fancontrol") -logger.setLevel(logging.DEBUG) -fanctrl_log = CompressedRotatingFileHandler(FILE_NAME, mode='a', maxBytes=MAX_LOG_BYTES, backupCount=BACKUP_COUNT, encoding=None, delay=0) -formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s") -fanctrl_log.setFormatter(formatter) -logger.addHandler(fanctrl_log) - -DEBUG_FILE = "/etc/fancontrol_debug" -FAN_CTRL_CFG_FILE = "/usr/local/bin/fan_ctrl_cfg.json" -KEY_THERMAL = "Thermal" -KEY_FAN = "Fans" -KEY_PID = "PID" -KEY_OPEN_LOOP = "OpenLoop" -KEY_DEVICE = "Device" -KEY_FAN_ERROR = "FanError" - -KEY_FANERROR_PWM_MAX = "Fan_Pwmmax" - -KEY_INLET_TEMP = "INLET_TEMP" -KEY_OUTLET_TEMP = "OUTLET_TEMP" -KEY_SWITCH_TEMP = "SWITCH_TEMP" -KEY_TEMP = [KEY_INLET_TEMP, KEY_OUTLET_TEMP, KEY_SWITCH_TEMP] - -KEY_PID_PWM_MAX = "Pwm_Max" -KEY_PID_PWM_MIN = "Pwm_Min" -KEY_PID_SETPOINT = "SetPoint" -KEY_PID_P = "P" -KEY_PID_I = "I" -KEY_PID_D = "D" -KEY_PID_TEMP_MIN = "Temp_Min" -KEY_PID_TEMP_MAX = "Temp_Max" - -KEY_OPENLOOP_A = "a" -KEY_OPENLOOP_B = "b" -KEY_OPENLOOP_C = "c" -KEY_OPENLOOP_FIXUP = "fix_up" -KEY_OPENLOOP_PWM_MAX = "pwmMax" -KEY_OPENLOOP_PWM_MIN = "pwmMin" -KEY_OPENLOOP_TEMP_MIN = "tempMin" - -STATUS_HIGH_CRIT = 1 -STATUS_MISS_CRIT = 2 -STATUS_BAD_FAN = 4 -STATUS_LOW_FAN = 8 -STATUS_MISS_ERR = 16 - -class AliasedGroup(click.Group): - def get_command(self, ctx, cmd_name): - rv = click.Group.get_command(self, ctx, cmd_name) - if rv is not None: - return rv - else: - return None - matches = [x for x in self.list_commands(ctx) - if x.startswith(cmd_name)] - if not matches: - return None - elif len(matches) == 1: - return click.Group.get_command(self, ctx, matches[0]) - ctx.fail('Too many matches: %s' % ', '.join(sorted(matches))) - -def fanctrl_debug_log(s): - # s = s.decode('utf-8').encode('gb2312') - if os.path.isfile(DEBUG_FILE): - logger.debug(s) - -class OpenLoop(): - def __init__(self): - self.a = 0 - self.b = 0 - self.c = 0 - self.fix_up = 0 - self.pwmMax = 0 - self.pwmMin = 0 - self.temp = 0 - self.tempMin = 0 - - def calcPwm(self): - if self.temp < self.tempMin: - return self.pwmMin - pwm = self.a * self.temp * self.temp + self.b * self.temp + self.c - pwm = (pwm / 2.56) - pwm = min(pwm, self.pwmMax) - pwm = max(pwm, self.pwmMin) - return pwm - - -class FanPid(): - def __init__(self): - self.pwmMin = 30 - self.pwmMax = 100 - self.SetPoint = 89 - self.D = 0.196 - self.I = 0.196 - self.P = 1.176 - self.tempMin = 28.0 - self.tempMax = 45.0 - self.pwms = [30, 30] - self.temps = [-1, -1, -1] - self.last_temp = -1 - self.sensor = KEY_SWITCH_TEMP - - def calcPwm(self): - temp_delta = self.temps[2] - self.last_temp - temp_sp_delta = self.temps[2] - self.SetPoint - temp_last_delta = ((self.temps[2] - self.temps[1]) - (self.temps[1] - self.temps[0])) - - delta_pwm = self.P * temp_delta + self.I * temp_sp_delta + self.D * temp_last_delta - - self.temps[0] = self.temps[1] - self.temps[1] = self.temps[2] - self.last_temp = self.temps[2] - - self.pwms[0] = self.pwms[1] - self.pwms[1] = self.pwms[0] + delta_pwm - self.pwms[1] = max(self.pwms[1], self.pwmMin) - self.pwms[1] = min(self.pwms[1], self.pwmMax) - - return self.pwms[1] - -class FanControl(): - - def __init__(self): - self.status = 0 - self.fan_status = 0 - self.error_time = 0 - self.low_time = 0 - self.fan_pwm = 40 - self.fanerr_pwmmax = 0 - self.interface = Interface() - self.temps = {} - self.tempsMax = {} - self.tempsMin = {} - self.tempStatus = {} - self.tempCritTime = {} - self.tempMissTime = {} - - self.fans = {} - self.fanStatus = {} - self.fanErrTime = {} - self.fanLowTime = {} - - self.fanPid = None - self.openloop = None - - self.isBuildin = 0 - self.isLiquid = 0 - self.eeproms = {} - self.airflow = "" - self.pid_switch = 1 - self.openloop_switch = 1 - - def doGetAirFlow(self): - if self.isLiquid == 1: - return "Liquid" - # PSU and Fan is buildin using Tlve2 - if self.isBuildin == 1: - productName = self.interface.get_productname() - if productName != "": - tmp = productName.split("-") - fanairflow = tmp[-1] - if fanairflow == "R": - return "exhaust" - else: - return "intake" - elif self.isBuildin == 0: - return self.interface.get_airflow() - - return "" - - def doFanCtrlInit(self): - if os.path.isfile(FAN_CTRL_CFG_FILE): - fh = open(FAN_CTRL_CFG_FILE) - if not fh: - logger.error("Config file %s doesn't exist" % FAN_CTRL_CFG_FILE) - return False - cfg_json = json.load(fh) - if not cfg_json: - logger.error('Load config file %s failed' % FAN_CTRL_CFG_FILE) - fh.close() - return False - - cfg_keys = [KEY_THERMAL, KEY_FAN, KEY_PID, KEY_OPEN_LOOP, KEY_DEVICE, KEY_FAN_ERROR] - for key in cfg_keys: - if key not in cfg_json: - logger.error('Key %s not present in cfg file' % key) - return False - thermal_json = cfg_json[KEY_THERMAL] - fan_json = cfg_json[KEY_FAN] - pid_json = cfg_json[KEY_PID] - openloop_json = cfg_json[KEY_OPEN_LOOP] - device_json = cfg_json[KEY_DEVICE] - fan_error_json = cfg_json[KEY_FAN_ERROR] - - #init fanerror - self.fanerr_pwmmax = fan_error_json["Fan_Pwmmax"] - - # Get Airflow - self.isBuildin = device_json["Buildin"] - self.isLiquid = device_json["Liquid"] - self.airflow = self.doGetAirFlow() - if self.airflow == "": - logger.warning("Cannot get airflow from device!") - self.pid_switch = device_json["PID"] - self.openloop_switch = device_json["OpenLoop"] - if self.pid_switch == 0 and self.openloop_switch == 0: - logger.warning("No PID and OpenLoop found!") - # Init openloop - self.openloop = OpenLoop() - self.openloop.a = openloop_json[KEY_OPENLOOP_A] - self.openloop.b = openloop_json[KEY_OPENLOOP_B] - self.openloop.c = openloop_json[KEY_OPENLOOP_C] - self.openloop.fix_up = openloop_json[KEY_OPENLOOP_FIXUP] - self.openloop.pwmMax = openloop_json[KEY_OPENLOOP_PWM_MAX] - self.openloop.pwmMin = openloop_json[KEY_OPENLOOP_PWM_MIN] - self.openloop.tempMin = openloop_json[KEY_OPENLOOP_TEMP_MIN] - # Init PID - self.fanPid = FanPid() - self.fanPid.pwmMax = pid_json[KEY_PID_PWM_MAX] - self.fanPid.pwmMin = pid_json[KEY_PID_PWM_MIN] - self.fanPid.SetPoint = pid_json[KEY_PID_SETPOINT] - self.fanPid.P = pid_json[KEY_PID_P] - self.fanPid.I = pid_json[KEY_PID_I] - self.fanPid.D = pid_json[KEY_PID_D] - self.fanPid.tempMin = pid_json[KEY_PID_TEMP_MIN] - self.fanPid.tempMax = pid_json[KEY_PID_TEMP_MAX] - # Init thermal setting - for key, item in list(thermal_json.items()): - fanctrl_debug_log("%s %s " % (key,item)) - if key not in KEY_TEMP: - logger.error('Key %s not present in cfg file' % key) - return False - self.temps[item] = -1.0 - self.tempsMax[item] = self.interface.get_thermal_temp_max(item) - self.tempsMin[item] = self.interface.get_thermal_temp_min(item) - self.tempStatus[item] = 0 - self.tempMissTime[item] = [0, 0] - self.tempCritTime[item] = [0, 0] - if key == self.fanPid.sensor: - self.fanPid.sensor = item - - # Init fans setting - for key, item in list(fan_json.items()): - self.fans[key] = item - self.fanStatus[key] = 0 - self.fanErrTime[key] = [0, 0] - self.fanLowTime[key] = [0, 0] - fh.close() - else: - logger.error('%s is not a file' % FAN_CTRL_CFG_FILE) - return False - - fanctrl_debug_log("Device AirFlow: %s" % (self.airflow)) - self.updateThermal() - self.fanPid.last_temp = self.temps[self.fanPid.sensor] - for i in range(3): - self.fanPid.temps[i] = self.temps[self.fanPid.sensor] - return True - - def setFanSpeed(self, speed): - return self.interface.set_fan_speed_pwm(speed) - - def updateThermal(self): - for key in self.temps: - self.temps[key] = self.interface.get_thermal_temp(key) - fanctrl_debug_log("%s temps %d C" % (key, self.temps[key])) - - if self.temps[KEY_INLET_TEMP] >= self.tempsMax[KEY_INLET_TEMP] or self.temps[KEY_INLET_TEMP] <= -99999: - self.temps[KEY_INLET_TEMP] = self.tempsMax[KEY_INLET_TEMP] - self.openloop.temp = self.temps[KEY_INLET_TEMP] - self.fanPid.temps[2] = self.temps[KEY_INLET_TEMP] - - def checkThermal(self): - thermal_cnt = 0 - for key in self.temps: - if self.temps[key] <= -9999: - if self.tempStatus[key] & STATUS_MISS_CRIT != 0: - self.tempMissTime[key][0] = time.time() - else: - self.tempMissTime[key][1] = time.time() - self.tempStatus[key] = self.tempStatus[key] | STATUS_MISS_CRIT - if self.tempMissTime[key][1] - self.tempMissTime[key][0] > 15: - logger.warning("%s Read Invaild Temperautre %d " % (key, self.temps[key])) - self.tempStatus[key] = self.tempStatus[key] | STATUS_MISS_ERR - else: - self.tempStatus[key] = self.tempStatus[key] & ~(STATUS_MISS_CRIT | STATUS_MISS_ERR) - - if self.temps[key] >= self.tempsMax[key]: - self.tempCritTime[key][0] = time.time() - self.tempStatus[key] = self.tempStatus[key] | STATUS_HIGH_CRIT - logger.warning("%s Temperautre %d >= High Threshold %d" % (key, self.temps[key], self.tempsMax[key])) - elif self.tempStatus[key] & (STATUS_HIGH_CRIT) != 0: - self.tempCritTime[key][1] = time.time() - logger.warning("%s Temperautre %d Recovery" % (key, self.temps[key])) - if self.tempCritTime[key][1] - self.tempCritTime[key][0] > 300: - self.tempStatus[key] = self.tempStatus[key] & ~(STATUS_HIGH_CRIT) - - if self.tempStatus[key] & ~(STATUS_MISS_CRIT) != 0: - thermal_cnt = thermal_cnt + 1 - - self.status = thermal_cnt - fanctrl_debug_log("Thermal error num %d" % self.status) - - def checkFanSpeed(self): - fan_error_cnt = 0 - for key, item in list(self.fans.items()): - speed = self.interface.get_fan_speed_rpm(item) - rpm_max = self.interface.get_fan_rpm_max() - if self.fan_pwm == 100 and speed < rpm_max * 0.7: - if self.fanStatus[key] & STATUS_BAD_FAN != 0: - self.fanErrTime[key][0] = time.time() - else: - self.fanErrTime[key][1] = time.time() - - self.fanStatus[key] = self.fanStatus[key] | STATUS_BAD_FAN - if self.fanErrTime[key][1] - self.fanErrTime[key][0] >= 30: - logger.warning("%s PWM is %d but Speed %d <= %d RPM" % (item, self.fan_pwm, speed, rpm_max * 0.7)) - else: - self.fanStatus[key] = self.fanStatus[key] & ~(STATUS_BAD_FAN) - - if speed < 1000: - if self.fanStatus[key] & STATUS_LOW_FAN != 0: - self.fanLowTime[key][0] = time.time() - else: - self.fanLowTime[key][1] = time.time() - self.fanStatus[key] = self.fanStatus[key] | STATUS_LOW_FAN - if self.fanLowTime[key][1] - self.fanLowTime[key][0] > 30: - logger.warning("%s Speed %d <= %d RPM" % (item, speed, 1000)) - else: - self.fanStatus[key] = self.fanStatus[key] & ~(STATUS_LOW_FAN) - - fanctrl_debug_log("%s speed %d RPM" % (key, speed)) - - if self.fanStatus[key] != 0: - fan_error_cnt = fan_error_cnt + 1 - self.fan_status = fan_error_cnt - fanctrl_debug_log("Fan error num %d" % fan_error_cnt) - - def doApplyPolicy(self): - if self.isLiquid == 1: - return - - self.fan_pwm = 0 - if self.openloop_switch == 1: - openloop_pwm = int(self.openloop.calcPwm()) - fanctrl_debug_log("OpenLoop pwm %d" % (openloop_pwm)) - self.fan_pwm = max(self.fan_pwm, openloop_pwm) - - if self.pid_switch == 1: - pid_pwm = int(self.fanPid.calcPwm()) - fanctrl_debug_log("PID pwm %d" % (pid_pwm)) - self.fan_pwm = max(self.fan_pwm, pid_pwm) - - # Check fan presence - if self.interface.get_fan_presence() == False: - logger.warning("Fan presence check false, set fan pwm to 100") - self.fan_pwm = self.fanerr_pwmmax - if self.fan_status != 0 or self.status != 0: - self.fan_pwm = self.fanerr_pwmmax - fanctrl_debug_log("Fan Speed set to %d pwm" % self.fan_pwm) - for i in range(3): - ret = self.setFanSpeed(self.fan_pwm) - if ret == False: - logger.warning("Fan speed set %d pwm failed, retry %d times" % (self.fan_pwm, i + 1)) - continue - break - - def doBoardFanLedCtrl(self): - if self.interface.get_fan_status() != False and self.interface.get_fan_presence() != False and self.fan_status == 0: - fanctrl_debug_log("Fan status good setting LED to green") - self.interface.set_fan_board_led("green") - else: - fanctrl_debug_log("Fan status error setting LED to red") - self.interface.set_fan_board_led("red") - - def doBoardPsuLedCtrl(self): - if self.interface.get_psu_status() != False: - fanctrl_debug_log("PSU status good setting LED to green") - self.interface.set_psu_board_led("green") - else: - fanctrl_debug_log("PSU status error setting LED to red") - self.interface.set_psu_board_led("red") - - def doSysLedCtrl(self): - self.interface.set_sysled("green") - -def run(interval, fanCtrol): - loop = 0 - # waitForDocker() - fanCtrol.setFanSpeed(fanCtrol.fan_pwm) #init set fan speed to 50 pwm - fanCtrol.doFanCtrlInit() - if fanCtrol.airflow == "Liquid": - logger.warning('Liquid device stopping fancontrol') - return True - while True: - try: - if loop % 5 == 0: # Fan speed control - try: - fanCtrol.updateThermal() - except Exception as e: - logger.error('Failed: Update Thermal, %s' % str(e)) - logger.error('%s' % traceback.format_exc()) - time.sleep(3) - continue - - try: - fanCtrol.checkThermal() - except Exception as e: - logger.error('Failed: Check Thermal, %s' % str(e)) - logger.error('%s' % traceback.format_exc()) - time.sleep(3) - continue - - try: - fanCtrol.checkFanSpeed() - except Exception as e: - logger.error('Failed: Check Fan Speed, %s' % str(e)) - logger.error('%s' % traceback.format_exc()) - time.sleep(3) - continue - - try: - fanCtrol.doApplyPolicy() - except Exception as e: - logger.error('Failed: Apply Policy, %s' % str(e)) - logger.error('%s' % traceback.format_exc()) - time.sleep(3) - continue - - try: - fanCtrol.doBoardFanLedCtrl() - except Exception as e: - logger.error('Failed: Led Control, %s' % str(e)) - logger.error('%s' % traceback.format_exc()) - time.sleep(3) - continue - - try: - fanCtrol.doBoardPsuLedCtrl() - except Exception as e: - logger.error('Failed: Led Control, %s' % str(e)) - logger.error('%s' % traceback.format_exc()) - time.sleep(3) - continue - - try: - fanCtrol.doSysLedCtrl() - except Exception as e: - logger.error('Failed: Led Control, %s' % str(e)) - logger.error('%s' % traceback.format_exc()) - time.sleep(3) - continue - - time.sleep(interval) - loop += interval - except Exception as e: - traceback.print_exc() - logger.error(str(e)) - -@click.group(cls=AliasedGroup, context_settings=CONTEXT_SETTINGS) -def main(): - '''device operator''' - pass - -@main.command() -def start(): - '''start fan control''' - logger.info("FANCTROL start") - fanCtrol = FanControl() - interval = 1 - run(interval, fanCtrol) - -@main.command() -def stop(): - '''stop fan control ''' - logger.info("FANCTROL stop") - -# device_i2c operation -if __name__ == '__main__': - main() diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/interface.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/script/interface.py deleted file mode 100644 index 140e09ec08..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/interface.py +++ /dev/null @@ -1,77 +0,0 @@ -from sonic_platform.chassis import Chassis - -class Interface(): - def __init__(self): - self.chassis = Chassis() - self.fan_list = self.chassis._fan_list - self.thermal_list = self.chassis._thermal_list - self.psu_list = self.chassis._psu_list - # Device - def get_productname(self): - return self.chassis.get_name() - - def set_sysled(self, color): - return self.thermal_list[0].set_sys_led(color) - - # Thermal - def get_thermal_temp_max(self, name): - for thermal in self.thermal_list: - if name == thermal.get_real_name(): - return thermal.get_high_threshold() - - def get_thermal_temp_min(self, name): - for thermal in self.thermal_list: - if name == thermal.get_real_name(): - return thermal.get_low_threshold() - - def get_thermal_temp(self, name): - for thermal in self.thermal_list: - if name == thermal.get_real_name(): - return thermal.get_temperature() - # Fans - def set_fan_speed_pwm(self, speed): - return self.fan_list[0].set_speed_pwm(speed) - - def get_fan_status(self): - for fan in self.fan_list: - if fan.get_status() == False: - return False - return True - - def get_fan_presence(self): - for fan in self.fan_list: - if fan.get_presence() == False: - return False - return True - - def set_fan_board_led(self, color): - return self.fan_list[0].set_status_led(color) - - def get_fan_speed_rpm(self, name): - for fan in self.fan_list: - if name == fan.get_name(): - return fan.get_speed_rpm() - return 0 - - def get_fan_rpm_max(self): - return self.fan_list[0].get_high_critical_threshold() - - def get_airflow(self): - tmp1 = self.fan_list[0].get_direction() - tmp2 = self.fan_list[0].get_direction() - for fan in self.fan_list: - tmp1 = fan.get_direction() - if tmp1 != tmp2: - return "F2B" - tmp2 = tmp1 - return tmp2 - # Psus - def get_psu_status(self): - for psu in self.psu_list: - if psu.get_powergood_status == False: - return False - return True - - def set_psu_board_led(self, color): - return self.psu_list[0].set_status_led(color) - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/platform_sensors.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/script/platform_sensors.py deleted file mode 100644 index ca20004308..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/platform_sensors.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/python3 -# * onboard sensors -# -import os -import sys -from sonic_platform.redfish_api import Redfish_Api - -def get_machine_info(): - if not os.path.isfile('/host/machine.conf'): - return None - machine_vars = {} - with open('/host/machine.conf') as machine_file: - for line in machine_file: - tokens = line.split('=') - if len(tokens) < 2: - continue - machine_vars[tokens[0]] = tokens[1].strip() - return machine_vars - -def get_platform_info(machine_info): - if machine_info is not None: - if 'onie_platform' in machine_info: - return machine_info['onie_platform'] - elif 'aboot_platform' in machine_info: - return machine_info['aboot_platform'] - return None - -PLATFORM_ROOT_PATH = '/usr/share/sonic/device' -platform = None - -def get_platform_name(): - global platform - platform = get_platform_info(get_machine_info()) - return platform - -val = get_platform_name() -sys.path.append("/".join([PLATFORM_ROOT_PATH, platform])) - -def print_console(str): - print(str) - -def print_platform(): - platform_info = get_platform_name() - print_console(platform_info) - print_console('Adapter: Ragile Platform Management Controller') - print_console("") - -def get_sensor(): - sensor = Redfish_Api().get_thresholdSensors() - ctrl = sensor["Sensors"] - list_sensor =[] - for item in ctrl: - name = item.get("@odata.id").split("/",9)[9] - now = item.get("Reading") - min = item.get("Thresholds").get("LowerFatal").get("Reading") - max = item.get("Thresholds").get("UpperFatal").get("Reading") - unit = item.get("ReadingUnits") - if unit == "Amps": - unit = "A" - if min == (-1000): - min = (min/1000) - elif unit == "Volts": - unit = "V" - tmp = {} - tmp["name"]= name - tmp["now"] = ("%.3f" % now) - tmp["min"] = ("%.3f" % min) - tmp["max"] = ("%.3f" % max) - tmp["unit"] = unit - list_sensor.append(tmp) - return list_sensor - -def print_boarddcdc(): - val_ret = get_sensor() - print_info_str = "" - toptile = "Onboard Sensors:" - errformat = " {id:<26} : {errmsg}" - formatstr = " {name:<26} : {now:<6} {unit:<1} (Min = {min:<6} {unit:<1} , Max = {max:<6} {unit:<1} )" - - if len(val_ret) != 0: - print_info_str += toptile + '\n' - for item in val_ret: - realformat = formatstr if item.get('errcode', 0) == 0 else errformat - print_info_str += realformat.format(**item) + '\n' - print_console(print_info_str) - -def getsensors(): - print_platform() - print_boarddcdc() - -if __name__ == "__main__": - getsensors() diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragilecommon.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragilecommon.py deleted file mode 100644 index 769427d679..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragilecommon.py +++ /dev/null @@ -1,1365 +0,0 @@ -# -*- coding: UTF-8 -*- -# ------------------------------------------------------------------------------- -# Name: Ragile python common module -# Purpose: called by other modules -# -# Author: support -# -# Created: 02/07/2018 -# Copyright: (c) rd 2018 -# ------------------------------------------------------------------------------- - -################################driver-load-adaption####################################################### -# need to export interface -################################################################################################### - -__all__ = [ - "fancontrol_loc", - "fancontrol_config_loc", - "GLOBALCONFIG", - "MONITOR_CONST", - "RAGILE_PART_NUMBER", - "RAGILE_LABEL_REVISION", - "RAGILE_ONIE_VERSION", - "RAGILE_MAC_SIZE", - "RAGILE_MANUF_NAME", - "RAGILE_MANUF_COUNTRY", - "RAGILE_VENDOR_NAME", - "RAGILE_DIAG_VERSION", - "RAGILE_SERVICE_TAG", - "DEV_LEDS", - "MEM_SLOTS", - "LOCAL_LED_CONTROL", - "FIRMWARE_TOOLS", - "STARTMODULE", - "i2ccheck_params", - "FANS_DEF", - "factest_module", - "MONITOR_TEMP_MIN", - "MONITOR_K", - "MONITOR_MAC_IN", - "MONITOR_DEFAULT_SPEED", - "MONITOR_MAX_SPEED", - "MONITOR_MIN_SPEED", - "MONITOR_MAC_ERROR_SPEED", - "MONITOR_FAN_TOTAL_NUM", - "MONITOR_MAC_UP_TEMP", - "MONITOR_MAC_LOWER_TEMP", - "MONITOR_MAC_MAX_TEMP", - "MONITOR_FALL_TEMP", - "MONITOR_MAC_WARNING_THRESHOLD", - "MONITOR_OUTTEMP_WARNING_THRESHOLD", - "MONITOR_BOARDTEMP_WARNING_THRESHOLD", - "MONITOR_CPUTEMP_WARNING_THRESHOLD", - "MONITOR_INTEMP_WARNING_THRESHOLD", - "MONITOR_MAC_CRITICAL_THRESHOLD", - "MONITOR_OUTTEMP_CRITICAL_THRESHOLD", - "MONITOR_BOARDTEMP_CRITICAL_THRESHOLD", - "MONITOR_CPUTEMP_CRITICAL_THRESHOLD", - "MONITOR_INTEMP_CRITICAL_THRESHOLD", - "MONITOR_CRITICAL_NUM", - "MONITOR_SHAKE_TIME", - "MONITOR_INTERVAL", - "MONITOR_MAC_SOURCE_SYSFS", - "MONITOR_MAC_SOURCE_PATH", - "MAC_AVS_PARAM", - "MAC_DEFAULT_PARAM", - "MONITOR_SYS_LED", - "MONITOR_SYS_FAN_LED", - "MONITOR_FANS_LED", - "MONITOR_SYS_PSU_LED", - "MONITOR_FAN_STATUS", - "MONITOR_PSU_STATUS", - "MONITOR_DEV_STATUS", - "MONITOR_DEV_STATUS_DECODE", - "DEV_MONITOR_PARAM", - "SLOT_MONITOR_PARAM", - "fanloc", - "PCA9548START", - "PCA9548BUSEND", - "RAGILE_CARDID", - "RAGILE_PRODUCTNAME", - "FAN_PROTECT", - "rg_eeprom", - "E2_LOC", - "E2_PROTECT", - "MAC_LED_RESET", - "INIT_PARAM", - "INIT_COMMAND", - "CPLDVERSIONS", - "DRIVERLISTS", - "DEVICE", - "E2TYPE", - "FRULISTS", - "fanlevel_6510", - "fanlevel_6520", - "fanlevel", - "TEMPIDCHANGE", - "FACTESTMODULE", - "item1", - "test_sys_reload_item", - "test_sys_item", - "test_temp_item", - "test_mem_item", - "test_hd_item", - "test_rtc_item", - "test_i2c_item", - "test_cpld_item", - "test_portframe_item", - "test_sysled_item", - "test_fan_item", - "test_power_item", - "test_usb_item", - "test_prbs_item", - "test_portbroadcast_item", - "test_debug_level", - "test_log_level", - "test_setmac", - "test_setrtc", - "log_level_critical", - "log_level_debug", - "log_level_error", - "log_level_info", - "log_level_notset", - "log_level_warning", - "test_e2_setmac_item", - "test_bmc_setmac_item", - "test_fan_setmac_item", - "alltest", - "looptest", - "diagtestall", - "menuList", - "TESTCASE", - "PCIe_DEV_LIST", - "PCIe_SPEED_ITEM", -] - -fancontrol_loc = "/usr/local/bin" -fancontrol_config_loc = "/usr/local/bin" - -GLOBALCONFIG = "GLOBALCONFIG" -MONITOR_CONST = "MONITOR_CONST" - -RAGILE_PART_NUMBER = "RJ000001" -RAGILE_LABEL_REVISION = "R01" -RAGILE_ONIE_VERSION = "2018.02" -RAGILE_MAC_SIZE = 3 -RAGILE_MANUF_NAME = "Ragile" -RAGILE_MANUF_COUNTRY = "CHN" -RAGILE_VENDOR_NAME = "Ragile" -RAGILE_DIAG_VERSION = "0.1.0.15" -RAGILE_SERVICE_TAG = "www.ragile.com" - -DEV_LEDS = {} -MEM_SLOTS = [] - -LOCAL_LED_CONTROL = {"CLOSE": {}, "OPEN": {}} - -FIRMWARE_TOOLS = {} -# start-up module -STARTMODULE = {"fancontrol": 1, "avscontrol": 1} - -i2ccheck_params = {"busend": "i2c-66", "retrytime": 6} - -################################################################################################### -##### fan board ID reference -################################################################################################### -FANS_DEF = { - 0x8100: "M6500-FAN-F", - 0x8101: "M6510-FAN-F", - 0x8102: "M6520-FAN-F", - 0x8103: "M6510-FAN-R", -} - -factest_module = { - "sysinfo_showfanmsg": 1, - "sysinfo_showPsumsg": 1, - "sysinfo_showrestfanmsg": 0, - "sysinfo_showrestpsumsg": 0, -} - -#################fan adjustment parameters ############################## -MONITOR_TEMP_MIN = 38 # temperature before speed-adjustment -MONITOR_K = 11 # adjustment algorithm -MONITOR_MAC_IN = 35 # temperature difference between mac and chip(backup) -MONITOR_DEFAULT_SPEED = 0x60 # default speed -MONITOR_MAX_SPEED = 0xFF # maximum speed -MONITOR_MIN_SPEED = 0x33 # minimum speed -MONITOR_MAC_ERROR_SPEED = 0xBB # MAC abnormal speed -MONITOR_FAN_TOTAL_NUM = 4 # 3+1 redundancy design, report to syslog if there is a error -MONITOR_MAC_UP_TEMP = 50 # MAC compared with inlet up -MONITOR_MAC_LOWER_TEMP = -50 # MAC compared with outlet down -MONITOR_MAC_MAX_TEMP = 100 # - -MONITOR_FALL_TEMP = 4 # adjustment reduced temperature -MONITOR_MAC_WARNING_THRESHOLD = 100 # 100 -MONITOR_OUTTEMP_WARNING_THRESHOLD = 85 -MONITOR_BOARDTEMP_WARNING_THRESHOLD = 85 -MONITOR_CPUTEMP_WARNING_THRESHOLD = 85 -MONITOR_INTEMP_WARNING_THRESHOLD = 70 # 70 - -MONITOR_MAC_CRITICAL_THRESHOLD = 105 # 105 -MONITOR_OUTTEMP_CRITICAL_THRESHOLD = 90 # 90 -MONITOR_BOARDTEMP_CRITICAL_THRESHOLD = 90 # 90 -MONITOR_CPUTEMP_CRITICAL_THRESHOLD = 100 # 100 -MONITOR_INTEMP_CRITICAL_THRESHOLD = 80 # 80 -MONITOR_CRITICAL_NUM = 3 # retry times -MONITOR_SHAKE_TIME = 20 # anti-shake times -MONITOR_INTERVAL = 60 - -# 1 get mac temperature from sysfs ,0 get mac temperature from bcmcmd -MONITOR_MAC_SOURCE_SYSFS = (0) -MONITOR_MAC_SOURCE_PATH = None # sysfs path - - -# default MAC AVS parameters -MAC_AVS_PARAM = { - 0x72: 0x0384, - 0x73: 0x037E, - 0x74: 0x0378, - 0x75: 0x0372, - 0x76: 0x036B, - 0x77: 0x0365, - 0x78: 0x035F, - 0x79: 0x0359, - 0x7A: 0x0352, - 0x7B: 0x034C, - 0x7C: 0x0346, - 0x7D: 0x0340, - 0x7E: 0x0339, - 0x7F: 0x0333, - 0x80: 0x032D, - 0x81: 0x0327, - 0x82: 0x0320, - 0x83: 0x031A, - 0x84: 0x0314, - 0x85: 0x030E, - 0x86: 0x0307, - 0x87: 0x0301, - 0x88: 0x02FB, - 0x89: 0x02F5, - 0x8A: 0x02EE, -} - -# default 6520 configuration -MAC_DEFAULT_PARAM = { - "type": 1, # type 1 represents default if out of range / 0 represents no voltage-adjustment if out of range - "default": 0x74, # should be used with type - "loopaddr": 0x00, # AVS loop address - "loop": 0x00, # AVS loop value - "open": 0x00, # diasble write-protection value - "close": 0x40, # enable write-protection value - "bus": 2, # AVSI2C bus address - "devno": 0x60, # AVS address - "addr": 0x21, # AVS voltage-adjustment address - "protectaddr": 0x10, # AVS write-protection address - "sdkreg": "DMU_PCU_OTP_CONFIG_8", # SDK register name - "sdktype": 1, # type 0 represents no shift operation / 1 represents shift operation - "macregloc": 24, # shift operation - "mask": 0xFF, # mask after shift -} - -MONITOR_SYS_LED = [ - {"bus": 2, "devno": 0x33, "addr": 0xB2, "yellow": 0x06, "red": 0x02, "green": 0x04}, - {"bus": 2, "devno": 0x32, "addr": 0x72, "yellow": 0x06, "red": 0x02, "green": 0x04}, -] - -MONITOR_SYS_FAN_LED = [ - {"bus": 2, "devno": 0x33, "addr": 0xB4, "yellow": 0x06, "red": 0x02, "green": 0x04}, -] - -MONITOR_FANS_LED = [ - {"bus": 2, "devno": 0x32, "addr": 0x23, "green": 0x09, "red": 0x0A}, - {"bus": 2, "devno": 0x32, "addr": 0x24, "green": 0x09, "red": 0x0A}, - {"bus": 2, "devno": 0x32, "addr": 0x25, "green": 0x09, "red": 0x0A}, - {"bus": 2, "devno": 0x32, "addr": 0x26, "green": 0x09, "red": 0x0A}, -] - - -MONITOR_SYS_PSU_LED = [ - {"bus": 2, "devno": 0x33, "addr": 0xB3, "yellow": 0x06, "red": 0x02, "green": 0x04}, -] - -MONITOR_FAN_STATUS = [ - {"status": "green", "minOkNum": 4, "maxOkNum": 4}, - {"status": "yellow", "minOkNum": 3, "maxOkNum": 3}, - {"status": "red", "minOkNum": 0, "maxOkNum": 2}, -] - -MONITOR_PSU_STATUS = [ - {"status": "green", "minOkNum": 2, "maxOkNum": 2}, - {"status": "yellow", "minOkNum": 1, "maxOkNum": 1}, - {"status": "red", "minOkNum": 0, "maxOkNum": 0}, -] - -MONITOR_DEV_STATUS = {} -MONITOR_DEV_STATUS_DECODE = {} -DEV_MONITOR_PARAM = {} -SLOT_MONITOR_PARAM = {} - - -fanloc = {"name": "fanset", "location": "0-0032/fan_speed_set"} -#####################MAC-Voltage-Adjustment-Parameters#################################### - - -####================================Adaption-Area================================ -#### RAGILE_COMMON common configuration head -#### "platform" specific configuration head -#### -PCA9548START = 11 -PCA9548BUSEND = 74 - -RAGILE_CARDID = 0x00004040 -RAGILE_PRODUCTNAME = "ragile_ra-b6510" - -FAN_PROTECT = {"bus": 0, "devno": 0x32, "addr": 0x19, "open": 0x00, "close": 0x0F} -rg_eeprom = "2-0057/eeprom" -E2_LOC = {"bus": 2, "devno": 0x57} -E2_PROTECT = {"bus": 2, "devno": 0x33, "addr": 0xB0, "open": 0, "close": 1} -MAC_LED_RESET = {"pcibus": 8, "slot": 0, "fn": 0, "bar": 0, "offset": 64, "reset": 0x98} - -INIT_PARAM = [ - {"loc": "1-0034/sfp_enable", "value": "01"}, - {"loc": "2-0035/sfp_enable2", "value": "ff"}, - {"loc": "2-0033/mac_led", "value": "ff"}, - {"loc": "1-0034/sfp_txdis1", "value": "00"}, - {"loc": "1-0034/sfp_txdis2", "value": "00"}, - {"loc": "1-0034/sfp_txdis3", "value": "00"}, - {"loc": "1-0036/sfp_txdis4", "value": "00"}, - {"loc": "1-0036/sfp_txdis5", "value": "00"}, - {"loc": "1-0036/sfp_txdis6", "value": "00"}, - {"loc": fanloc["location"], "value": "80"}, -] - -INIT_COMMAND = [] - -CPLDVERSIONS = [ - {"loc": "2-0033/cpld_version", "des": "MAC Board CPLDA"}, - {"loc": "2-0035/cpld_version", "des": "MAC Board CPLDB"}, - {"loc": "2-0037/cpld_version", "des": "CPU Board CPLD"}, -] - -## Driver List -## - -DRIVERLISTS = [] -DEVICE = [] -""" -DRIVERLISTS = [ - "i2c_dev", - "i2c_algo_bit", - "i2c_gpio", - "i2c_mux", - "i2c_mux_pca9641", - "i2c_mux_pca954x", # force_deselect_on_exit=1 - "eeprom", - "at24", - "ragile_platform", - "rg_cpld", - "rg_fan", - "rg_psu", - "csu550", - "rg_gpio_xeon", - #IPMIdriver - "ipmi_msghandler", - "ipmi_devintf", - "ipmi_si", -] - -DEVICE = [ - {"name":"pca9641","bus":0 ,"loc":0x10 }, - {"name":"pca9548","bus":2 ,"loc":0x70 }, - {"name":"lm75","bus": 2, "loc":0x48 }, - {"name":"lm75","bus": 2, "loc":0x49 }, - {"name":"lm75","bus": 2, "loc":0x4a }, - {"name":"24c02","bus":2 , "loc":0x57 }, - {"name":"rg_cpld","bus":2 ,"loc":0x33 }, - {"name":"rg_cpld","bus":2 ,"loc":0x35 }, - {"name":"rg_cpld","bus":2 ,"loc":0x37 }, - {"name":"pca9548","bus":1,"loc":0x70 }, - {"name":"pca9548","bus":1,"loc":0x71 }, - {"name":"pca9548","bus":1,"loc":0x72 }, - {"name":"pca9548","bus":1,"loc":0x73 }, - {"name":"pca9548","bus":1,"loc":0x74 }, - {"name":"pca9548","bus":1,"loc":0x75 }, - {"name":"pca9548","bus":1,"loc":0x76 }, - {"name":"pca9548","bus":1,"loc":0x77 }, - {"name":"rg_fan","bus":3,"loc":0x53 }, - {"name":"rg_fan","bus":4,"loc":0x53 }, - {"name":"rg_fan","bus":5,"loc":0x53 }, - #{"name":"rg_fan","bus":6,"loc":0x53 }, #specific fan - {"name":"rg_psu","bus":7 ,"loc":0x50 }, - {"name":"csu550","bus":7 ,"loc":0x58 }, - {"name":"rg_psu","bus":8 ,"loc":0x53 }, - {"name":"csu550","bus":8 ,"loc":0x5b }, -] -""" - -#####################FRU-Info-Adaption################################# -E2TYPE = { - "1": "tlveeprom", - "2": "x86cpueeprom", - "3": "bmceeprom", - "4": "cpueeprom", - "5": "maceeprom", - "6": "sloteeprom", - "7": "fanconnecteeprom", - "8": "M1HFANI-F", - "9": "M1HFANI-R", - "A": "M2HFANI-F", - "B": "M2HFANI-R", - "C": "psu", -} -FRULISTS = [] -################################Manufacturing-Test-Adaption-Area####################################################### -# need to export interface -fanlevel_6510 = { - "level": [51, 150, 255], - "low_speed": [500, 7500, 17000], - "high_speed": [11000, 22500, 28500], -} - -fanlevel_6520 = { - "level": [75, 150, 255], - "low_speed": [750, 4250, 6750], - "high_speed": [4500, 7500, 10000], -} - -fanlevel = fanlevel_6520 - -TEMPIDCHANGE = { - "lm75in": "inlet", - "lm75out": "outlet", - "lm75hot": "hot-point", - "inlet": "lm75in", - "outlet": "lm75out", - "hot-point": "lm75hot", -} - -# Manufacturing-Test module -FACTESTMODULE = {} - -##################################Manufacturing-Test-Menu -item1 = {"name": "Single Test", "deal": "test_signal", "childid": 1} -test_sys_reload_item = {"name": "reset-system", "deal": "test_sys_reload"} - -test_sys_item = {"name": "Product information test", "deal": "test_sysinfo"} -test_temp_item = {"name": "temperature test", "deal": "test_tempinfo"} -test_mem_item = {"name": "Memory test", "deal": "test_cpumemoryinfo"} -test_hd_item = {"name": "Hard disk test", "deal": "test_hard"} -test_rtc_item = {"name": "RTC test ", "deal": "test_rtc"} -test_i2c_item = {"name": "I2c test ", "deal": "test_i2c"} -test_cpld_item = {"name": "CPLD test", "deal": "test_cpld"} -test_portframe_item = { - "name": "Port transmit-receive frame test", - "deal": "test_portframe", -} -test_sysled_item = {"name": "System led test", "deal": "test_led"} -test_fan_item = {"name": "Fan status test", "deal": "test_fan"} -test_power_item = {"name": "PSU status test", "deal": "test_power"} -test_usb_item = {"name": "USB test", "deal": "test_usb"} -test_prbs_item = {"name": "PRBS test", "deal": "test_prbs"} -test_portbroadcast_item = {"name": "Port broadcast", "deal": "test_portbroadcast"} - -test_debug_level = {"name": "Change debug level", "deal": "test_setdebug"} -test_log_level = {"name": "Log output level", "deal": "test_loginfolevel"} -test_setmac = {"name": "setmac", "deal": "test_setmac"} -test_setrtc = {"name": "Set RTC", "deal": "test_set_rtc"} - -log_level_critical = {"name": "CRITICAL", "deal": "test_log_critical"} -log_level_debug = {"name": "DEBUG", "deal": "test_log_debug"} -log_level_error = {"name": "ERROR", "deal": "test_log_error"} -log_level_info = {"name": "INFO", "deal": "test_log_info"} -log_level_notset = {"name": "NOTSET", "deal": "test_log_notset"} -log_level_warning = {"name": "WARNING", "deal": "test_log_warning"} - - -test_e2_setmac_item = {"name": "E2SETMAC", "deal": "test_e2_setmac"} -test_bmc_setmac_item = {"name": "BMCSETMAC", "deal": "test_bmc_setmac"} -test_fan_setmac_item = {"name": "fan SETMAC", "deal": "test_fan_setmac"} - -alltest = [ - test_sys_item, - test_temp_item, - test_mem_item, - test_hd_item, - test_rtc_item, - test_i2c_item, - test_cpld_item, - test_portframe_item, - test_sysled_item, - test_fan_item, - test_power_item, - test_usb_item, - test_prbs_item, - test_portbroadcast_item, -] - -looptest = [ - test_sys_item, - test_temp_item, - test_mem_item, - test_hd_item, - test_rtc_item, - test_i2c_item, - test_cpld_item, - test_portframe_item, - test_fan_item, - test_power_item, - test_usb_item, - test_prbs_item, - test_portbroadcast_item, -] - -diagtestall = [] - -menuList = [ - { - "menuid": 0, - "value": [ - {"name": "Single test", "deal": "test_signal", "childid": 1}, - {"name": "All test", "deal": "test_all"}, - {"name": "Loop test", "deal": "test_loop"}, - # {"name":"Check loop-test result", "deal" :"test_loop_read"}, - # {"name":"Delete loop-test result", "deal" :"test_loop_delete"}, - # {"name":"Load configuration", "deal" :"test_config"}, - test_sys_reload_item, - {"name": "System Configuration", "deal": "test_sysconfig", "childid": 2}, - ], - }, - { - "menuid": 1, - "parentid": 0, - "value": [ - test_sys_item, - test_temp_item, - test_mem_item, - test_hd_item, - test_rtc_item, - test_i2c_item, - test_cpld_item, - test_portframe_item, - test_sysled_item, - test_fan_item, - test_power_item, - test_usb_item, - test_prbs_item, - test_portbroadcast_item, - ], - }, - { - "menuid": 2, - "parentid": 0, - "value": [test_debug_level, test_log_level, test_setmac, test_setrtc,], - }, - { - "menuid": 3, - "parentid": 2, - "value": [ - log_level_critical, - log_level_debug, - log_level_error, - log_level_info, - log_level_notset, - log_level_warning, - ], - }, - { - "menuid": 4, - "parentid": 2, - "value": [test_e2_setmac_item, test_bmc_setmac_item, test_fan_setmac_item,], - }, -] - - -TESTCASE = { - "CPLD": [ - { - "name": "CONNECT BOARD CPLD-A", - "cases": [ - {"name": "cpld32", "cmd": "grtd_test.py cpld_check 0 0x32 0xAA"}, - {"name": "cpld37", "cmd": "grtd_test.py cpld_check 2 0x37 0xAC"}, - ], - }, - { - "name": "MAC BOARD CPLD-A", - "cases": [ - {"name": "cpld33", "cmd": "grtd_test.py cpld_check 2 0x33 0xAB"}, - {"name": "cpld34", "cmd": "grtd_test.py cpld_check 1 0x34 0xAA"}, - ], - }, - { - "name": "MAC BOARD CPLD-B", - "cases": [ - {"name": "cpld36", "cmd": "grtd_test.py cpld_check 1 0x36 0xAA"}, - {"name": "cpld35", "cmd": "grtd_test.py cpld_check 2 0x35 0xAB"}, - ], - }, - ], - "TEMPERATURE": [ - { - "name": "-->temperature test", - "cases": [ - { - "name": "inlet", - "cmd": "grtd_test.py temp 2-0048/hwmon/hwmon1/temp1_input", - }, - { - "name": "outlet", - "cmd": "grtd_test.py temp 2-0049/hwmon/hwmon2/temp1_input", - }, - { - "name": "hot-point", - "cmd": "grtd_test.py temp 2-004a/hwmon/hwmon3/temp1_input", - }, - ], - } - ], - "MEMTORY": { - "cases": [ - {"name": "->memory test 1M", "cmd": "memtester 1M 1"}, - {"name": "->memory test 2M", "cmd": "memtester 2M 1"}, - {"name": "->memory test 8M", "cmd": "memtester 8M 1"}, - # {"name":"->memory test 16M","cmd":"memtester 16M 1"}, - # {"name":"->memory test 256M","cmd":"memtester 256M 1"}, - ] - }, - "SMARTCTLCMDS": { - "cases": [ - {"name": "->Check Hard Disk Info", "cmd": "smartctl -i /dev/sda"}, - {"name": "->Check Hard Disk Monitor Status", "cmd": "smartctl -H /dev/sda"}, - ] - }, - "LED": [ - { - "name": "Light Port Led test", - "cases": [ - { - "name": "-> Red Led Off", - "cmd": "grtd_test.py led loc 1-0034/sfp_led1_red,1-0034/sfp_led2_red,1-0034/sfp_led3_red,1-0034/sfp_led8_red,1-0036/sfp_led4_red,1-0036/sfp_led5_red,1-0036/sfp_led6_red,1-0036/sfp_led7_red 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00", - }, - { - "name": "-> Red Led On", - "cmd": "grtd_test.py led loc 1-0034/sfp_led1_red,1-0034/sfp_led2_red,1-0034/sfp_led3_red,1-0034/sfp_led8_red,1-0036/sfp_led4_red,1-0036/sfp_led5_red,1-0036/sfp_led6_red,1-0036/sfp_led7_red 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff", - }, - { - "name": "-> Recovery Red Led Off", - "cmd": "grtd_test.py led loc 1-0034/sfp_led1_red,1-0034/sfp_led2_red,1-0034/sfp_led3_red,1-0034/sfp_led8_red,1-0036/sfp_led4_red,1-0036/sfp_led5_red,1-0036/sfp_led6_red,1-0036/sfp_led7_red 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00", - }, - { - "name": "-> Yellow Led Off", - "cmd": "grtd_test.py led loc 1-0034/sfp_led1_yellow,1-0034/sfp_led2_yellow,1-0034/sfp_led3_yellow,1-0034/sfp_led8_yellow,1-0036/sfp_led4_yellow,1-0036/sfp_led5_yellow,1-0036/sfp_led6_yellow,1-0036/sfp_led7_yellow 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00", - }, - { - "name": "-> Yellow Led On", - "cmd": "grtd_test.py led loc 1-0034/sfp_led1_yellow,1-0034/sfp_led2_yellow,1-0034/sfp_led3_yellow,1-0034/sfp_led8_yellow,1-0036/sfp_led4_yellow,1-0036/sfp_led5_yellow,1-0036/sfp_led6_yellow,1-0036/sfp_led7_yellow 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff", - }, - { - "name": "-> Recovery Yellow Led Off", - "cmd": "grtd_test.py led loc 1-0034/sfp_led1_yellow,1-0034/sfp_led2_yellow,1-0034/sfp_led3_yellow,1-0034/sfp_led8_yellow,1-0036/sfp_led4_yellow,1-0036/sfp_led5_yellow,1-0036/sfp_led6_yellow,1-0036/sfp_led7_yellow 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00", - }, - ], - }, - { - "name": "fan 1 Led", - "cases": [ - { - "name": "-> LedOff", - "cmd": "grtd_test.py led loc 0-0032/fan0_led 0x0b", - }, - { - "name": "-> Red Led ", - "cmd": "grtd_test.py led loc 0-0032/fan0_led 0x0a", - }, - { - "name": "-> Green Led ", - "cmd": "grtd_test.py led loc 0-0032/fan0_led 0x09", - }, - { - "name": "-> Yellow Led ", - "cmd": "grtd_test.py led loc 0-0032/fan0_led 0x08", - }, - { - "name": "-> Red Led Flashing", - "cmd": "grtd_test.py led loc 0-0032/fan0_led 0x0e", - }, - { - "name": "-> Green Led Flashing", - "cmd": "grtd_test.py led loc 0-0032/fan0_led 0x0d", - }, - { - "name": "-> Yellow Led Flashing", - "cmd": "grtd_test.py led loc 0-0032/fan0_led 0x0c", - }, - { - "name": "-> Recovery Green Led ", - "cmd": "grtd_test.py led loc 0-0032/fan0_led 0x09", - }, - ], - }, - { - "name": "fan 2 Led", - "cases": [ - { - "name": "-> LedOff", - "cmd": "grtd_test.py led loc 0-0032/fan1_led 0x0b", - }, - { - "name": "-> Red Led ", - "cmd": "grtd_test.py led loc 0-0032/fan1_led 0x0a", - }, - { - "name": "-> Green Led ", - "cmd": "grtd_test.py led loc 0-0032/fan1_led 0x09", - }, - { - "name": "-> Yellow Led ", - "cmd": "grtd_test.py led loc 0-0032/fan1_led 0x08", - }, - { - "name": "-> Red Led Flashing", - "cmd": "grtd_test.py led loc 0-0032/fan1_led 0x0e", - }, - { - "name": "-> Green Led Flashing", - "cmd": "grtd_test.py led loc 0-0032/fan1_led 0x0d", - }, - { - "name": "-> Yellow Led Flashing", - "cmd": "grtd_test.py led loc 0-0032/fan1_led 0x0c", - }, - { - "name": "-> Recovery Green Led ", - "cmd": "grtd_test.py led loc 0-0032/fan1_led 0x09", - }, - ], - }, - { - "name": "fan 3 Led", - "cases": [ - { - "name": "-> LedOff", - "cmd": "grtd_test.py led loc 0-0032/fan2_led 0x0b", - }, - { - "name": "-> Red Led ", - "cmd": "grtd_test.py led loc 0-0032/fan2_led 0x0a", - }, - { - "name": "-> Green Led ", - "cmd": "grtd_test.py led loc 0-0032/fan2_led 0x09", - }, - { - "name": "-> Yellow Led ", - "cmd": "grtd_test.py led loc 0-0032/fan2_led 0x08", - }, - { - "name": "-> Red Led Flashing", - "cmd": "grtd_test.py led loc 0-0032/fan2_led 0x0e", - }, - { - "name": "-> Green Led Flashing", - "cmd": "grtd_test.py led loc 0-0032/fan2_led 0x0d", - }, - { - "name": "-> Yellow Led Flashing", - "cmd": "grtd_test.py led loc 0-0032/fan2_led 0x0c", - }, - { - "name": "-> Recovery Green Led ", - "cmd": "grtd_test.py led loc 0-0032/fan2_led 0x09", - }, - ], - }, - { - "name": "Front panel CPU Led", - "cases": [ - { - "name": "-> LedOff", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x00", - }, - { - "name": "-> Green Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x01", - }, - { - "name": "-> Red Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x02", - }, - { - "name": "-> Yellow Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x03", - }, - { - "name": "-> Green Led 1/4sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x11", - }, - { - "name": "-> Green Led 1/2sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x21", - }, - { - "name": "-> Green Led 1sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x41", - }, - { - "name": "-> Green Led 2sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x81", - }, - { - "name": "-> Red Led 1/4sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x12", - }, - { - "name": "-> Red Led 1/2sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x22", - }, - { - "name": "-> Red Led 1sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x42", - }, - { - "name": "-> Red Led 2sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x82", - }, - { - "name": "-> Yellow Led 1/4sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x13", - }, - { - "name": "-> Yellow Led 1/2sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x23", - }, - { - "name": "-> Yellow Led 1sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x43", - }, - { - "name": "-> Yellow Led 2sFlashing ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x83", - }, - { - "name": "-> Recovery Green Led ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_cpu 0x01", - }, - ], - }, - { - "name": "Front panel BMC Led", - "cases": [ - { - "name": "-> LedOff", - "cmd": "grtd_test.py led loc 2-0035/broad_front_bmc 0x00", - }, - { - "name": "-> Red Led Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_bmc 0x01", - }, - { - "name": "-> Red Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_bmc 0x02", - }, - { - "name": "-> Green Led Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_bmc 0x03", - }, - { - "name": "-> Green Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_bmc 0x04", - }, - { - "name": "-> Yellow Led Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_bmc 0x05", - }, - { - "name": "-> Yellow Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_bmc 0x06", - }, - { - "name": "-> Recovery Green Led ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_bmc 0x04", - }, - ], - }, - { - "name": "Front panel location Led", - "cases": [ - { - "name": "-> LedOff", - "cmd": "grtd_test.py led loc 2-0035/broad_front_lct 0xff", - }, - { - "name": "-> LedOn", - "cmd": "grtd_test.py led loc 2-0035/broad_front_lct 0xfe", - }, - { - "name": "->Recovery LedOff", - "cmd": "grtd_test.py led loc 2-0035/broad_front_lct 0xff", - }, - ], - }, - { - "name": "Front panel pwr Led", - "cases": [ - { - "name": "-> LedOff", - "cmd": "grtd_test.py led loc 2-0035/broad_front_pwr 0x00", - }, - { - "name": "-> Red Led Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_pwr 0x01", - }, - { - "name": "-> Red Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_pwr 0x02", - }, - { - "name": "-> Green Led Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_pwr 0x03", - }, - { - "name": "-> Green Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_pwr 0x04", - }, - { - "name": "-> Yellow Led Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_pwr 0x05", - }, - { - "name": "-> Yellow Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_pwr 0x06", - }, - { - "name": "-> Recovery Green Led ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_pwr 0x04", - }, - ], - }, - { - "name": "Front panel fan Led", - "cases": [ - { - "name": "-> LedOff", - "cmd": "grtd_test.py led loc 2-0035/broad_front_fan 0x00", - }, - { - "name": "-> Red Led Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_fan 0x01", - }, - { - "name": "-> Red Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_fan 0x02", - }, - { - "name": "-> Green Led Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_fan 0x03", - }, - { - "name": "-> Green Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_fan 0x04", - }, - { - "name": "-> Yellow Led Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_fan 0x05", - }, - { - "name": "-> Yellow Led not Flashing", - "cmd": "grtd_test.py led loc 2-0035/broad_front_fan 0x06", - }, - { - "name": "-> Recovery Green Led ", - "cmd": "grtd_test.py led loc 2-0035/broad_front_fan 0x04", - }, - ], - }, - ], - "I2C": [ - ####type 1 represents value obtained compated with value - ####type 2 represents return True or False - { - "name": "I2C device test", - "cases": [ - { - "name": " PCA9641 test", - "cmd": "grtd_test.py dev_rd 0 10 0", - "deal_type": 2, - }, - { - "name": " cpld32 test", - "cmd": "grtd_test.py dev_rd 0 32 0", - "deal_type": 2, - }, - { - "name": " cpld33 test", - "cmd": "grtd_test.py dev_rd 0 32 0", - "deal_type": 2, - }, - { - "name": " cpld34 test", - "cmd": "grtd_test.py dev_rd 0 32 0", - "deal_type": 2, - }, - { - "name": " cpld35 test", - "cmd": "grtd_test.py dev_rd 0 32 0", - "deal_type": 2, - }, - { - "name": " cpld36 test", - "cmd": "grtd_test.py dev_rd 0 32 0", - "deal_type": 2, - }, - { - "name": " cpld37 test", - "cmd": "grtd_test.py dev_rd 0 32 0", - "deal_type": 2, - }, - { - "name": " inlet LM75", - "cmd": "grtd_test.py dev_rd 0 32 0", - "deal_type": 2, - }, - { - "name": " outlet LM75", - "cmd": "grtd_test.py dev_rd 0 32 0", - "deal_type": 2, - }, - { - "name": " hot-point LM75", - "cmd": "grtd_test.py dev_rd 0 32 0", - "deal_type": 2, - }, - { - "name": " EEPROM", - "cmd": "grtd_test.py dev_rd 0 32 0", - "deal_type": 2, - }, - { - "name": " Port 1", - "cmd": "grtd_test.py dev_rd 11 0050 0", - "deal_type": 2, - }, - { - "name": " Port 2", - "cmd": "grtd_test.py dev_rd 12 0050 0", - "deal_type": 2, - }, - { - "name": " Port 3", - "cmd": "grtd_test.py dev_rd 13 0050 0", - "deal_type": 2, - }, - { - "name": " Port 4", - "cmd": "grtd_test.py dev_rd 14 0050 0", - "deal_type": 2, - }, - { - "name": " Port 5", - "cmd": "grtd_test.py dev_rd 15 0050 0", - "deal_type": 2, - }, - { - "name": " Port 6", - "cmd": "grtd_test.py dev_rd 16 0050 0", - "deal_type": 2, - }, - { - "name": " Port 7", - "cmd": "grtd_test.py dev_rd 17 0050 0", - "deal_type": 2, - }, - { - "name": " Port 8", - "cmd": "grtd_test.py dev_rd 18 0050 0", - "deal_type": 2, - }, - { - "name": " Port 9", - "cmd": "grtd_test.py dev_rd 19 0050 0", - "deal_type": 2, - }, - { - "name": " Port 10", - "cmd": "grtd_test.py dev_rd 20 0050 0", - "deal_type": 2, - }, - { - "name": " Port 11", - "cmd": "grtd_test.py dev_rd 21 0050 0", - "deal_type": 2, - }, - { - "name": " Port 12", - "cmd": "grtd_test.py dev_rd 22 0050 0", - "deal_type": 2, - }, - { - "name": " Port 13", - "cmd": "grtd_test.py dev_rd 23 0050 0", - "deal_type": 2, - }, - { - "name": " Port 14", - "cmd": "grtd_test.py dev_rd 24 0050 0", - "deal_type": 2, - }, - { - "name": " Port 15", - "cmd": "grtd_test.py dev_rd 25 0050 0", - "deal_type": 2, - }, - { - "name": " Port 16", - "cmd": "grtd_test.py dev_rd 26 0050 0", - "deal_type": 2, - }, - { - "name": " Port 17", - "cmd": "grtd_test.py dev_rd 27 0050 0", - "deal_type": 2, - }, - { - "name": " Port 18", - "cmd": "grtd_test.py dev_rd 28 0050 0", - "deal_type": 2, - }, - { - "name": " Port 19", - "cmd": "grtd_test.py dev_rd 29 0050 0", - "deal_type": 2, - }, - { - "name": " Port 20", - "cmd": "grtd_test.py dev_rd 30 0050 0", - "deal_type": 2, - }, - { - "name": " Port 21", - "cmd": "grtd_test.py dev_rd 31 0050 0", - "deal_type": 2, - }, - { - "name": " Port 22", - "cmd": "grtd_test.py dev_rd 32 0050 0", - "deal_type": 2, - }, - { - "name": " Port 23", - "cmd": "grtd_test.py dev_rd 33 0050 0", - "deal_type": 2, - }, - { - "name": " Port 24", - "cmd": "grtd_test.py dev_rd 34 0050 0", - "deal_type": 2, - }, - { - "name": " Port 25", - "cmd": "grtd_test.py dev_rd 35 0050 0", - "deal_type": 2, - }, - { - "name": " Port 26", - "cmd": "grtd_test.py dev_rd 36 0050 0", - "deal_type": 2, - }, - { - "name": " Port 27", - "cmd": "grtd_test.py dev_rd 37 0050 0", - "deal_type": 2, - }, - { - "name": " Port 28", - "cmd": "grtd_test.py dev_rd 38 0050 0", - "deal_type": 2, - }, - { - "name": " Port 29", - "cmd": "grtd_test.py dev_rd 39 0050 0", - "deal_type": 2, - }, - { - "name": " Port 30", - "cmd": "grtd_test.py dev_rd 40 0050 0", - "deal_type": 2, - }, - { - "name": " Port 31", - "cmd": "grtd_test.py dev_rd 41 0050 0", - "deal_type": 2, - }, - { - "name": " Port 32", - "cmd": "grtd_test.py dev_rd 42 0050 0", - "deal_type": 2, - }, - { - "name": " Port 33", - "cmd": "grtd_test.py dev_rd 43 0050 0", - "deal_type": 2, - }, - { - "name": " Port 34", - "cmd": "grtd_test.py dev_rd 44 0050 0", - "deal_type": 2, - }, - { - "name": " Port 35", - "cmd": "grtd_test.py dev_rd 45 0050 0", - "deal_type": 2, - }, - { - "name": " Port 36", - "cmd": "grtd_test.py dev_rd 46 0050 0", - "deal_type": 2, - }, - { - "name": " Port 37", - "cmd": "grtd_test.py dev_rd 47 0050 0", - "deal_type": 2, - }, - { - "name": " Port 38", - "cmd": "grtd_test.py dev_rd 48 0050 0", - "deal_type": 2, - }, - { - "name": " Port 39", - "cmd": "grtd_test.py dev_rd 49 0050 0", - "deal_type": 2, - }, - { - "name": " Port 40", - "cmd": "grtd_test.py dev_rd 50 0050 0", - "deal_type": 2, - }, - { - "name": " Port 41", - "cmd": "grtd_test.py dev_rd 51 0050 0", - "deal_type": 2, - }, - { - "name": " Port 42", - "cmd": "grtd_test.py dev_rd 52 0050 0", - "deal_type": 2, - }, - { - "name": " Port 43", - "cmd": "grtd_test.py dev_rd 53 0050 0", - "deal_type": 2, - }, - { - "name": " Port 44", - "cmd": "grtd_test.py dev_rd 54 0050 0", - "deal_type": 2, - }, - { - "name": " Port 45", - "cmd": "grtd_test.py dev_rd 55 0050 0", - "deal_type": 2, - }, - { - "name": " Port 46", - "cmd": "grtd_test.py dev_rd 56 0050 0", - "deal_type": 2, - }, - { - "name": " Port 47", - "cmd": "grtd_test.py dev_rd 57 0050 0", - "deal_type": 2, - }, - { - "name": " Port 48", - "cmd": "grtd_test.py dev_rd 58 0050 0", - "deal_type": 2, - }, - { - "name": " Port 49", - "cmd": "grtd_test.py dev_rd 59 0050 0", - "deal_type": 2, - }, - { - "name": " Port 50", - "cmd": "grtd_test.py dev_rd 60 0050 0", - "deal_type": 2, - }, - { - "name": " Port 51", - "cmd": "grtd_test.py dev_rd 61 0050 0", - "deal_type": 2, - }, - { - "name": " Port 52", - "cmd": "grtd_test.py dev_rd 62 0050 0", - "deal_type": 2, - }, - { - "name": " Port 53", - "cmd": "grtd_test.py dev_rd 63 0050 0", - "deal_type": 2, - }, - { - "name": " Port 54", - "cmd": "grtd_test.py dev_rd 64 0050 0", - "deal_type": 2, - }, - { - "name": " Port 55", - "cmd": "grtd_test.py dev_rd 65 0050 0", - "deal_type": 2, - }, - { - "name": " Port 56", - "cmd": "grtd_test.py dev_rd 66 0050 0", - "deal_type": 2, - }, - { - "name": " Port 57", - "cmd": "grtd_test.py dev_rd 67 0050 0", - "deal_type": 2, - }, - { - "name": " Port 58", - "cmd": "grtd_test.py dev_rd 68 0050 0", - "deal_type": 2, - }, - { - "name": " Port 59", - "cmd": "grtd_test.py dev_rd 69 0050 0", - "deal_type": 2, - }, - { - "name": " Port 60", - "cmd": "grtd_test.py dev_rd 70 0050 0", - "deal_type": 2, - }, - { - "name": " Port 61", - "cmd": "grtd_test.py dev_rd 71 0050 0", - "deal_type": 2, - }, - { - "name": " Port 62", - "cmd": "grtd_test.py dev_rd 72 0050 0", - "deal_type": 2, - }, - { - "name": " Port 63", - "cmd": "grtd_test.py dev_rd 73 0050 0", - "deal_type": 2, - }, - { - "name": " Port 64", - "cmd": "grtd_test.py dev_rd 74 0050 0", - "deal_type": 2, - }, - ], - }, - ], -} - -PCIe_DEV_LIST = [] -PCIe_SPEED_ITEM = [] - -################################Manufacturing-Test-Adaption-Area####################################################### diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragileconfig.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragileconfig.py deleted file mode 100644 index 90085fbf64..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragileconfig.py +++ /dev/null @@ -1,228 +0,0 @@ -#!/usr/bin/python3 -# -*- coding: UTF-8 -*- -# ------------------------------------------------------------------------------- -# Name: ragileconfig.py -# Purpose: block the difference between various product/onie version for other module -# -# Author: rd -# -# Created: 02/07/2018 -# Copyright: (c) rd 2018 -# ------------------------------------------------------------------------------- -import sys -import os -import logging -from rgutil.baseutil import get_machine_info -from rgutil.baseutil import get_platform_info - -__all__ = [ - "getdeviceplatform", - "get_rjconfig_info", - "MONITOR_CONST", - "MAILBOX_DIR", - "DEVICE", - "GLOBALCONFIG", - "GLOBALINITPARAM", - "GLOBALINITCOMMAND", - "MAC_LED_RESET", - "STARTMODULE", - "fanloc", - "RAGILE_CARDID", - "RAGILE_PRODUCTNAME", - "RAGILE_PART_NUMBER", - "RAGILE_LABEL_REVISION", - "RAGILE_MAC_SIZE", - "RAGILE_MANUF_NAME", - "RAGILE_MANUF_COUNTRY", - "RAGILE_VENDOR_NAME", - "RAGILE_DIAG_VERSION", - "RAGILE_SERVICE_TAG", - "E2_PROTECT", - "E2_LOC", - "FAN_PROTECT", - "FANS_DEF", - "MONITOR_FANS_LED", - "MONITOR_SYS_FAN_LED", - "MONITOR_SYS_PSU_LED", - "MONITOR_FAN_STATUS", - "MONITOR_PSU_STATUS", - "MONITOR_DEV_STATUS", - "MONITOR_DEV_STATUS_DECODE", - "DEV_LEDS", - "MAC_AVS_PARAM", - "MAC_DEFAULT_PARAM", - "FRULISTS", - "rg_eeprom", - "i2ccheck_params", - "FANCTROLDEBUG", - "DEVMONITORDEBUG", -] - - -def getdeviceplatform(): - x = get_platform_info(get_machine_info()) - if x != None: - filepath = "/usr/share/sonic/device/" + x - return filepath - else: - return None - - -platform = get_platform_info(get_machine_info()) -platformpath = getdeviceplatform() -MAILBOX_DIR = "/sys/bus/i2c/devices/" -grtd_productfile = (platform + "_config").replace("-", "_") -common_productfile = "ragilecommon" -configfile_pre = "/usr/local/bin/" - -sys.path.append(platformpath) -sys.path.append(configfile_pre) - - -def get_rjconfig_info(attr_key): - rjconf_filename = platformpath + "/plugins" + "/rj.conf" - if not os.path.isfile(rjconf_filename): - return None - with open(rjconf_filename) as rjconf_file: - for line in rjconf_file: - tokens = line.split("=") - if len(tokens) < 2: - continue - if tokens[0] == attr_key: - return tokens[1].strip() - return None - - -#####BMC-Password### -OPENBMC_PASSWORD = get_rjconfig_info("OPENBMC_PASSWORD") -OPENBMC_PASSWORD = OPENBMC_PASSWORD if (OPENBMC_PASSWORD != None) else "0penBmc" - -############################################################################################ -## if there is no specific file, use common file -module_product = None -if os.path.exists(configfile_pre + grtd_productfile + ".py"): - module_product = __import__(grtd_productfile, globals(), locals(), [], 0) -elif os.path.exists(configfile_pre + common_productfile + ".py"): - module_product = __import__(common_productfile, globals(), locals(), [], 0) -else: - logging.info("No Configuration existed, quit") - exit(-1) -############################################################################################ - -DEVICE = module_product.DEVICE - -##########Driver loading needs parameters -# get different product configuration -RAGILE_GLOBALCONFIG = { - "DRIVERLISTS": module_product.DRIVERLISTS, - "QSFP": { - "startbus": module_product.PCA9548START, - "endbus": module_product.PCA9548BUSEND, - }, - "DEVS": DEVICE, -} -GLOBALCONFIG = RAGILE_GLOBALCONFIG -GLOBALINITPARAM = module_product.INIT_PARAM -GLOBALINITCOMMAND = module_product.INIT_COMMAND - -fancontrol_loc = module_product.fancontrol_loc -fancontrol_config_loc = module_product.fancontrol_config_loc -MAC_LED_RESET = module_product.MAC_LED_RESET -###########Stat-up module parameters -STARTMODULE = module_product.STARTMODULE -FIRMWARE_TOOLS = module_product.FIRMWARE_TOOLS - - -##########Manufacturing-Test need parameters -FACTESTMODULE = module_product.FACTESTMODULE -TESTCASE = module_product.TESTCASE -menuList = module_product.menuList -alltest = module_product.alltest -diagtestall = module_product.diagtestall -looptest = module_product.looptest -fanloc = module_product.fanloc -fanlevel = module_product.fanlevel # fan adjustment level -TEMPIDCHANGE = module_product.TEMPIDCHANGE -CPLDVERSIONS = module_product.CPLDVERSIONS -RAGILE_CARDID = module_product.RAGILE_CARDID -RAGILE_PRODUCTNAME = module_product.RAGILE_PRODUCTNAME - -RAGILE_PART_NUMBER = module_product.RAGILE_PART_NUMBER -RAGILE_LABEL_REVISION = module_product.RAGILE_LABEL_REVISION -RAGILE_ONIE_VERSION = module_product.RAGILE_ONIE_VERSION -RAGILE_MAC_SIZE = module_product.RAGILE_MAC_SIZE -RAGILE_MANUF_NAME = module_product.RAGILE_MANUF_NAME -RAGILE_MANUF_COUNTRY = module_product.RAGILE_MANUF_COUNTRY -RAGILE_VENDOR_NAME = module_product.RAGILE_VENDOR_NAME -RAGILE_DIAG_VERSION = module_product.RAGILE_DIAG_VERSION -RAGILE_SERVICE_TAG = module_product.RAGILE_SERVICE_TAG - -E2_PROTECT = module_product.E2_PROTECT -E2_LOC = module_product.E2_LOC -FAN_PROTECT = module_product.FAN_PROTECT - -FANS_DEF = module_product.FANS_DEF -MONITOR_SYS_LED = module_product.MONITOR_SYS_LED -MONITOR_FANS_LED = module_product.MONITOR_FANS_LED -MONITOR_SYS_FAN_LED = module_product.MONITOR_SYS_FAN_LED -MONITOR_SYS_PSU_LED = module_product.MONITOR_SYS_PSU_LED -MONITOR_FAN_STATUS = module_product.MONITOR_FAN_STATUS -MONITOR_PSU_STATUS = module_product.MONITOR_PSU_STATUS -MONITOR_DEV_STATUS = module_product.MONITOR_DEV_STATUS -MONITOR_DEV_STATUS_DECODE = module_product.MONITOR_DEV_STATUS_DECODE -DEV_MONITOR_PARAM = module_product.DEV_MONITOR_PARAM -SLOT_MONITOR_PARAM = module_product.SLOT_MONITOR_PARAM - - -DEV_LEDS = module_product.DEV_LEDS -MEM_SLOTS = module_product.MEM_SLOTS - -MAC_AVS_PARAM = module_product.MAC_AVS_PARAM -MAC_DEFAULT_PARAM = module_product.MAC_DEFAULT_PARAM -E2TYPE = module_product.E2TYPE -FRULISTS = module_product.FRULISTS -rg_eeprom = "%d-%04x/eeprom" % (E2_LOC["bus"], E2_LOC["devno"]) -factest_module = module_product.factest_module - -LOCAL_LED_CONTROL = module_product.LOCAL_LED_CONTROL - -PCIe_DEV_LIST = module_product.PCIe_DEV_LIST -PCIe_SPEED_ITEM = module_product.PCIe_SPEED_ITEM -i2ccheck_params = module_product.i2ccheck_params - - -class MONITOR_CONST: - TEMP_MIN = module_product.MONITOR_TEMP_MIN - K = module_product.MONITOR_K - MAC_IN = module_product.MONITOR_MAC_IN - DEFAULT_SPEED = module_product.MONITOR_DEFAULT_SPEED - MAX_SPEED = module_product.MONITOR_MAX_SPEED - MIN_SPEED = module_product.MONITOR_MIN_SPEED - MAC_ERROR_SPEED = module_product.MONITOR_MAC_ERROR_SPEED - FAN_TOTAL_NUM = module_product.MONITOR_FAN_TOTAL_NUM - MAC_UP_TEMP = module_product.MONITOR_MAC_UP_TEMP - MAC_LOWER_TEMP = module_product.MONITOR_MAC_LOWER_TEMP - MAC_MAX_TEMP = module_product.MONITOR_MAC_MAX_TEMP - - MAC_WARNING_THRESHOLD = module_product.MONITOR_MAC_WARNING_THRESHOLD - OUTTEMP_WARNING_THRESHOLD = module_product.MONITOR_OUTTEMP_WARNING_THRESHOLD - BOARDTEMP_WARNING_THRESHOLD = module_product.MONITOR_BOARDTEMP_WARNING_THRESHOLD - CPUTEMP_WARNING_THRESHOLD = module_product.MONITOR_CPUTEMP_WARNING_THRESHOLD - INTEMP_WARNING_THRESHOLD = module_product.MONITOR_INTEMP_WARNING_THRESHOLD - - MAC_CRITICAL_THRESHOLD = module_product.MONITOR_MAC_CRITICAL_THRESHOLD - OUTTEMP_CRITICAL_THRESHOLD = module_product.MONITOR_OUTTEMP_CRITICAL_THRESHOLD - BOARDTEMP_CRITICAL_THRESHOLD = module_product.MONITOR_BOARDTEMP_CRITICAL_THRESHOLD - CPUTEMP_CRITICAL_THRESHOLD = module_product.MONITOR_CPUTEMP_CRITICAL_THRESHOLD - INTEMP_CRITICAL_THRESHOLD = module_product.MONITOR_INTEMP_CRITICAL_THRESHOLD - CRITICAL_NUM = module_product.MONITOR_CRITICAL_NUM - SHAKE_TIME = module_product.MONITOR_SHAKE_TIME - MONITOR_INTERVAL = module_product.MONITOR_INTERVAL - MONITOR_FALL_TEMP = module_product.MONITOR_FALL_TEMP - - MONITOR_MAC_SOURCE_SYSFS = module_product.MONITOR_MAC_SOURCE_SYSFS - MONITOR_MAC_SOURCE_PATH = module_product.MONITOR_MAC_SOURCE_PATH - - -FANCTROLDEBUG = 0 # 1 means enable -DEVMONITORDEBUG = 0 # 1 means enable diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragileutil.py b/platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragileutil.py deleted file mode 100644 index 365fcb56a7..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/ragileutil.py +++ /dev/null @@ -1,2088 +0,0 @@ -# -*- coding: UTF-8 -*- -# ------------------------------------------------------------------------- -# Name: ragileutil -# Purpose: common configuration and api -# -# Author: rd -# -# Created: 02/07/2018 -# Copyright: (c) rd 2018 -# ------------------------------------------------------------------------- -import sys - -if sys.version_info >= (3, 0): - import subprocess as commands -else: - import commands -import os -import re -import syslog -import time -import binascii -import tty -import termios -import threading -import click -import mmap -from ragileconfig import ( - rg_eeprom, - FRULISTS, - MAC_DEFAULT_PARAM, - MAC_AVS_PARAM, - FANS_DEF, - FAN_PROTECT, - E2_LOC, - E2_PROTECT, - RAGILE_SERVICE_TAG, - RAGILE_DIAG_VERSION, - STARTMODULE, - RAGILE_CARDID, - RAGILE_PRODUCTNAME, - RAGILE_PART_NUMBER, - RAGILE_LABEL_REVISION, - RAGILE_MAC_SIZE, - RAGILE_MANUF_NAME, - RAGILE_MANUF_COUNTRY, - RAGILE_VENDOR_NAME, - MAILBOX_DIR, -) - -try: - from eepromutil.fru import ipmifru -except Exception or SystemExit: - print("error") - -import logging.handlers -import shutil -import gzip -import glob - -__all__ = [ - "MENUID", - "MENUPARENT", - "MENUVALUE", - "CHILDID", - "MENUITEMNAME", - "MENUITEMDEAL", - "GOBACK", - "GOQUIT", - "file_name", - "CRITICAL", - "FATAL", - "ERROR", - "WARNING", - "WARN", - "INFO", - "DEBUG", - "NOTSET", - "levelNames", - "TLV_INFO_ID_STRING", - "TLV_INFO_VERSION", - "TLV_INFO_LENGTH", - "TLV_INFO_LENGTH_VALUE", - "TLV_CODE_PRODUCT_NAME", - "TLV_CODE_PART_NUMBER", - "TLV_CODE_SERIAL_NUMBER", - "TLV_CODE_MAC_BASE", - "TLV_CODE_MANUF_DATE", - "TLV_CODE_DEVICE_VERSION", - "TLV_CODE_LABEL_REVISION", - "TLV_CODE_PLATFORM_NAME", - "TLV_CODE_ONIE_VERSION", - "TLV_CODE_MAC_SIZE", - "TLV_CODE_MANUF_NAME", - "TLV_CODE_MANUF_COUNTRY", - "TLV_CODE_VENDOR_NAME", - "TLV_CODE_DIAG_VERSION", - "TLV_CODE_SERVICE_TAG", - "TLV_CODE_VENDOR_EXT", - "TLV_CODE_CRC_32", - "_TLV_DISPLAY_VENDOR_EXT", - "TLV_CODE_RJ_CARID", - "_TLV_INFO_HDR_LEN", - "SYSLOG_IDENTIFIER", - "log_info", - "log_debug", - "log_warning", - "log_error", - "CompressedRotatingFileHandler", - "SETMACException", - "checkinput", - "checkinputproduct", - "getInputSetmac", - "fan_tlv", - "AVSUTIL", - "I2CUTIL", - "BMC", - "getSdkReg", - "getfilevalue", - "get_sysfs_value", - "write_sysfs_value", - "RJPRINTERR", - "strtoint", - "inttostr", - "str_to_hex", - "hex_to_str", - "str_to_bin", - "bin_to_str", - "get_mac_temp", - "get_mac_temp_sysfs", - "restartDockerService", - "wait_dhcp", - "wait_sdk", - "wait_docker", - "getTLV_BODY", - "_crc32", - "printvalue", - "generate_value", - "getsyseeprombyId", - "fac_init_cardidcheck", - "isValidMac", - "util_setmac", - "getInputCheck", - "getrawch", - "upper_input", - "changeTypeValue", - "astrcmp", - "generate_ext", - "rgi2cget", - "rgi2cset", - "rgpcird", - "rgpciwr", - "rgsysset", - "rgi2cget_word", - "rgi2cset_word", - "fan_setmac", - "checkfansninput", - "checkfanhwinput", - "util_show_fanse2", - "get_fane2_sysfs", - "util_show_fane2", - "getPid", - "fac_fans_setmac_tlv", - "fac_fan_setmac_fru", - "fac_fans_setmac", - "fac_fan_setmac", - "writeToEEprom", - "get_local_eth0_mac", - "getonieversion", - "createbmcMac", - "fac_board_setmac", - "ipmi_set_mac", - "getInputValue", - "bmc_setmac", - "closeProtocol", - "checkSdkMem", - "getch", - "get_raw_input", - "getsysvalue", - "get_pmc_register", - "decoder", - "decode_eeprom", - "get_sys_eeprom", - "getCardId", - "getsysmeminfo", - "getsysmeminfo_detail", - "getDmiSysByType", - "gethwsys", - "getsysbios", - "searchDirByName", - "getUsbLocation", - "getusbinfo", - "get_cpu_info", - "get_version_config_info", - "io_rd", - "io_wr", -] - -MENUID = "menuid" -MENUPARENT = "parentid" -MENUVALUE = "value" -CHILDID = "childid" -MENUITEMNAME = "name" -MENUITEMDEAL = "deal" -GOBACK = "goBack" -GOQUIT = "quit" - -file_name = "/etc/init.d/opennsl-modules-3.16.0-5-amd64" -########################################################################## -# ERROR LOG LEVEL -########################################################################## -CRITICAL = 50 -FATAL = CRITICAL -ERROR = 40 -WARNING = 30 -WARN = WARNING -INFO = 20 -DEBUG = 10 -NOTSET = 0 - -levelNames = { - CRITICAL: "CRITICAL", - ERROR: "ERROR", - WARNING: "WARNING", - INFO: "INFO", - DEBUG: "DEBUG", - NOTSET: "NOTSET", - "CRITICAL": CRITICAL, - "ERROR": ERROR, - "WARN": WARNING, - "WARNING": WARNING, - "INFO": INFO, - "DEBUG": DEBUG, - "NOTSET": NOTSET, -} - -TLV_INFO_ID_STRING = "TlvInfo\x00" -TLV_INFO_VERSION = 0x01 -TLV_INFO_LENGTH = 0x00 -TLV_INFO_LENGTH_VALUE = 0xBA - -########################################################################## -# eeprom info -########################################################################## -TLV_CODE_PRODUCT_NAME = 0x21 -TLV_CODE_PART_NUMBER = 0x22 -TLV_CODE_SERIAL_NUMBER = 0x23 -TLV_CODE_MAC_BASE = 0x24 -TLV_CODE_MANUF_DATE = 0x25 -TLV_CODE_DEVICE_VERSION = 0x26 -TLV_CODE_LABEL_REVISION = 0x27 -TLV_CODE_PLATFORM_NAME = 0x28 -TLV_CODE_ONIE_VERSION = 0x29 -TLV_CODE_MAC_SIZE = 0x2A -TLV_CODE_MANUF_NAME = 0x2B -TLV_CODE_MANUF_COUNTRY = 0x2C -TLV_CODE_VENDOR_NAME = 0x2D -TLV_CODE_DIAG_VERSION = 0x2E -TLV_CODE_SERVICE_TAG = 0x2F -TLV_CODE_VENDOR_EXT = 0xFD -TLV_CODE_CRC_32 = 0xFE -_TLV_DISPLAY_VENDOR_EXT = 1 -TLV_CODE_RJ_CARID = 0x01 -_TLV_INFO_HDR_LEN = 11 - - -SYSLOG_IDENTIFIER = "UTILTOOL" - -# ========================== Syslog wrappers ========================== - - -def log_info(msg, also_print_to_console=False): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - - if also_print_to_console: - click.echo(msg) - - -def log_debug(msg, also_print_to_console=False): - try: - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_DEBUG, msg) - syslog.closelog() - - if also_print_to_console: - click.echo(msg) - except Exception as e: - print(str(e)) - - -def log_warning(msg, also_print_to_console=False): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_WARNING, msg) - syslog.closelog() - - if also_print_to_console: - click.echo(msg) - - -def log_error(msg, also_print_to_console=False): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - - if also_print_to_console: - click.echo(msg) - - -class CompressedRotatingFileHandler(logging.handlers.RotatingFileHandler): - def doRollover(self): - """ - Do a rollover, as described in __init__(). - """ - if self.stream: - self.stream.close() - self.stream = None - if self.backupCount > 0: - for i in range(self.backupCount - 1, 0, -1): - sfn = "%s.%d.gz" % (self.baseFilename, i) - dfn = "%s.%d.gz" % (self.baseFilename, i + 1) - if os.path.exists(sfn): - if os.path.exists(dfn): - os.remove(dfn) - os.rename(sfn, dfn) - dfn = self.baseFilename + ".1.gz" - if os.path.exists(dfn): - os.remove(dfn) - # These two lines below are the only new lines. I commented out the os.rename(self.baseFilename, dfn) and - # replaced it with these two lines. - with open(self.baseFilename, "rb") as f_in, gzip.open(dfn, "wb") as f_out: - shutil.copyfileobj(f_in, f_out) - self.mode = "w" - self.stream = self._open() - - -class SETMACException(Exception): - def __init__(self, param="ERROR", errno="-1"): - err = "Setmac fail[%s]: %s" % (errno, param) - Exception.__init__(self, err) - self.param = param - self.errno = errno - - -def checkinput(b): - if b.isdigit() == False: - raise Exception("Ivalid Number") - if int(b) > 0xFF or int(b) < 0: - raise Exception("Out of area") - - -def checkinputproduct(b): - if b.isalnum() == False: - raise Exception("Invalid string") - - -def getInputSetmac(val): - bia = val.boardInfoArea - pia = val.productInfoArea - if bia != None: - a = raw_input("[Board Card]Product Serial Number:") - if len(a) != 13: - raise Exception("Invalid Serial Number length") - checkinputproduct(a) - bia.boardSerialNumber = a - b = raw_input("[Board Card]Product Version:(from 1-255)") - checkinput(b) - b = "%0x" % int(b) - bia.boardextra1 = b.upper() - if pia != None: - a = raw_input("[Product Area]Product Serial Number:") - if len(a) != 13: - raise Exception("Invalid Serial Number") - checkinputproduct(a) - pia.productSerialNumber = a - b = raw_input("[Product Area]Product Version:(from 1-255)") - checkinput(b) - b = "%0x" % int(b) - pia.productVersion = b.upper() - return val - - -class fan_tlv(object): - VERSION = 0x01 # E2PROM Version, start from 0x01 - FLAG = 0x7E # New E2PROM version flag is 0x7E - HW_VER = 0x01 # compose by master version and fixed version - TYPE = 0xF1 # hw type defination - TLV_LEN = 00 # data length (16bit) - _FAN_TLV_HDR_LEN = 6 - _FAN_TLV_CRC_LEN = 2 - - _FAN_TLV_TYPE_NAME = 0x02 - _FAN_TLV_TYPE_SN = 0x03 - _FAN_TLV_TYPE_HW_INFO = 0x05 - _FAN_TLV_TYPE_DEV_TYPE = 0x06 - - _fandecodetime = 0 - - @property - def dstatus(self): - return self._dstatus - - @property - def typename(self): - return self._typename - - @property - def typesn(self): - return self._typesn - - @property - def typehwinfo(self): - return self._typehwinfo - - @property - def typedevtype(self): - return self._typedevtype - - @property - def fanbus(self): - return self._fanbus - - @property - def fanloc(self): - return self._fanloc - - @property - def fandecodetime(self): - return self._fandecodetime - - def __init__(self): - self._typename = "" - self._typesn = "" - self._typehwinfo = "" - self._typedevtype = "" - self._dstatus = 0 - - def strtoarr(self, str): - s = [] - if str is not None: - for index in range(len(str)): - s.append(str[index]) - return s - - def generate_fan_value(self): - bin_buffer = [chr(0xFF)] * 256 - bin_buffer[0] = chr(self.VERSION) - bin_buffer[1] = chr(self.FLAG) - bin_buffer[2] = chr(self.HW_VER) - bin_buffer[3] = chr(self.TYPE) - - temp_t = "%08x" % self.typedevtype # handle devtype first - typedevtype_t = hex_to_str(temp_t) - total_len = ( - len(self.typename) - + len(self.typesn) - + len(self.typehwinfo) - + len(typedevtype_t) - + 8 - ) - - bin_buffer[4] = chr(total_len >> 8) - bin_buffer[5] = chr(total_len & 0x00FF) - - index_start = 6 - bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_NAME) - bin_buffer[index_start + 1] = chr(len(self.typename)) - bin_buffer[ - index_start + 2 : index_start + 2 + len(self.typename) - ] = self.strtoarr(self.typename) - index_start = index_start + 2 + len(self.typename) - - bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_SN) - bin_buffer[index_start + 1] = chr(len(self.typesn)) - bin_buffer[ - index_start + 2 : index_start + 2 + len(self.typesn) - ] = self.strtoarr(self.typesn) - index_start = index_start + 2 + len(self.typesn) - - bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_HW_INFO) - bin_buffer[index_start + 1] = chr(len(self.typehwinfo)) - bin_buffer[ - index_start + 2 : index_start + 2 + len(self.typehwinfo) - ] = self.strtoarr(self.typehwinfo) - index_start = index_start + 2 + len(self.typehwinfo) - - bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_DEV_TYPE) - bin_buffer[index_start + 1] = chr(len(typedevtype_t)) - bin_buffer[ - index_start + 2 : index_start + 2 + len(typedevtype_t) - ] = self.strtoarr(typedevtype_t) - index_start = index_start + 2 + len(typedevtype_t) - - crcs = fan_tlv.fancrc("".join(bin_buffer[0:index_start])) # check 2bytes - bin_buffer[index_start] = chr(crcs >> 8) - bin_buffer[index_start + 1] = chr(crcs & 0x00FF) - return bin_buffer - - def decode(self, e2): - ret = [] - self.VERSION = ord(e2[0]) - self.FLAG = ord(e2[1]) - self.HW_VER = ord(e2[2]) - self.TYPE = ord(e2[3]) - self.TLV_LEN = (ord(e2[4]) << 8) | ord(e2[5]) - - tlv_index = self._FAN_TLV_HDR_LEN - tlv_end = self._FAN_TLV_HDR_LEN + self.TLV_LEN - - # check checksum - if len(e2) < self._FAN_TLV_HDR_LEN + self.TLV_LEN + 2: - self._dstatus = -2 - return ret - sumcrc = fan_tlv.fancrc(e2[0 : self._FAN_TLV_HDR_LEN + self.TLV_LEN]) - readcrc = ord(e2[self._FAN_TLV_HDR_LEN + self.TLV_LEN]) << 8 | ord( - e2[self._FAN_TLV_HDR_LEN + self.TLV_LEN + 1] - ) - if sumcrc != readcrc: - self._dstatus = -1 - return ret - else: - self._dstatus = 0 - while (tlv_index + 2) < len(e2) and tlv_index < tlv_end: - s = self.decoder(e2[tlv_index : tlv_index + 2 + ord(e2[tlv_index + 1])]) - tlv_index += ord(e2[tlv_index + 1]) + 2 - ret.append(s) - - return ret - - @staticmethod - def fancrc(t): - sum = 0 - for index in range(len(t)): - sum += ord(t[index]) - return sum - - def decoder(self, t): - try: - name = "" - value = "" - if ord(t[0]) == self._FAN_TLV_TYPE_NAME: - name = "Product Name" - value = str(t[2 : 2 + ord(t[1])]) - self._typename = value - elif ord(t[0]) == self._FAN_TLV_TYPE_SN: - name = "serial Number" - value = str(t[2 : 2 + ord(t[1])]) - self._typesn = value - elif ord(t[0]) == self._FAN_TLV_TYPE_HW_INFO: - name = "hardware info" - value = str(t[2 : 2 + ord(t[1])]) - self._typehwinfo = value - elif ord(t[0]) == self._FAN_TLV_TYPE_DEV_TYPE: - name = "dev type" - value = str(t[2 : 2 + ord(t[1])]) - value = str_to_hex(value) - self._typedevtype = value - value = "0x08%x" % value - except Exception as e: - print(e) - return {"name": name, "code": ord(t[0]), "value": value} - - def __str__(self): - formatstr = ( - "VERSION : 0x%02x \n" - " FLAG : 0x%02x \n" - " HW_VER : 0x%02x \n" - " TYPE : 0x%02x \n" - "typename : %s \n" - "typesn : %s \n" - "typehwinfo : %s \n" - ) - return formatstr % ( - self.VERSION, - self.FLAG, - self.HW_VER, - self.TYPE, - self.typename, - self.typesn, - self.typehwinfo, - ) - - -class AVSUTIL: - @staticmethod - def mac_avs_chip(bus, devno, loc, open, close, loop, protectaddr, level, loopaddr): - # disable protection - rgi2cset(bus, devno, protectaddr, open) - rgi2cset(bus, devno, loopaddr, loop) - rgi2cset_word(bus, devno, loc, level) - ret, value = rgi2cget_word(bus, devno, loc) - if strtoint(value) == level: - ret = 0 - # enable protection - rgi2cset(bus, devno, protectaddr, close) - if ret == 0: - return True - return False - - @staticmethod - def macPressure_adj(macavs, avs_param, mac_def_param): - # check whether it within range - max_adj = max(avs_param.keys()) - min_adj = min(avs_param.keys()) - type = mac_def_param["type"] - level = 0 - if type == 0: - if macavs not in range(min_adj, max_adj + 1): - return False - else: - level = macavs - else: - if macavs not in range(min_adj, max_adj + 1): - level = mac_def_param["default"] - else: - level = macavs - ret = AVSUTIL.mac_avs_chip( - mac_def_param["bus"], - mac_def_param["devno"], - mac_def_param["addr"], - mac_def_param["open"], - mac_def_param["close"], - mac_def_param["loop"], - mac_def_param["protectaddr"], - avs_param[level], - mac_def_param["loopaddr"], - ) - return ret - - @staticmethod - def mac_adj(): - macavs = 0 - name = MAC_DEFAULT_PARAM["sdkreg"] - ret, status = getSdkReg(name) - if ret == False: - return False - status = strtoint(status) - # shift operation - if MAC_DEFAULT_PARAM["sdktype"] != 0: - status = (status >> MAC_DEFAULT_PARAM["macregloc"]) & MAC_DEFAULT_PARAM[ - "mask" - ] - macavs = status - ret = AVSUTIL.macPressure_adj(macavs, MAC_AVS_PARAM, MAC_DEFAULT_PARAM) - return ret - - -class I2CUTIL: - @staticmethod - def getvaluefromdevice(name): - ret = [] - for item in DEVICE: - if item["name"] == name: - ret.append(item) - return ret - - @staticmethod - def openFanE2Protect(): - rgi2cset( - FAN_PROTECT["bus"], - FAN_PROTECT["devno"], - FAN_PROTECT["addr"], - FAN_PROTECT["open"], - ) - - @staticmethod - def closeFanE2Protect(): - rgi2cset( - FAN_PROTECT["bus"], - FAN_PROTECT["devno"], - FAN_PROTECT["addr"], - FAN_PROTECT["close"], - ) - - @staticmethod - def writeToFanE2(bus, loc, rst_arr): - index = 0 - for item in rst_arr: - rgi2cset(bus, loc, index, ord(item)) - index += 1 - - @staticmethod - def writeToE2(bus, loc, rst_arr): - index = 0 - for item in rst_arr: - rgi2cset(bus, loc, index, ord(item)) - index += 1 - - @staticmethod - def getE2File(bus, loc): - return "/sys/bus/i2c/devices/%d-00%02x/eeprom" % (bus, loc) - - -class BMC(): - _instance_lock = threading.Lock() - - def __init__(self): - pass - - def __new__(cls, *args, **kwargs): - if not hasattr(Singleton, "_instance"): - with Singleton._instance_lock: - if not hasattr(Singleton, "_instance"): - Singleton._instance = object.__new__(cls) - return Singleton._instance - - -# Internal interface - - -def getSdkReg(reg): - try: - cmd = "bcmcmd -t 1 'getr %s ' < /dev/null" % reg - ret, result = os_system(cmd) - result_t = result.strip().replace("\r", "").replace("\n", "") - if ret != 0 or "Error:" in result_t: - return False, result - patt = r"%s.(.*):(.*)>drivshell" % reg - rt = re.findall(patt, result_t, re.S) - test = re.findall("=(.*)", rt[0][0])[0] - except Exception as e: - return False, "getsdk register error" - return True, test - - -def getfilevalue(location): - try: - with open(location, "r") as fd: - value = fd.read() - return True, value.strip() - except Exception as e: - return False, "error" - - -def get_sysfs_value(location): - pos_t = str(location) - name = get_pmc_register(pos_t) - return name - - -def write_sysfs_value(reg_name, value): - fileLoc = MAILBOX_DIR + reg_name - try: - if not os.path.isfile(fileLoc): - print(fileLoc, "not found !") - return False - with open(fileLoc, "w") as fd: - fd.write(value) - except Exception as error: - log_error("Unable to open " + fileLoc + "file !") - return False - return True - - -def RJPRINTERR(str): - print("\033[0;31m%s\033[0m" % str) - - -def strtoint(str): # convert Hex string to int such as "4040"/"0x4040"/"0X4040" = 16448 - value = 0 - rest_v = str.replace("0X", "").replace("0x", "") - for index in range(len(rest_v)): - value |= int(rest_v[index], 16) << ((len(rest_v) - index - 1) * 4) - return value - - -def inttostr(vl, len): # convert int to string such as 0x3030 = 00 - if type(vl) != int: - raise Exception(" type error") - index = 0 - ret_t = "" - while index < len: - ret = 0xFF & (vl >> index * 8) - ret_t += chr(ret) - index += 1 - return ret_t - - -def str_to_hex(rest_v): - value = 0 - for index in range(len(rest_v)): - value |= ord(rest_v[index]) << ((len(rest_v) - index - 1) * 8) - return value - - -def hex_to_str(s): - len_t = len(s) - if len_t % 2 != 0: - return 0 - ret = "" - for t in range(0, int(len_t / 2)): - ret += chr(int(s[2 * t : 2 * t + 2], 16)) - return ret - - -def str_to_bin(s): - return " ".join([bin(ord(c)).replace("0b", "") for c in s]) - - -def bin_to_str(s): - return "".join([chr(i) for i in [int(b, 2) for b in s.split(" ")]]) - - -def get_mac_temp(): - result = {} - # wait_docker() - # exec twice, get the second result - os_system('bcmcmd -t 1 "show temp" < /dev/null') - ret, log = os_system('bcmcmd -t 1 "show temp" < /dev/null') - if ret: - return False, result - else: - # decode obtained info - logs = log.splitlines() - for line in logs: - if "average" in line: - b = re.findall(r"\d+.\d+", line) - result["average"] = b[0] - elif "maximum" in line: - b = re.findall(r"\d+.\d+", line) - result["maximum"] = b[0] - return True, result - - -def get_mac_temp_sysfs(mactempconf): - try: - temp = -1000000 - temp_list = [] - mac_temp_loc = mactempconf.get("loc", []) - mac_temp_flag = mactempconf.get("flag", None) - if mac_temp_flag is not None: # check mac temperature vaild flag - gettype = mac_temp_flag.get("gettype") - okbit = mac_temp_flag.get("okbit") - okval = mac_temp_flag.get("okval") - if gettype == "io": - io_addr = mac_temp_flag.get("io_addr") - val = io_rd(io_addr) - if val is None: - raise Exception("get mac_flag by io failed.") - else: - bus = mac_temp_flag.get("bus") - loc = mac_temp_flag.get("loc") - offset = mac_temp_flag.get("offset") - ind, val = rgi2cget(bus, loc, offset) - if ind is not True: - raise Exception("get mac_flag by i2c failed.") - val_t = (int(val, 16) & (1 << okbit)) >> okbit - if val_t != okval: - raise Exception("mac_flag invalid, val_t:%d." % val_t) - for loc in mac_temp_loc: - temp_s = get_sysfs_value(loc) - if isinstance(temp_s, str) and temp_s.startswith("ERR"): - raise Exception("get mac temp error. loc:%s" % loc) - temp_t = int(temp_s) - if temp_t == -1000000: - raise Exception("mac temp invalid.loc:%s" % loc) - temp_list.append(temp_t) - temp_list.sort(reverse=True) - temp = temp_list[0] - except Exception as e: - return False, temp - return True, temp - - -def restartDockerService(force=False): - container_name = [ - "database", - "snmp", - "syncd", - "swss", - "dhcp_relay", - "radv", - "teamd", - "pmon", - ] - ret, status = os_system("docker ps") - if ret == 0: - for tmpname in container_name: - if tmpname not in status: - if force == True: - os_system("docker restart %s" % tmpname) - else: - os_system("systemctl restart %s" % tmpname) - - -def wait_dhcp(timeout): - time_cnt = 0 - while True: - try: - ret, status = os_system("systemctl status dhcp_relay.service") - if (ret == 0 and "running" in status) or "SUCCESS" in status: - break - else: - sys.stdout.write(".") - sys.stdout.flush() - time_cnt = time_cnt + 1 - if time_cnt > timeout: - raise Exception("wait_dhcp timeout") - time.sleep(1) - except Exception as e: - return False - return True - - -def wait_sdk(sdk_fpath, timeout): - time_cnt = 0 - while True: - try: - if os.path.exists(sdk_fpath): - break - else: - sys.stdout.write(".") - sys.stdout.flush() - time_cnt = time_cnt + 1 - if time_cnt > timeout: - raise Exception("wait_sdk timeout") - time.sleep(1) - except Exception as e: - return False - return True - - -def wait_docker(need_restart=False, timeout=180): - sdkcheck_params = STARTMODULE.get("sdkcheck", {}) - if sdkcheck_params.get("checktype") == "file": # pass file check - sdk_fpath = sdkcheck_params.get("sdk_fpath") - return wait_sdk(sdk_fpath, timeout) - return wait_dhcp(timeout) - - -def getTLV_BODY(type, productname): - x = [] - temp_t = "" - if type == TLV_CODE_MAC_BASE: - arr = productname.split(":") - for tt in arr: - temp_t += chr(int(tt, 16)) - elif type == TLV_CODE_DEVICE_VERSION: - temp_t = chr(productname) - elif type == TLV_CODE_MAC_SIZE: - temp_t = chr(productname >> 8) + chr(productname & 0x00FF) - else: - temp_t = productname - x.append(chr(type)) - x.append(chr(len(temp_t))) - for i in temp_t: - x.append(i) - return x - - -def _crc32(v): - return "0x%08x" % ( - binascii.crc32(v) & 0xFFFFFFFF - ) # get 8 bytes of crc32 %x return hex - - -def printvalue(b): - index = 0 - for i in range(0, len(b)): - if index % 16 == 0: - print(" ") - print("%02x " % ord(b[i])) - index += 1 - print("\n") - - -def generate_value(_t): - ret = [] - for i in TLV_INFO_ID_STRING: - ret.append(i) - ret.append(chr(TLV_INFO_VERSION)) - ret.append(chr(TLV_INFO_LENGTH)) - ret.append(chr(TLV_INFO_LENGTH_VALUE)) - - total_len = 0 - for key in _t: - x = getTLV_BODY(key, _t[key]) - ret += x - total_len += len(x) - ret[10] = chr(total_len + 6) - - ret.append(chr(0xFE)) - ret.append(chr(0x04)) - s = _crc32("".join(ret)) - for t in range(0, 4): - ret.append(chr(int(s[2 * t + 2 : 2 * t + 4], 16))) - totallen = len(ret) - if totallen < 256: - for left_t in range(0, 256 - totallen): - ret.append(chr(0x00)) - return (ret, True) - - -def getsyseeprombyId(id): - ret = get_sys_eeprom() - for item in ret: - if item["code"] == id: - return item - return None - - -def fac_init_cardidcheck(): - rest = getsyseeprombyId(TLV_CODE_RJ_CARID) # check cardId same or not - if rest is None: - print("need to program write bin file") - return False - else: - rest_v = rest["value"] - value = strtoint(rest_v) - if value == RAGILE_CARDID: - log_debug("check card ID pass") - else: - log_debug("check card ID error") - return False - return True - - -def isValidMac(mac): - if re.match(r"^\s*([0-9a-fA-F]{2,2}:){5,5}[0-9a-fA-F]{2,2}\s*$", mac): - return True - return False - - -# Internet cardsetmac - - -def util_setmac(eth, mac): - rulefile = "/etc/udev/rules.d/70-persistent-net.rules" - if isValidMac(mac) == False: - return False, "MAC invaild" - cmd = "ethtool -e %s | grep 0x0010 | awk '{print \"0x\"$13$12$15$14}'" % eth - ret, log = os_system(cmd) - log_debug(log) - magic = "" - if ret == 0 and len(log): - magic = log - macs = mac.upper().split(":") - - # chage ETH0 to value after setmac - ifconfigcmd = "ifconfig eth0 hw ether %s" % mac - log_debug(ifconfigcmd) - ret, status = os_system(ifconfigcmd) - if ret: - raise SETMACException("software set Internet card MAC error") - index = 0 - for item in macs: - cmd = "ethtool -E %s magic %s offset %d value 0x%s" % (eth, magic, index, item) - log_debug(cmd) - index += 1 - ret, log = os_system(cmd) - if ret != 0: - raise SETMACException("set hardware Internet card MAC error") - # get value after setting - cmd_t = "ethtool -e eth0 offset 0 length 6" - ret, log = os_system(cmd_t) - m = re.split(":", log)[-1].strip().upper() - mac_result = m.upper().split(" ") - - for ind, s in enumerate(macs): - if s != mac_result[ind]: - RJPRINTERR("MAC comparison error") - if os.path.exists(rulefile): - os.remove(rulefile) - print("MGMT MAC[%s]" % mac) - return True - - -def getInputCheck(tips): - str = raw_input(tips) - if ( - astrcmp(str, "y") - or astrcmp(str, "ye") - or astrcmp(str, "yes") - or astrcmp(str, "") - ): - return True - else: - return False - - -def getrawch(): - fd = sys.stdin.fileno() - old_settings = termios.tcgetattr(fd) - try: - tty.setraw(sys.stdin.fileno()) - ch = sys.stdin.read(1) - finally: - termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) - return ch - - -def upper_input(tips): - sys.stdout.write(tips) - sys.stdout.flush() - passwd = [] - while True: - ch = getrawch().upper() - if ch == "\r" or ch == "\n": - return "".join(passwd) - elif ch == "\b" or ord(ch) == 127: - if passwd: - del passwd[-1] - sys.stdout.write("\b \b") - else: - sys.stdout.write(ch) - passwd.append(ch) - - -def changeTypeValue(_value, type1, tips, example): - if type1 == TLV_CODE_PRODUCT_NAME: - while True: - print( - "please check (1)air from forward to backward/(2)air from backward to forward:" - ) - option = raw_input() - if option == "1": - _value[type1] = example + "-F-RJ" - print( - "check Product is air from forward to backward device,Product Name:%s" - % _value[type1] - ) - break - elif option == "2": - _value[type1] = example + "-R-RJ" - print( - "check Product is air from backward to forward device,Product Name:%s" - % _value[type1] - ) - break - else: - print("input incorrect, check please") - return True - print("Please input[%s]such as(%s):" % (tips, example)) - name = upper_input("") - if type1 == TLV_CODE_MAC_BASE: - if len(name) != 12: - raise SETMACException("MAC address length incorrect, check please") - release_mac = "" - for i in range(int(len(name) / 2)): - if i == 0: - release_mac += name[i * 2 : i * 2 + 2] - else: - release_mac += ":" + name[i * 2 : i * 2 + 2] - if isValidMac(release_mac) == True: - _value[type1] = release_mac - else: - raise SETMACException("MAC address invaild, check please") - elif type1 == TLV_CODE_DEVICE_VERSION: - if name.isdigit(): - _value[type1] = int(name) - else: - raise SETMACException("Version is not number, check please") - elif type1 == TLV_CODE_MAC_SIZE: - if name.isdigit(): - _value[type1] = int(name, 16) - else: - raise SETMACException("Version is not number, check please") - elif type1 == TLV_CODE_SERIAL_NUMBER: - if name.isalnum() == False: - raise SETMACException("Serial Number invaild string, check please") - elif len(name) != 13: - raise SETMACException("Serial Number length incorrect, check please") - else: - _value[type1] = name - elif type1 == TLV_CODE_VENDOR_EXT: - _value[type1] = name - else: - _value[type1] = name - return True - - -def astrcmp(str1, str2): - return str1.lower() == str2.lower() - - -def generate_ext(cardid): - s = "%08x" % cardid - ret = "" - for t in range(0, 4): - ret += chr(int(s[2 * t : 2 * t + 2], 16)) - ret = chr(0x01) + chr(len(ret)) + ret - return ret - - -def rgi2cget(bus, devno, address): - command_line = "i2cget -f -y %d 0x%02x 0x%02x " % (bus, devno, address) - retrytime = 6 - ret_t = "" - for i in range(retrytime): - ret, ret_t = os_system(command_line) - if ret == 0: - return True, ret_t - time.sleep(0.1) - return False, ret_t - - -def rgi2cset(bus, devno, address, byte): - command_line = "i2cset -f -y %d 0x%02x 0x%02x 0x%02x" % (bus, devno, address, byte) - retrytime = 6 - ret_t = "" - for i in range(retrytime): - ret, ret_t = os_system(command_line) - if ret == 0: - return True, ret_t - return False, ret_t - - -def rgpcird(pcibus, slot, fn, bar, offset): - """read pci register""" - if offset % 4 != 0: - return False - filename = "/sys/bus/pci/devices/0000:%02x:%02x.%x/resource%d" % (int(pcibus), int(slot), int(fn), int(bar)) - with open(filename, "r+") as file: - size = os.path.getsize(filename) - data = mmap.mmap(file.fileno(), size) - result = data[offset: offset + 4] - s = result[::-1] - val = 0 - for i in range(0, len(s)): - val = val << 8 | ord(s[i]) - data.close() - return "0x%08x" % val - - -def rgpciwr(pcibus, slot, fn, bar, offset, data): - """write pci register""" - ret = inttostr(data, 4) - filename = "/sys/bus/pci/devices/0000:%02x:%02x.%x/resource%d" % (int(pcibus), int(slot), int(fn), int(bar)) - with open(filename, "r+") as file: - size = os.path.getsize(filename) - data = mmap.mmap(file.fileno(), size) - data[offset: offset + 4] = ret - result = data[offset: offset + 4] - s = result[::-1] - val = 0 - for i in range(0, len(s)): - val = val << 8 | ord(s[i]) - data.close() - - -def rgsysset(location, value): - command_line = "echo 0x%02x > %s" % (value, location) - retrytime = 6 - ret_t = "" - for i in range(retrytime): - ret, ret_t = os_system(command_line) - if ret == 0: - return True, ret_t - return False, ret_t - - -def rgi2cget_word(bus, devno, address): - command_line = "i2cget -f -y %d 0x%02x 0x%02x w" % (bus, devno, address) - retrytime = 3 - ret_t = "" - for i in range(retrytime): - ret, ret_t = os_system(command_line) - if ret == 0: - return True, ret_t - return False, ret_t - - -def rgi2cset_word(bus, devno, address, byte): - command_line = "i2cset -f -y %d 0x%02x 0x%02x 0x%x w" % (bus, devno, address, byte) - os_system(command_line) - - -def fan_setmac(): - rgi2cset( - FAN_PROTECT["bus"], - FAN_PROTECT["devno"], - FAN_PROTECT["addr"], - FAN_PROTECT["open"], - ) - rgi2cset( - FAN_PROTECT["bus"], - FAN_PROTECT["devno"], - FAN_PROTECT["addr"], - FAN_PROTECT["close"], - ) - - -def checkfansninput(fan_sn, fansntemp): - if fan_sn in fansntemp: - RJPRINTERR("exist same Serial Number, please input again") - return False - if len(fan_sn) != 13: - RJPRINTERR("Serial Number length incorrect, please input again") - return False - return True - - -# check hw version -def checkfanhwinput(hw): - if len(hw) != 4: - RJPRINTERR("hardware version length incorrect, please input again") - return False - if hw.find(".") != 1: - RJPRINTERR("hardware version incorrect, please input again") - return False - return True - - -def util_show_fanse2(fans): - formatstr = "%-8s %-20s %-20s %-20s %-20s" - print(formatstr % ("id", "Name", "hardware version", "Serial Number", "Time")) - print( - formatstr - % ("------", "---------------", "---------------", "---------------", "----") - ) - for fan in fans: - # print fan.dstatus - if fan.dstatus < 0: - print("%-8s" % ("FAN%d" % (fans.index(fan) + 1))) - RJPRINTERR(" decode e2 error") - else: - print( - formatstr - % ( - "FAN%d" % (fans.index(fan) + 1), - fan.typename.replace(chr(0x00), ""), - fan.typehwinfo.replace(chr(0x00), ""), - fan.typesn.replace(chr(0x00), ""), - fan.fandecodetime, - ) - ) - - -def get_fane2_sysfs(bus, loc): - rg_fan_e2 = "%d-%04x/fan" % (bus, loc) - eeprom = get_sysfs_value(rg_fan_e2) - return eeprom - - -def util_show_fane2(): - ret = sorted(I2CUTIL.getvaluefromdevice("rg_fan")) - if len(ret) <= 0: - return None - fans = [] - for index in range(len(ret)): - t1 = int(round(time.time() * 1000)) - eeprom = get_fane2_sysfs(ret[index]["bus"], ret[index]["loc"]) - t2 = int(round(time.time() * 1000)) - fane2 = fan_tlv() - fane2.fandecodetime = t2 - t1 - fane2.decode(eeprom) - fans.append(fane2) - util_show_fanse2(fans) - - -def getPid(name): - ret = [] - for dirname in os.listdir("/proc"): - if dirname == "curproc": - continue - try: - with open("/proc/{}/cmdline".format(dirname), mode="rb") as fd: - content = fd.read() - except Exception: - continue - if name in content: - ret.append(dirname) - return ret - - -def fac_fans_setmac_tlv(ret): - if len(ret) <= 0: - return False - fans = [] - fansntemp = [] - for index in range(len(ret)): - item = ret[index] - log_debug(item) - eeprom = get_fane2_sysfs(item["bus"], item["loc"]) - fane2 = fan_tlv() - fane2.decode(eeprom) - fane2.fanbus = item["bus"] - fane2.fanloc = item["loc"] - log_debug("decode eeprom success") - - print("Fan[%d]-[%s]setmac" % ((index + 1), FANS_DEF[fane2.typedevtype])) - while True: - print("Please input[%s]:" % "Serial Number") - fan_sn = raw_input() - if checkfansninput(fan_sn, fansntemp) == False: - continue - fansntemp.append(fan_sn) - fan_sn = fan_sn + chr(0x00) - fane2.typesn = fan_sn + chr(0x00) - break - while True: - print("Please input[%s]:" % "hardware version") - hwinfo = raw_input() - if checkfanhwinput(hwinfo) == False: - continue - fan_hwinfo = hwinfo + chr(0x00) - fane2.typehwinfo = fan_hwinfo + chr(0x00) - break - log_debug(fane2.typedevtype) - fane2.typename = FANS_DEF[fane2.typedevtype] + chr(0x00) - fans.append(fane2) - print("\n") - print("\n*******************************\n") - - util_show_fanse2(fans) - if getInputCheck("check input correctly or not(Yes/No):") == True: - for fan in fans: - log_debug("ouput fan") - fac_fan_setmac(fan) - else: - print("setmac quit") - return False - - -def fac_fan_setmac_fru(ret): - fans = FRULISTS.get("fans") - - fanfrus = {} - newfrus = {} - - # getmsg - try: - for fan in fans: - print("===============%s ================getmessage" % fan.get("name")) - eeprom = getsysvalue(I2CUTIL.getE2File(fan.get("bus"), fan.get("loc"))) - fru = ipmifru() - fru.decodeBin(eeprom) - fanfrus[fan.get("name")] = fru - except Exception as e: - print(str(e)) - return False - - # setmsg - for fan in fans: - print("===============%s ================setmac" % fan.get("name")) - fruold = fanfrus.get(fan.get("name")) - newfru = getInputSetmac(fruold) - newfru.recalcute() - newfrus[fan.get("name")] = newfru - # writemsg - for fan in fans: - print("===============%s ================writeToE2" % fan.get("name")) - ret_t = newfrus.get(fan.get("name")) - I2CUTIL.openFanE2Protect() - I2CUTIL.writeToFanE2(fan.get("bus"), fan.get("loc"), ret_t.bindata) - I2CUTIL.closeFanE2Protect() - # check - try: - for fan in fans: - print("===============%s ================getmessage" % fan.get("name")) - eeprom = getsysvalue(I2CUTIL.getE2File(fan.get("bus"), fan.get("loc"))) - fru = ipmifru() - fru.decodeBin(eeprom) - except Exception as e: - print(str(e)) - return False - return True - - -def fac_fans_setmac(): - ret = I2CUTIL.getvaluefromdevice("rg_fan") - if ret is not None and len(ret) > 0: - return fac_fans_setmac_tlv(ret) - fans = FRULISTS.get("fans", None) - if fans is not None and len(fans) > 0: - return fac_fan_setmac_fru(ret) - return False - - -def fac_fan_setmac(item): - I2CUTIL.openFanE2Protect() - I2CUTIL.writeToFanE2(item.fanbus, item.fanloc, item.generate_fan_value()) - I2CUTIL.closeFanE2Protect() - - -def writeToEEprom(rst_arr): - dealtype = E2_PROTECT.get("gettype", None) - if dealtype is None: - rgi2cset( - E2_PROTECT["bus"], - E2_PROTECT["devno"], - E2_PROTECT["addr"], - E2_PROTECT["open"], - ) - elif dealtype == "io": - io_wr(E2_PROTECT["io_addr"], E2_PROTECT["open"]) - index = 0 - for item in rst_arr: - rgi2cset(E2_LOC["bus"], E2_LOC["devno"], index, ord(item)) - index += 1 - - if dealtype is None: - rgi2cset( - E2_PROTECT["bus"], - E2_PROTECT["devno"], - E2_PROTECT["addr"], - E2_PROTECT["close"], - ) - elif dealtype == "io": - io_wr(E2_PROTECT["io_addr"], E2_PROTECT["close"]) - # deal last drivers - os.system("rmmod at24 ") - os.system("modprobe at24 ") - os.system("rm -f /var/cache/sonic/decode-syseeprom/syseeprom_cache") - - -def get_local_eth0_mac(): - cmd = "ifconfig eth0 |grep HWaddr" - print(os_system(cmd)) - - -def getonieversion(): - if not os.path.isfile("/host/machine.conf"): - return "" - machine_vars = {} - with open("/host/machine.conf") as machine_file: - for line in machine_file: - tokens = line.split("=") - if len(tokens) < 2: - continue - machine_vars[tokens[0]] = tokens[1].strip() - return machine_vars.get("onie_version") - - -def createbmcMac(cpumac, num=2): - bcmvalue = strtoint(cpumac[cpumac.rindex(":") + 1 : len(cpumac)]) + num - # bmcmac = - t = cpumac.split(":") - t[5] = "%02x" % bcmvalue - bmcmac = ":".join(t) - return bmcmac.upper() - - -def fac_board_setmac(): - _value = {} - # default value - _value[TLV_CODE_VENDOR_EXT] = generate_ext(RAGILE_CARDID) # generate id - _value[TLV_CODE_PRODUCT_NAME] = RAGILE_PRODUCTNAME - _value[TLV_CODE_PART_NUMBER] = RAGILE_PART_NUMBER - _value[TLV_CODE_LABEL_REVISION] = RAGILE_LABEL_REVISION - _value[TLV_CODE_PLATFORM_NAME] = platform - _value[TLV_CODE_ONIE_VERSION] = getonieversion() - _value[TLV_CODE_MAC_SIZE] = RAGILE_MAC_SIZE - _value[TLV_CODE_MANUF_NAME] = RAGILE_MANUF_NAME - _value[TLV_CODE_MANUF_COUNTRY] = RAGILE_MANUF_COUNTRY - _value[TLV_CODE_VENDOR_NAME] = RAGILE_VENDOR_NAME - _value[TLV_CODE_DIAG_VERSION] = RAGILE_DIAG_VERSION - _value[TLV_CODE_SERVICE_TAG] = RAGILE_SERVICE_TAG - try: - if 0x00004052 == RAGILE_CARDID: - _value[TLV_CODE_PRODUCT_NAME] = RAGILE_PRODUCTNAME + "-RJ" - elif 0x00004051 == RAGILE_CARDID or 0x00004050 == RAGILE_CARDID: - changeTypeValue( - _value, TLV_CODE_PRODUCT_NAME, "Product name", RAGILE_PRODUCTNAME - ) - - changeTypeValue( - _value, TLV_CODE_SERIAL_NUMBER, "SN", "0000000000000" - ) # add serial number - changeTypeValue( - _value, TLV_CODE_DEVICE_VERSION, "hardware version", "101" - ) # hardware version - changeTypeValue( - _value, TLV_CODE_MAC_BASE, "MAC address", "58696cfb2108" - ) # MAC address - _value[TLV_CODE_MANUF_DATE] = time.strftime( - "%m/%d/%Y %H:%M:%S", time.localtime() - ) # add setmac time - rst, ret = generate_value(_value) - if ( - util_setmac("eth0", _value[TLV_CODE_MAC_BASE]) == True - ): # set Internet cardIP - writeToEEprom(rst) # write to e2 - # set BMC MAC - if "bmcsetmac" in FACTESTMODULE and FACTESTMODULE["bmcsetmac"] == 1: - bmcmac = createbmcMac(_value[TLV_CODE_MAC_BASE]) - if ipmi_set_mac(bmcmac) == True: - print("BMC MAC[%s]" % bmcmac) - else: - print("SET BMC MAC FAILED") - return False - else: - return False - except SETMACException as e: - # print(e) - RJPRINTERR("\n\n%s\n\n" % e) - return False - except ValueError as e: - return False - return True - - -def ipmi_set_mac(mac): - macs = mac.split(":") - cmdinit = "ipmitool raw 0x0c 0x01 0x01 0xc2 0x00" - cmdset = "ipmitool raw 0x0c 0x01 0x01 0x05" - for ind in range(len(macs)): - cmdset += " 0x%02x" % int(macs[ind], 16) - os_system(cmdinit) - ret, status = os_system(cmdset) - if ret: - RJPRINTERR("\n\n%s\n\n" % status) - return False - return True - - -def getInputValue(title, tips): - print("Please input[%s]such as(%s):" % (title, tips)) - name = raw_input() - - return name - - -def bmc_setmac(): - tips = "BMC MAC" - print("Please input value you want to change[%s]:" % tips) - name = raw_input() - if len(name) != 12: - RJPRINTERR("\nMAC address invaild, try again\n") - return False - release_mac = "" - for i in range(int(len(name) / 2)): - if i == 0: - release_mac += name[i * 2 : i * 2 + 2] - else: - release_mac += ":" + name[i * 2 : i * 2 + 2] - if isValidMac(release_mac) == True: - if ipmi_set_mac(release_mac) == True: - return True - else: - RJPRINTERR("\nMAC address invaild, try again\n") - return False - - -def closeProtocol(): - # disable LLDP - log_info("disable LLDP") - sys.stdout.write(".") - sys.stdout.flush() - os_system("systemctl stop lldp.service") - log_info("disable lldp service") - sys.stdout.write(".") - sys.stdout.flush() - os_system("systemctl stop bgp.service") - log_info("disable bgp service") - sys.stdout.write(".") - sys.stdout.flush() - # ret, status = os_system('bcmcmd "port ce,xe stp=disable"') - - -# check SDK memory must be 256M - - -def checkSdkMem(): - ind = 0 - file_data = "" - with open(file_name, "r") as f: - for line in f: - if "dmasize=16M" in line: - line = line.replace("dmasize=16M", "dmasize=256M") - ind = -1 - file_data += line - if ind == 0: - return - with open(file_name, "w") as f: - f.write(file_data) - print("change SDK memory to 256, reboot required") - os_system("sync") - os_system("reboot") - - -########################################################################## -# receives a character setting -########################################################################## - - -def getch(msg): - ret = "" - fd = sys.stdin.fileno() - old_ttyinfo = termios.tcgetattr(fd) - new_ttyinfo = old_ttyinfo[:] - new_ttyinfo[3] &= ~termios.ICANON - new_ttyinfo[3] &= ~termios.ECHO - sys.stdout.write(msg) - sys.stdout.flush() - try: - termios.tcsetattr(fd, termios.TCSANOW, new_ttyinfo) - ret = os.read(fd, 1) - finally: - # print "try to setting" - termios.tcsetattr(fd, termios.TCSANOW, old_ttyinfo) - return ret - - -def get_raw_input(): - ret = "" - fd = sys.stdin.fileno() - old_ttyinfo = termios.tcgetattr(fd) - new_ttyinfo = old_ttyinfo[:] - new_ttyinfo[3] &= ~termios.ICANON - new_ttyinfo[3] &= ~termios.ECHO - try: - termios.tcsetattr(fd, termios.TCSANOW, new_ttyinfo) - ret = raw_input("") - except Exception as e: - print(e) - finally: - termios.tcsetattr(fd, termios.TCSANOW, old_ttyinfo) - return ret - - -def getsysvalue(location): - retval = None - mb_reg_file = location - if not os.path.isfile(mb_reg_file): - print(mb_reg_file, "not found !") - return retval - try: - if not os.path.isfile(mb_reg_file): - print(mb_reg_file, "not found !") - return retval - with open(mb_reg_file, "r") as fd: - retval = fd.read() - except Exception as error: - log_error("Unable to open " + mb_reg_file + "file !") - retval = retval.rstrip("\r\n") - retval = retval.lstrip(" ") - # log_debug(retval) - return retval - - -# get file value - - -def get_pmc_register(reg_name): - retval = "ERR" - mb_reg_file = MAILBOX_DIR + reg_name - filepath = glob.glob(mb_reg_file) - if len(filepath) == 0: - return "%s %s notfound" % (retval, mb_reg_file) - mb_reg_file = filepath[0] - if not os.path.isfile(mb_reg_file): - return "%s %s notfound" % (retval, mb_reg_file) - try: - with open(mb_reg_file, "r") as fd: - retval = fd.read() - except Exception as error: - print("error") - retval = retval.rstrip("\r\n") - retval = retval.lstrip(" ") - return retval - - -# decode EEPROM - - -def decoder(s, t): - if ord(t[0]) == TLV_CODE_PRODUCT_NAME: - name = "Product Name" - value = str(t[2 : 2 + ord(t[1])]) - elif ord(t[0]) == TLV_CODE_PART_NUMBER: - name = "Part Number" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_SERIAL_NUMBER: - name = "Serial Number" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_MAC_BASE: - name = "Base MAC Address" - value = ":".join([binascii.b2a_hex(T) for T in t[2:8]]).upper() - elif ord(t[0]) == TLV_CODE_MANUF_DATE: - name = "Manufacture Date" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_DEVICE_VERSION: - name = "Device Version" - value = str(ord(t[2])) - elif ord(t[0]) == TLV_CODE_LABEL_REVISION: - name = "Label Revision" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_PLATFORM_NAME: - name = "Platform Name" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_ONIE_VERSION: - name = "ONIE Version" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_MAC_SIZE: - name = "MAC Addresses" - value = str((ord(t[2]) << 8) | ord(t[3])) - elif ord(t[0]) == TLV_CODE_MANUF_NAME: - name = "Manufacturer" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_MANUF_COUNTRY: - name = "Manufacture Country" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_VENDOR_NAME: - name = "Vendor Name" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_DIAG_VERSION: - name = "Diag Version" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_SERVICE_TAG: - name = "Service Tag" - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_VENDOR_EXT: - name = "Vendor Extension" - value = "" - if _TLV_DISPLAY_VENDOR_EXT: - value = t[2 : 2 + ord(t[1])] - elif ord(t[0]) == TLV_CODE_CRC_32 and len(t) == 6: - name = "CRC-32" - value = "0x%08X" % ( - ((ord(t[2]) << 24) | (ord(t[3]) << 16) | (ord(t[4]) << 8) | ord(t[5])), - ) - elif ord(t[0]) == TLV_CODE_RJ_CARID: - name = "rj_cardid" - value = "" - for c in t[2 : 2 + ord(t[1])]: - value += "%02X" % (ord(c),) - else: - name = "Unknown" - value = "" - for c in t[2 : 2 + ord(t[1])]: - value += "0x%02X " % (ord(c),) - return {"name": name, "code": ord(t[0]), "value": value} - - -def decode_eeprom(e): - total_len = (ord(e[9]) << 8) | ord(e[10]) - tlv_index = _TLV_INFO_HDR_LEN - tlv_end = _TLV_INFO_HDR_LEN + total_len - ret = [] - while (tlv_index + 2) < len(e) and tlv_index < tlv_end: - rt = decoder(None, e[tlv_index : tlv_index + 2 + ord(e[tlv_index + 1])]) - ret.append(rt) - if ord(e[tlv_index]) == TLV_CODE_CRC_32: - break - tlv_index += ord(e[tlv_index + 1]) + 2 - for item in ret: - if item["code"] == TLV_CODE_VENDOR_EXT: - rt = decoder(None, item["value"][0 : 0 + 2 + ord(item["value"][0 + 1])]) - ret.append(rt) - return ret - - -def get_sys_eeprom(): - eeprom = get_sysfs_value(rg_eeprom) - return decode_eeprom(eeprom) - - -# get card ID -def getCardId(): - ret = get_sys_eeprom() - for item in ret: - if item["code"] == TLV_CODE_RJ_CARID: - return item.get("value", None) - return None - - -# ==================================== -# execute shell command -# ==================================== -def os_system(cmd): - status, output = commands.getstatusoutput(cmd) - return status, output - - -########################################### -# get memory slot and number via DMI command -########################################### -def getsysmeminfo(): - ret, log = os_system("which dmidecode ") - if ret != 0 or len(log) <= 0: - error = "cmd find dmidecode" - return False, error - cmd = log + '|grep -P -A5 "Memory\s+Device"|grep Size|grep -v Range' - # get total number first - result = [] - ret1, log1 = os_system(cmd) - if ret1 == 0 and len(log1): - log1 = log1.lstrip() - arr = log1.split("\n") - # total = len(arr) # total slot number - for i in range(len(arr)): - val = re.sub("\D", "", arr[i]) - if val == "": - val = arr[i].lstrip() - val = re.sub("Size:", "", val).lstrip() - # print val - result.append({"slot": i + 1, "size": val}) - return True, result - return False, "error" - - -########################################### -# get memory slot and number via DMI command -# return various arrays -########################################### -def getsysmeminfo_detail(): - ret, log = os_system("which dmidecode ") - if ret != 0 or len(log) <= 0: - error = "cmd find dmidecode" - return False, error - cmd = log + ' -t 17 | grep -A21 "Memory Device"' # 17 - # get total number - ret1, log1 = os_system(cmd) - if ret1 != 0 or len(log1) <= 0: - return False, "command execution error[%s]" % cmd - result_t = log1.split("--") - mem_rets = [] - for item in result_t: - its = item.replace("\t", "").strip().split("\n") - ret = {} - for it in its: - if ":" in it: - key = it.split(":")[0].lstrip() - value = it.split(":")[1].lstrip() - ret[key] = value - mem_rets.append(ret) - return True, mem_rets - - -########################################### -# get BIOS info via DMI command -########################################### -def getDmiSysByType(type_t): - ret, log = os_system("which dmidecode ") - if ret != 0 or len(log) <= 0: - error = "cmd find dmidecode" - return False, error - cmd = log + " -t %s" % type_t - # get total number - ret1, log1 = os_system(cmd) - if ret1 != 0 or len(log1) <= 0: - return False, "command execution error[%s]" % cmd - its = log1.replace("\t", "").strip().split("\n") - ret = {} - for it in its: - if ":" in it: - key = it.split(":")[0].lstrip() - value = it.split(":")[1].lstrip() - ret[key] = value - return True, ret - - -def gethwsys(): - return getDmiSysByType(1) - - -########################################### -# get BIOS info via DMI command - - -def getsysbios(): - return getDmiSysByType(0) - - -def searchDirByName(name, dir): - result = [] - try: - files = os.listdir(dir) - for file in files: - if name in file: - result.append(os.path.join(dir, file)) - except Exception as e: - print(str(e)) - return result - - -def getUsbLocation(): - dir = "/sys/block/" - spect = "sd" - usbpath = "" - result = searchDirByName(spect, dir) - if len(result) <= 0: - return False, usbpath - for item in result: - with open(os.path.join(item, "removable"), "r") as fd: - value = fd.read() - if value.strip() == "1": # U-Disk found - usbpath = item - break - if usbpath == "": # no U-Disk found - log_debug("no usb found") - return False, usbpath - return True, usbpath - - -# judge USB file -def getusbinfo(): - ret, path = getUsbLocation() - if ret == False: - return False, "not usb exists" - str = os.path.join(path, "size") - ret, value = getfilevalue(str) - if ret == True: - return ( - True, - { - "id": os.path.basename(path), - "size": float(value) * 512 / 1024 / 1024 / 1024, - }, - ) - else: - return False, "Err" - - -def get_cpu_info(): - cmd = "cat /proc/cpuinfo |grep processor -A18" # 17 - - ret, log1 = os_system(cmd) - if ret != 0 or len(log1) <= 0: - return False, "command execution error[%s]" % cmd - result_t = log1.split("--") - mem_rets = [] - for item in result_t: - its = item.replace("\t", "").strip().split("\n") - ret = {} - for it in its: - if ":" in it: - key = it.split(":")[0].lstrip() - value = it.split(":")[1].lstrip() - ret[key] = value - mem_rets.append(ret) - return True, mem_rets - - -# read file -def get_version_config_info(attr_key, file_name=None): - if file_name is None: - version_conf_filename = "/root/version.json" - else: - version_conf_filename = file_name - if not os.path.isfile(version_conf_filename): - return None - with open(version_conf_filename) as rjconf_file: - for line in rjconf_file: - tokens = line.split("=") - if len(tokens) < 2: - continue - if tokens[0] == attr_key: - return tokens[1].strip() - return None - - -def io_rd(reg_addr, size=1): - path = "/dev/port" - ret = "" - fd = None - try: - reg_addr = int(reg_addr) - fd = os.open(path, os.O_RDWR|os.O_CREAT) - for i in range(size): - os.lseek(fd, reg_addr+i, os.SEEK_SET) - ret+="{:02x}".format(ord(os.read(fd, 1).decode('latin-1'))) - return ret - except Exception as e: - print(str(e)) - return None - finally: - if fd: os.close(fd) - - -def io_wr(reg_addr, reg_data): - u"""io write""" - fd = None - try: - regdata = 0 - regaddr = 0 - if type(reg_addr) == int: - regaddr = reg_addr - else: - regaddr = int(reg_addr, 16) - if type(reg_data) == int: - regdata = reg_data - else: - regdata = int(reg_data, 16) - devfile = "/dev/port" - fd = os.open(devfile, os.O_RDWR | os.O_CREAT) - os.lseek(fd, regaddr, os.SEEK_SET) - os.write(fd, regdata.to_bytes(2, 'little')) - return True - except ValueError as e: - print(e) - return False - except Exception as e: - print(e) - return False - finally: - if fd: os.close(fd) diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/sensors b/platform/centec-arm64/sonic-platform-modules-ragile/common/script/sensors deleted file mode 100755 index a2c72b123a..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/script/sensors +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -#docker exec -i pmon sensors "$@" - - -#To probe sensors not part of lm-sensors -if [ -r /usr/local/bin/platform_sensors.py ]; then - python /usr/local/bin/platform_sensors.py -fi diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/service/device_i2c.service b/platform/centec-arm64/sonic-platform-modules-ragile/common/service/device_i2c.service deleted file mode 100644 index c7f5776cb5..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/service/device_i2c.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description= Ragile Global Initialize I2c drivers. -After=local-fs.target -Before=pmon.service ntp.service -DefaultDependencies=no - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/device_i2c.py start -ExecStop=/usr/local/bin/device_i2c.py stop -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common/service/fancontrol.service b/platform/centec-arm64/sonic-platform-modules-ragile/common/service/fancontrol.service deleted file mode 100644 index aa686c9f9d..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common/service/fancontrol.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description= Fancontrol for Device. -After=privatenetwork.service -DefaultDependencies=no - -[Service] -ExecStart=/usr/local/bin/fancontrol.py start -Restart=on-failure - -[Install] -WantedBy=multi-user.target - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/Makefile b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/Makefile deleted file mode 100644 index 3202290737..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -PWD = $(shell pwd) -EXTRA_CFLAGS:= -I$(M)/include -EXTRA_CFLAGS+= -Wall -SUB_BUILD_DIR = $(PWD)/build -SERVICE_DIR = $(PWD)/service -INSTALL_DIR = $(SUB_BUILD_DIR)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) -INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin -INSTALL_LIB_DIR = $(SUB_BUILD_DIR)/usr/lib/python3.9/dist-packages -INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system -INSTALL_ETC_DIR = $(SUB_BUILD_DIR)/etc -UNSUPPORT_KERVER = 4.9.189 - -all: - @if [ ! -d ${INSTALL_LIB_DIR} ]; then mkdir -p ${INSTALL_LIB_DIR} ;fi - @if [ -d $(PWD)/lib/ ]; then cp -r $(PWD)/lib/* ${INSTALL_LIB_DIR} ;fi - @if [ ! -d ${INSTALL_SCRIPT_DIR} ]; then mkdir -p ${INSTALL_SCRIPT_DIR} ;fi - @if [ -d $(PWD)/script/ ]; then cp -r $(PWD)/script/* ${INSTALL_SCRIPT_DIR} ;fi - @if [ ! -d ${INSTALL_ETC_DIR} ]; then mkdir -p ${INSTALL_ETC_DIR} ;fi - @if [ -d $(INSTALL_SCRIPT_DIR) ]; then chmod +x $(INSTALL_SCRIPT_DIR)/* ;fi - @if [ ! -d ${INSTALL_SERVICE_DIR} ]; then mkdir -p ${INSTALL_SERVICE_DIR} ;fi - if [ -d $(SERVICE_DIR) ]; then cp -r $(SERVICE_DIR)/* $(INSTALL_SERVICE_DIR) ;fi -clean: - rm -rf $(SUB_BUILD_DIR) - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/__init__.py b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/fru.py b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/fru.py deleted file mode 100644 index 78e7e2bf2c..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/fru.py +++ /dev/null @@ -1,1286 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -from bitarray import bitarray -from datetime import datetime, timedelta -import requests -import ConfigParser -import os -import collections - -CONFIG_FILE = "product.conf" -__DEBUG__ = "N" -conf = None - - -def e_print(err): - print("ERROR: " + err) - - -def d_print(debug_info): - if(__DEBUG__ == "Y"): - print(debug_info) - - -def p_print(prompt): - print("PROMPT: " + prompt) - - -class E2Exception(Exception): - - def __init__(self, message='e2 error', code=-100): - self.code = code - self.message = message - - -class BaseArea(): - SUGGESTED_SIZE_COMMON_HEADER = 8 - SUGGESTED_SIZE_INTERNAL_USE_AREA = 72 - SUGGESTED_SIZE_CHASSIS_INFO_AREA = 32 - SUGGESTED_SIZE_BOARD_INFO_AREA = 80 - SUGGESTED_SIZE_PRODUCT_INFO_AREA = 80 - - INITVALUE = b'\x00' - resultvalue = INITVALUE * 256 - COMMON_HEAD_VERSION = b'\x01' - __childList = None - - def __init__(self, name="", size=0, offset=0): - self.__childList = [] - self._offset = offset - self.name = name - self._size = size - self._isPresent = False - self._data = b'\x00' * size - self.__dataoffset = 0 - - @property - def childList(self): - return self.__childList - - @property - def offset(self): - return self._offset - - @property - def size(self): - return self._size - - @property - def data(self): - return self._data - - @property - def isPresent(self): - return self._isPresent - - @isPresent.setter - def isPresent(self, value): - self._isPresent = value - - -class InternalUseArea(BaseArea): - pass - - -class ChassisInfoArea(BaseArea): - pass - - -class BoardInfoArea(BaseArea): - - _boardextra1 = None - - def __str__(self): - formatstr = "version: %x\n" \ - "length: %d \n" \ - "language:%x \n" \ - "mfg_date:%s \n" \ - "boardManufacturer:%s \n" \ - "boardProductName:%s \n" \ - "boardSerialNumber:%s \n" \ - "boardPartNumber:%s \n" \ - "fruFileId:%s \n" \ - "boardextra1:%d \n" - - return formatstr % (ord(self.boardversion), self.size, self.language, self.getMfgRealData(), self.boardManufacturer, - self.boardProductName, self.boardSerialNumber, self.boardPartNumber, - self.fruFileId, int(self.boardextra1,16)) - # return json.load(self.__dict__) - def todict(self): - dic = collections.OrderedDict() - dic["boardversion"]= ord(self.boardversion) - dic["boardlength"]= self.size - dic["boardlanguage"]=self.language - dic["boardmfg_date"]=self.getMfgRealData() - dic["boardManufacturer"]=self.boardManufacturer - dic["boardProductName"]=self.boardProductName - dic["boardSerialNumber"]=self.boardSerialNumber - dic["boardPartNumber"]=self.boardPartNumber - dic["boardfruFileId"]=self.fruFileId - dic["boardextra1"]= int(self.boardextra1,16) - return dic - - def decodedata(self): - index = 0 - self.areaversion = self.data[index] - index += 1 - d_print("decode length :%d class size:%d" % - ((ord(self.data[index]) * 8), self.size)) - index += 2 - - timetmp = self.data[index: index + 3] - self.mfg_date = ord(timetmp[0]) | ( - ord(timetmp[1]) << 8) | (ord(timetmp[2]) << 16) - d_print("decode getMfgRealData :%s" % self.getMfgRealData()) - index += 3 - - templen = E2Util.decodeLength(self.data[index]) - self.boardManufacturer = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode boardManufacturer:%s" % self.boardManufacturer) - - templen = E2Util.decodeLength(self.data[index]) - self.boardProductName = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode boardProductName:%s" % self.boardProductName) - - templen = E2Util.decodeLength(self.data[index]) - self.boardSerialNumber = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode boardSerialNumber:%s" % self.boardSerialNumber) - - templen = E2Util.decodeLength(self.data[index]) - self.boardPartNumber = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode boardPartNumber:%s" % self.boardPartNumber) - - templen = E2Util.decodeLength(self.data[index]) - self.fruFileId = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode fruFileId:%s" % self.fruFileId) - - templen = E2Util.decodeLength(self.data[index]) - self.boardextra1 = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode boardextra1:%s" % self.boardextra1) - - def recalcute(self): - d_print("boardInfoArea version:%x" % ord(self.boardversion)) - d_print("boardInfoArea length:%d" % self.size) - d_print("boardInfoArea language:%x" % self.language) - self.mfg_date = E2Util.minToData() - d_print("boardInfoArea mfg_date:%x" % self.mfg_date) - - self.data = chr(ord(self.boardversion)) + \ - chr(self.size / 8) + chr(self.language) - - self.data += chr(self.mfg_date & 0xFF) - self.data += chr((self.mfg_date >> 8) & 0xFF) - self.data += chr((self.mfg_date >> 16) & 0xFF) - - d_print("boardInfoArea boardManufacturer:%s" % self.boardManufacturer) - typelength = E2Util.getTypeLength(self.boardManufacturer) - self.data += chr(typelength) - self.data += self.boardManufacturer - - d_print("boardInfoArea boardProductName:%s" % self.boardProductName) - self.data += chr(E2Util.getTypeLength(self.boardProductName)) - self.data += self.boardProductName - - d_print("boardInfoArea boardSerialNumber:%s" % self.boardSerialNumber) - self.data += chr(E2Util.getTypeLength(self.boardSerialNumber)) - self.data += self.boardSerialNumber - - d_print("boardInfoArea boardPartNumber:%s" % self.boardPartNumber) - self.data += chr(E2Util.getTypeLength(self.boardPartNumber)) - self.data += self.boardPartNumber - - d_print("boardInfoArea fruFileId:%s" % self.fruFileId) - self.data += chr(E2Util.getTypeLength(self.fruFileId)) - self.data += self.fruFileId - - if self.boardextra1 != None: - d_print("boardInfoArea boardextra1:%s" % self.boardextra1) - self.data += chr(E2Util.getTypeLength(self.boardextra1)) - self.data += self.boardextra1 - - self.data += chr(0xc1) - d_print("self.data:%d" % len(self.data)) - d_print("self.size:%d" % self.size) - - if len(self.data) > (self.size - 1): - incr = (len(self.data) - self.size) / 8 + 1 - self.size += incr * 8 - - for tianchong in range(self.size - len(self.data) - 1): - self.data += self.INITVALUE - - test = 0 - for index in range(len(self.data)): - test += ord(self.data[index]) - - # checksum - checksum = (0x100 - (test % 256)) if (test % 256) != 0 else 0 - d_print("board info checksum:%x" % checksum) - self.data += chr(checksum) - - def getMfgRealData(self): - starttime = datetime(1996, 1, 1, 0, 0, 0) - mactime = starttime + timedelta(minutes=self.mfg_date) - return mactime - - @property - def language(self): - self._language = 25 - return self._language - - @property - def mfg_date(self): - return self._mfg_date - - @property - def boardversion(self): - self._boardversion = self.COMMON_HEAD_VERSION - return self._boardversion - - @property - def fruFileId(self): - return self._FRUFileID - - @property - def boardextra1(self): - return self._boardextra1 - - @property - def boardPartNumber(self): - return self._boardPartNumber - - @property - def boardSerialNumber(self): - return self._boardSerialNumber - - @property - def boardProductName(self): - return self._boradProductName - - @property - def boardManufacturer(self): - return self._boardManufacturer - - @property - def boardTime(self): - return self._boardTime - - @property - def fields(self): - return self._fields - - -class ProductInfoArea(BaseArea): - _productExtra1 = None - _productExtra2 = None - _productExtra3 = None - _productManufacturer = None - _productAssetTag = None - _FRUFileID = None - - def __str__(self): - formatstr = "version: %x\n" \ - "length: %d \n" \ - "language::%x \n" \ - "productManufacturer:%s \n" \ - "productName:%s \n" \ - "productPartModelName:%s \n" \ - "productVersion:%d \n" \ - "productSerialNumber:%s \n" \ - "productAssetTag:%s \n" \ - "fruFileId:%s \n" \ - "productExtra1:%s \n"\ - "productExtra2:%s \n"\ - "productExtra3:%s \n" - - return formatstr % (ord(self.areaversion), self.size, self.language, self.productManufacturer, self.productName, - self.productPartModelName, int(self.productVersion, 16), self.productSerialNumber, - self.productAssetTag,self.fruFileId, self.productExtra1, - E2Util.decodeMac(self.productExtra2), E2Util.decodeMacLen(self.productExtra3)) - - def todict(self): - dic = collections.OrderedDict() - dic["productversion"]= ord(self.areaversion) - dic["productlength"]= self.size - dic["productlanguage"]=self.language - dic["productManufacturer"]=self.productManufacturer - dic["productName"]=self.productName - dic["productPartModelName"]=self.productPartModelName - dic["productVersion"]= int(self.productVersion, 16) - dic["productSerialNumber"]=self.productSerialNumber - dic["productAssetTag"]=self.productAssetTag - dic["productfruFileId"]= self.fruFileId - dic["productExtra1"]=self.productExtra1 - dic["productExtra2"]=E2Util.decodeMac(self.productExtra2) - dic["productExtra3"]= E2Util.decodeMacLen(self.productExtra3) - return dic - - def decodedata(self): - index = 0 - self.areaversion = self.data[index] # 0 - index += 1 - d_print("decode length %d" % (ord(self.data[index]) * 8)) - d_print("class size %d" % self.size) - index += 2 - - templen = E2Util.decodeLength(self.data[index]) - self.productManufacturer = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productManufacturer:%s" % self.productManufacturer) - - templen = E2Util.decodeLength(self.data[index]) - self.productName = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productName:%s" % self.productName) - - templen = E2Util.decodeLength(self.data[index]) - self.productPartModelName = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productPartModelName:%s" % self.productPartModelName) - - templen = E2Util.decodeLength(self.data[index]) - self.productVersion = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productVersion:%s" % self.productVersion) - - templen = E2Util.decodeLength(self.data[index]) - self.productSerialNumber = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productSerialNumber:%s" % self.productSerialNumber) - - - templen = E2Util.decodeLength(self.data[index]) - self.productAssetTag = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productAssetTag:%s" % self.productAssetTag) - - - templen = E2Util.decodeLength(self.data[index]) - self.fruFileId = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode fruFileId:%s" % self.fruFileId) - - if index < self.size and self.data[index] != chr(0xC1): # end - templen = E2Util.decodeLength(self.data[index]) - self.productExtra1 = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productExtra1:%s" % self.productExtra1) - if index < self.size and self.data[index] != chr(0xC1): # end - templen = E2Util.decodeLength(self.data[index]) - self.productExtra2 = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productExtra2:%s" % - E2Util.decodeMac(self.productExtra2)) - if index < self.size and self.data[index] != chr(0xC1): # end - templen = E2Util.decodeLength(self.data[index]) - self.productExtra3 = self.data[index + 1: index + templen + 1] - index += templen + 1 - d_print("decode productExtra3:%s" % - E2Util.decodeMacLen(self.productExtra3)) - - @property - def productVersion(self): - return self._productVersion - - @property - def areaversion(self): - self._areaversion = self.COMMON_HEAD_VERSION - return self._areaversion - - @property - def language(self): - self._language = 25 - return self._language - - @property - def productManufacturer(self): - return self._productManufacturer - - @property - def productName(self): - return self._productName - - @property - def productPartModelName(self): - return self._productPartModelName - - @property - def productSerialNumber(self): - return self._productSerialNumber - - @property - def productAssetTag(self): - return self._productAssetTag - - @property - def fruFileId(self): - return self._FRUFileID - - @property - def productExtra1(self): - return self._productExtra1 - - @property - def productExtra2(self): - return self._productExtra2 - - @property - def productExtra3(self): - return self._productExtra3 - - def recalcute(self): - d_print("product version:%x" % ord(self.areaversion)) - d_print("product length:%d" % self.size) - d_print("product language:%x" % self.language) - self.data = chr(ord(self.areaversion)) + \ - chr(self.size / 8) + chr(self.language) - - typelength = E2Util.getTypeLength(self.productManufacturer) - self.data += chr(typelength) - self.data += self.productManufacturer - - self.data += chr(E2Util.getTypeLength(self.productName)) - self.data += self.productName - - self.data += chr(E2Util.getTypeLength(self.productPartModelName)) - self.data += self.productPartModelName - - self.data += chr(E2Util.getTypeLength(self.productVersion)) - self.data += self.productVersion - - self.data += chr(E2Util.getTypeLength(self.productSerialNumber)) - self.data += self.productSerialNumber - - self.data += chr(E2Util.getTypeLength(self.productAssetTag)) - if self.productAssetTag != None: - self.data += self.productAssetTag - - self.data += chr(E2Util.getTypeLength(self.fruFileId)) - if self.fruFileId != None: - self.data += self.fruFileId - - if self.productExtra1 != None: - self.data += chr(E2Util.getTypeLength(self.productExtra1)) - self.data += self.productExtra1 - - if self.productExtra2 != None: - self.data += chr(E2Util.getTypeLength(self.productExtra2)) - self.data += self.productExtra2 - - if self.productExtra3 != None: - self.data += chr(E2Util.getTypeLength(self.productExtra3)) - self.data += self.productExtra3 - - self.data += chr(0xc1) - if len(self.data) > (self.size - 1): - incr = (len(self.data) - self.size) / 8 + 1 - self.size += incr * 8 - d_print("self.data:%d" % len(self.data)) - d_print("self.size:%d" % self.size) - for tianchong in range(self.size - len(self.data) - 1): - self.data += self.INITVALUE - test = 0 - for index in range(len(self.data)): - test += ord(self.data[index]) - checksum = (0x100 - (test % 256)) if (test % 256) != 0 else 0 - d_print("board info checksum:%x" % checksum) - self.data += chr(checksum) - - -class MultiRecordArea(BaseArea): - pass - - -class Field(): - - def __init__(self, fieldType="ASCII", fieldData=""): - self.fieldData = fieldData - self.fieldType = fieldType - - @property - def data(self): - return self._data - - @property - def fieldType(self): - return self._fieldType - - @property - def fieldData(self): - return self._fieldData - - -class CommonArea(BaseArea): - _internalUserAreaOffset = None - _InternalUseArea = None - _ChassisInfoArea = None - _multiRecordArea = None - _chassicInfoAreaOffset = None - _multiRecordAreaOffset = None - - def decodeBin(self, eeprom): - commonHead = eeprom[0:8] - d_print("decode version %x" % ord(commonHead[0])) - if self.COMMON_HEAD_VERSION != commonHead[0]: - print ("not equal") - if E2Util.checksum(commonHead[0:7]) != ord(commonHead[7]): - print ("check sum error") - sys.exit(-1) - if commonHead[1] != self.INITVALUE: - d_print("Internal Use Area is present") - self.internalUseArea = InternalUseArea( - name="Internal Use Area", size=self.SUGGESTED_SIZE_INTERNAL_USE_AREA) - self.internalUseArea.isPresent = True - self.internalUserAreaOffset = ord(commonHead[1]) - self.internalUseArea.data = eeprom[self.internalUserAreaOffset * 8: ( - self.internalUserAreaOffset * 8 + self.internalUseArea.size)] - if commonHead[2] != self.INITVALUE: - d_print("Chassis Info Area is present") - self.chassisInfoArea = ChassisInfoArea( - name="Chassis Info Area", size=self.SUGGESTED_SIZE_CHASSIS_INFO_AREA) - self.chassisInfoArea.isPresent = True - self.chassicInfoAreaOffset = ord(commonHead[2]) - self.chassisInfoArea.data = eeprom[self.chassicInfoAreaOffset * 8: ( - self.chassicInfoAreaOffset * 8 + self.chassisInfoArea.size)] - if commonHead[3] != self.INITVALUE: - self.boardInfoArea = BoardInfoArea( - name="Board Info Area", size=self.SUGGESTED_SIZE_BOARD_INFO_AREA) - self.boardInfoArea.isPresent = True - self.boardInfoAreaOffset = ord(commonHead[3]) - self.boardInfoArea.size = ord( - eeprom[self.boardInfoAreaOffset * 8 + 1]) * 8 - d_print("Board Info Area is present size:%d" % - (self.boardInfoArea.size)) - self.boardInfoArea.data = eeprom[self.boardInfoAreaOffset * 8: ( - self.boardInfoAreaOffset * 8 + self.boardInfoArea.size)] - if E2Util.checksum(self.boardInfoArea.data[:-1]) != ord(self.boardInfoArea.data[-1:]): - print ("check boardInfoArea checksum error[cal:%02x data:%02x]" % (E2Util.checksum(self.boardInfoArea.data[:-1]), ord(self.boardInfoArea.data[-1:]))) - sys.exit(-1) - self.boardInfoArea.decodedata() - if commonHead[4] != self.INITVALUE: - d_print("Product Info Area is present") - self.productInfoArea = ProductInfoArea( - name="Product Info Area ", size=self.SUGGESTED_SIZE_PRODUCT_INFO_AREA) - self.productInfoArea.isPresent = True - self.productinfoAreaOffset = ord(commonHead[4]) - - self.productInfoArea.size = ord( - eeprom[self.productinfoAreaOffset * 8 + 1]) * 8 - d_print("Product Info Area is present size:%d" % - (self.productInfoArea.size)) - - self.productInfoArea.data = eeprom[self.productinfoAreaOffset * 8: ( - self.productinfoAreaOffset * 8 + self.productInfoArea.size)] - if E2Util.checksum(self.productInfoArea.data[:-1]) != ord(self.productInfoArea.data[-1:]): - print ("check productInfoArea checksum error [cal:%02x data:%02x]" % (E2Util.checksum(self.productInfoArea.data[:-1]), ord(self.productInfoArea.data[-1:]))) - sys.exit(-1) - self.productInfoArea.decodedata() - if commonHead[5] != self.INITVALUE: - self.multiRecordArea = MultiRecordArea( - name="MultiRecord record Area ") - d_print("MultiRecord record present") - self.multiRecordArea.isPresent = True - self.multiRecordAreaOffset = ord(commonHead[5]) - self.multiRecordArea.data = eeprom[self.multiRecordAreaOffset * 8: ( - self.multiRecordAreaOffset * 8 + self.multiRecordArea.size)] - # self.recalcute() - - def initDefault(self): - self.version = self.COMMON_HEAD_VERSION - self.internalUserAreaOffset = self.INITVALUE - self.chassicInfoAreaOffset = self.INITVALUE - self.boardInfoAreaOffset = self.INITVALUE - self.productinfoAreaOffset = self.INITVALUE - self.multiRecordAreaOffset = self.INITVALUE - self.PAD = self.INITVALUE - self.zeroCheckSum = self.INITVALUE - self.offset = self.SUGGESTED_SIZE_COMMON_HEADER - self.productInfoArea = None - self.internalUseArea = None - self.boardInfoArea = None - self.chassisInfoArea = None - self.multiRecordArea = None - self.recalcute() - - @property - def version(self): - return self._version - - @property - def internalUserAreaOffset(self): - return self._internalUserAreaOffset - - @property - def chassicInfoAreaOffset(self): - return self._chassicInfoAreaOffset - - @property - def productinfoAreaOffset(self): - return self._productinfoAreaOffset - - @property - def boardInfoAreaOffset(self): - return self._boardInfoAreaOffset - - @property - def multiRecordAreaOffset(self): - return self._multiRecordAreaOffset - - @property - def PAD(self): - return self._PAD - - @property - def zeroCheckSum(self): - return self._zeroCheckSum - - @property - def productInfoArea(self): - return self._ProductInfoArea - - @property - def internalUseArea(self): - return self._InternalUseArea - - @property - def boardInfoArea(self): - return self._BoardInfoArea - - @property - def chassisInfoArea(self): - return self._ChassisInfoArea - - @property - def multiRecordArea(self): - return self._multiRecordArea - - @property - def bindata(self): - return self._bindata - - def recalcuteCommonHead(self): - self.offset = self.SUGGESTED_SIZE_COMMON_HEADER - d_print("common Header %d" % self.offset) - if self.internalUseArea != None and self.internalUseArea.isPresent: - self.internalUserAreaOffset = self.offset / 8 - self.offset += self.internalUseArea.size - d_print("internalUseArea is present offset:%d" % self.offset) - if self.chassisInfoArea != None and self.chassisInfoArea.isPresent: - self.chassicInfoAreaOffset = self.offset / 8 - self.offset += self.chassisInfoArea.size - d_print("chassisInfoArea is present offset:%d" % self.offset) - if self.boardInfoArea != None and self.boardInfoArea.isPresent: - self.boardInfoAreaOffset = self.offset / 8 - self.offset += self.boardInfoArea.size - d_print("boardInfoArea is present offset:%d" % self.offset) - - if self.productInfoArea != None and self.productInfoArea.isPresent: - self.productinfoAreaOffset = self.offset / 8 - self.offset += self.productInfoArea.size - d_print("productInfoArea is present offset:%d" % self.offset) - if self.multiRecordArea != None and self.multiRecordArea.isPresent: - self.multiRecordAreaOffset = self.offset / 8 - d_print("multiRecordArea is present offset:%d" % self.offset) - - if self.internalUserAreaOffset == self.INITVALUE: - self.internalUserAreaOffset = 0 - if self.productinfoAreaOffset == self.INITVALUE: - self.productinfoAreaOffset = 0 - if self.chassicInfoAreaOffset == self.INITVALUE: - self.chassicInfoAreaOffset = 0 - if self.boardInfoAreaOffset == self.INITVALUE: - self.boardInfoAreaOffset = 0 - if self.multiRecordAreaOffset == self.INITVALUE: - self.multiRecordAreaOffset = 0 - self.zeroCheckSum = (0x100 - ord(self.version) - self.internalUserAreaOffset - self.chassicInfoAreaOffset - self.productinfoAreaOffset \ - - self.boardInfoAreaOffset - self.multiRecordAreaOffset)&0xff - d_print("zerochecksum:%x" % self.zeroCheckSum) - self.data = self.version + chr(self.internalUserAreaOffset) + chr(self.chassicInfoAreaOffset) + chr( - self.boardInfoAreaOffset) + chr(self.productinfoAreaOffset) + chr(self.multiRecordAreaOffset) + self.PAD + chr(self.zeroCheckSum) - - def recalcutebin(self): - self.bindata = "" - self.bindata += self.data - if self.internalUseArea != None and self.internalUseArea.isPresent: - d_print("internalUseArea is present") - self.bindata += self.internalUseArea.data - if self.chassisInfoArea != None and self.chassisInfoArea.isPresent: - d_print("chassisInfoArea is present") - self.bindata += self.chassisInfoArea.data - if self.boardInfoArea != None and self.boardInfoArea.isPresent: - d_print("boardInfoArea is present") - self.boardInfoArea.recalcute() - self.bindata += self.boardInfoArea.data - if self.productInfoArea != None and self.productInfoArea.isPresent: - d_print("productInfoArea is present") - self.productInfoArea.recalcute() - self.bindata += self.productInfoArea.data - if self.multiRecordArea != None and self.multiRecordArea.isPresent: - d_print("multiRecordArea is present") - self.bindata += self.productInfoArea.data - totallen = len(self.bindata) - if (totallen < 256): - for left_t in range(0, 256 - totallen): - self.bindata += chr(0x00) - - def recalcute(self): - self.recalcuteCommonHead() - self.recalcutebin() - - -class E2Util(): - - BOARDINFOAREAISPRESETN = 'boardinfoarea.ispresent' - BOARDINFOAREABOARDMANUFACTURER = 'boardinfoarea.boardmanufacturer' - BOARDINFOAREABORADPRODUCTNAME = 'boardinfoarea.boradproductname' - BOARDINFOAREABOARDSERIALNUMBER = 'boardinfoarea.boardserialnumber' - BOARDINFOAREABOARDPARTNUMBER = 'boardinfoarea.boardpartnumber' - BOARDINFOAREAFRUFILEID = 'boardinfoarea.frufileid' - BOARDINFOAREAFEXTRA1 = 'boardinfoarea.boardextra1' - - PRODUCTINFOAREAISPRESENT = "productInfoArea.ispresent" - PRODUCTINFOAREAPRODUCTMANUFACTURER = 'productinfoarea.productmanufacturer' - PRODUCTINFOAREAPRODUCTNAME = 'productinfoarea.productname' - PRODUCTINFOAREAPRODUCTPARTMODELNAME = 'productinfoarea.productpartmodelname' - PRODUCTINFOAREAPRODUCTVERSION = 'productinfoarea.productversion' - PRODUCTINFOAREAPRODUCTSERIALNUMBER = 'productinfoarea.productserialnumber' - PRODUCTINFOAREAPRODUCTASSETTAG = 'productinfoarea.productassettag' - PRODUCTINFOAREAFRUFILEID = 'productinfoarea.frufileid' - PRODUCTINFOAREAEXTRA1 = 'productinfoarea.productextra1' - PRODUCTINFOAREAEXTRA2 = 'productinfoarea.productextra2' - PRODUCTINFOAREAEXTRA3 = 'productinfoarea.productextra3' - - @staticmethod - def equals(x, typeV): - if x.strip()[-1] == typeV: - return True - else: - return False - - @staticmethod - def decodeBinByValue(retval): - fru = CommonArea() - fru.initDefault() - fru.decodeBin(retval) - return fru - - @staticmethod - def getBoardInfoAreaByProperty(prop): - boardinfoarea = None - try: - boradispresent = prop[E2Util.BOARDINFOAREAISPRESETN] - if (boradispresent == "1"): - boardinfoarea = BoardInfoArea(name="Board Info Area", - size=0) - boardinfoarea.isPresent = True - boardinfoarea.boardManufacturer = prop[E2Util.BOARDINFOAREABOARDMANUFACTURER] - boardinfoarea.boardProductName = prop[E2Util.BOARDINFOAREABORADPRODUCTNAME] - boardinfoarea.boardSerialNumber = prop[E2Util.BOARDINFOAREABOARDSERIALNUMBER] - boardinfoarea.boardPartNumber = prop[E2Util.BOARDINFOAREABOARDPARTNUMBER] - boardinfoarea.fruFileId = prop[E2Util.BOARDINFOAREAFRUFILEID] - boardinfoarea.boardextra1 = prop[E2Util.BOARDINFOAREAFEXTRA1] - boardinfoarea.recalcute() - else: - boardinfoarea = None - return boardinfoarea - except Exception as e: - raise e - return None - - @staticmethod - def getProductInfoAreaByProperty(prop): - productInfoArea = None - try: - productispresent = prop[E2Util.PRODUCTINFOAREAISPRESENT] - if (productispresent == "1"): - productInfoArea = ProductInfoArea(name="Product Info Area ", - size=0) - productInfoArea.isPresent = True - - productInfoArea.productManufacturer = prop[E2Util.PRODUCTINFOAREAPRODUCTMANUFACTURER] - productInfoArea.productName = prop[E2Util.PRODUCTINFOAREAPRODUCTNAME] - productInfoArea.productPartModelName = prop[E2Util.PRODUCTINFOAREAPRODUCTPARTMODELNAME] - productInfoArea.productVersion = prop[E2Util.PRODUCTINFOAREAPRODUCTVERSION] - productInfoArea.productSerialNumber = prop[E2Util.PRODUCTINFOAREAPRODUCTSERIALNUMBER] - # productInfoArea.fruFileId = prop[E2Util.PRODUCTINFOAREAFRUFILEID] - val_t = E2Util.getTimeFormat() - if val_t != None: - productInfoArea.productExtra1 = val_t - if prop.__contains__(E2Util.PRODUCTINFOAREAEXTRA2): - # Extra2 Special Processing (MAC address) - macaddr = prop[E2Util.PRODUCTINFOAREAEXTRA2] - if macaddr != None: - productInfoArea.productExtra2 = E2Util.encodeMac( - macaddr) - if prop.__contains__(E2Util.PRODUCTINFOAREAEXTRA3): - # Extra3 Special Processing - productInfoArea.productExtra3 = E2Util.encodeMacLen( - prop[E2Util.PRODUCTINFOAREAEXTRA3]) - productInfoArea.recalcute() - else: - productInfoArea = None - - except Exception as e: - print ("error") - productInfoArea = None - return productInfoArea - - @staticmethod - def generateBinBySetMac(bia, pia): - fru = CommonArea() - fru.initDefault() - if bia != None: - fru.boardInfoArea = bia - if pia != None: - fru.productInfoArea = pia - fru.recalcute() - return fru - - @staticmethod - def generateBinByInput(prop): - bia = E2Util.getBoardInfoAreaByProperty(prop) - pia = E2Util.getProductInfoAreaByProperty(prop) - fru = CommonArea() - fru.initDefault() - if bia != None: - fru.boardInfoArea = bia - if pia != None: - fru.productInfoArea = pia - fru.recalcute() - return fru - - @staticmethod - def defaultBinByConfig(product, typeVal): - filename = CONFIG_FILE - dir = os.path.dirname(os.path.realpath(__file__)) - if filename in os.listdir(dir): - filename = os.path.join(dir, filename) - return E2Util.generateBinByConfig(filename, product, typeVal) - - @staticmethod - def generateBinByConfig(filename, product, typeVal): - fileconf = E2Util.getConfig(filename) - if product not in fileconf.ProductsTypes: - raise E2Exception("product type not in Success") - productParts = fileconf.getProductSections(product) - if len(productParts) <= 0: - raise E2Exception("config file has no product config") - # print typeVal - ret_t = filter(lambda x: E2Util.equals(x, typeVal), productParts) - if len(ret_t) <= 0: - raise E2Exception("config file has no child eeprom config") - # print "".join(ret_t) - bia = E2Util.getBoardInfoAreaConfigFile(fileconf, "".join(ret_t)) - pia = E2Util.getProductInfoAreaConfigFile(fileconf, "".join(ret_t)) - - fru = CommonArea() - fru.initDefault() - - if bia != None: - fru.boardInfoArea = bia - if pia != None: - fru.productInfoArea = pia - fru.recalcute() - return fru - - @staticmethod - def getProductInfoAreaConfigFile(conf, part): - pia = None - try: - productispresent = conf.getProductName( - E2Util.PRODUCTINFOAREAISPRESENT, part) - if (productispresent == "1"): - pia = ProductInfoArea(name="Product Info Area ", - size=0) - pia.isPresent = True - - pia.productManufacturer = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTMANUFACTURER, part) - pia.productName = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTNAME, part) - pia.productPartModelName = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTPARTMODELNAME, part) - pia.productVersion = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTVERSION, part) - pia.productSerialNumber = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTSERIALNUMBER, part) - pia.productAssetTag = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTASSETTAG, part) - # print pia.productAssetTag - pia.fruFileId = conf.getProductName( - E2Util.PRODUCTINFOAREAFRUFILEID, part) - val_t = E2Util.getTimeFormat() - if val_t != None: - pia.productExtra1 = val_t - # Extra2 Special Processing (MAC address) - macaddr = conf.getProductName( - E2Util.PRODUCTINFOAREAEXTRA2, part) - if macaddr != None: - pia.productExtra2 = E2Util.encodeMac(macaddr) - # Extra3 Special Processing - pia.productExtra3 = E2Util.encodeMacLen(conf.getProductName( - E2Util.PRODUCTINFOAREAEXTRA3, part)) - pia.recalcute() - else: - pia = None - - except Exception as e: - print (e) - pia = None - return pia - - @staticmethod - def getBoardInfoAreaConfigFile(conf, part): - boardinfoarea = None - try: - boradispresent = conf.getProductName( - E2Util.BOARDINFOAREAISPRESETN, part) - if (boradispresent == "1"): - boardinfoarea = BoardInfoArea(name="Board Info Area", - size=0) - boardinfoarea.isPresent = True - boardinfoarea.boardManufacturer = conf.getProductName( - E2Util.BOARDINFOAREABOARDMANUFACTURER, part) - boardinfoarea.boardProductName = conf.getProductName( - E2Util.BOARDINFOAREABORADPRODUCTNAME, part) - boardinfoarea.boardSerialNumber = conf.getProductName( - E2Util.BOARDINFOAREABOARDSERIALNUMBER, part) - boardinfoarea.boardPartNumber = conf.getProductName( - E2Util.BOARDINFOAREABOARDPARTNUMBER, part) - boardinfoarea.fruFileId = conf.getProductName( - E2Util.BOARDINFOAREAFRUFILEID, part) - boardinfoarea.boardextra1 = conf.getProductName( - E2Util.BOARDINFOAREAFEXTRA1, part) - boardinfoarea.recalcute() - else: - boardinfoarea = None - except Exception as e: - print (e) - boardinfoarea = None - return boardinfoarea - - @staticmethod - def decodeBinName(filename): - retval = None - try: - with open(filename, 'rb') as fd: - retval = fd.read() - except Exception: - print ("open file error") - return None - return E2Util.decodeBinByValue(retval) - - - @staticmethod - def decodeMac(encodedata): - if encodedata == None: - return None - ret = "" - for i in range(len(encodedata)): - ret += "%02x" % ord(encodedata[i]) - return ret.upper() - - @staticmethod - def strtoint(strtmp): - value = 0 - rest_v = strtmp.replace("0X", "").replace("0x", "") - for index in range(len(rest_v)): - value |= int(rest_v[index], 16) << ((len(rest_v) - index - 1) * 4) - return value - - @staticmethod - def decodeMacLen(lenstr): - if lenstr == None: - return None - maclen = ord(lenstr[0]) << 8 | ord(lenstr[1]) - return maclen - - @staticmethod - def encodeMac(macaddr): - ret_t = "" - if len(macaddr) != 12: - return None - for i in range(6): - tt = macaddr[2 * i: 2 * i + 2] - ret_t += chr(int(tt, 16)) - return ret_t - - @staticmethod - def encodeMacLen(strlem): - val_t = int(strlem) - temp_t = chr(val_t >> 8) + chr(val_t & 0x00ff) - return temp_t - - @staticmethod - def loadconfig(): - global conf - conf = E2Config() - return conf - - @staticmethod - def getConfig(filename): - return E2Config(filename) - - - @staticmethod - def getdefaultconfig(): - filename = CONFIG_FILE - dir = os.path.dirname(os.path.realpath(__file__)) - if filename in os.listdir(dir): - filename = os.path.join(dir, filename) - config = E2Util.getConfig(filename) - ret = {} - for i in config.ProductsTypes: - ret[config.getProductName(i)] = i - return ret - - @staticmethod - def createFruBin(filename, boardinfoarea, productInfoArea): - fru = CommonArea() - fru.initDefault() - - if boardinfoarea != None: - fru.boardInfoArea = boardinfoarea - if productInfoArea != None: - fru.productInfoArea = productInfoArea - - fru.recalcute() - E2Util.write_bin_file(filename, fru.bindata) - - @staticmethod - def createpartbin(part): - try: - bia = None - pia = None - - boradispresent = conf.getProductName( - E2Util.BOARDINFOAREAISPRESETN, part) - if (boradispresent == "1"): - bia = BoardInfoArea(name="Board Info Area", - size=0) - bia.isPresent = True - bia.boardManufacturer = conf.getProductName( - E2Util.BOARDINFOAREABOARDMANUFACTURER, part) - bia.boardProductName = conf.getProductName( - E2Util.BOARDINFOAREABORADPRODUCTNAME, part) - bia.boardSerialNumber = conf.getProductName( - E2Util.BOARDINFOAREABOARDSERIALNUMBER, part) - bia.boardPartNumber = conf.getProductName( - E2Util.BOARDINFOAREABOARDPARTNUMBER, part) - bia.fruFileId = conf.getProductName( - E2Util.BOARDINFOAREAFRUFILEID, part) - bia.boardextra1 = conf.getProductName( - E2Util.BOARDINFOAREAFEXTRA1, part) - bia.recalcute() - - productispresent = conf.getProductName( - E2Util.PRODUCTINFOAREAISPRESENT, part) - if (productispresent == "1"): - pia = ProductInfoArea(name="Product Info Area ", - size=0) - pia.isPresent = True - - pia.productManufacturer = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTMANUFACTURER, part) - pia.productName = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTNAME, part) - pia.productPartModelName = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTPARTMODELNAME, part) - pia.productVersion = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTVERSION, part) - pia.productSerialNumber = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTSERIALNUMBER, part) - pia.productAssetTag = conf.getProductName( - E2Util.PRODUCTINFOAREAPRODUCTASSETTAG, part) - pia.fruFileId = conf.getProductName( - E2Util.PRODUCTINFOAREAFRUFILEID, part) - val_t = E2Util.getTimeFormat() - if val_t != None: - pia.productExtra1 = val_t - # Extra2 Special Processing (MAC address - macaddr = conf.getProductName( - E2Util.PRODUCTINFOAREAEXTRA2, part) - if macaddr != None: - pia.productExtra2 = E2Util.encodeMac(macaddr) - # Extra3 Special Processing - pia.productExtra3 = E2Util.encodeMacLen(conf.getProductName( - E2Util.PRODUCTINFOAREAEXTRA3, part)) - pia.recalcute() - - filename = conf.getPartBinName(part) - print ("filename", filename) - E2Util.createFruBin(filename, bia, pia) - except Exception as e: - print (e) - - @staticmethod - def checksum(b): - result = 0 - for i in range(len(b)): - result += ord(b[i]) - return (0x100 - (result % 256)) if (result % 256) != 0 else 0 - - @staticmethod - def decodeLength(value): - a = bitarray(8) - a.setall(True) - a[0:1] = 0 - a[1:2] = 0 - x = ord(a.tobytes()) - return x & ord(value) - - @staticmethod - def getTypeLength(value): - if value == None: - return 0 - a = bitarray(8) - a.setall(False) - a[0:1] = 1 - a[1:2] = 1 - x = ord(a.tobytes()) - return x | len(value) - - @staticmethod - def minToData(): - starttime = datetime(1996, 1, 1, 0, 0, 0) - endtime = datetime.now() - seconds = (endtime - starttime).total_seconds() - mins = seconds / 60 - m = int(round(mins)) - return m - - @staticmethod - def mfgToTime(val): - starttime = datetime(1996, 1, 1, 0, 0, 0) - - - @staticmethod - def getTimeFormat(): - return datetime.now().strftime('%Y-%m-%d') - - @staticmethod - def printbinvalue(b): - index = 0 - print (" ",) - for width in range(16): - print ("%02x " % width,) - print ("") - for i in range(0, len(b)): - if index % 16 == 0: - print (" ") - print (" %02x " % i,) - print ("%02x " % ord(b[i]),) - index += 1 - print ("") - - @staticmethod - def write_bin_file(filename, _value): - retname = "test/" + filename - with open(retname, 'wb') as filep: - for x in _value: - filep.write(str(x)) - filep.close() - - @staticmethod - def getRemoteConfig(url): - res = requests.get(url) - print (res.content) - f = open('bin.conf', 'w') - f.write(res.content) - f.close() - return res.text - - -class E2Config(): - _CONFIG_PRODUCT_SECTON = "products" - _CONFIG_TYPENAME_SECTON = "typename" - - def __init__(self, filename=CONFIG_FILE): - cf = ConfigParser.ConfigParser() - cf.read(filename) - if os.path.exists(filename) != True: - raise E2Exception("init E2Config error") - self.configparse = cf - self.Sections = cf.sections() - self.ProductsTypes = cf.options(self._CONFIG_PRODUCT_SECTON) - - def getProductPartItem(self, section): - return self.configparse.options(section) - - def getPartBinName(self, part): - part = part.rstrip() - fileprename = self.getProductName( - part[-1:], self._CONFIG_TYPENAME_SECTON) - return (part + "_" + fileprename + ".bin").lower().replace("-", "_") - - def getProductName(self, name, section=_CONFIG_PRODUCT_SECTON): - try: - return self.configparse.get(section, name) - except Exception: - return None - - def loadFile(self): - pass - - def getProductSections(self, typeindex): - typename = self.getProductName(typeindex) - return filter(lambda x: typename in x, self.Sections) - - @property - def ProductsTypes(self): - return self._productTypes - - @property - def Sections(self): - return self._sections - - @property - def configparse(self): - return self._configparse - - -def main(arg): - '''create bin''' - E2Util.loadconfig() - if len(arg) < 1: - usage() - sys.exit(1) - producttype = arg[0] - d_print(producttype) - if producttype not in conf.ProductsTypes: - usage() - sys.exit(1) - - productParts = conf.getProductSections(producttype) - print ("productParts", productParts) - print ("prudct name: %s" % conf.getProductName(producttype)) - if len(productParts) <= 0: - print ("product config not found") - for part in productParts: - print (" generate file: %s" % conf.getPartBinName(part)) - E2Util.createpartbin(part) - - -def usage(): - print("Usage: [e2.py product ]") - print(" example: e2.py 1 ") - print(" userless-product :") - for card in conf.ProductsTypes: - print (" %s %s" % (card, conf.getProductName(card))) - - -if __name__ == '__main__': - # main(sys.argv[1:]) - main(["1"]) - main(["2"]) - main(["3"]) - main(["4"]) - main(["5"]) - main(["6"]) diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/product.conf b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/product.conf deleted file mode 100644 index 3028246e1d..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/fruutil/product.conf +++ /dev/null @@ -1,67 +0,0 @@ -[products] -6 = BMCEEPROM -17 = CPUM-C7EDN6-U2 -26 = EMMC-CARD -33 = RA-B6010-48GT4X -# 1 TLV EEPROM 0x56 -# 2 X86 CPU EEPROM -# 3 BMC EEPROM -# 4 CPU BASE_BOARD EEPROM 0x57 -# 5 MAC BOARD EEPROM -# 6.Line card EEPROM (128) -# 7.Fan adapter EEPROM -# 8.Fan the small plate EEPROM -# 9.PSU FRU EEPROM -[typename] -1= tlveeprom -2= x86cpueeprom -3= bmceeprom -4= cpueeprom -5= maceeprom -6= sloteeprom -7= fanconnecteeprom -8= M1HFANI-F -9= M1HFANI-R -A= M2HFANI-F -B= M2HFANI-R -C= psu -M = RA-EMMC-CARD -Q = ibvbeeprom - -[BMCEEPROM-3] -boardinfoarea.ispresent = 1 -boardinfoarea.boardManufacturer = Ragile -boardinfoarea.boradProductName = BMC -boardinfoarea.boardSerialNumber = 0000000000000 -boardinfoarea.boardPartNumber = BMC -boardinfoarea.FRUFileID = 6-3 -boardinfoarea.boardextra1 = AA - -[RA-B6010-48GT4X-4] -productInfoArea.ispresent = 1 -productInfoArea.productManufacturer = Ragile -productInfoArea.productName = RA-B6010-48GT4X -productInfoArea.productPartModelName = RA-B6010-48GT4X -productInfoArea.productVersion = 00 -productInfoArea.productSerialNumber = 0000000000000 -productInfoArea.FRUFileID = 33-4 -productInfoArea.productExtra1 = 2020-12-20 -productInfoArea.productExtra2 = 1a2b3c4d5e6f -productInfoArea.productExtra3 = 2 - -boardinfoarea.ispresent = 1 -boardinfoarea.boardManufacturer = Ragile -boardinfoarea.boradProductName = RA-B6010-48GT4X -boardinfoarea.boardSerialNumber = 0000000000000 -boardinfoarea.boardPartNumber = RA-B6010-48GT4X -boardinfoarea.FRUFileID = 33-4 -boardinfoarea.boardextra1 = AA - -[EMMC-CARD-M] -boardinfoarea.ispresent = 1 -boardinfoarea.boardManufacturer = Ragile -boardinfoarea.boradProductName = EMMC-CARD -boardinfoarea.boardSerialNumber = 0000000000000 -boardinfoarea.boardPartNumber = RA-EMMC-CARD -boardinfoarea.FRUFileID = 26-M -boardinfoarea.boardextra1 = AA \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/logutil/__init__.py b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/logutil/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/logutil/logutil.py b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/logutil/logutil.py deleted file mode 100644 index 0d9f6ff94c..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/logutil/logutil.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/python -# -*- coding: UTF-8 -*- -import os -import syslog -import logging -import subprocess -import shlex - -SYSLOG_IDENTIFIER = "LOGUTIL" - -# ========================== Syslog wrappers ========================== - -def log_info(msg,log_type=SYSLOG_IDENTIFIER, also_print_to_console=False): - syslog.openlog(log_type) - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - - if also_print_to_console: - click.echo(msg) - - -def log_debug(msg, log_type=SYSLOG_IDENTIFIER, also_print_to_console=False): - try: - syslog.openlog(log_type) - syslog.syslog(syslog.LOG_DEBUG, msg) - syslog.closelog() - - if also_print_to_console: - click.echo(msg) - except Exception as e: - print(str(e)) - - -def log_warning(msg, log_type=SYSLOG_IDENTIFIER, also_print_to_console=False): - syslog.openlog(log_type) - syslog.syslog(syslog.LOG_WARNING, msg) - syslog.closelog() - - if also_print_to_console: - click.echo(msg) - -def log_error(msg, log_type=SYSLOG_IDENTIFIER, also_print_to_console=False): - syslog.openlog(log_type) - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - - if also_print_to_console: - click.echo(msg) - -restful_logger_path = "/var/log/bmc_restful.log" -def bmc_restful_logger(message): - if not os.path.isfile(restful_logger_path): - cmd = "sudo touch %s && sudo chmod +x %s" % ( - restful_logger_path, restful_logger_path) - subprocess.Popen( - shlex.split(cmd), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - logging.basicConfig(filename=restful_logger_path, - filemode='a', - format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', - datefmt='%H:%M:%S', - level=logging.INFO) - - logging.info(message) diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/redfishutil/redfish_api.py b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/redfishutil/redfish_api.py deleted file mode 100644 index 25ba521733..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/redfishutil/redfish_api.py +++ /dev/null @@ -1,304 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -import shlex -import datetime -import os -import ssl -import subprocess -import syslog - -class Redfish_Api(): - BmcBaseUrl = 'http://240.1.1.1:8080' - ThermalUrl = '/redfish/v1/Chassis/1/Thermal' - PowerUrl = '/redfish/v1/Chassis/1/Power' - ThresholdSensorsUrl = '/redfish/v1/Chassis/1/ThresholdSensors' - FanSpeedUrl = '/redfish/v1/Chassis/1/Thermal/Actions/Oem/Ragile/Fan.SetSpeed' - BoardsUrl = '/redfish/v1/Chassis/1/Boards/' - BoardLedUrl = "/redfish/v1/Chassis/1/Boards/{}/Actions/Oem/Ragile/Boards.SetLED" - - # Maximum time in seconds that you allow the connection to the server to take. - connect_timeout = 30 - # Maximum time in seconds that you allow the whole operation to take - operation_timeout = 300 - - default_prefix='/redfish/v1/' - session = None - __DEBUG__ = "N" - __DUMP_RESP__ = "N" - RST_STATUS = "status" - RST_SUCCESS = "OK" - refish_logger = None - - def redfish_log_debug(self, msg): - if (self.__DEBUG__ == "Y"): - syslog.openlog("redfis_api") - syslog.syslog(syslog.LOG_DEBUG, msg) - syslog.closelog() - - def redfish_log_error(self, msg): - syslog.openlog("redfish_api") - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - - def __init__(self): - pass - - def get_full_url(self, url): - return self.BmcBaseUrl + url - - def _exec_cmd(self, cmd): - self.redfish_log_debug("Cmd: %s" % cmd) - p = subprocess.Popen(shlex.split(cmd), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - p.wait() - self.redfish_log_debug("Cmd return: %d" % p.returncode) - str_stdout = p.stdout.read().decode('utf-8') - str_stderr = p.stderr.read().decode('utf-8') - self.redfish_log_debug("Cmd stdout: %s" % str_stdout) - if p.returncode !=0: - self.redfish_log_error("Cmd: %s, failed! error msg:%s" % (cmd, str_stderr)) - return None - else: - try: - ret = json.loads(str_stdout) - return ret - except Exception as e: - self.redfish_log_error("Cmd: %s, failed! stdout msg:%s" % (cmd, str_stdout)) - return None - - def _redfish_get(self, url): - self.redfish_log_debug("Get info from %s." % url) - result = None - try: - cmd_get="curl --connect-timeout %d -m %d -X GET %s" % (self.connect_timeout, self.operation_timeout, self.get_full_url(url)) - result = self._exec_cmd(cmd_get) - return result - except Exception as e: - self.redfish_log_error("error_message: %s" % e) - return None - - def _redfish_post(self, url, playload): - self.redfish_log_debug("post url: %s" % url) - self.redfish_log_debug("Playload: %s" % playload) - - playload_json = json.dumps(playload) - result = False - try: - cmd_post="curl --connect-timeout %d -m %d -X POST %s -d \'%s\'" % (self.connect_timeout, self.operation_timeout, self.get_full_url(url), playload_json) - ret_msg = self._exec_cmd(cmd_post) - if ret_msg == None: - return False - elif ret_msg["success"] == False: - redfish_log_error("Url: '%s', Playload: '%s', Bmc return failed, error_message: %s" % (url, playload_json, ret_msg["Message"])) - result = False - else: - result = True - return result - except Exception as e: - redfish_log_error("error_message: %s" % e) - return False - - def get_thermal(self): - """Get thermal info - :returns: class 'redfish.rest.v1.RestResponse' or None when failed - """ - return self._redfish_get(self.ThermalUrl) - - def get_power(self): - """Get power info - :returns: class 'redfish.rest.v1.RestResponse' or None when failed - """ - return self._redfish_get(self.PowerUrl) - - def get_thresholdSensors(self): - """Get thresholdSensors info - :returns: class 'redfish.rest.v1.RestResponse' or None when failed - """ - return self._redfish_get(self.ThresholdSensorsUrl) - - def post_odata(self, odata_id, playload): - """post odata info - :params odata_id: the specified odata_id path - :type odata_id: string - :playload: info to post - :type: dictionary - :returns: True or False - """ - if odata_id is None or playload is None: - print("post failed: odata_id or playload is None") - return False - return self._redfish_post(odata_id, playload) - - def get_odata(self, odata_id): - """Get odata info - :params odata_id: the specified odata_id path - :type odata_id: string - :returns: class 'redfish.rest.v1.RestResponse' or None when failed - """ - if odata_id is None: - print("Get odata_id failed: odata_id is None") - return None - return self._redfish_get(odata_id) - - def post_fanSpeed(self, playload): - """post odata info - :playload: info to post - :type: dictionary - :returns: True or False - """ - if playload is None: - print("post failed: playload is None") - return False - return self._redfish_post(self.FanSpeedUrl, playload) - - def get_board(self, board_name="indicatorboard"): - """Get board info - :board_name: name of board, default is "indicatorboard" - :type: string - :returns: class'redfish.rest.v1.RestResponse' or None when failed - """ - if board_name is None : - print("get failed: board_name is None") - return None - return self._redfish_get(self.BoardsUrl + board_name) - - def post_boardLed(self, playload, board_name="indicatorboard"): - """post boardLed info - :board_name: name of board, default is "indicatorboard" - :type: string - :playload: info to post - :type: dictionary - :returns: True or False - """ - if board_name is None or playload is None: - print("post failed: playload is None") - return False - return self._redfish_post(self.BoardLedUrl.format(board_name), playload) - - ''' not supported currently - def post_thermal(self, playload): - """post thermal info - :playload: info to post - :type: dictionary - :returns: True or False - """ - if playload is None: - print("post_thermal failed: playload is None") - return None - return self._redfish_post(self.ThermalUrl, playload) - - def post_power(self, playload): - """post power info - :playload: info to post - :type: dictionary - :returns: True or False - """ - if playload is None: - print("post_power failed: playload is None") - return None - return self._redfish_post(self.PowerUrl, playload) - - def post_thresholdSensors(self, playload): - """post thresholdSensors info - :playload: info to post - :type: dictionary - :returns: True or False - """ - if playload is None: - print("post_thresholdSensors failed: playload is None") - return None - return self._redfish_post(self.ThresholdSensorsUrl, playload) - - def get_fanSpeed(self): - """Get board led info - :returns: class'redfish.rest.v1.RestResponse' or None when failed - """ - return self._redfish_get(self.FanSpeedUrl) - - def post_board(self, playload, board_name="indicatorboard"): - """post board info - :board_name: name of board, default is "indicatorboard" - :type: string - :playload: info to post - :type: dictionary - :returns: True or False - """ - if board_name is None or playload is None: - print("post failed: playload is None") - return False - return self._redfish_post(self.BoardsUrl + board_name, playload) - - def get_boardLed(self, board_name="indicatorboard"): - """Get boardLed info - :board_name: name of board, default is "indicatorboard" - :type: string - :returns: class'redfish.rest.v1.RestResponse' or None when failed - """ - if board_name is None : - print("get failed: board_name is None") - return None - return self._redfish_get(self.BoardsUrl % board_name) - - ''' - -''' -if __name__ == '__main__': - redfish = Redfish_Api() - - ### get - # boards - ret = redfish.get_board() - if ret is None: - print("get failed: board") - else: - print("get succeeded, board:%s" % ret) - - ret = redfish.get_thresholdSensors() - if ret is None: - print("get failed: threshold") - else: - print("get succeeded, threshold:%s" % ret) - - ret = redfish.get_power() - if ret is None: - print("get failed: power") - else: - print("get succeeded, power:%s" % ret) - - ret = redfish.get_thermal() - if ret is None: - print("get failed:thermal") - else: - print("get succeeded,thermal:%s" % ret) - - # get playload - resp = redfish.get_thresholdSensors() - if (resp != None): - print(resp["@odata.id"]) - print(resp["@odata.type"]) - print(resp["Id"]) - print(resp["Name"]) - else: - print("Failed: get_thresholdSensors") - - ### post - # fanSpeed - playload = {} - playload["FanName"] = 'Fan0' - playload["FanSpeedLevelPercents"] = "70" - print("post fanSpeed:%s" % redfish.post_fanSpeed(playload)) - - #{"LEDs": [{"IndicatorLEDColor": "green","LEDType": "sys"},{"IndicatorLEDColor": "off","LEDType": "pwr"},{"IndicatorLEDColor": "green","LEDType": "fan"}]} - playload = {} - led = {} - led1 = {} - led_list = [] - led["IndicatorLEDColor"] = "green" - led["LEDType"] = "sys" - led1["IndicatorLEDColor"] = "off" - led1["LEDType"] = "pwr" - led_list.append(led) - led_list.append(led1) - playload["LEDs"] = led_list - # boardsLed - print("post boardLed:%s" % redfish.post_boardLed(playload)) -''' diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/rjutil/__init__.py b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/rjutil/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/rjutil/ragileutil.py b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/rjutil/ragileutil.py deleted file mode 100644 index b704d384b0..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/rjutil/ragileutil.py +++ /dev/null @@ -1,290 +0,0 @@ -#!/usr/bin/python -# -*- coding: UTF-8 -*- - -import os -import re -import time -import mmap -configfile_pre = "/usr/local/bin/" -import sys -sys.path.append(configfile_pre) -from ragileconfig import * -import subprocess -import pexpect -import shlex - -SYSLOG_IDENTIFIER = "UTILTOOL" - -def os_system(cmd): - status, output = subprocess.getstatusoutput(cmd) - return status, output - -def get_machine_info(): - if not os.path.isfile('/host/machine.conf'): - return None - machine_vars = {} - with open('/host/machine.conf') as machine_file: - for line in machine_file: - tokens = line.split('=') - if len(tokens) < 2: - continue - machine_vars[tokens[0]] = tokens[1].strip() - return machine_vars - -def get_platform_info(machine_info): - if machine_info != None: - if machine_info.__contains__('onie_platform'): - return machine_info['onie_platform'] - elif machine_info.__contains__('aboot_platform'): - return machine_info['aboot_platform'] - return None - -''' -def cpld_version_restful(url): - if url == "" or len(url) <=0: - print("invalid url") - return - bmc = BMCMessage() - value = bmc.getBmcValue(url) - json_dicts=json.dumps(value,indent=4) - return json_dicts -''' - -def lpc_cpld_rd(reg_addr): - try: - regaddr = 0 - if type(reg_addr) == int: - regaddr = reg_addr - else: - regaddr = int(reg_addr, 16) - devfile = "/dev/lpc_cpld" - fd = os.open(devfile, os.O_RDWR|os.O_CREAT) - os.lseek(fd, regaddr, os.SEEK_SET) - str = os.read(fd, 1) - os.close(fd) - return "%02x" % ord(str) - except ValueError: - return None - except Exception as e: - print (e) - return None - - -def my_log(txt): - if DEBUG == True: - print ("[RAGILE]:",) - print (txt) - return - -def log_os_system(cmd, show): - my_log (' Run :'+ cmd) - status, output = subprocess.getstatusoutput(cmd) - my_log (" with result :" + str(status)) - my_log (" output :" + output) - if status: - log_error('Failed :%s msg:%s'%(cmd,output)) - if show: - print ('Failed :'+ cmd) - return status, output - -def password_command(cmd, password, exec_timeout=30): - - newkey = 'continue connecting' - log_os_system("rm -rf ~/.ssh", 0) - msg = "" - try_times = 3 - try_times_conter = try_times - while try_times_conter: - child = pexpect.spawn(cmd) - if try_times != try_times_conter: - time.sleep(5) - try_times_conter -= 1 - try: - i = child.expect([pexpect.TIMEOUT, newkey, 'password: ',"refused",pexpect.EOF],timeout=30) - # If the login times out, print an error message and exit. - if i == 0: # Timeout - msg = 'connect to BMC timeout' - continue - # no public key - if i == 1: - child.sendline ('yes') - i = child.expect([pexpect.TIMEOUT, 'password: '],timeout=30) - if i == 0: # Timeout - msg = 'connect to BMC timeout' - continue - if i == 1:# Go below and enter the logic of the password - i = 2 - if i == 2: # Enter the password - child.sendline (password) - i = child.expect([pexpect.EOF, pexpect.TIMEOUT], exec_timeout) - if i == 0: - return True,child.before - if i == 1: - msg = str(child.before)+"\nBMC run commands timeout" - return False,msg - if i == 3: # BMC Connection refused - msg = 'connect to BMC failed' - continue - if i == 4: - msg = child.before - except Exception as e: - msg = str(child.before)+"\nconnect to BMC failed" - - return False,msg - -def password_command_realtime(ssh_header, ssh_cmd, password,key_words, exec_timeout=30): - - key_word_end = key_words.get("key_word_end") - key_word_pass = key_words.get("key_word_pass") - key_word_noshow = key_words.get("key_word_noshow") - # Prevents waiting caused by BMC restart - key_word_exit = key_words.get("key_word_exit") - - if None in [key_word_end,key_word_pass]: - print ("Missing parameters") - return False - - newkey = 'continue connecting' - log_os_system("rm -rf ~/.ssh", 0) - msg = "" - try_times = 3 - key_word_pass_flag = False - try_times_conter = try_times - child = pexpect.spawn(ssh_header) - try: - i = child.expect([pexpect.TIMEOUT,newkey, 'password: ',"refused",pexpect.EOF],timeout=30) - # If the login times out, print an error message and exit. - if i == 0: # Timeout - msg = 'connect to BMC timeout' - # no public key - if i == 1: - child.sendline ('yes') - i = child.expect([pexpect.TIMEOUT, 'password: '],timeout=30) - if i == 0: # Timeout - msg = 'connect to BMC timeout' - if i == 1:# Go below and enter the logic of the password - i = 2 - - if i == 2: # Enter the password - child.sendline (password) - i = child.expect([pexpect.EOF, "\r",pexpect.TIMEOUT], exec_timeout) - if i == 0: - print (child.before) - return key_word_pass_flag - if i == 1: - child.sendline(ssh_cmd) - # amount received is similar to root@switch2 in order to avoid misjudgment about the end of execution - usr_symble_first = True - bmc_str_tmp="" - while True: - i = child.expect([pexpect.EOF,"\r","\n",key_word_end, pexpect.TIMEOUT], exec_timeout) - if i == 0: - return key_word_pass_flag - elif i in [1,2]: - if key_word_noshow == None or key_word_noshow not in child.before: - bmc_str, times = re.subn("\r|\n","",child.before) - if len(bmc_str) > 1: - print (bmc_str) - bmc_str_tmp=bmc_str_tmp + bmc_str - # print bmc_str_tmp - # if key_word_pass in child.before: - if re.search(key_word_pass,bmc_str_tmp) != None: - key_word_pass_flag = True - if key_word_exit != None and key_word_exit in child.before: - # Give the BMC time to execute the last command - time.sleep(3) - return key_word_pass_flag - elif i == 3 : - if usr_symble_first: - usr_symble_first = False - else: - return key_word_pass_flag - - if i == 3: # BMC Connection refused - msg = 'connect to BMC failed' - if i == 4: - msg = child.before - except Exception as e: - print (e) - msg = str(child.before)+"\nconnect to BMC error" - print (msg) - - return False - -def get_sys_execute2(cmd, key_word_pass): - # key_word_pass_flag1 = False - key_word_pass_flag = False - filename = "/tmp/diag_excute_out" - cmd = cmd + "|tee %s" % filename - p = subprocess.Popen(shlex.split(cmd), shell=False) - p.wait() - with open(filename, 'r') as f: - str1 = f.read() - if key_word_pass in str1: - key_word_pass_flag = True - # if key_word_pass_flag1 and "100%" in str1: - # key_word_pass_flag = True - log_os_system("rm %s"%filename,0) - return key_word_pass_flag - - -BMC_PATH = "PATH=/usr/sbin/:/bin/:/usr/bin/:/sbin" -RETURN_KEY1 = "code" -RETURN_KEY2 = "msg" -DEBUG = False - -def rgi2cget(bus, devno, address): - command_line = "i2cget -f -y %d 0x%02x 0x%02x " % (bus, devno, address) - retrytime = 6 - ret_t = "" - for i in range(retrytime): - ret, ret_t = os_system(command_line) - if ret == 0: - return True, ret_t - time.sleep(0.1) - return False, ret_t - -def strtoint(str): # Hexadecimal string to int,"4040"/"0x4040"/"0X4040" = 16448 - value = 0 - rest_v = str.replace("0X", "").replace("0x", "") - for index in range(len(rest_v)): - value |= int(rest_v[index], 16) << ((len(rest_v) - index - 1) * 4) - return value - -def pci_read(pcibus, slot, fn , bar, offset): - if offset % 4 != 0: - return None - filename = "/sys/bus/pci/devices/0000:%02x:%02x.%x/resource%d" % (int(pcibus), int(slot), int(fn), int(bar)) - file = open(filename, "r+") - size = os.path.getsize(filename) - data = mmap.mmap(file.fileno(), size) - result = data[offset: offset + 4] - s = result[::-1] - val = 0 - for i in range(0, len(s)): - val = val << 8 | ord(s[i]) - data.close() - file.close() - return val - -########################################### -# Run the DMI command to obtain the BIOS information -########################################### -def getDmiSysByType(type_t): - ret, log = os_system("which dmidecode ") - if ret != 0 or len(log) <= 0: - error = "cmd find dmidecode" - return False, error - cmd = log + " -t %s" % type_t - # Get the total first - ret1, log1 = os_system(cmd) - if ret != 0 or len(log1) <= 0: - return False, "Command error[%s]" % cmd - its = log1.replace("\t", "").strip().split("\n") - ret = {} - for it in its: - if ":" in it: - key = it.split(":")[0].lstrip() - value = it.split(":")[1].lstrip() - ret[key] = value - return True, ret diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/sonic_fwmgr/__init__.py b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/sonic_fwmgr/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/sonic_fwmgr/fwgmr_base.py b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/sonic_fwmgr/fwgmr_base.py deleted file mode 100644 index 50a4ca7bc6..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/lib/sonic_fwmgr/fwgmr_base.py +++ /dev/null @@ -1,141 +0,0 @@ -# fwgmr_base.py -# -# Base class for creating platform-specific firmware management interfaces for SONiC -# -try: - import abc -except ImportError as e: - raise ImportError("%s - required module not found" % str(e)) - -class FwMgrUtilBase(object): - - """Base class for Platform-specific FwMgrUtil class""" - __metaclass__ = abc.ABCMeta - - def __init__(self): - """TODO: to be defined1. """ - pass - - @abc.abstractmethod - def get_bmc_version(self): - """Get BMC version from SONiC - :returns: version string - """ - return - - @abc.abstractmethod - def get_cpld_version(self): - """Get CPLD version from SONiC - :returns: dict like {'CPLD_1': version_string, 'CPLD_2': version_string} - """ - return - - @abc.abstractmethod - def get_onie_version(self): - """Get ONiE version from SONiC - :returns: version string - """ - return - - @abc.abstractmethod - def get_uboot_version(self): - """Get UBOOT version from SONiC - :returns: version string - """ - return - - # @fw_type MANDATORY, firmware type, should be one of the strings: 'cpld', 'fpga', 'bios', 'bmc' - # @fw_path MANDATORY, target firmware file - # @fw_extra OPTIONAL, extra information string, - # for fw_type 'cpld' and 'fpga': it can be used to indicate specific cpld, such as 'cpld1', 'cpld2', ... - # or 'cpld_fan_come_board', etc. For fw_type 'bios' and 'bmc', value should be one of 'master' - # or 'slave' or 'both'. For BMC, 'pingpong' stands for alternative upgrade policy. - @abc.abstractmethod - def firmware_upgrade(self, fw_type, fw_path, fw_extra): - return - - # Get last firmware upgrade information, inlcudes: - # 1) FwType: cpld/fpga/bios/bmc(passed by method 'firmware_upgrade'), string - # 2) FwPath: path and file name of firmware(passed by method 'firmware_upgrade'), string - # 3) FwExtra: designated string, econdings of this string is determined by vendor(passed by method 'firmware_upgrade') - # 4) Result: indicates whether the upgrade action is performed and success/failure status if performed. Values should be one of: "DONE"/"FAILED"/"NOT_PERFORMED". - # dict object: - # { - # "FwType": "cpld", - # "FwExtra": "specific_encoded_string" - # "Result": "DONE"/"FAILED"/"NOT_PERFORMED" - # } - @abc.abstractmethod - def get_last_upgrade_result(self): - return - - # Program FPGA and/or CPLD firmware only, but do not refresh them - # - # @param fw_type value can be: FPGA, CPLD - # @param fw_path a string of firmware file path, seperated by ':' - # @param fw_extra a string of firmware subtype, i.e CPU_CPLD, BOARD_CPLD, - # FAN_CPLD, LC_CPLD, etc. Subtypes are seperated by ':', - # the sequence should match the file nanmes in param @fw_path - # @return True when all required firmware is program succefully, - # False otherwise. - # - # Example: - # self.firmware_program("CPLD", "/cpu_cpld.vme:/lc_cpld", \ - # "CPU_CPLD:LC_CPLD") - # or - # self.firmware_program("FPGA", "/fpga.bin", "FPGA") - @abc.abstractmethod - def firmware_program(self, fw_type, fw_path, fw_extra=None): - return - - # Refresh firmware and take extra action when necessary. - # @param fpga_list a list of FPGA names - # @param cpld_list a list of CPLD names - # @return True if refresh succefully - # - # @Note extra action: - # 1) response OK to restful call - # 2) shutdown eth0.4088(keep eth0 working) - # 3) shutdown SFP power - # 4) power off all(CPU, switch, gearbox) - # 5) if power off fpga is supported: - # power off fpga - # else: - # refresh fpga - # 6) refresh linecard cpld, fan cpld - # 7) refresh cpu cpld, baseboard cpld - # 8) power on all - # 9) bring up eth0.4088 - # - # Example: - # self.firmware_refresh(["FPGA"], ["CPU_CPLD", "LC_CPLD"], "/tmp/fw/refresh.vme") - # or - # self.firmware_refresh(["FPGA"], None, None) - # or - # self.firmware_refresh(None, ["FAN_CPLD", "LC1_CPLD", "BOARD_CPLD"], "/tmp/fw/refresh.vme") - @abc.abstractmethod - def firmware_refresh(self, fpga_list, cpld_list, fw_extra=None): - return - - # Get booting flash of running BMC. - # @return a string, "master" or "slave" - @abc.abstractmethod - def get_running_bmc(self): - return - - # Set booting flash of BMC - # @param flash should be "master" or "slave" - @abc.abstractmethod - def set_bmc_boot_flash(self, flash): - return - - # Reboot BMC - @abc.abstractmethod - def reboot_bmc(self): - return - - # Get booting uboot image of current running host OS - # @return a string, "master" or "slave" - @abc.abstractmethod - def get_current_uboot(self): - return diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/ctccmd b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/ctccmd deleted file mode 100755 index 2c4410a16d..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/ctccmd +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash - -docker exec -i syncd ctc_shell -e "$@" \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/privatenetwork.py b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/privatenetwork.py deleted file mode 100644 index b169662e99..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/privatenetwork.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/python -# -*- coding: UTF-8 -*- -import sys -import os -import re -try: - from sonic_platform import get_machine_info - from sonic_platform import get_platform_info -except ImportError : - try: - from sonic_device_util import get_machine_info - from sonic_device_util import get_platform_info - except ImportError: - from sonic_py_common import device_info - def get_machine_info(): - print("get_machine_info is null") - return False - def get_platform_info(x): - return device_info.get_platform() - -def start(): - x = get_platform_info(get_machine_info()) - print (x) - str = re.findall(r"-(.+?)_",x) - print (str[0]) - if str[0] == 'ragile': - print ("Start privatenetwork.sh") - os.system("/usr/local/bin/privatenetwork.sh start") - else: - print ("Not set private network.") -def stop(): - x = get_platform_info(get_machine_info()) - print (x) - str = re.findall(r"-(.+?)_",x) - print (str[0]) - if str[0] == 'ragile': - print ("Stop privatenetwork.sh") - os.system("/usr/local/bin/privatenetwork.sh stop") - else: - print ("Not stop private network.") -def main(): - print (sys.argv[1]) - if sys.argv[1]=='start': - start() - elif sys.argv[1]=='stop': - stop() - else: - print ("Error parameter!\nRequired parameters : start or stop.") -if __name__ == '__main__': - main() diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/privatenetwork.sh b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/privatenetwork.sh deleted file mode 100644 index 4105dcbfff..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/privatenetwork.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -function load_eth0.4088(){ - try_times_remain=5 - state_up=$(ip -d link show eth0.4088 | awk '/state UP/{print $2}') - while [ -z "$state_up" ] && [ $try_times_remain -ne 0 ] - do - ((try_times_remain-=1)) - ip link add link eth0 name eth0.4088 type vlan id 4088 || true - ip addr add 240.1.1.2/30 brd 240.1.1.3 dev eth0.4088 || true - ip link set dev eth0.4088 up || true - state_up=$(ip -d link show eth0.4088 | awk '/state UP/{print $2}') - sleep 1 - done -} - -function unload_eth0.4088(){ - ip link set dev eth0.4088 down - ip link del eth0.4088 -} - -if [ "$1" = "start" ];then - load_eth0.4088 -elif [ "$1" = "stop" ];then - unload_eth0.4088 -fi diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/update_machine_config.sh b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/update_machine_config.sh deleted file mode 100644 index 933e7cc357..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/script/update_machine_config.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') -mkdir -p /mnt/onie-boot -mount $onie_dev /mnt/onie-boot -onie_grub_cfg=/mnt/onie-boot/onie/grub/grub-machine.cfg - -if [ ! -e $onie_grub_cfg ]; then - echo "$onie_grub_cfg not found" -else - oldoniebuilddate=`cat /host/machine.conf|grep "onie_build_date="` - oniebuilddate=`cat $onie_grub_cfg|grep "onie_build_date="|sed "s/\"//g"` - onieversion=`cat $onie_grub_cfg|grep "onie_version="` - oniekernelversion=`cat $onie_grub_cfg|grep "onie_kernel_version="` - if [ "$oldoniebuilddate" != "$oniebuilddate" ]; then - echo "update /home/machine.conf" - sed -i "s/onie_build_date=.*/$oniebuilddate/" /host/machine.conf - sed -i "s/onie_version=.*/$onieversion/" /host/machine.conf - sed -i "s/onie_kernel_version=.*/$oniekernelversion/" /host/machine.conf - sed -i "s/\"//g" /host/machine.conf - fi -fi -umount /mnt/onie-boot - - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/service/privatenetwork.service b/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/service/privatenetwork.service deleted file mode 100644 index a962613ad1..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/common_custom/common_ragile/service/privatenetwork.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Update interfaces configuration for adding eth0 private subnetwork -After=network.target ra-b6010-48gt4x_platform.service -DefaultDependencies=no - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/privatenetwork.py start -ExecStop=/usr/local/bin/privatenetwork.py stop -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/debian/changelog b/platform/centec-arm64/sonic-platform-modules-ragile/debian/changelog deleted file mode 100755 index 4cbb334fd2..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -sonic-centec-platform-modules (1.3) unstable; urgency=low - - * Add support for ragile ra-b6010-48gt4x - - -- sonic_rd Mon, 21 Sep 2020 13:34:33 +0800 - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/debian/compat b/platform/centec-arm64/sonic-platform-modules-ragile/debian/compat deleted file mode 100644 index f599e28b8a..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/debian/compat +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/debian/control b/platform/centec-arm64/sonic-platform-modules-ragile/debian/control deleted file mode 100644 index 5c32698717..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/debian/control +++ /dev/null @@ -1,11 +0,0 @@ -Source: sonic-centec-platform-modules -Section: main -Priority: extra -Maintainer: shil -Build-Depends: debhelper (>= 8.0.0), bzip2 -Standards-Version: 3.9.3 - -Package: platform-modules-ra-b6010-48gt4x -Architecture: arm64 -Description: kernel modules for platform devices such as fan, led, sfp - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.init b/platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.init deleted file mode 100644 index 33db82a450..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.init +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# This script load/unload centec kernel modules - -function install_python_api_package() -{ - device="/usr/share/sonic/device" - platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - - rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) - if [ $? -ne 0 ]; then - echo -n "Install sonic_platform-1.0-py3-none-any.whl ..." - rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) - fi -} - -function load_kernel_modules() -{ - hwaddr=`fw_printenv ethaddr | awk -F = '{print $2}'` - if [ "$hwaddr" != "" ]; then - ifconfig eth0 hw ether $hwaddr - fi - depmod -a - modprobe dal - modprobe psample -} - -function remove_kernel_modules() -{ - modprobe -r dal -} - -case "$1" in -start) - echo -n "Load Centec kernel modules... " - - load_kernel_modules - install_python_api_package - - echo "done." - ;; - -stop) - echo -n "Unload Centec kernel modules... " - - remove_kernel_modules - - echo "done." - ;; - -force-reload|restart) - echo "Not supported" - ;; - -*) - echo "Usage: /etc/init.d/platform-modules-ra-b6010-48gt4x {start|stop}" - exit 1 - ;; -esac - -exit 0 - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.install b/platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.install deleted file mode 100644 index 3ad193101a..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.install +++ /dev/null @@ -1,2 +0,0 @@ -ra-b6010-48gt4x/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-ragile_ra-b6010-48gt4x-r0 - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.postinst b/platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.postinst deleted file mode 100644 index eef57df148..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/debian/platform-modules-ra-b6010-48gt4x.postinst +++ /dev/null @@ -1,8 +0,0 @@ -systemctl enable ra-b6010-48gt4x_platform.service -systemctl start ra-b6010-48gt4x_platform.service -systemctl enable device_i2c.service -systemctl start device_i2c.service -systemctl enable privatenetwork.service -systemctl start privatenetwork.service -systemctl enable fancontrol.service -systemctl start fancontrol.service diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/debian/rules b/platform/centec-arm64/sonic-platform-modules-ragile/debian/rules deleted file mode 100755 index 7676379cfa..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/debian/rules +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -include /usr/share/dpkg/pkg-info.mk - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -export INSTALL_MOD_DIR:=extra - -PYTHON = python3.9 - -PACKAGE_PRE_NAME := platform-modules -KVERSION ?= $(shell uname -r) -KERNEL_SRC := /lib/modules/$(KVERSION) -MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= ra-b6010-48gt4x -MODULE_DIR := common -CUSTOMS_DIRS := common_custom/common_ragile -SERVICE_DIR := service -CLASSES_DIR := classes -CONFIG_DIR := config -KDAL_DIR := ../../centec/centec-dal/ -export KERNEL_SRC - - - -clean: - dh_testdir - dh_testroot - dh_clean - -build: - #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) - (for mod in $(KDAL_DIR); do \ - make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \ - done) - (for mod in $(MODULE_DIRS); do \ - make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ - cd $${mod}; $(PYTHON) setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ - cd -; \ - done) - make -C $(MODULE_DIR); - make -C $(CUSTOMS_DIRS); - -binary: binary-arch binary-indep - # Nothing to do - -binary-arch: - # Nothing to do - -binary-indep: - dh_testdir - dh_installdirs - - # Custom package commands - (for mod in $(MODULE_DIRS); do \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} etc; \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} boot; \ - cp -r $(MOD_SRC_DIR)/$(MODULE_DIR)/build/* debian/$(PACKAGE_PRE_NAME)-$${mod}/; \ - cp -r $(MOD_SRC_DIR)/$(CUSTOMS_DIRS)/build/* debian/$(PACKAGE_PRE_NAME)-$${mod}/; \ - cp $(MOD_SRC_DIR)/$${mod}/config/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ - cp $(MOD_SRC_DIR)/$${mod}/modules/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - cp $(MOD_SRC_DIR)/$(KDAL_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ - cp $(MOD_SRC_DIR)/${CONFIG_DIR}/* debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/; \ - cd -; \ - done) - - # Resuming debhelper scripts - dh_testroot - dh_install - dh_installchangelogs - dh_installdocs - dh_systemd_enable - dh_installinit - dh_systemd_start - dh_link - dh_fixperms - dh_compress - dh_strip - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb -.PHONY: build binary binary-arch binary-indep clean diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/config/arm64_ragile_ra_b6010_48gt4x_r0_config.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/config/arm64_ragile_ra_b6010_48gt4x_r0_config.py deleted file mode 100755 index 72b115967a..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/config/arm64_ragile_ra_b6010_48gt4x_r0_config.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/python -# -*- coding: UTF-8 -*- -from ragilecommon import * -PCA9548START = -1 -PCA9548BUSEND = -2 - -RAGILE_CARDID = 0x00004065 -RAGILE_PRODUCTNAME = "RA-B6010-48GT4X" -RAGILE_PART_NUMBER = "01016994" -RAGILE_LABEL_REVISION = "R01" -RAGILE_ONIE_VERSION = "2018.05-rc1" -RAGILE_MAC_SIZE = 3 -RAGILE_MANUF_NAME = "Ragile" -RAGILE_MANUF_COUNTRY = "USA" -RAGILE_VENDOR_NAME = "Ragile" -RAGILE_DIAG_VERSION = "0.1.0.15" -RAGILE_SERVICE_TAG = "www.ragilenetworks.com" - -LOCAL_LED_CONTROL = { - "CLOSE":{}, - "OPEN":{} -} - -MACLED_PARAMS = [] - -# start system modules -STARTMODULE = { - "i2ccheck":0, - "fancontrol":0, - "avscontrol":0, - "avscontrol_restful":0, - "sfptempmodule":0, - "sfptempmodule_interval":3, - "macledreset": 0, - "macledreset_interval": 5, - "macledset_param":MACLED_PARAMS, - } - -FRULISTS = [ - {"name":"mmceeprom","bus":5,"loc":0x50, "E2PRODUCT":'2', "E2TYPE":'5' , "CANRESET":'1'}, - {"name":"cpueeprom","bus":5,"loc":0x57,"E2PRODUCT":'2', "E2TYPE":'4', "CANRESET":'1' }, - ] - -# rg_eeprom = "1-0056/eeprom" -E2_LOC = {"bus":1, "devno":0x56} -E2_PROTECT = {} - - -CPLDVERSIONS = [ - {"bus":2, "devno":0x0d, "name":"CPU_CPLD"}, - {"bus":3, "devno":0x30, "name":"MAC_BOARD_CPLD_1"}, -] - -FIRMWARE_TOOLS = {"cpld": [{"channel":"0","cmd":"firmware_upgrade %s cpld %s cpld", "successtips":"CPLD Upgrade succeeded!"} - ], - } - -# drivers list -DRIVERLISTS = [ - {"name":"i2c_dev", "delay":0}, - {"name":"i2c_algo_bit","delay":0}, - {"name":"spi-bitbang", "delay":0}, - {"name":"i2c_mux", "delay":0}, - {"name":"rtcpcf85063", "delay":0}, - {"name":"i2c_mux_pca954x", "delay":0}, # force_deselect_on_exit=1 - {"name":"ragile_common dfd_my_type=0x4065", "delay":0}, - {"name":"firmware_driver", "delay":0}, - {"name":"rg_cpld", "delay":0}, - {"name":"rg_at24", "delay":0}, - #{"name":"spi-gpio", "delay":0}, - #{"name":"rg_spi_gpio", "delay":0}, - #{"name":"tpm_tis_core", "delay":0}, - #{"name":"tpm_tis_spi", "delay":0}, - {"name":"optoe", "delay":0}, -] - -DEVICE = [ - {"name":"rtcpcf85063","bus":1,"loc":0x51 }, - {"name":"rg_24c02","bus":1,"loc":0x56 }, - {"name":"rg_cpld","bus":3,"loc":0x30 }, - {"name":"rg_24c02","bus":5,"loc":0x50 }, - {"name":"rg_24c02","bus":5,"loc":0x57 }, -] - -INIT_PARAM = [ - {"loc":"3-0030/tx_write_protect","value": "59","delay":1}, - {"loc":"3-0030/tx_disable","value": "00"}, - {"loc":"3-0030/tx_write_protect","value": "4e"}, -] - -INIT_COMMAND = [ - "hwclock -s", -] - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/config/fan_ctrl_cfg.json b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/config/fan_ctrl_cfg.json deleted file mode 100644 index 86fcf892f0..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/config/fan_ctrl_cfg.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "Device": { - "Liquid": 0, - "Buildin": 1, - "PID": 0, - "OpenLoop": 1 - }, - "Thermal": { - "INLET_TEMP": "INLET_TEMP", - "OUTLET_TEMP": "OUTLET_TEMP", - "SWITCH_TEMP": "TPS53688_TEMP" - }, - "Fans": { - "Fan1" : "Fantray1_1", - "Fan2" : "Fantray2_1" - }, - "PID": { - "Pwm_Max": 99, - "Pwm_Min": 30, - "SetPoint" : 90, - "P": 1.5, - "I": 1, - "D": 0.3, - "Temp_Min": 28.0, - "Temp_Max": 45.0, - "Sensor": "TPS53688_TEMP" - }, - "OpenLoop": { - "a": -0.06, - "b": 10.3, - "c": -142.0, - "fix_up": -8, - "pwmMax": 99, - "pwmMin": 30, - "tempMin": 25 - }, - "FanError": { - "Fan_Pwmmax":99 - } -} \ No newline at end of file diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/modules/Makefile b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/modules/Makefile deleted file mode 100644 index 9310841c64..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/modules/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-m += rg_cpld.o diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/modules/rg_cpld.c b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/modules/rg_cpld.c deleted file mode 100644 index becd53c19a..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/modules/rg_cpld.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * rg_cpld.c - A driver for control rg_cpld base on rg_cpld.c - * - * Copyright (c) 1998, 1999 Frodo Looijaard - * Copyright (c) 2018 wk - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* debug switch level */ -typedef enum { - DBG_START, - DBG_VERBOSE, - DBG_KEY, - DBG_WARN, - DBG_ERROR, - DBG_END, -} dbg_level_t; - -static int debuglevel = 0; -module_param(debuglevel, int, S_IRUGO | S_IWUSR); - -#define DBG_DEBUG(fmt, arg...) do { \ - if ( debuglevel > DBG_START && debuglevel < DBG_ERROR) { \ - printk(KERN_INFO "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ - } else if ( debuglevel >= DBG_ERROR ) { \ - printk(KERN_ERR "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ - } else { } \ -} while (0) - -#define DBG_ERROR(fmt, arg...) do { \ - if ( debuglevel > DBG_START) { \ - printk(KERN_ERR "[ERROR]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ - } \ - } while (0) - -#define CPLD_SIZE 256 -#define CPLD_I2C_RETRY_TIMES 5 /* changed the number of retry time to 5 */ -#define CPLD_I2C_RETRY_WAIT_TIME 10 /* Delay 10ms before operation */ - -struct cpld_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct mutex update_lock; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - u8 data[CPLD_SIZE]; /* Register value */ -}; - -static s32 cpld_i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command) -{ - int try; - s32 ret; - - ret = -1; - for (try = 0; try < CPLD_I2C_RETRY_TIMES; try++) { - if ((ret = i2c_smbus_read_byte_data(client, command) ) >= 0 ) - break; - msleep(CPLD_I2C_RETRY_WAIT_TIME); - } - return ret; -} - -static s32 cpld_i2c_smbus_read_i2c_block_data(const struct i2c_client *client, - u8 command, u8 length, u8 *values) -{ - int try; - s32 ret; - - ret = -1; - for (try = 0; try < CPLD_I2C_RETRY_TIMES; try++) { - if ((ret = i2c_smbus_read_i2c_block_data(client, command, length, values) ) >= 0 ) - break; - msleep(CPLD_I2C_RETRY_WAIT_TIME); - } - return ret; -} - -static ssize_t set_cpld_sysfs_value(struct device *dev, struct device_attribute *da, const char *buf, size_t -count) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct cpld_data *data = i2c_get_clientdata(client); - unsigned long val; - int err; - - err = kstrtoul(buf, 16, &val); - if (err) - return err; - if ((val < 0) || (val > 0xff)) { - DBG_ERROR("please enter 0x00 ~ 0xff\n"); - return -1; - } - mutex_lock(&data->update_lock); - data->data[0] = (u8)val; - DBG_DEBUG("pos: 0x%02x count = %ld, data = 0x%02x\n", attr->index, count, data->data[0]); - i2c_smbus_write_byte_data(client, attr->index, data->data[0]); - mutex_unlock(&data->update_lock); - - return count; -} - -static ssize_t show_cpld_version(struct device *dev, struct device_attribute *da, char *buf) -{ - struct i2c_client *client = to_i2c_client(dev); - struct cpld_data *data = i2c_get_clientdata(client); - s32 status; - - status = -1; - mutex_lock(&data->update_lock); - status = cpld_i2c_smbus_read_i2c_block_data(client, 0, 4, data->data); - if (status < 0) { - mutex_unlock(&data->update_lock); - return 0; - } - mutex_unlock(&data->update_lock); - return sprintf(buf, "%02x %02x %02x %02x \n", data->data[0], data->data[1], data->data[2], - data->data[3]); -} - -static ssize_t show_cpld_sysfs_value(struct device *dev, struct device_attribute *da, char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct cpld_data *data = i2c_get_clientdata(client); - s32 status; - - status = -1; - mutex_lock(&data->update_lock); - status = cpld_i2c_smbus_read_byte_data(client, attr->index); - if (status < 0) { - mutex_unlock(&data->update_lock); - return 0; - } - data->data[0] = status; - DBG_DEBUG("cpld reg pos:0x%x value:0x%02x\n", attr->index, data->data[0]); - mutex_unlock(&data->update_lock); - return sprintf(buf, "%02x\n", data->data[0]); -} - -/* sys */ -static SENSOR_DEVICE_ATTR(cpld_version, S_IRUGO, show_cpld_version, NULL, 0); - -/* sfp */ -static SENSOR_DEVICE_ATTR(sfp_presence1, S_IRUGO, show_cpld_sysfs_value, NULL, 0x30); -static SENSOR_DEVICE_ATTR(cable_led1, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x20); -static SENSOR_DEVICE_ATTR(cable_led2, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x21); -static SENSOR_DEVICE_ATTR(cable_led3, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x22); -static SENSOR_DEVICE_ATTR(cable_led4, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x23); -static SENSOR_DEVICE_ATTR(cable_led5, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x24); -static SENSOR_DEVICE_ATTR(cable_led6, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x25); -static SENSOR_DEVICE_ATTR(sfp_led1, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x26); -static SENSOR_DEVICE_ATTR(sfp_drop_record1, S_IRUGO , show_cpld_sysfs_value, NULL, 0x38); -static SENSOR_DEVICE_ATTR(sfp_tx_fault1, S_IRUGO , show_cpld_sysfs_value, NULL, 0x50); -static SENSOR_DEVICE_ATTR(sfp_rx_loss1, S_IRUGO , show_cpld_sysfs_value, NULL, 0x70); -/* tx-disbale */ -static SENSOR_DEVICE_ATTR(tx_disable, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x90); -static SENSOR_DEVICE_ATTR(tx_write_protect, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x0e); - -static struct attribute *mac_cpld_0x30_sysfs_attrs[] = { - &sensor_dev_attr_cpld_version.dev_attr.attr, - &sensor_dev_attr_sfp_presence1.dev_attr.attr, - &sensor_dev_attr_cable_led1.dev_attr.attr, - &sensor_dev_attr_cable_led2.dev_attr.attr, - &sensor_dev_attr_cable_led3.dev_attr.attr, - &sensor_dev_attr_cable_led4.dev_attr.attr, - &sensor_dev_attr_cable_led5.dev_attr.attr, - &sensor_dev_attr_cable_led6.dev_attr.attr, - &sensor_dev_attr_sfp_led1.dev_attr.attr, - &sensor_dev_attr_tx_disable.dev_attr.attr, - &sensor_dev_attr_tx_write_protect.dev_attr.attr, - &sensor_dev_attr_sfp_drop_record1.dev_attr.attr, - &sensor_dev_attr_sfp_tx_fault1.dev_attr.attr, - &sensor_dev_attr_sfp_rx_loss1.dev_attr.attr, - NULL -}; - -static const struct attribute_group mac_cpld_0x30_sysfs_group = { - .attrs = mac_cpld_0x30_sysfs_attrs, -}; - -struct cpld_attr_match_group { - int bus_nr; /* I2C-BUS number */ - unsigned short addr; /* device adress */ - const struct attribute_group *attr_group_ptr;/* SYS attribute pointer */ - const struct attribute_group *attr_hwmon_ptr;/* HWMON Attribute pointer */ -}; - -static struct cpld_attr_match_group g_cpld_attr_match[] = { - {3, 0x30, &mac_cpld_0x30_sysfs_group, NULL}, - -}; - -static const struct attribute_group *cpld_get_attr_group(struct i2c_client *client, int is_hwmon) -{ - int i; - struct cpld_attr_match_group *group; - - for (i = 0; i < ARRAY_SIZE(g_cpld_attr_match); i++) { - group = &g_cpld_attr_match[i]; - DBG_DEBUG("is_hwmon %d i %d client(nr:%d,addr:0x%x), group(nr:%d,addr:0x0%x) .\n", is_hwmon, - i, client->adapter->nr, client->addr, group->bus_nr, group->addr); - if ((client->addr == group->addr) && (client->adapter->nr == group->bus_nr)) { - DBG_DEBUG("is_hwmon %d i %d nr %d addr %d .\n", is_hwmon, i, client->adapter->nr, client->addr); - return (is_hwmon) ? (group->attr_hwmon_ptr) : (group->attr_group_ptr); - } - } - - DBG_DEBUG("is_hwmon %d nr %d addr %d dismatch, return NULL.\n", is_hwmon, client->adapter->nr, client->addr); - return NULL; -} - -static int cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - struct cpld_data *data; - int status; - const struct attribute_group *sysfs_group, *hwmon_group; - - status = -1; - DBG_DEBUG("=========cpld_probe(addr:0x%x, nr:%d)===========\n", client->addr, client->adapter->nr); - data = devm_kzalloc(&client->dev, sizeof(struct cpld_data), GFP_KERNEL); - if (!data) { - return -ENOMEM; - } - - data->client = client; - i2c_set_clientdata(client, data); - mutex_init(&data->update_lock); - - sysfs_group = NULL; - sysfs_group = cpld_get_attr_group(client, 0); - if (sysfs_group) { - status = sysfs_create_group(&client->dev.kobj, sysfs_group); - DBG_DEBUG("=========(addr:0x%x, nr:%d) sysfs_create_group status %d===========\n", client->addr, client->adapter->nr, status); - if (status != 0) { - DBG_ERROR("sysfs_create_group status %d.\n", status); - goto error; - } - } else { - DBG_DEBUG("=========(addr:0x%x, nr:%d) no sysfs_create_group \n", client->addr, client->adapter->nr); - } - - hwmon_group = NULL; - hwmon_group = cpld_get_attr_group(client, 1); - if (hwmon_group) { - data->hwmon_dev = hwmon_device_register_with_groups(&client->dev, client->name, data, (const struct attribute_group **)hwmon_group); - if (IS_ERR(data->hwmon_dev)) { - sysfs_remove_group(&client->dev.kobj, (const struct attribute_group *)sysfs_group); - DBG_ERROR("hwmon_device_register_with_groups failed ret %ld.\n", PTR_ERR(data->hwmon_dev)); - return PTR_ERR(data->hwmon_dev); - } - DBG_DEBUG("=========(addr:0x%x, nr:%d) hwmon_device_register_with_groups success===========\n", client->addr, client->adapter->nr); - if (status != 0) { - DBG_ERROR("sysfs_create_group status %d.\n", status); - goto error; - } - } else { - DBG_DEBUG("=========(addr:0x%x, nr:%d) no hwmon_device_register_with_groups \n", client->addr, client->adapter->nr); - } - -error: - return status; - -} - -static int cpld_remove(struct i2c_client *client) -{ - struct cpld_data *data = i2c_get_clientdata(client); - const struct attribute_group *sysfs_group, *hwmon_group; - - DBG_DEBUG("=========cpld_remove(addr:0x%x, nr:%d)===========\n", client->addr, client->adapter->nr); - - /* To be added the corresponding uninstall operation */ - sysfs_group = NULL; - sysfs_group = cpld_get_attr_group(client, 0); - if (sysfs_group) { - DBG_DEBUG("=========(addr:0x%x, nr:%d) do sysfs_remove_group \n", client->addr, client->adapter->nr); - sysfs_remove_group(&client->dev.kobj, (const struct attribute_group *)sysfs_group); - } else { - DBG_DEBUG("=========(addr:0x%x, nr:%d) no sysfs_remove_group \n", client->addr, client->adapter->nr); - } - - hwmon_group = NULL; - hwmon_group = cpld_get_attr_group(client, 1); - if (hwmon_group) { - DBG_DEBUG("=========(addr:0x%x, nr:%d) do hwmon_device_unregister \n", client->addr, client->adapter->nr); - hwmon_device_unregister(data->hwmon_dev); - } else { - DBG_DEBUG("=========(addr:0x%x, nr:%d) no hwmon_device_unregister \n", client->addr, client->adapter->nr); - } - - return 0; -} - -static const struct i2c_device_id cpld_id[] = { - { "rg_cpld", 0 }, - {} -}; -MODULE_DEVICE_TABLE(i2c, cpld_id); - -static struct i2c_driver rg_cpld_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = "rg_cpld", - }, - .probe = cpld_probe, - .remove = cpld_remove, - .id_table = cpld_id, -}; - -module_i2c_driver(rg_cpld_driver); -MODULE_AUTHOR("wk "); -MODULE_DESCRIPTION("ragile CPLD driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/service/ra-b6010-48gt4x_platform.service b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/service/ra-b6010-48gt4x_platform.service deleted file mode 100644 index bd13cf98ae..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/service/ra-b6010-48gt4x_platform.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Centec modules init -After=local-fs.target -Before=syncd.service - -[Service] -Type=oneshot -ExecStart=-/etc/init.d/platform-modules-ra-b6010-48gt4x start -ExecStop=-/etc/init.d/platform-modules-ra-b6010-48gt4x stop -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/setup.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/setup.py deleted file mode 100644 index 01f97dfd43..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/setup.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -import os -import sys -from setuptools import setup - -setup( - name='sonic_platform', - version='1.0', - description='Module to initialize centec ra-b6010-48gt4x platforms', - - packages=['sonic_platform'], - package_dir={'sonic_platform': 'sonic_platform'}, -) - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/__init__.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/__init__.py deleted file mode 100644 index 4bfefa0fb6..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -__all__ = ["platform", "chassis"] -from sonic_platform import * - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/chassis.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/chassis.py deleted file mode 100644 index 8cdf84cf38..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/chassis.py +++ /dev/null @@ -1,444 +0,0 @@ - -#!/usr/bin/env python - -try: - import time - from sonic_platform_base.chassis_base import ChassisBase - from sonic_platform.eeprom import Eeprom - from sonic_platform.thermal import Thermal - from sonic_platform.fan_drawer import FanDrawer - from sonic_platform.sfp import Sfp - from sonic_platform.psu import Psu - from .component import Component -except ImportError as e: - raise ImportError(str(e) + "- required module not found") - -NUM_FAN_TRAY = 2 -NUM_FAN = 2 -NUM_THERMAL = 5 -NUM_PORT = 52 -NUM_PSU = 2 - -class Chassis(ChassisBase): - - port_dict = {} - STATUS_INSERTED = "1" - STATUS_REMOVED = "0" - - def __init__(self): - ChassisBase.__init__(self) - # Initialize EEPROM - self._eeprom = Eeprom() - #firmware - for i in range(0,2): - self._component_list.append(Component(i)) - # Initialize FAN - for i in range(NUM_FAN_TRAY): - fandrawer = FanDrawer(i) - self._fan_drawer_list.append(fandrawer) - self._fan_list.extend(fandrawer._fan_list) - # Initialize THERMAL - for index in range(0, NUM_THERMAL): - thermal = Thermal(index) - self._thermal_list.append(thermal) - # Initialize SFP - for index in range(0, NUM_PORT + 1): - sfp = Sfp(index) - self._sfp_list.append(sfp) - if sfp.get_presence(): - self.port_dict[index] = self.STATUS_INSERTED - else: - self.port_dict[index] = self.STATUS_REMOVED - # Initialize PSU - for index in range(0, NUM_PSU): - psu = Psu(index) - self._psu_list.append(psu) - -############################################## -# Device methods -############################################## - - def get_name(self): - """ - Retrieves the name of the chassis - Returns: - string: The name of the chassis - """ - name = '' - sys_eeprom = self.get_eeprom() - if sys_eeprom is None: - return '' - - e = sys_eeprom.read_eeprom() - name = sys_eeprom.modelstr(e) - if name is None: - return '' - return name - - def get_presence(self): - """ - Retrieves the presence of the chassis - Returns: - bool: True if chassis is present, False if not - """ - return True - - def get_model(self): - """ - Retrieves the model number (or part number) of the chassis - Returns: - string: Model/part number of chassis - """ - model = '' - sys_eeprom = self.get_eeprom() - if sys_eeprom is None: - return '' - - e = sys_eeprom.read_eeprom() - model = sys_eeprom.modelnumber(e) - if model is None: - return '' - return model - - def get_serial_number(self): - """ - Retrieves the hardware serial number for the chassis - - Returns: - A string containing the hardware serial number for this chassis. - """ - serial_number = '' - sys_eeprom = self.get_eeprom() - if sys_eeprom is None: - return '' - - e = sys_eeprom.read_eeprom() - serial_number = sys_eeprom.serial_number_str(e) - if serial_number is None: - return '' - - return serial_number - - def get_revision(self): - """ - Retrieves the hardware revision of the device - - Returns: - string: Revision value of device - """ - device_version = '' - sys_eeprom = self.get_eeprom() - if sys_eeprom is None: - return '' - - e = sys_eeprom.read_eeprom() - device_version = sys_eeprom.deviceversion(e) - if device_version is None: - return '' - - return device_version - - def get_serial(self): - """ - Retrieves the serial number of the chassis (Service tag) - Returns: - string: Serial number of chassis - """ - return self.get_serial_number() - - def get_status(self): - """ - Retrieves the operational status of the chassis - Returns: - bool: A boolean value, True if chassis is operating properly - False if not - """ - return True - - def get_position_in_parent(self): - """ - Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position - for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned - Returns: - integer: The 1-based relative physical position in parent device or -1 if cannot determine the position - """ - return -1 - - def is_replaceable(self): - """ - Indicate whether this device is replaceable. - Returns: - bool: True if it is replaceable. - """ - return False - - def initizalize_system_led(self): - return True - - def get_status_led(self): - """ - Gets the state of the system LED - - Returns: - A string, one of the valid LED color strings which could be vendor - specified. - """ - return 'green' - - def set_status_led(self, color): - return False -############################################## -# Chassis methods -############################################## - - def get_base_mac(self): - """ - Retrieves the base MAC address for the chassis - - Returns: - A string containing the MAC address in the format - 'XX:XX:XX:XX:XX:XX' - """ - base_mac = '' - sys_eeprom = self.get_eeprom() - if sys_eeprom is None: - return '' - - e = sys_eeprom.read_eeprom() - base_mac = sys_eeprom.base_mac_addr(e) - if base_mac is None: - return '' - - return base_mac.upper() - - def get_system_eeprom_info(self): - """ - Retrieves the full content of system EEPROM information for the chassis - - Returns: - A dictionary where keys are the type code defined in - OCP ONIE TlvInfo EEPROM format and values are their corresponding - values. - Ex. { '0x21':'AG9064', '0x22':'V1.0', '0x23':'AG9064-0109867821', - '0x24':'001c0f000fcd0a', '0x25':'02/03/2018 16:22:00', - '0x26':'01', '0x27':'REV01', '0x28':'AG9064-C2358-16G'} - """ - sys_eeprom_dict = dict() - sys_eeprom = self.get_eeprom() - if sys_eeprom is None: - return {} - - e = sys_eeprom.read_eeprom() - if sys_eeprom._TLV_HDR_ENABLED: - if not sys_eeprom.is_valid_tlvinfo_header(e): - return {} - total_len = (e[9] << 8) | e[10] - tlv_index = sys_eeprom._TLV_INFO_HDR_LEN - tlv_end = sys_eeprom._TLV_INFO_HDR_LEN + total_len - else: - tlv_index = sys_eeprom.eeprom_start - tlv_end = sys_eeprom._TLV_INFO_MAX_LEN - - while (tlv_index + 2) < len(e) and tlv_index < tlv_end: - if not sys_eeprom.is_valid_tlv(e[tlv_index:]): - break - - tlv = e[tlv_index:tlv_index + 2 + e[tlv_index + 1]] - name, value = sys_eeprom.decoder(None, tlv) - sys_eeprom_dict[name] = value - - if e[tlv_index] == sys_eeprom._TLV_CODE_QUANTA_CRC or \ - e[tlv_index] == sys_eeprom._TLV_CODE_CRC_32: - break - tlv_index += e[tlv_index + 1] + 2 - - return sys_eeprom_dict - - def get_thermal_manager(self): - """ - Retrieves thermal manager class on this chassis - :return: A class derived from ThermalManagerBase representing the - specified thermal manager. ThermalManagerBase is returned as default - """ - return False - - def get_reboot_cause(self): - """ - Retrieves the cause of the previous reboot - Returns: - A tuple (string, string) where the first element is a string - containing the cause of the previous reboot. This string must be - one of the predefined strings in this class. If the first string - is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used - to pass a description of the reboot cause. - """ - return (None, None) - - def get_module(self, index): - """ - Retrieves module represented by (0-based) index - - Args: - index: An integer, the index (0-based) of the module to - retrieve - - Returns: - An object dervied from ModuleBase representing the specified - module - """ - module = None - - try: - if self.get_num_modules(): - module = self._module_list[index] - except IndexError: - sys.stderr.write("Module index {} out of range (0-{})\n".format( - index, len(self._module_list)-1)) - - return module - - def get_fan_drawer(self, index): - """ - Retrieves fan drawers represented by (0-based) index - - Args: - index: An integer, the index (0-based) of the fan drawer to - retrieve - - Returns: - An object dervied from FanDrawerBase representing the specified fan - drawer - """ - fan_drawer = None - - try: - if self.get_num_fan_drawers(): - fan_drawer = self._fan_drawer_list[index] - except IndexError: - sys.stderr.write("Fan drawer index {} out of range (0-{})\n".format( - index, len(self._fan_drawer_list)-1)) - - return fan_drawer - - def get_change_event(self, timeout=0): - """ - Returns a nested dictionary containing all devices which have - experienced a change at chassis level - - Args: - timeout: Timeout in milliseconds (optional). If timeout == 0, - this method will block until a change is detected. - - Returns: - (bool, dict): - - bool: True if call successful, False if not; - - dict: A nested dictionary where key is a device type, - value is a dictionary with key:value pairs in the format of - {'device_id':'device_event'}, where device_id is the device ID - for this device and device_event. - The known devices's device_id and device_event was defined as table below. - ----------------------------------------------------------------- - device | device_id | device_event | annotate - ----------------------------------------------------------------- - 'fan' '' '0' Fan removed - '1' Fan inserted - - 'sfp' '' '0' Sfp removed - '1' Sfp inserted - '2' I2C bus stuck - '3' Bad eeprom - '4' Unsupported cable - '5' High Temperature - '6' Bad cable - - 'voltage' '' '0' Vout normal - '1' Vout abnormal - -------------------------------------------------------------------- - Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0', '12':'1'}, - 'voltage':{'U20':'0', 'U21':'1'}} - Indicates that: - fan 0 has been removed, fan 2 has been inserted. - sfp 11 has been removed, sfp 12 has been inserted. - monitored voltage U20 became normal, voltage U21 became abnormal. - Note: For sfp, when event 3-6 happened, the module will not be avalaible, - XCVRD shall stop to read eeprom before SFP recovered from error status. - """ - - change_event_dict = {"fan": {}, "sfp": {}, "voltage": {}} - - start_time = time.time() - forever = False - - if timeout == 0: - forever = True - elif timeout > 0: - timeout = timeout / float(1000) # Convert to secs - else: - print("get_change_event:Invalid timeout value", timeout) - return False, change_event_dict - - end_time = start_time + timeout - if start_time > end_time: - print( - "get_change_event:" "time wrap / invalid timeout value", - timeout, - ) - return False, change_event_dict # Time wrap or possibly incorrect timeout - try: - while timeout >= 0: - # check for sfp - sfp_change_dict = self.get_transceiver_change_event() - # check for fan - # fan_change_dict = self.get_fan_change_event() - # check for voltage - # voltage_change_dict = self.get_voltage_change_event() - - if sfp_change_dict: - change_event_dict["sfp"] = sfp_change_dict - # change_event_dict["fan"] = fan_change_dict - # change_event_dict["voltage"] = voltage_change_dict - return True, change_event_dict - if forever: - time.sleep(1) - else: - timeout = end_time - time.time() - if timeout >= 1: - time.sleep(1) # We poll at 1 second granularity - else: - if timeout > 0: - time.sleep(timeout) - return True, change_event_dict - except Exception as e: - print(e) - print("get_change_event: Should not reach here.") - return False, change_event_dict - - def get_transceiver_change_event(self): - current_port_dict = {} - ret_dict = {} - - # Check for OIR events and return ret_dict - for index in range(0, NUM_PORT + 1): - if self._sfp_list[index].get_presence(): - current_port_dict[index] = self.STATUS_INSERTED - else: - current_port_dict[index] = self.STATUS_REMOVED - - if len(self.port_dict) == 0: # first time - self.port_dict = current_port_dict - return {} - - if current_port_dict == self.port_dict: - return {} - - # Update reg value - for index, status in current_port_dict.items(): - if self.port_dict[index] != status: - ret_dict[index] = status - #ret_dict[str(index)] = status - self.port_dict = current_port_dict - for index, status in ret_dict.items(): - if int(status) == 1: - pass - #self._sfp_list[int(index)].check_sfp_optoe_type() - return ret_dict diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/component.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/component.py deleted file mode 100755 index be84ca63d6..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/component.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python - -try: - import subprocess - from sonic_platform_base.component_base import ComponentBase - import sonic_platform.hwaccess as hwaccess -except ImportError as e: - raise ImportError(str(e) + "- required module not found") - -def get_cpld_version(bus, i2caddr): - return '{}{}{}{}'.format(hwaccess.i2c_get(bus, i2caddr, 1), - hwaccess.i2c_get(bus, i2caddr, 2), - hwaccess.i2c_get(bus, i2caddr, 3), - hwaccess.i2c_get(bus, i2caddr, 0) - ) - -def get_cpu_cpld_version(): - return get_cpld_version(2, 0x0d) - -def get_cpld1_version(): - return get_cpld_version(3, 0x30) - -COMPONENT_LIST= [ - ['CPU CPLD', - 'cpu board', - get_cpu_cpld_version - ], - - ['MAC1 CPLD', - 'mac1 board', - get_cpld1_version - ] - ] - -class Component(ComponentBase): - """ Ragile Platform-specific Component class""" - - def __init__(self, component_index=0): - ComponentBase.__init__(self) - self.index = component_index - - def get_name(self): - """ - Retrieves the name of the component - - Returns: - A string containing the name of the component - """ - return COMPONENT_LIST[self.index][0] - - def get_description(self): - """ - Retrieves the description of the component - - Returns: - A string containing the description of the component - """ - return COMPONENT_LIST[self.index][1] - - def get_firmware_version(self): - """ - Retrieves the firmware version of the component - - Returns: - A string containing the firmware version of the component - """ - return COMPONENT_LIST[self.index][2]() - - def install_firmware(self, image_path): - """ - Installs firmware to the component - - Args: - image_path: A string, path to firmware image - - Returns: - A boolean, True if install was successful, False if not - """ - try: - successtips = "CPLD Upgrade succeeded!" - status, output = subprocess.getstatusoutput("which firmware_upgrade") - if status or len(output) <= 0: - logger.error("no upgrade tool.") - return False - cmdstr = "%s %s cpld %d cpld"%(output,image_path,self.slot) - ret, log = subprocess.getstatusoutput(cmdstr) - if ret == 0 and successtips in log: - return True - logger.error("upgrade failed. ret:%d, log:\n%s" % (ret, log)) - except Exception as e: - logger.error(str(e)) - return False - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/eeprom.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/eeprom.py deleted file mode 100644 index af5da656b7..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/eeprom.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python - -try: - from sonic_eeprom import eeprom_tlvinfo - import binascii -except ImportError as e: - raise ImportError(str(e) + "- required module not found") - -class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): - """Platform-specific Eeprom class""" - - def __init__(self): - eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom" - if eeprom_path is None: - raise ValueError("get eeprom path failed") - - super(Eeprom, self).__init__(eeprom_path, 0, "", True) - - - def modelnumber(self, e): - ''' - Returns the value field of the model(part) number TLV as a string - ''' - (is_valid, t) = self.get_tlv_field(e, self._TLV_CODE_PART_NUMBER) - if not is_valid: - return super(Eeprom, self).part_number_str(e) - - return t[2].decode("ascii") - - def deviceversion(self, e): - ''' - Returns the value field of the Device Version as a string - ''' - (is_valid, t) = self.get_tlv_field(e, self._TLV_CODE_DEVICE_VERSION) - if not is_valid: - return "N/A" - - return str(ord(t[2])) diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/fan.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/fan.py deleted file mode 100644 index 3548ee0b46..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/fan.py +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env python - -import time - -try: - from sonic_platform_base.fan_base import FanBase - from .redfish_api import Redfish_Api -except ImportError as e: - raise ImportError(str(e) + "- required module not found") - -FAN_NAME_LIST = ["1", "2"] - -class Fan(FanBase): - """Platform-specific Fan class""" - - def __init__(self, fan_tray_index, fan_index=0): - self.fan_index = fan_index - self.fan_tray_index = fan_tray_index - self.redfish = Redfish_Api() - self.pinf = {} - self._fan_list = [] - FanBase.__init__(self) - self.begin = time.time() - - def get_power_3s(self): - self.elapsed = time.time() - if not self.pinf or self.elapsed - self.begin >= 3: - self.begin = time.time() - self.pinf = self.redfish.get_thermal() - - def get_speed_pwm(self): - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fan_tray_index] - speed = output.get("Oem").get("Ragile").get("FanSpeedLevelPercents") - return int(speed) - - def get_speed_rpm(self): - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fan_tray_index] - speed = output.get("Reading") - return int(speed) - - def get_high_critical_threshold(self): - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fan_tray_index] - high = output.get("UpperThresholdFatal") - return int(high) - - def get_low_critical_threshold(self): - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fan_tray_index] - low = output.get("LowerThresholdFatal") - return int(low) - - def set_speed_pwm(self, speed): - post_url = '/redfish/v1/Chassis/1/Thermal/Actions/Oem/Ragile/Fan.SetSpeed' - playload = {} - playload["FanName"] = "Fan0" - playload["FanSpeedLevelPercents"] = str(speed) - return self.redfish.post_odata(post_url, playload) - - def get_status_led(self): - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fan_tray_index] - led = output.get("Oem").get("Ragile").get("IndicatorLEDColor") - return led - - def set_status_led(self, color): - playload = {} - led = {} - led_list = [] - led["IndicatorLEDColor"] = color - led["LEDType"] = "fan" - led_list.append(led) - playload["LEDs"] = led_list - # boardsLed - return self.redfish.post_boardLed(playload) - - def get_direction(self): - return "intake" - - def get_name(self): - fan_name = FAN_NAME_LIST[self.fan_index] - return "Fantray{}_{}".format(self.fan_tray_index+1, fan_name) - - def get_model(self): - """ - Retrieves the part number of the FAN - Returns: - string: Part number of FAN - """ - return 'N/A' - - def get_position_in_parent(self): - """ - Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position - for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned - Returns: - integer: The 1-based relative physical position in parent device or -1 if cannot determine the position - """ - return -1 - - def is_replaceable(self): - """ - Indicate whether this device is replaceable. - Returns: - bool: True if it is replaceable. - """ - return False - - def get_revision(self): - """ - Retrieves the hardware revision of the device - - Returns: - string: Revision value of device - """ - return 'N/A' - - def get_serial(self): - """ - Retrieves the serial number of the FAN - Returns: - string: Serial number of FAN - """ - return 'N/A' - - def get_presence(self): - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fan_tray_index] - state = output.get("Status").get("Status").get("State") - if state == "Enabled" or state == "UnavailableOffline": - return True - return False - - def get_status(self): - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fan_tray_index] - if output.get("Status").get("Status").get("Health") == "OK": - return True - return False - - def get_speed(self): - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fan_tray_index] - speed = output.get("Reading") - speed_percentage = round((speed*100)/17500) - if speed_percentage > 100: - speed_percentage = 100 - return speed_percentage - else: - return speed_percentage - - def get_speed_tolerance(self): - """ - Retrieves the speed tolerance of the fan - Returns: - An integer, the percentage of variance from target speed which is - considered tolerable - """ - return 30 - - def get_target_speed(self): - """ - Retrieves the target (expected) speed of the fan - Returns: - An integer, the percentage of full fan speed, in the range 0 (off) - to 100 (full speed) - """ - return self.get_speed_pwm() diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/fan_drawer.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/fan_drawer.py deleted file mode 100755 index 95010bf7e9..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/fan_drawer.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env python -import time - -try: - from sonic_platform_base.fan_drawer_base import FanDrawerBase - from sonic_platform.fan import Fan - from .redfish_api import Redfish_Api -except ImportError as e: - raise ImportError(str(e) + "- required module not found") - - -class FanDrawer(FanDrawerBase): - - FANS_PER_FANTRAY = 1 - - def __init__(self, fantray_index=0): - FanDrawerBase.__init__(self) - self.fantrayindex = fantray_index - self.redfish = Redfish_Api() - self.pinf = {} - self.begin = time.time() - for i in range(self.FANS_PER_FANTRAY): - self._fan_list.append(Fan(fantray_index, i)) - - def get_power_3s(self): - self.elapsed = time.time() - if not self.pinf or self.elapsed - self.begin >= 3: - self.begin = time.time() - self.pinf = self.redfish.get_thermal() - - def get_name(self): - return "FanTray{}".format(self.fantrayindex+1) - - def get_presence(self): - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fantrayindex] - state = output.get("Status").get("Status").get("State") - if state == "Enabled" or state == "UnavailableOffline": - return True - return False - - def get_model(self): - """ - Retrieves the part number of the FAN - Returns: - string: Part number of FAN - """ - return 'N/A' - - def get_serial(self): - """ - Retrieves the serial number of the FAN - Returns: - string: Serial number of FAN - """ - return 'N/A' - - def get_revision(self): - """ - Retrieves the hardware revision of the device - - Returns: - string: Revision value of device - """ - return 'N/A' - - def get_status(self): - """ - Retrieves the operational status of the FAN - Returns: - bool: True if FAN is operating properly, False if not - """ - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fantrayindex] - if output.get("Status").get("Status").get("Health") == "OK": - return True - return False - - def get_position_in_parent(self): - """ - Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position - for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned - Returns: - integer: The 1-based relative physical position in parent device or -1 if cannot determine the position - """ - return -1 - - def is_replaceable(self): - """ - Indicate whether this device is replaceable. - Returns: - bool: True if it is replaceable. - """ - return False - - def get_status_led(self): - self.get_power_3s() - ctrl = self.pinf["Fans"] - output = ctrl[self.fantrayindex] - led = output.get("Oem").get("Ragile").get("IndicatorLEDColor") - return led - - def set_status_led(self, color): - playload = {} - led = {} - led_list = [] - led["IndicatorLEDColor"] = color - led["LEDType"] = "fan" - led_list.append(led) - playload["LEDs"] = led_list - # boardsLed - return self.redfish.post_boardLed(playload) - - def get_maximum_consumed_power(self): - """ - Retrives the maximum power drawn by Fan Drawer - - Returns: - A float, with value of the maximum consumable power of the - component. - """ - return 'N/A' diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/hwaccess.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/hwaccess.py deleted file mode 100755 index 7a04e766ae..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/hwaccess.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python - -import struct -import mmap -import subprocess - -# Read PCI device - -def pci_mem_read(mm, offset): - mm.seek(offset) - read_data_stream = mm.read(4) - return struct.unpack('I',read_data_stream)[0] - -def pci_get_value(resource, offset): - with open(resource, 'r+b') as fd: - mm = mmap.mmap(fd.fileno(), 0) - val = pci_mem_read(mm, offset) - mm.close() - return val - -def pci_mem_write(memmap, offset, data): - """ Write PCI device """ - memmap.seek(offset) - memmap.write(struct.pack('I', data)) - -def pci_set_value(resource, val, offset): - """ Set a value to PCI device """ - with open(resource, 'w+b') as filed: - memmap = None - try: - memmap = mmap.mmap(filed.fileno(), 0) - pci_mem_write(memmap, offset, val) - except EnvironmentError: - print("error") - if memmap is not None: - memmap.close() - -# Read I2C device - -def i2c_get(bus, i2caddr, ofs): - try: - valx = int(subprocess.check_output(['/usr/sbin/i2cget','-f', '-y', str(bus), str(i2caddr), str(ofs)]), 16) - return "{:02x}".format(valx) - except (FileNotFoundError, subprocess.CalledProcessError): - return -1 - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/platform.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/platform.py deleted file mode 100644 index 7225a71b03..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/platform.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -try: - from sonic_platform_base.platform_base import PlatformBase - from sonic_platform.chassis import Chassis -except ImportError as e: - raise ImportError(str(e) + "- required module not found") - - -class Platform(PlatformBase): - - def __init__(self): - PlatformBase.__init__(self) - self._chassis = Chassis() - diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/psu.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/psu.py deleted file mode 100644 index 256b3b79f1..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/psu.py +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/env python - -import time -import imp -import os -import sys - -try: - from sonic_platform_base.psu_base import PsuBase - from .redfish_api import Redfish_Api -except ImportError as e: - raise ImportError("%s - required module not found" % e) - -class Psu(PsuBase): - """Platform-specific Psu class""" - - def __init__(self, index=0): - PsuBase.__init__(self) - self.redfish = Redfish_Api() - self.pinf = {} - self.psu_index = index - self._fan_list = [] - self._thermal_list = [] - self.begin = time.time() - - def get_power_3s(self): - self.elapsed = time.time() - if not self.pinf or self.elapsed - self.begin >= 3: - self.begin = time.time() - self.pinf = self.redfish.get_power() - - def get_presence(self): - return True - - def get_fan(self, index): - """ - Retrieves fan module represented by (0-based) index - - Args: - index: An integer, the index (0-based) of the fan module to - retrieve - - Returns: - An object dervied from FanBase representing the specified fan - module - """ - return None - - def get_powergood_status(self): - self.get_power_3s() - ctrl = self.pinf["PowerSupplies"] - output = ctrl[self.psu_index] - if output.get("Status").get("Health") == "OK": - return True - else: - return False - - def get_name(self): - """ - Retrieves the name of the device - - Returns: - string: The name of the device - """ - return "PSU {}".format(self.psu_index + 1) - - def get_serial(self): - self.get_power_3s() - ctrl = self.pinf["PowerSupplies"] - output = ctrl[self.psu_index] - serial = output.get("SerialNumber") - return serial - - def get_model(self): - self.get_power_3s() - ctrl = self.pinf["PowerSupplies"] - output = ctrl[self.psu_index] - model = output.get("Model") - return model - - def get_revision(self): - self.get_power_3s() - ctrl = self.pinf["PowerSupplies"] - output = ctrl[self.psu_index] - manufacturer = output.get("Manufacturer") - return manufacturer - - def get_voltage(self): - self.get_power_3s() - ctrl = self.pinf["PowerSupplies"] - output = ctrl[self.psu_index] - voltage = output.get("Oem").get("Ragile").get("OutputVoltage") - return voltage - - def get_input_current(self): - self.get_power_3s() - ctrl = self.pinf["PowerSupplies"] - output = ctrl[self.psu_index] - current = output.get("Oem").get("Ragile").get("OutputAmperage") - return current - - def get_input_voltage(self): - self.get_power_3s() - ctrl = self.pinf["PowerSupplies"] - output = ctrl[self.psu_index] - voltage = output.get("Oem").get("Ragile").get("OutputVoltage") - return voltage - - def get_current(self): - self.get_power_3s() - ctrl = self.pinf["PowerSupplies"] - output = ctrl[self.psu_index] - current = output.get("Oem").get("Ragile").get("OutputAmperage") - return current - - def get_power(self): - self.get_power_3s() - ctrl = self.pinf["PowerSupplies"] - output = ctrl[self.psu_index] - current = output.get("Oem").get("Ragile").get("OutputAmperage") - voltage = output.get("Oem").get("Ragile").get("OutputVoltage") - power = float(current)*float(voltage) - return round(power,2) - - def get_temperature(self): - """ - Retrieves current temperature reading from PSU - - Returns: - A float number of current temperature in Celsius up to nearest thousandth - of one degree Celsius, e.g. 30.125 - """ - # no temperature sensor - value = 35 - return round(float(value), 1) - - def get_status_led(self): - return "BuildIn" - - def set_status_led(self, color): - playload = {} - led = {} - led_list = [] - led["IndicatorLEDColor"] = color - led["LEDType"] = "pwr" - led_list.append(led) - playload["LEDs"] = led_list - # boardsLed - return self.redfish.post_boardLed(playload) - - def get_maximum_supplied_power(self): - """ - Retrieves the maximum supplied power by PSU - - Returns: - A float number, the maximum power output in Watts. - e.g. 1200.1 - """ - return False - - def get_position_in_parent(self): - """ - Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position - for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned - Returns: - integer: The 1-based relative physical position in parent device or -1 if cannot determine the position - """ - return -1 - - def is_replaceable(self): - """ - Indicate whether this device is replaceable. - Returns: - bool: True if it is replaceable. - """ - return False - - def get_status(self): - """ - Retrieves the operational status of the PSU - - Returns: - bool: True if PSU is operating properly, False if not - """ - return self.get_powergood_status() - - def get_temperature_high_threshold(self): - """ - Retrieves the high threshold temperature of PSU - - Returns: - A float number, the high threshold temperature of PSU in Celsius - up to nearest thousandth of one degree Celsius, e.g. 30.125 - """ - value = 75 - return round(float(value), 1) - - def get_voltage_high_threshold(self): - """ - Retrieves the high threshold PSU voltage output - - Returns: - A float number, the high threshold output voltage in volts, - e.g. 12.1 - """ - value = 14.52 - return str(round(float(value), 2)) - - def get_voltage_low_threshold(self): - """ - Retrieves the low threshold PSU voltage output - - Returns: - A float number, the low threshold output voltage in volts, - e.g. 12.1 - """ - value = 9.72 - return str(round(float(value), 2)) - - def get_thermal(self, index): - """ - Retrieves thermal unit represented by (0-based) index - - Args: - index: An integer, the index (0-based) of the thermal to - retrieve - - Returns: - An object dervied from ThermalBase representing the specified thermal - """ - return None diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/redfish_api.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/redfish_api.py deleted file mode 100755 index 28ba1025d5..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/redfish_api.py +++ /dev/null @@ -1,304 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -import shlex -import json -import os -import ssl -import subprocess -import syslog - -class Redfish_Api(): - BmcBaseUrl = 'http://240.1.1.1:8080' - ThermalUrl = '/redfish/v1/Chassis/1/Thermal' - PowerUrl = '/redfish/v1/Chassis/1/Power' - ThresholdSensorsUrl = '/redfish/v1/Chassis/1/ThresholdSensors' - FanSpeedUrl = '/redfish/v1/Chassis/1/Thermal/Actions/Oem/Ragile/Fan.SetSpeed' - BoardsUrl = '/redfish/v1/Chassis/1/Boards/' - BoardLedUrl = "/redfish/v1/Chassis/1/Boards/{}/Actions/Oem/Ragile/Boards.SetLED" - - # Maximum time in seconds that you allow the connection to the server to take. - connect_timeout = 30 - # Maximum time in seconds that you allow the whole operation to take - operation_timeout = 300 - - default_prefix='/redfish/v1/' - session = None - __DEBUG__ = "N" - __DUMP_RESP__ = "N" - RST_STATUS = "status" - RST_SUCCESS = "OK" - refish_logger = None - - def redfish_log_debug(self, msg): - if (self.__DEBUG__ == "Y"): - syslog.openlog("redfis_api") - syslog.syslog(syslog.LOG_DEBUG, msg) - syslog.closelog() - - def redfish_log_error(self, msg): - syslog.openlog("redfish_api") - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - - def __init__(self): - pass - - def get_full_url(self, url): - return self.BmcBaseUrl + url - - def _exec_cmd(self, cmd): - self.redfish_log_debug("Cmd: %s" % cmd) - p = subprocess.Popen(shlex.split(cmd), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - p.wait() - self.redfish_log_debug("Cmd return: %d" % p.returncode) - str_stdout = p.stdout.read().decode('utf-8') - str_stderr = p.stderr.read().decode('utf-8') - self.redfish_log_debug("Cmd stdout: %s" % str_stdout) - if p.returncode !=0: - self.redfish_log_error("Cmd: %s, failed! error msg:%s" % (cmd, str_stderr)) - return None - else: - try: - ret = json.loads(str_stdout) - return ret - except Exception as e: - self.redfish_log_error("Cmd: %s, failed! stdout msg:%s" % (cmd, str_stdout)) - return None - - def _redfish_get(self, url): - self.redfish_log_debug("Get info from %s." % url) - result = None - try: - cmd_get="curl --connect-timeout %d -m %d -X GET %s" % (self.connect_timeout, self.operation_timeout, self.get_full_url(url)) - result = self._exec_cmd(cmd_get) - return result - except Exception as e: - self.redfish_log_error("error_message: %s" % e) - return None - - def _redfish_post(self, url, playload): - self.redfish_log_debug("post url: %s" % url) - self.redfish_log_debug("Playload: %s" % playload) - - playload_json = json.dumps(playload) - result = False - try: - cmd_post="curl --connect-timeout %d -m %d -X POST %s -d \'%s\'" % (self.connect_timeout, self.operation_timeout, self.get_full_url(url), playload_json) - ret_msg = self._exec_cmd(cmd_post) - if ret_msg == None: - return False - elif ret_msg["success"] == False: - redfish_log_error("Url: '%s', Playload: '%s', Bmc return failed, error_message: %s" % (url, playload_json, ret_msg["Message"])) - result = False - else: - result = True - return result - except Exception as e: - redfish_log_error("error_message: %s" % e) - return False - - def get_thermal(self): - """Get thermal info - :returns: class 'redfish.rest.v1.RestResponse' or None when failed - """ - return self._redfish_get(self.ThermalUrl) - - def get_power(self): - """Get power info - :returns: class 'redfish.rest.v1.RestResponse' or None when failed - """ - return self._redfish_get(self.PowerUrl) - - def get_thresholdSensors(self): - """Get thresholdSensors info - :returns: class 'redfish.rest.v1.RestResponse' or None when failed - """ - return self._redfish_get(self.ThresholdSensorsUrl) - - def post_odata(self, odata_id, playload): - """post odata info - :params odata_id: the specified odata_id path - :type odata_id: string - :playload: info to post - :type: dictionary - :returns: True or False - """ - if odata_id is None or playload is None: - print("post failed: odata_id or playload is None") - return False - return self._redfish_post(odata_id, playload) - - def get_odata(self, odata_id): - """Get odata info - :params odata_id: the specified odata_id path - :type odata_id: string - :returns: class 'redfish.rest.v1.RestResponse' or None when failed - """ - if odata_id is None: - print("Get odata_id failed: odata_id is None") - return None - return self._redfish_get(odata_id) - - def post_fanSpeed(self, playload): - """post odata info - :playload: info to post - :type: dictionary - :returns: True or False - """ - if playload is None: - print("post failed: playload is None") - return False - return self._redfish_post(self.FanSpeedUrl, playload) - - def get_board(self, board_name="indicatorboard"): - """Get board info - :board_name: name of board, default is "indicatorboard" - :type: string - :returns: class'redfish.rest.v1.RestResponse' or None when failed - """ - if board_name is None : - print("get failed: board_name is None") - return None - return self._redfish_get(self.BoardsUrl + board_name) - - def post_boardLed(self, playload, board_name="indicatorboard"): - """post boardLed info - :board_name: name of board, default is "indicatorboard" - :type: string - :playload: info to post - :type: dictionary - :returns: True or False - """ - if board_name is None or playload is None: - print("post failed: playload is None") - return False - return self._redfish_post(self.BoardLedUrl.format(board_name), playload) - - ''' not supported currently - def post_thermal(self, playload): - """post thermal info - :playload: info to post - :type: dictionary - :returns: True or False - """ - if playload is None: - print("post_thermal failed: playload is None") - return None - return self._redfish_post(self.ThermalUrl, playload) - - def post_power(self, playload): - """post power info - :playload: info to post - :type: dictionary - :returns: True or False - """ - if playload is None: - print("post_power failed: playload is None") - return None - return self._redfish_post(self.PowerUrl, playload) - - def post_thresholdSensors(self, playload): - """post thresholdSensors info - :playload: info to post - :type: dictionary - :returns: True or False - """ - if playload is None: - print("post_thresholdSensors failed: playload is None") - return None - return self._redfish_post(self.ThresholdSensorsUrl, playload) - - def get_fanSpeed(self): - """Get board led info - :returns: class'redfish.rest.v1.RestResponse' or None when failed - """ - return self._redfish_get(self.FanSpeedUrl) - - def post_board(self, playload, board_name="indicatorboard"): - """post board info - :board_name: name of board, default is "indicatorboard" - :type: string - :playload: info to post - :type: dictionary - :returns: True or False - """ - if board_name is None or playload is None: - print("post failed: playload is None") - return False - return self._redfish_post(self.BoardsUrl + board_name, playload) - - def get_boardLed(self, board_name="indicatorboard"): - """Get boardLed info - :board_name: name of board, default is "indicatorboard" - :type: string - :returns: class'redfish.rest.v1.RestResponse' or None when failed - """ - if board_name is None : - print("get failed: board_name is None") - return None - return self._redfish_get(self.BoardsUrl % board_name) - - ''' - -''' -if __name__ == '__main__': - redfish = Redfish_Api() - - ### get - # boards - ret = redfish.get_board() - if ret is None: - print("get failed: board") - else: - print("get succeeded, board:%s" % ret) - - ret = redfish.get_thresholdSensors() - if ret is None: - print("get failed: threshold") - else: - print("get succeeded, threshold:%s" % ret) - - ret = redfish.get_power() - if ret is None: - print("get failed: power") - else: - print("get succeeded, power:%s" % ret) - - ret = redfish.get_thermal() - if ret is None: - print("get failed:thermal") - else: - print("get succeeded,thermal:%s" % ret) - - # get playload - resp = redfish.get_thresholdSensors() - if (resp != None): - print(resp["@odata.id"]) - print(resp["@odata.type"]) - print(resp["Id"]) - print(resp["Name"]) - else: - print("Failed: get_thresholdSensors") - - ### post - # fanSpeed - playload = {} - playload["FanName"] = 'Fan0' - playload["FanSpeedLevelPercents"] = "70" - print("post fanSpeed:%s" % redfish.post_fanSpeed(playload)) - - #{"LEDs": [{"IndicatorLEDColor": "green","LEDType": "sys"},{"IndicatorLEDColor": "off","LEDType": "pwr"},{"IndicatorLEDColor": "green","LEDType": "fan"}]} - playload = {} - led = {} - led1 = {} - led_list = [] - led["IndicatorLEDColor"] = "green" - led["LEDType"] = "sys" - led1["IndicatorLEDColor"] = "off" - led1["LEDType"] = "pwr" - led_list.append(led) - led_list.append(led1) - playload["LEDs"] = led_list - # boardsLed - print("post boardLed:%s" % redfish.post_boardLed(playload)) -''' diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/sfp.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/sfp.py deleted file mode 100644 index 29dd0cb079..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/sfp.py +++ /dev/null @@ -1,325 +0,0 @@ -#!/usr/bin/python -# -*- coding: UTF-8 -*- - -############################################################################# -# -# Module contains an implementation of SONiC Platform Base API and -# provides the platform information -# -# -# *_device.py config version instruction: -# ver 1.0 - platform api: -# "presence_cpld": { -# "dev_id": { -# [dev_id]: { -# "offset": { -# [offset]: [port_id] -# } -# } -# } -# } -# "reset_cpld": { -# "dev_id": { -# [dev_id]: { -# "offset": { -# [offset]: [port_id] -# } -# } -# } -# } -# ver 2.0 - wb_plat: -# "presence_path": "/xx/wb_plat/xx[port_id]/present" -# "eeprom_path": "/sys/bus/i2c/devices/i2c-[bus]/[bus]-0050/eeprom" -# "reset_path": "/xx/wb_plat/xx[port_id]/reset" -############################################################################# -import sys -import time -import os -import syslog -import traceback -from abc import abstractmethod - -configfile_pre = "/usr/local/bin/" -sys.path.append(configfile_pre) - -try: - from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase - -except ImportError as error: - raise ImportError(str(error) + "- required module not found") from error - -LOG_DEBUG_LEVEL = 1 -LOG_WARNING_LEVEL = 2 -LOG_ERROR_LEVEL = 3 - - -class Sfp(SfpOptoeBase): - - OPTOE_DRV_TYPE1 = 1 - OPTOE_DRV_TYPE2 = 2 - OPTOE_DRV_TYPE3 = 3 - - # index must start at 1 - def __init__(self, index): - SfpOptoeBase.__init__(self) - self.sfp_type = None - self.log_level_config = LOG_WARNING_LEVEL - # Init instance of SfpCust - self._sfp_api = SfpV2(index) - - def get_eeprom_path(self): - return self._sfp_api._get_eeprom_path() - - def read_eeprom(self, offset, num_bytes): - return self._sfp_api.read_eeprom(offset, num_bytes) - - def write_eeprom(self, offset, num_bytes, write_buffer): - return self._sfp_api.write_eeprom(offset, num_bytes, write_buffer) - - def get_presence(self): - return self._sfp_api.get_presence() - - def get_transceiver_info(self): - # temporary solution for a sonic202111 bug - transceiver_info = super().get_transceiver_info() - try: - if transceiver_info["vendor_rev"] is not None: - transceiver_info["hardware_rev"] = transceiver_info["vendor_rev"] - except BaseException: - print(traceback.format_exc()) - return None - return transceiver_info - - def set_optoe_write_max(self, write_max): - """ - This func is declared and implemented by SONiC but we're not supported - so override it as NotImplemented - """ - self._sfplog(LOG_DEBUG_LEVEL, "set_optoe_write_max NotImplemented") - - def refresh_xcvr_api(self): - """ - Updates the XcvrApi associated with this SFP - """ - self._xcvr_api = self._xcvr_api_factory.create_xcvr_api() - class_name = self._xcvr_api.__class__.__name__ - optoe_type = None - # set sfp_type - if 'CmisApi' in class_name: - self.sfp_type = 'QSFP-DD' - optoe_type = self.OPTOE_DRV_TYPE3 - elif 'Sff8472Api' in class_name: - self.sfp_type = 'SFP' - optoe_type = self.OPTOE_DRV_TYPE2 - elif ('Sff8636Api' in class_name or 'Sff8436Api' in class_name): - self.sfp_type = 'QSFP' - optoe_type = self.OPTOE_DRV_TYPE1 - # set optoe driver - if optoe_type is not None: - self._sfp_api.set_optoe_type(optoe_type) - - def _sfplog(self, log_level, msg): - if log_level >= self.log_level_config: - try: - syslog.openlog("Sfp") - if log_level == LOG_DEBUG_LEVEL: - syslog.syslog(syslog.LOG_DEBUG, msg) - elif log_level == LOG_WARNING_LEVEL: - syslog.syslog(syslog.LOG_DEBUG, msg) - elif log_level == LOG_ERROR_LEVEL: - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - - except BaseException: - print(traceback.format_exc()) - - -class SfpCust(): - def __init__(self, index): - self.eeprom_path = None - self._init_config(index) - - def _init_config(self, index): - self.log_level_config = LOG_WARNING_LEVEL - self._port_id = index - self.eeprom_retry_times = 5 - self.eeprom_retry_break_sec = 0.2 - - def _get_eeprom_path(self): - return self.eeprom_path or None - - @abstractmethod - def get_presence(self): - pass - - def read_eeprom(self, offset, num_bytes): - try: - for i in range(self.eeprom_retry_times): - with open(self._get_eeprom_path(), mode='rb', buffering=0) as f: - f.seek(offset) - result = f.read(num_bytes) - # temporary solution for a sonic202111 bug - if len(result) < num_bytes: - result = result[::-1].zfill(num_bytes)[::-1] - if result is not None: - return bytearray(result) - time.sleep(self.eeprom_retry_break_sec) - continue - - except BaseException: - self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) - return None - - def write_eeprom(self, offset, num_bytes, write_buffer): - try: - for i in range(self.eeprom_retry_times): - ret = SfpOptoeBase.write_eeprom(self, offset, num_bytes, write_buffer) - if ret is False: - time.sleep(self.eeprom_retry_break_sec) - continue - break - - return ret - except BaseException: - self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) - return False - - @abstractmethod - def set_optoe_type(self, optoe_type): - pass - - @abstractmethod - def set_reset(self, reset): - pass - - def _convert_str_range_to_int_arr(self, range_str): - if not range_str: - return [] - - int_range_strs = range_str.split(',') - range_res = [] - for int_range_str in int_range_strs: - if '-' in int_range_str: - range_s = int(int_range_str.split('-')[0]) - range_e = int(int_range_str.split('-')[1]) + 1 - else: - range_s = int(int_range_str) - range_e = int(int_range_str) + 1 - - range_res = range_res + list(range(range_s, range_e)) - - return range_res - - def _sfplog(self, log_level, msg): - if log_level >= self.log_level_config: - try: - syslog.openlog("SfpCust") - if log_level == LOG_DEBUG_LEVEL: - syslog.syslog(syslog.LOG_DEBUG, msg) - elif log_level == LOG_WARNING_LEVEL: - syslog.syslog(syslog.LOG_DEBUG, msg) - elif log_level == LOG_ERROR_LEVEL: - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - - except BaseException: - print(traceback.format_exc()) - - -class SfpV2(SfpCust): - def _init_config(self, index): - super()._init_config(index) - # init eeprom path - sfp_pt2ee_path_list = [0] * 53 - sfp_pt2ee_path_list[49:53] = [9, 10, 11, 12] - - eeprom_path_config = "/sys/bus/i2c/devices/i2c-%d/%d-0050/eeprom" - eeprom_path_key = sfp_pt2ee_path_list[self._port_id] - self.eeprom_path = None if eeprom_path_config is None or eeprom_path_key == 0 else eeprom_path_config % ( - eeprom_path_key, eeprom_path_key) - self._sfplog(LOG_DEBUG_LEVEL, "Done init eeprom path: %s" % self.eeprom_path) - - # init presence path - self.presence_path = "/sys/bus/i2c/devices/3-0030/sfp_presence1" - self.presence_val_is_present = 0 - self._sfplog(LOG_DEBUG_LEVEL, "Done init presence path: %s" % self.presence_path) - - # init optoe driver path - optoe_driver_path = "/sys/bus/i2c/devices/i2c-%d/%d-0050/dev_class" - optoe_driver_key = sfp_pt2ee_path_list[self._port_id] - self.dev_class_path = None if optoe_driver_path is None or optoe_driver_key == 0 else optoe_driver_path % ( - optoe_driver_key, optoe_driver_key) - self._sfplog(LOG_DEBUG_LEVEL, "Done init optoe driver path: %s" % self.dev_class_path) - - # init reset path - self.reset_val_is_reset = 0 - - new_device_path = "/sys/bus/i2c/devices/i2c-%d/new_device" - new_device_key = sfp_pt2ee_path_list[self._port_id] - self.new_class_path = None if new_device_path is None or new_device_key == 0 else new_device_path % new_device_key - self._sfplog(LOG_DEBUG_LEVEL, "Done init new_class path: %s" % self.new_class_path) - - if sfp_pt2ee_path_list[self._port_id] != 0: - self.add_new_sfp_device(self._port_id, 0x50) - self._sfplog(LOG_DEBUG_LEVEL, "Done add_new_sfp_device 0x50 port %d" % self._port_id) - - def sfp_add_dev(self, new_device_path, devaddr, devtype): - try: - # Write device address to new_device file - nd_file = open(new_device_path, "w") - nd_str = "%s %s" % (devtype, hex(devaddr)) - nd_file.write(nd_str) - nd_file.close() - except Exception as err: - self._sfplog(LOG_ERROR_LEVEL, ("Error writing to new device file: %s" % str(err))) - return 1 - else: - return 0 - - def add_new_sfp_device(self, port_num, devid): - if os.path.exists(self.dev_class_path): - return - - ret = self.sfp_add_dev(self.new_class_path, devid, "optoe2") - if ret != 0: - self._sfplog(LOG_ERROR_LEVEL, "Error adding sfp device") - - def get_presence(self): - sfp_ls = [49, 50, 51, 52] - if self._port_id not in sfp_ls or self.presence_path is None: - self._sfplog(LOG_ERROR_LEVEL, "presence_path is None!") - return False - try: - with open(self.presence_path, "rb") as data: - presence_data = data.read(2) - if presence_data == "": - return False - result = int(presence_data, 16) - - # ModPrsL is active low - presence_offset = sfp_ls.index(self._port_id) - if result & (1 << presence_offset) == 0: - return True - return False - except BaseException: - self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) - return False - - def set_reset(self, reset): - return True - - def set_optoe_type(self, optoe_type): - if self.dev_class_path is None: - self._sfplog(LOG_ERROR_LEVEL, "dev_class_path is None!") - return False - try: - with open(self.dev_class_path, "r+") as dc_file: - dc_file_val = dc_file.read(1) - if int(dc_file_val) != optoe_type: - dc_str = "%s" % str(optoe_type) - dc_file.write(dc_str) - # dc_file.close() - except BaseException: - self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc()) - return False - return True diff --git a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/thermal.py b/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/thermal.py deleted file mode 100644 index 5fded8d9dd..0000000000 --- a/platform/centec-arm64/sonic-platform-modules-ragile/ra-b6010-48gt4x/sonic_platform/thermal.py +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env python - -import os -import re -import os.path -import time - -try: - from sonic_platform_base.thermal_base import ThermalBase - from .redfish_api import Redfish_Api -except ImportError as e: - raise ImportError(str(e) + "- required module not found") - - -class Thermal(ThermalBase): - """Platform-specific Thermal class""" - - def __init__(self, thermal_index): - ThermalBase.__init__(self) - self.index = thermal_index - self.high_threshold = float(112) - self.redfish = Redfish_Api() - self.pinf = {} - self.begin = time.time() - - def get_power_3s(self): - self.elapsed = time.time() - if not self.pinf or self.elapsed - self.begin >= 3: - self.begin = time.time() - self.pinf = self.redfish.get_thermal() - - def get_temperature(self): - self.get_power_3s() - ctrl = self.pinf["Temperatures"] - output = ctrl[self.index] - temp = output.get("ReadingCelsius") - return temp - - def get_high_threshold(self): - self.get_power_3s() - ctrl = self.pinf["Temperatures"] - output = ctrl[self.index] - temp = output.get("UpperThresholdFatal") - return temp - - def get_low_threshold(self): - self.get_power_3s() - ctrl = self.pinf["Temperatures"] - output = ctrl[self.index] - temp = output.get("LowerThresholdFatal") - return temp - - def get_high_critical_threshold(self): - self.get_power_3s() - ctrl = self.pinf["Temperatures"] - output = ctrl[self.index] - temp = output.get("UpperThresholdFatal") - return temp - - def get_low_critical_threshold(self): - self.get_power_3s() - ctrl = self.pinf["Temperatures"] - output = ctrl[self.index] - temp = output.get("LowerThresholdFatal") - return temp - - def get_name(self): - self.get_power_3s() - ctrl = self.pinf["Temperatures"] - output = ctrl[self.index].get("Name") - name = output.split("/",3)[2] - if name == "SWITCH_TEMP": - name = "ASIC_TEMP" - return "{}".format(name) - - def get_real_name(self): - self.get_power_3s() - ctrl = self.pinf["Temperatures"] - output = ctrl[self.index].get("Name") - name = output.split("/",3)[2] - return "{}".format(name) - - def get_presence(self): - self.get_power_3s() - ctrl = self.pinf["Temperatures"] - output = ctrl[self.index] - if output.get("Status").get("Status").get("State") == "Enabled": - return True - return False - - def get_status(self): - self.get_power_3s() - ctrl = self.pinf["Temperatures"] - output = ctrl[self.index] - if output.get("Status").get("Status").get("Health") == "OK": - return True - return False - - def set_sys_led(self, color): - playload = {} - led = {} - led_list = [] - led["IndicatorLEDColor"] = color - led["LEDType"] = "sys" - led_list.append(led) - playload["LEDs"] = led_list - # boardsLed - return self.redfish.post_boardLed(playload) - - def get_minimum_recorded(self): - """ - Retrieves the minimum recorded temperature of thermal - - Returns: - A float number, the minimum recorded temperature of thermal in Celsius - up to nearest thousandth of one degree Celsius, e.g. 30.125 - """ - return "N/A" - - def get_maximum_recorded(self): - """ - Retrieves the maximum recorded temperature of thermal - - Returns: - A float number, the maximum recorded temperature of thermal in Celsius - up to nearest thousandth of one degree Celsius, e.g. 30.125 - """ - return "N/A" - - def get_model(self): - """ - Retrieves the model number (or part number) of the Thermal - - Returns: - string: Model/part number of Thermal - """ - return "N/A" - - def get_serial(self): - """ - Retrieves the serial number of the Thermal - - Returns: - string: Serial number of Thermal - """ - return "N/A" - - def get_revision(self): - """ - Retrieves the hardware revision of the device - - Returns: - string: Revision value of device - """ - return "N/A" - - def get_position_in_parent(self): - """ - Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position - for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned - Returns: - integer: The 1-based relative physical position in parent device or -1 if cannot determine the position - """ - return -1 - - def is_replaceable(self): - """ - Indicate whether this device is replaceable. - Returns: - bool: True if it is replaceable. - """ - return False diff --git a/platform/centec-arm64/sonic_fit.its b/platform/centec-arm64/sonic_fit.its index a953f67f77..0f96550c88 100644 --- a/platform/centec-arm64/sonic_fit.its +++ b/platform/centec-arm64/sonic_fit.its @@ -48,18 +48,6 @@ algo = "crc32"; }; }; - ctc_fdtb6010 { - description = "dtb for ra-b6010-48gt4x-r0"; - data = /incbin/("./ra-b6010-48gt4x-r0.dtb"); - type = "flat_dt"; - arch = "arm64"; - os = "linux"; - compression = "none"; - load = <0x88000000>; - hash { - algo = "crc32"; - }; - }; }; configurations { default = "arm64-centec_e530_24x2c-r0"; @@ -98,12 +86,5 @@ ramdisk = "initramfs"; fdt = "ctc_fdt"; }; - - arm64-ragile_ra-b6010-48gt4x-r0 { - description = "config for ragile_ra-b6010-48gt4x"; - kernel = "kernel_ctc"; - ramdisk = "initramfs"; - fdt = "ctc_fdtb6010"; - }; }; }; diff --git a/platform/centec-arm64/tsingma-bsp/debian/rules b/platform/centec-arm64/tsingma-bsp/debian/rules index 88167489cc..39744906e3 100755 --- a/platform/centec-arm64/tsingma-bsp/debian/rules +++ b/platform/centec-arm64/tsingma-bsp/debian/rules @@ -17,7 +17,6 @@ KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) MODULE_DIRS:= ctc5236-mc ctc5236_switch ctcmac ctc_wdt ehci-ctc gpio-ctc i2c-ctc pinctrl-ctc pwm-ctc rtc-sd2405 sdhci-ctc5236 spi-ctc-qspi ctc-phy DTS_DIR := ctc-dts -DTS_DIR0 := ra-b6010-48gt4x MODULE_DIR := src UTILS_DIR := utils SERVICE_DIR := service @@ -37,7 +36,6 @@ build: make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$(MODULE_DIR)/$${mod}; \ done) make -C $(MOD_SRC_DIR)/$(MODULE_DIR)/$(DTS_DIR) - make -C $(MOD_SRC_DIR)/$(MODULE_DIR)/$(DTS_DIR0) binary: binary-arch binary-indep # Nothing to do diff --git a/platform/centec-arm64/tsingma-bsp/debian/tsingma-bsp.install b/platform/centec-arm64/tsingma-bsp/debian/tsingma-bsp.install index 5914f9f1ce..e072cb1751 100644 --- a/platform/centec-arm64/tsingma-bsp/debian/tsingma-bsp.install +++ b/platform/centec-arm64/tsingma-bsp/debian/tsingma-bsp.install @@ -13,6 +13,5 @@ src/rtc-sd2405/rtc-sd2405.ko /lib/modules/5.10.0-18-2-arm64/kernel/extra src/sdhci-ctc5236/sdhci-ctc5236.ko /lib/modules/5.10.0-18-2-arm64/kernel/extra src/spi-ctc-qspi/spi-ctc-qspi.ko /lib/modules/5.10.0-18-2-arm64/kernel/extra src/ctc-dts/e530-ctc5236.dtb /boot/ -src/ra-b6010-48gt4x/ra-b6010-48gt4x-r0.dtb /boot/ src/config/fw_env.config /etc/ src/config/tsingma-bsp.service /lib/systemd/system diff --git a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.c b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.c index 277b41c2ab..ea28b561ec 100755 --- a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.c +++ b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.c @@ -1736,8 +1736,7 @@ static bool ctcmac_new_page(struct ctcmac_priv_rx_q *rxq, struct page *page; dma_addr_t addr; - //page = dev_alloc_page(); - page = __dev_alloc_pages(GFP_DMA | GFP_ATOMIC | __GFP_NOWARN, 0); + page = dev_alloc_page(); if (unlikely(!page)) return false; diff --git a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/Makefile b/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/Makefile deleted file mode 100755 index 8808f1d78b..0000000000 --- a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -ra-b6010-48gt4x-r0.dtb: ra-b6010-48gt4x-r0.dts ctc5236.dtsi ctc5236-clock.dtsi - cpp -nostdinc -I. -undef -x assembler-with-cpp ra-b6010-48gt4x-r0.dts > tmp.dts - dtc -O dtb -o ra-b6010-48gt4x-r0.dtb tmp.dts - rm tmp.dts -rf - \ No newline at end of file diff --git a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/arm-gic.h b/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/arm-gic.h deleted file mode 100755 index ef79498bdd..0000000000 --- a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/arm-gic.h +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR MIT */ -/* - * This header provides constants for the ARM GIC. - */ - -#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_ARM_GIC_H -#define _DT_BINDINGS_INTERRUPT_CONTROLLER_ARM_GIC_H - -#include "irq.h" - -/* interrupt specifier cell 0 */ - -#define GIC_SPI 0 -#define GIC_PPI 1 - -/* - * Interrupt specifier cell 2. - * The flags in irq.h are valid, plus those below. - */ -#define GIC_CPU_MASK_RAW(x) ((x) << 8) -#define GIC_CPU_MASK_SIMPLE(num) GIC_CPU_MASK_RAW((1 << (num)) - 1) - -#endif diff --git a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236-clks.h b/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236-clks.h deleted file mode 100755 index 56d91da313..0000000000 --- a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236-clks.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * ctc5236 clock tree IDs - * - * (C) Copyright 2004-2017 Centec Networks (suzhou) Co., LTD. - * - * Jay Cao - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation version 2. - * - * This program is distributed "as is" WITHOUT ANY WARRANTY of any - * kind, whether express or implied; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef __CTC5236_CLKS_H -#define __CTC5236_CLKs_H - -#define CLKID_UNUSED 0 -#define CLKID_PLL_FIXED 1 -#define CLKID_UART0 2 - -#endif /* __CTC5236_CLKS_H */ diff --git a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236-clock.dtsi b/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236-clock.dtsi deleted file mode 100755 index ae6b00c00b..0000000000 --- a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236-clock.dtsi +++ /dev/null @@ -1,63 +0,0 @@ -/* - * dts file for Centec CTC5236(TsingMa) SoC - * - * (C) Copyright 2004-2017 Centec Networks (suzhou) Co., LTD. - * - * Jay Cao - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - */ - - osc: oscillator { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <50000000>; - }; - - sup_clk: sup_clk_12m { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <1200000000>; - clock-output-names = "sup_clk"; - }; - - uart_clk: uart_clk_20m { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <20000000>; - clock-output-names = "uart_clk"; - }; - - i2c_clk: clkm { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <50000000>; - clock-output-names = "i2c_clk"; - }; - wdog_clk:wdog_clk{ - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <1000000>; - clock-output-names = "wdog_clk"; - }; - timer_clk:timer_clk{ - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <500000000>; - clock-output-names = "timer_clk"; - }; - mmc_clk:mmc_clk{ - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <100000000>; - clock-output-names = "mmc_clk"; - }; - spi_clk:spi_clk{ - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <100000000>; - clock-output-names = "spi_clk"; - }; diff --git a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236.dtsi b/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236.dtsi deleted file mode 100755 index bacf2eb17d..0000000000 --- a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ctc5236.dtsi +++ /dev/null @@ -1,428 +0,0 @@ -/* - * dts file for Centec CTC5236(TsingMa) SoC - * - * (C) Copyright 2004-2017 Centec Networks (suzhou) Co., LTD. - * - * Jay Cao - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - */ - -#include "arm-gic.h" -#include "ctc5236-clks.h" -#include "../pinctrl-ctc/pinctrl-ctc.h" - -/ { - compatible = "centec,ctc5236"; - #address-cells = <2>; - #size-cells = <2>; - interrupt-parent = <&gic>; - - cpus { - #address-cells = <2>; - #size-cells = <0>; - - cpu-map { - cluster0 { - core0 { - cpu = <&cpu0>; - }; - core1 { - cpu = <&cpu1>; - }; - }; - }; - - cpu0: cpu@0 { - device_type = "cpu"; - compatible = "arm,cortex-a53", "arm,armv8"; - reg = <0 0x000>; - enable-method = "spin-table"; - cpu-release-addr = <0 0x0010fff0>; - }; - - cpu1: cpu@1 { - device_type = "cpu"; - compatible = "arm,cortex-a53", "arm,armv8"; - reg = <0 0x001>; - enable-method = "spin-table"; - cpu-release-addr = <0 0x0010fff0>; - }; - }; - - gic: interrupt-controller@31201000 { - compatible = "arm,gic-400"; - #interrupt-cells = <3>; - interrupt-controller; - reg = <0x0 0x31201000 0 0x1000>, - <0x0 0x31202000 0 0x2000>, - <0x0 0x31204000 0 0x2000>, - <0x0 0x31206000 0 0x2000>; - interrupts = ; - }; - - timer { - compatible = "arm,armv8-timer"; - interrupt-parent = <&gic>; - interrupts = , - , - , - ; - }; - - soc: soc { - compatible = "simple-bus"; - #address-cells = <2>; - #size-cells = <2>; - ranges; - - #include "ctc5236-clock.dtsi" - ocram: sram@00100000 { - compatible = "mmio-sram"; - reg = <0x0 0x00100000 0x0 0x10000>; - }; - - memory-controller@30600000 { - compatible = "ctc,ctc5236-ddr-ctrl"; - reg = <0x0 0x30600000 0x0 0x100000>; - interrupts = , - , - , - ; - ctc,sysctrl = <&sysctrl>; - }; - - sysctrl: sysctrl@33200000 { - compatible = "ctc,ctc5236-sysctrl", "syscon"; - reg = <0x0 0x33200000 0x0 0x100000>; - little-endian; - }; - - serial0: serial@33000000 { - compatible = "arm,pl011","arm,primecell"; - reg = <0x0 0x33000000 0x0 0x1000>; - interrupts = ; - clocks = <&uart_clk>, <&sup_clk>; - clock-names = "uart_clk", "apb_pclk"; - status="disabled"; - }; - serial1: serial@33001000 { - compatible = "arm,pl011","arm,primecell"; - reg = <0x0 0x33001000 0x0 0x1000>; - interrupts = ; - clocks = <&uart_clk>, <&sup_clk>; - clock-names = "uart_clk", "apb_pclk"; - status="disabled"; - }; - serial2: serial@33002000 { - compatible = "arm,pl011","arm,primecell"; - reg = <0x0 0x33002000 0x0 0x1000>; - interrupts = ; - clocks = <&uart_clk>, <&sup_clk>; - clock-names = "uart_clk", "apb_pclk"; - status="disabled"; - }; - mdio: mdio@33620000 { - compatible = "ctc,mdio"; - reg = <0x0 0x33620000 0x0 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - - enet0: ethernet@33410000 { - compatible = "ctc,mac"; - device_type = "network"; - #address-cells = <2>; - #size-cells = <2>; - interrupt-parent = <&gic>; - status = "disabled"; - local-mac-address = [00 00 00 00 00 00]; - index = <0x00>; - reg = <0x0 0x33410000 0x0 0x10000>, - <0x0 0x33400000 0x0 0x10000>; - interrupts = , - , - , - , - ; - ctc,sysctrl = <&sysctrl>; - }; - - enet1: ethernet@33420000 { - compatible = "ctc,mac"; - device_type = "network"; - #address-cells = <2>; - #size-cells = <2>; - interrupt-parent = <&gic>; - status = "disabled"; - local-mac-address = [00 00 00 00 00 00]; - index = <0x01>; - reg = <0x0 0x33420000 0x0 0x10000>, - <0x0 0x33400000 0x0 0x10000>; - interrupts = , - , - , - , - ; - ctc,sysctrl = <&sysctrl>; - }; - - ehci0: usb@30500000 { - compatible = "ctc-ehci"; - reg = <0x0 0x30500000 0x0 0x1000>; - interrupts = ; - ctc,sysctrl = <&sysctrl>; - status = "disabled"; - }; - - ohci0: usb@30580000 { - compatible = "generic-ohci"; - reg = <0x0 0x30580000 0x0 0x1000>; - interrupts = ; - status = "disabled"; - }; - - spi: spi@33100000 { - compatible = "arm,pl022","arm,primecell"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x0 0x33100000 0x0 0x100000>; - clocks = <&spi_clk>, <&sup_clk>; - clock-names = "spi_clk", "apb_pclk"; - num-cs = <4>; - interrupts = ; - ctc,sysctrl = <&sysctrl>; - status ="disabled"; - }; - - qspi: qspi@10000000 { - compatible = "ctc, igdaxi001a-qspi"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x0 0x10000000 0x0 0x10000>; - pclk = <500000000>; - num-cs = <2>; - idle-cycle = <2>; - post-cycle = <1>; - pre-cycle = <2>; - interrupts = ; - status = "disabled"; - }; - switch: switch@31100000 { - compatible = "centec,dal-localbus"; - reg = <0x0 0x31100000 0x0 0x1000>, - <0x0 0x33290000 0x0 0x10000>; - interrupts = , - , - , - , - , - , - , - ; - status ="disabled"; - }; - switch1: switch1@31101000 { - compatible = "centec,switch"; - reg = <0x0 0x31101000 0x0 0x1000>; - status ="disabled"; - }; - - i2c0: i2c0@33700000{ - compatible = "ctc,i2c"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x0 0x33700000 0x0 0x1000>; - interrupts = ; - clocks = <&i2c_clk>; - ctc,sysctrl = <&sysctrl>; - i2c-num = <0>; - status ="disabled"; - }; - - i2c1: i2c1@33701000{ - compatible = "ctc,i2c"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x0 0x33701000 0x0 0x1000>; - interrupts = ; - clocks = <&i2c_clk>; - ctc,sysctrl = <&sysctrl>; - i2c-num = <1>; - status ="disabled"; - }; - - pcie: pcie@20000000 { - compatible = "centec,ctc5236-pcie"; - reg = <0x0 0x20000000 0x0 0x10000000 - 0x0 0x30000000 0x0 0x1000>; - reg-names = "cfg", "ctrl"; - #address-cells = <3>; - #size-cells = <2>; - #interrupt-cells = <1>; - device_type = "pci"; - interrupt-parent = <&gic>; - interrupts = , - , - ; - interrupt-names = "msi","aer","pme"; - msi-parent = <&pcie>; - bus-range = <0 0xff>; - ranges = <0x42000000 0 0x00000000 0 0x40000000 0 0x20000000 - 0x02000000 0 0x20000000 0 0x60000000 0 0x20000000>; - num-lanes = <1>; - ctc,sysctrl = <&sysctrl>; - status ="disabled"; - }; - - wtd0: wtd0@33500000{ - compatible = "arm,sp805-wdt", "arm,primecell"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x0 0x33500000 0x0 0x1000>; - clocks = <&wdog_clk>, <&sup_clk>; - clock-names = "wdog_clk", "apb_pclk"; - ctc,sysctrl = <&sysctrl>; - interrupts = ; - status="disabled"; - }; - wtd1: wtd1@33501000{ - compatible = "arm,sp805-wdt", "arm,primecell"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x0 0x33501000 0x0 0x1000>; - clocks = <&wdog_clk>, <&sup_clk>; - clock-names = "wdog_clk", "apb_pclk"; - ctc,sysctrl = <&sysctrl>; - interrupts = ; - status="disabled"; - }; - - sdhci: sdhci@30400000 { - compatible = "centec,ctc5236-sdhci"; - status = "disabled"; - interrupt-parent = <&gic>; - interrupts = ; - clocks = <&mmc_clk>; - clock-names = "mmc_clk"; - ctc,sysctrl = <&sysctrl>; - reg = <0x0 0x30400000 0x0 0x1000>; - }; - - timer0: timer0@33600000{ - compatible = "snps,dw-apb-timer"; - reg = <0x0 0x33600000 0x0 0x20>; - clocks = <&timer_clk>; - clock-names = "timer"; - interrupts = ; - DivNum = <0x3c>; - status="disabled"; - }; - timer1: timer1@33600020{ - compatible = "snps,dw-apb-timer"; - reg = <0x0 0x33600020 0x0 0x20>; - clocks = <&timer_clk>; - clock-names = "timer"; - interrupts = ; - DivNum = <0x3c>; - status="disabled"; - }; - - pwm: pwm@33200240{ - compatible = "centec-pwm"; - ctc,sysctrl = <&sysctrl>; - #pwm-cells = <2>; - - status="disabled"; - }; - - fan: fan-ctc5236 { - compatible = "fan-ctc5236"; - pwms = <&pwm 0 1000000>, - <&pwm 1 1000000>, - <&pwm 2 1000000>, - <&pwm 3 1000000>; - pwm-names = "pwm1","pwm2","pwm3","pwm4"; - }; - - gpio0: gpio@33610000 { - compatible = "ctc,apb-gpio"; - reg = <0x0 0x33610000 0x0 0x10000>; - #address-cells = <1>; - #size-cells = <0>; - ctc,sysctrl = <&sysctrl>; - - porta: gpio-port@0 { - compatible = "ctc,apb-gpio-porta"; - gpio-controller; - #gpio-cells = <2>; - ctc,nr-gpios = <16>; - reg = <0>; - interrupt-controller; - #interrupt-cells = <2>; - interrupts = ; - }; - portb: gpio-port@1 { - compatible = "ctc,apb-gpio-portb"; - gpio-controller; - #gpio-cells = <2>; - ctc,nr-gpios = <18>; - reg = <1>; - interrupt-controller; - #interrupt-cells = <2>; - interrupts = ; - }; - }; - - pinctrl: pinctrl { - compatible = "ctc,ctc5236-pinctrl"; - #address-cells = <0x2>; - #size-cells = <0x2>; - ctc,pinctrl-bank0 = <16>; - ctc,pinctrl-bank1 = <8>; - ctc,sysctrl = <&sysctrl>; - - spi { - spi_pin: spi_pin { - ctc,pins = <0 0 PIN_FUNC_SPI>, - <0 2 PIN_FUNC_SPI>, - <0 3 PIN_FUNC_SPI>, - <0 4 PIN_FUNC_SPI>, - <0 5 PIN_FUNC_SPI>, - <0 6 PIN_FUNC_SPI>, - <0 7 PIN_FUNC_SPI>; - }; - }; - - uart2 { - uart2_pin: uart2_pin { - ctc,pins = <0 10 PIN_FUNC_UART>, - <0 11 PIN_FUNC_UART>, - <0 12 PIN_FUNC_UART>, - <0 13 PIN_FUNC_UART>, - <0 14 PIN_FUNC_UART>, - <0 15 PIN_FUNC_UART>; - }; - }; - - fc { - fc_pin: fc_pin { - ctc,pins = <1 0 PIN_FUNC_FC>, - <1 1 PIN_FUNC_FC>, - <1 2 PIN_FUNC_FC>, - <1 3 PIN_FUNC_FC>, - <1 4 PIN_FUNC_FC>, - <1 5 PIN_FUNC_FC>, - <1 6 PIN_FUNC_FC>, - <1 7 PIN_FUNC_FC>; - }; - }; - }; - }; - -}; - diff --git a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/irq.h b/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/irq.h deleted file mode 100755 index 9e3d183e13..0000000000 --- a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/irq.h +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR MIT */ -/* - * This header provides constants for most IRQ bindings. - * - * Most IRQ bindings include a flags cell as part of the IRQ specifier. - * In most cases, the format of the flags cell uses the standard values - * defined in this header. - */ - -#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_IRQ_H -#define _DT_BINDINGS_INTERRUPT_CONTROLLER_IRQ_H - -#define IRQ_TYPE_NONE 0 -#define IRQ_TYPE_EDGE_RISING 1 -#define IRQ_TYPE_EDGE_FALLING 2 -#define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING) -#define IRQ_TYPE_LEVEL_HIGH 4 -#define IRQ_TYPE_LEVEL_LOW 8 - -#endif diff --git a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ra-b6010-48gt4x-r0.dts b/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ra-b6010-48gt4x-r0.dts deleted file mode 100755 index 2a68ecb8d9..0000000000 --- a/platform/centec-arm64/tsingma-bsp/src/ra-b6010-48gt4x/ra-b6010-48gt4x-r0.dts +++ /dev/null @@ -1,328 +0,0 @@ -/* - * dts file for Centec CTC5236(TsingMa) SoC E530-24X2C Board - * - * (C) Copyright 2004-2018 Centec Networks (suzhou) Co., LTD. - * - * liuht - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - */ - -/dts-v1/; -#include "ctc5236.dtsi" - -/ { - model = " CTC5236(TsingMa) E530 Board"; - compatible = "ctc5236,e530-ctc5236"; - - memory@0 { - device_type = "memory"; - reg = <0 0x80000000 0x1 0x00000000>; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - aliases { - serial0 = &serial0; - serial1 = &serial1; - ethernet0 = &enet0; - ethernet1 = &enet1; - - i2c0 = &i2c1; - /* 0 0x70 */ - i2c1 = &imux1; - i2c2 = &imux2; - i2c3 = &imux3; - i2c4 = &imux4; - i2c5 = &imux5; - i2c6 = &imux6; - i2c7 = &imux7; - i2c8 = &imux8; - /* 8 0x74 */ - i2c9 = &imux9; - i2c10 = &imux10; - i2c11 = &imux11; - i2c12 = &imux12; - i2c13 = &imux13; - i2c14 = &imux14; - i2c15 = &imux15; - i2c16 = &imux16; - }; - -}; - -&serial0 { - status = "okay"; -}; - -&serial1 { - status = "okay"; -}; - -&mdio { - status = "okay"; - phy0: ethernet-phy@0 { - index = <0x00>; - reg = <0x00>; - }; -}; - -&enet0 { - status = "okay"; - phy-handle = <&phy0>; - auto-nego-mode= "sgmii-mac"; -}; - -&qspi { - status = "okay"; - - qspiflash0: mx25u3235f@0 { - compatible = "jedec,spi-nor"; - reg = <0x0>; - spi-cpha; - spi-cpol; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x300000>; - }; - partition@300000 { - label = "uboot-env"; - reg = <0x300000 0x10000>; - }; - partition@310000 { - label = "onie"; - reg = <0x310000 0x1cf0000>; - }; - }; - }; - - qspiflash1: mx25u3235f@1 { - compatible = "jedec,spi-nor"; - reg = <0x1>; - spi-cpha; - spi-cpol; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot1"; - reg = <0x0 0x300000>; - }; - partition@300000 { - label = "uboot1-env"; - reg = <0x300000 0x10000>; - }; - partition@310000 { - label = "onie1"; - reg = <0x310000 0x1cf0000>; - }; - }; - }; -}; - -&spi { - status = "disabled"; - pinctrl-names = "default"; - pinctrl-0 = <&spi_pin>; - - clock0: ad9559@1 { - compatible = "analog,ad9559"; - reg = <1>; - spi-max-frequency = <25000000>; - }; -}; - -&switch { - status = "okay"; -}; - -&switch1 { - status = "okay"; -}; - - -&i2c1{ - status = "okay"; - clock-frequency = <95000>; - - pca9548@70 { - compatible = "nxp,pca9548"; - reg = <0x70>; - #address-cells = <1>; - #size-cells = <0>; - - imux1:i2c@0 { - reg = <0>; - }; - imux2:i2c@1 { - #address-cells = <1>; - #size-cells = <0>; - reg = <1>; - }; - imux3:i2c@2 { - #address-cells = <1>; - #size-cells = <0>; - reg = <2>; - }; - imux4:i2c@3 { - #address-cells = <1>; - #size-cells = <0>; - reg = <3>; - }; - imux5:i2c@4 { - #address-cells = <1>; - #size-cells = <0>; - reg = <4>; - }; - imux6:i2c@5 { - #address-cells = <1>; - #size-cells = <0>; - reg = <5>; - }; - imux7:i2c@6 { - #address-cells = <1>; - #size-cells = <0>; - reg = <6>; - }; - imux8:i2c@7 { - #address-cells = <1>; - #size-cells = <0>; - reg = <7>; - pca9548@74 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "nxp,pca9548"; - reg = <0x74>; - imux9:i2c@0 { - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - }; - imux10:i2c@1 { - #address-cells = <1>; - #size-cells = <0>; - reg = <1>; - }; - imux11:i2c@2 { - #address-cells = <1>; - #size-cells = <0>; - reg = <2>; - }; - imux12:i2c@3 { - #address-cells = <1>; - #size-cells = <0>; - reg = <3>; - }; - imux13:i2c@4 { - #address-cells = <1>; - #size-cells = <0>; - reg = <4>; - }; - imux14:i2c@5 { - #address-cells = <1>; - #size-cells = <0>; - reg = <5>; - }; - imux15:i2c@6 { - #address-cells = <1>; - #size-cells = <0>; - reg = <6>; - }; - imux16:i2c@7 { - #address-cells = <1>; - #size-cells = <0>; - reg = <7>; - }; - }; - }; - }; -}; - -&ehci0 { - status = "okay"; -}; - -&ohci0 { - status = "okay"; -}; - -&wtd0{ - status = "okay"; -}; - -&wtd1{ - status = "disabled"; -}; - -&sdhci { - bus-width = <8>; - max-frequency = <100000000>; - non-removable; - no-sd; - no-sdio; - voltage-ranges = <3300 3300>; - status = "okay"; -}; - -&timer0 { - status = "okay"; -}; - -&soc { - ctc-irq { - compatible = "centec,ctc-irq"; - device_type = "ctc-irq"; - interrupt-parent=<&porta>; - interrupts = < 0 IRQ_TYPE_LEVEL_LOW>, - < 1 IRQ_TYPE_LEVEL_LOW>, - <15 IRQ_TYPE_LEVEL_LOW>, - < 6 IRQ_TYPE_LEVEL_HIGH>, - < 7 IRQ_TYPE_LEVEL_HIGH>; - }; -}; - -&pwm { - status = "disabled"; -}; - - -&pinctrl { - spi { - spi_pin: spi_pin { - status = "disabled"; - ctc,pins = <0 0 PIN_FUNC_SPI>, - <0 2 PIN_FUNC_SPI>, - <0 3 PIN_FUNC_SPI>, - <0 5 PIN_FUNC_SPI>; - }; - }; - - pwm0 { - pwm0_pin: pwm0_pin { - ctc,pins = <0 8 PIN_FUNC_PWM>, - <0 9 PIN_FUNC_PWM>, - <0 10 PIN_FUNC_PWM>, - <0 11 PIN_FUNC_PWM>, - <0 12 PIN_FUNC_PWM>, - <0 13 PIN_FUNC_PWM>, - <0 14 PIN_FUNC_PWM>, - <0 15 PIN_FUNC_PWM>; - }; - }; -};