Skip to content

Commit

Permalink
ELBERT: SCM fpga upgrade keeps x86 state (#95)
Browse files Browse the repository at this point in the history
Summary:
ELBERT: SCM fpga upgrade keeps x86 state

Previously, SCM fpga upgrades would reset the x86 enable register to the default  which is x86 off. To prevent this, we need to latch and restore the x86 reset signal when programming scm fpga.

Testing:
Before this image: an upgrade would cause x86 to go down until reboot/powercycle
After this image: Downgrade/Upgraded and confirmed that x86 stays up. Repeated 30 times.

Pull Request resolved: facebookexternal/openbmc.arista#95

Reviewed By: benwei13

fbshipit-source-id: d69748af68
  • Loading branch information
joancaneus authored and facebook-github-bot committed Oct 9, 2020
1 parent 10c9a8b commit 79eefc6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

CPLD_JTAG_SEL_L="CPLD_JTAG_SEL_L"
JTAG_TRST_L="JTAG_TRST_L"
SCM_FPGA_LATCH_L="SCM_FPGA_LATCH_L"
JTAG_EN="${SCMCPLD_SYSFS_DIR}/jtag_en"
PROGRAM_SEL="${SCMCPLD_SYSFS_DIR}/program_sel"
SPI_CTRL="${SMBCPLD_SYSFS_DIR}/spi_ctrl"
Expand All @@ -16,6 +17,7 @@ SMB_SPIDEV="spidev1.1"

SCM_PROGRAM=false
SMB_PROGRAM=false
CACHED_SCM_PWR_ON_SYSFS="0x1"

trap disconnect_program_paths INT TERM QUIT EXIT

Expand All @@ -33,17 +35,31 @@ disconnect_program_paths() {
# Return values to defaults
gpio_set_value $CPLD_JTAG_SEL_L 1
gpio_set_value $JTAG_TRST_L 0
if [ "$SCM_PROGRAM" = false ]; then
if [ "$SCM_PROGRAM" = true ]; then
# Give SCM cpld time to come back on SMBus
sleep 2
# Restore x86 power state
echo "$CACHED_SCM_PWR_ON_SYSFS" > "$SCM_PWR_ON_SYSFS" || {
echo "Failed to recover CPU power state."
}
sleep 1
gpio_set_value $SCM_FPGA_LATCH_L 1
else
echo 0 > "$JTAG_EN"
echo 1 > "$PROGRAM_SEL"
fi

if [ "$SMB_PROGRAM" = false ]; then
echo 0 > "$SPI_CTRL"
echo 0 > "$JTAG_CTRL"
fi
}

connect_scm_jtag() {
# Store initial state of x86 power in order to restore after programming
CACHED_SCM_PWR_ON_SYSFS="$(head -n 1 "$SCM_PWR_ON_SYSFS" 2> /dev/null)"
gpio_set_value $SCM_FPGA_LATCH_L 0

gpio_set_value $CPLD_JTAG_SEL_L 0
gpio_set_value $JTAG_TRST_L 1
echo 0 > "$JTAG_EN"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ i2c_device_add 7 0x50 24c512

# SMBus 9 SCM DPM UCD90320
hwmon_device_add 9 0x11 ucd90320
gpio_export_by_offset 9-0011 13 SCM_FPGA_LATCH_L

# SMBus 10 SCM POWER
i2c_device_add 10 0x30 cpupwr
Expand Down

0 comments on commit 79eefc6

Please sign in to comment.