From a3c10515f4977d659eb12f421be6fc0a7a56cd4f Mon Sep 17 00:00:00 2001 From: jostar-yang Date: Fri, 4 Mar 2022 07:59:12 +0800 Subject: [PATCH] [as7326-56x] Modify to check eeprom by pre_pddf_init.sh (#7841) Modify to check eeprom by pre_pddf_init.sh Signed-off-by: Jostar Yang --- .../as7326-56x/utils/pre_pddf_init.sh | 23 +++++++++++++++++++ .../sonic-platform-accton-as7326-56x.postinst | 18 --------------- 2 files changed, 23 insertions(+), 18 deletions(-) create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pre_pddf_init.sh diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pre_pddf_init.sh b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pre_pddf_init.sh new file mode 100755 index 0000000000..8b8c45ef54 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pre_pddf_init.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Steps to check syseeprom i2c address +modprobe i2c-i801 +modprobe i2c-dev +use_57_eeprom=true +i2cget -y -f 0 0x56 0x0 +if [ $? -eq 0 ]; then + use_57_eeprom=false + echo "The board has system EEPROM at I2C address 0x56." +fi + +if $use_57_eeprom ; then + echo "The board has system EEPROM at I2C address 0x57." + # syseeprom is at the i2c address 0x57. Change the PDDF JSON file + if [ -f /usr/share/sonic/device/x86_64-accton_as7326_56x-r0/pddf_support ] && \ + [ -f /usr/share/sonic/device/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json ]; then + sed -i 's@"topo_info": {"parent_bus": "0x0", "dev_addr": "0x56", "dev_type": "24c04"},@\ + "topo_info": {"parent_bus": "0x0", "dev_addr": "0x57", "dev_type": "24c02"},@g' \ + /usr/share/sonic/device/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json + sync + fi +fi diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.postinst index 94fd9cf67d..035f07e571 100644 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.postinst +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.postinst @@ -2,24 +2,6 @@ # Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) # Enable pddf-platform-monitor -# Steps to check syseeprom i2c address -modprobe i2c-i801 -modprobe i2c-dev -use_57_eeprom=true -(i2cget -y -f 0 0x56 0x0) > /dev/null 2>&1 -if [ $? -eq 0 ]; then - use_57_eeprom=false -fi - -if $use_57_eeprom ; then - echo "The board has system EEPROM at I2C address 0x57" - # syseeprom is at the i2c address 0x57. Change the PDDF JSON file - sed -i 's@"topo_info": {"parent_bus": "0x0", "dev_addr": "0x56", "dev_type": "24c04"},@\ - "topo_info": {"parent_bus": "0x0", "dev_addr": "0x57", "dev_type": "24c02"},@g' \ - /usr/share/sonic/device/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json - sync -fi - depmod -a systemctl enable as7326-platform-handle_mac.service systemctl start as7326-platform-handle_mac.service