Skip to content

Commit

Permalink
ELBERT: Use pim eeprom as presence detection source (#113)
Browse files Browse the repository at this point in the history
Summary:
NOTE: Please merge facebookexternal/openbmc.arista#112 first as this depends on that change

Sometimes, CMB cpld will erroneously report PIM as not inserted even
though it is present but may have corrupted fpga. Add pim smbus eeprom
detection as another source of presence detection.

```Testing:

------PIM-FPGA------
PIM 2: 7.3
PIM 3: 6.4
PIM 4: 7.3
PIM 5: 7.3
PIM 6: 6.4
PIM 7: 6.4
PIM 8: 6.4
PIM 9: 6.4

dpm_ver.sh
PIM2.: SFT013860103
PIM3.: SFT012990103
PIM4.: SFT013860103
PIM5.: SFT013860103
PIM6.: SFT012990103
PIM7.: SFT012990103
PIM8.: SFT012990103
PIM9.: SFT012990103

root@bmc-oob:~# pim_types.sh
PIM 2: PIM8DDM
PIM 3: PIM16Q
PIM 4: PIM8DDM
PIM 5: PIM8DDM
PIM 6: PIM16Q
PIM 7: PIM16Q
PIM 8: PIM16Q
PIM 9: PIM16Q

Pull Request resolved: facebookexternal/openbmc.arista#113

Reviewed By: mikechoifb

fbshipit-source-id: fed0564419
  • Loading branch information
joancaneus authored and facebook-github-bot committed Nov 20, 2020
1 parent 62a8ece commit 59109c1
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# Copyright 2020-present Facebook. All Rights Reserved.

Expand Down Expand Up @@ -94,6 +94,31 @@ wedge_should_enable_oob() {
return 1
}

wedge_is_pim_present() {
# $1 - pim range 2 - 9
pim="$1"

# PIM SMBus 16-23
pim_index=(0 1 2 3 4 5 6 7)
pim_bus=(16 17 18 19 20 21 22 23)
if wedge_is_smb_p1; then
# P1 has different PIM bus mapping
pim_bus=(16 17 18 23 20 21 22 19)
fi

busId=${pim_bus[$((pim-2))]}
pim_prsnt="$(head -n 1 "$SMBCPLD_SYSFS_DIR"/pim"$pim"_present)"
pim_eeprom_prsnt="$(i2cget -f -y "$busId" 0x50 && echo 1 || echo 0)"
if [ "$((pim_prsnt))" -eq 1 ]; then
return 0
elif [ "$((pim_eeprom_prsnt))" -eq 1 ]; then
# PIM Eeprom found but PIM present bit is incorrect
echo "PIM$pim present is false but eeprom detected."
return 0
fi
return 1
}

wedge_power_off_asic() {
# ASIC put into reset
echo 1 > "$SMB_TH4_RST_ON_SYSFS"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ for i in "${pim_index[@]}"
do
# PIM numbered 2-9
pim=$((i+2))
pim_prsnt="$(head -n 1 "$SMBCPLD_SYSFS_DIR"/pim"$pim"_present)"
if [ "$((pim_prsnt))" -eq 1 ]; then
if wedge_is_pim_present "$pim"; then
# PIM 2-9, SMBUS 16-23
bus_id="${pim_bus[$i]}"
show_dpm_ver "PIM${pim}.:" "$bus_id" "$pim_dpm_addr"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ while true; do
pim_number="$((i+2))"
pim_addr=${pim_bus[$i]}-00$dpm_addr # 16-004e for example
# Check if Switch card senses the PIM presence
pim_path="$SMBCPLD_SYSFS_DIR/pim${pim_number}_present"
pim_present="$(head -n 1 "$pim_path")"
if [ "$pim_present" == "0x1" ]; then
if wedge_is_pim_present "$pim_number"; then
# Check if device was probed and driver was installed
drv_path=/sys/bus/i2c/drivers/ucd9000/$pim_addr
if [ -e "$drv_path"/gpio ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

pim_list="2 3 4 5 6 7 8 9"
for pim in ${pim_list}; do
pim_present=$(head -n 1 "$SMBCPLD_SYSFS_DIR"/pim"$pim"_present)
if [ "$((pim_present))" -eq 0 ]; then
if ! wedge_is_pim_present "$pim"; then
echo "PIM $pim: NOT INSERTED"
else
pim_type='NOT DETECTED'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ for i in "${pim_index[@]}"
do
# PIM numbered 2-9
pim=$((i+2))
pim_prsnt="$(head -n 1 "$SMBCPLD_SYSFS_DIR"/pim"$pim"_present)"
if [ "$((pim_prsnt))" -eq 1 ]; then
if wedge_is_pim_present "$pim"; then
# PIM 2-9, SMBUS 16-23
bus_id="${pim_bus[$i]}"
i2c_device_add "$bus_id" 0x16 pmbus # TPS546D24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ toggle_pim_reset() {
# Re-initialize reset pims
for slot in 2 3 4 5 6 7 8 9; do
if [ "$pim" -eq 0 ] || [ "$slot" -eq "$pim" ]; then
pim_prsnt="$(head -n 1 "$SMBCPLD_SYSFS_DIR"/pim"$slot"_present)"
if [ "$pim_prsnt" == '0x1' ]; then
if wedge_is_pim_present "$slot"; then
power_on_pim "$slot"
fi
fi
Expand Down

0 comments on commit 59109c1

Please sign in to comment.