summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-mitchell
diff options
context:
space:
mode:
authorThang Q. Nguyen <thang@os.amperecomputing.com>2023-04-15 10:23:25 +0300
committerThang Q. Nguyen <thang@os.amperecomputing.com>2023-04-16 01:23:54 +0300
commit12bb5739263e5c13809249a744c768d00af0782f (patch)
tree69ab93888a6c4bfa836d8d4180868cd092238ba2 /meta-ampere/meta-mitchell
parent4e5d64daf0a666064320b0d1345c5f39ebef5adf (diff)
downloadopenbmc-12bb5739263e5c13809249a744c768d00af0782f.tar.xz
meta-ampere: mtmitchell: fix Host is powered OFF when BMC reboots
When BMC is rebooted, because PSON_L has pull up to P3V3_STB, it changes its value to HIGH which causes the Host is turned OFF. Add code to check P3V3_STB and recover PSON_L to correct state before setting BMC_RDY. Tested: 1. Turn ON the Host 2. Run BMC reboot stress test and check if the Host is still ON Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com> Change-Id: Ic1e3a403d2833b3549fa4f08dcce21a27d8e2308
Diffstat (limited to 'meta-ampere/meta-mitchell')
-rw-r--r--meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh
index 396fbffa38..76d3a7454c 100644
--- a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh
+++ b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh
@@ -18,9 +18,48 @@ function pre-platform-init() {
}
function post-platform-init() {
+
+ # When BMC is rebooted, because PSON_L has pull up to P3V3_STB, it changes its
+ # value to HIGH. Add code to check P3V3_STB and recover PSON_L to correct state
+ # before setting BMC_RDY.
+ cnt=10
+ pgood=""
+ while [ $cnt -gt 0 ];
+ do
+ pgood=$(busctl get-property org.openbmc.control.Power /org/openbmc/control/power0 org.openbmc.control.Power pgood | cut -d' ' -f2)
+ if [[ "$pgood" != '' ]]; then
+ break;
+ fi
+ cnt=$(( cnt - 1 ))
+ sleep 1
+ done
+
+ if [ "$pgood" == '1' ]; then
+ echo "PSU is on. Setting PSON to 0"
+ gpio_name_set power-chassis-control 0
+ else
+ echo "pgood D-Bus property response as 0. PSU is off."
+ # for unknown reason when stress reboot bmc power-control.exe detect power-chassis-good is 1 (power on)
+ # But "busctl get-property org.openbmc.control.Power /org/openbmc/control/power0 org.openbmc.control.Power pgood" responses 0 (power off)
+ # Add sleep 3 seconds after the pgood dbus reponse (power off) and recheck the power-chassis-good to confirm about the PSU power state
+ sleep 3
+ pgood=$(gpio_name_get power-chassis-good)
+ if [ "$pgood" == '0' ]; then
+ echo "power-chassis-good reponse as 0. Confirm PSU is off. Setting PSON to 1."
+ gpio_name_set power-chassis-control 1
+ fi
+ fi
+ gpio_name_set host0-sysreset-n 1
+
# gpio-leds is controlling bmc-ready, not by gpio
echo 1 > /sys/class/leds/bmc-ready/brightness
+ echo "Set default FAN speed to 60%"
+ for filename in /sys/class/hwmon/*/pwm*
+ do
+ echo 153 > "$filename"
+ done
+
# Bind rtc driver
bind_rtc_driver
}
@@ -44,9 +83,11 @@ export input_gpios_in_ac=(
export output_high_gpios_in_bmc_reboot=(
"host0-sysreset-n"
"host0-pmin-n"
+ "bmc-debug-mode"
"vrd-sel"
"spd-sel"
"ext-high-temp-n"
+ "fpga-program-b"
"wd-disable-n"
"hpm-stby-rst-n"
"jtag-sel-s0"
@@ -71,6 +112,7 @@ export input_gpios_in_bmc_reboot=(
"presence-ps0"
"presence-ps1"
"hsc-12vmain-alt2-n"
+ "eth-phy-int-n"
"s0-pcp-oc-warn-n"
"s1-pcp-oc-warn-n"
"cpu-bios-recover"
@@ -97,6 +139,7 @@ export input_gpios_in_bmc_reboot=(
"s1-fw-boot-ok"
"s0-spi-auth-fail-n"
"s1-sys-auth-failure-n"
+ "cpld-s1-spi-auth-fail-n"
"ps0-pgood"
"ps1-pgood"
"s0-soc-pgood"