-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[as7816-64x]Modify to check specific DUT #7826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lguohan
merged 3 commits into
sonic-net:master
from
jostar-yang:as7816_20210609_pddf_check_at
Mar 1, 2022
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151 changes: 151 additions & 0 deletions
151
platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pre_pddf_init.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Steps to check syseeprom i2c address | ||
| modprobe i2c-i801 | ||
| modprobe i2c-dev | ||
| at_id=false | ||
|
|
||
| (i2cset -y -f 0 0x77 0x1) > /dev/null 2>&1 | ||
| (i2cset -y -f 0 0x76 0x4) > /dev/null 2>&1 | ||
|
|
||
|
|
||
| (i2cget -y -f 0 0x60 0xfd) > /dev/null 2>&1 | ||
| if [ $? -eq 0 ]; then | ||
| echo "get at_id" | ||
|
|
||
| at_1=$(i2cget -y -f 0 0x60 0xfd) | ||
|
|
||
| if [[ ${at_1} -eq 0x41 ]]; then | ||
| echo "get at_1 is 0x41" | ||
| at_2=$(i2cget -y -f 0 0x60 0xfe) | ||
|
|
||
| if [[ ${at_2} -eq 0x54 ]]; then | ||
| echo "get at_2 is 0x54" | ||
| at_id=true | ||
| fi | ||
| else | ||
| cpld_id=$(i2cget -y -f 0 0x60 0x1) #This CPD version that not support to record at_id | ||
| if [[ ${cpld_id} -eq 0x5 ]]; then | ||
| at_id=true | ||
| fi | ||
|
|
||
| fi | ||
| fi | ||
|
|
||
| if $at_id ; then | ||
| echo "This CPLD is for AT used PSU" | ||
| echo "PSU-1 pmbus use parent_bus:0x9, dev_addr:0x58" | ||
| echo "PSU-1 eeprom use parent_bus:0x9, dev_addr:0x50" | ||
| echo "PSU-2 pmbus use parent_bus:0xa, dev_addr:0x5b" | ||
| echo "PSU-2 eeprom use parent_bus:0xa, dev_addr:0x53" | ||
|
|
||
| if [ -f /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf_support ] && \ | ||
| [ -f /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json ]; then | ||
| #Change the PDDF JSON file | ||
| sed -i 's@{ "chn":"0", "dev":"PSU2"},@\ | ||
| { "chn":"0", "dev":"PSU1" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "chn":"1", "dev":"PSU1"}@\ | ||
| { "chn":"1", "dev":"PSU2" }@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
|
|
||
| sed -i 's@"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x5b", "dev_type":"psu_pmbus"},@\ | ||
| "topo_info": {"parent_bus":"0x9", "dev_addr":"0x58" , "dev_type": "psu_pmbus" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ | ||
| { "attr_name":"psu_model_name", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ | ||
| { "attr_name":"psu_mfr_id", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},@\ | ||
| { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ | ||
| { "attr_name":"psu_v_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ | ||
| { "attr_name":"psu_i_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ | ||
| { "attr_name":"psu_p_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ | ||
| { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}@\ | ||
| { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" }@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
|
|
||
| sed -i 's@"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x53", "dev_type":"psu_eeprom"},@\ | ||
| "topo_info": {"parent_bus":"0x9", "dev_addr":"0x50" , "dev_type": "psu_eeprom" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
|
|
||
|
|
||
| sed -i 's@"topo_info": { "parent_bus":"0x9", "dev_addr":"0x58", "dev_type":"psu_pmbus"},@\ | ||
| "topo_info": {"parent_bus":"0xa", "dev_addr":"0x5b", "dev_type": "psu_pmbus" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
|
|
||
| sed -i 's@{ "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ | ||
| { "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
|
|
||
| sed -i 's@{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ | ||
| { "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},@\ | ||
| { "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ | ||
| { "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ | ||
| { "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ | ||
| { "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ | ||
| { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| sed -i 's@{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}@\ | ||
| { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" }@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
|
|
||
| sed -i 's@"topo_info":{ "parent_bus":"0x9", "dev_addr":"0x50", "dev_type":"psu_eeprom"},@\ | ||
| "topo_info": {"parent_bus":"0xa", "dev_addr":"0x53", "dev_type": "psu_eeprom" },@g' \ | ||
| /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json | ||
| sync | ||
| fi | ||
| fi | ||
|
|
||
| (i2cset -y -f 0 0x76 0x0) > /dev/null 2>&1 | ||
| (i2cset -y -f 0 0x77 0x0) > /dev/null 2>&1 | ||
| echo "Pre PDDF init steps completed successully" | ||
|
|
||
| #For others, psu i2c bus use below, | ||
| #PSU-1 pmbus use "parent_bus":"0xa", "dev_addr":"0x5b" | ||
| #PSU-1 eeprom use "parent_bus":"0xa", "dev_addr":"0x53" | ||
| #PSU-2 pmbus use "parent_bus":"0x9", "dev_addr":"0x58" | ||
| #PSU-2 eeprom use "parent_bus":"0x9", "dev_addr":"0x50" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove these changes and all other changes in pddf-device.json file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done to modify back pddf-device.json