summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-mitchell
diff options
context:
space:
mode:
authorThang Tran <thuutran@amperecomputing.com>2023-10-05 05:20:05 +0300
committerThang Q. Nguyen <thang@os.amperecomputing.com>2023-10-19 05:49:20 +0300
commit7c3ecf4c4e762c8957ca8453da98cbcd52184101 (patch)
treee211440051a537eec2895704a3a52e4d2640c8d8 /meta-ampere/meta-mitchell
parent38f200f4681f0d780fbef1e2b7418ac2b33c8463 (diff)
downloadopenbmc-7c3ecf4c4e762c8957ca8453da98cbcd52184101.tar.xz
meta-ampere: mtmitchell: correct checking PGOOD
Currently, in the platform initialization phase, BMC is checking PGOOD gpio via both dbus and "/sys/class/gpio" methods. The "power_control" application is polling PGOOD. Sometimes, "power_control" stops checking the PGOOD's status due to a conflict with platform initialization. It makes BMC can not control the power. This commit removes the conflict between the "power_control" and the platform initialization as below: - Update ampere-platform-init.service to request the platform initialization run before the "power_control". - Update mtmitchell_platform_gpios_init.sh to remove checking PGOOD via dbus. Tested: The platform initialization runs before the "power_control". Turn on/off the host, reboot BMC, AC power work correctly. Signed-off-by: Thang Tran <thuutran@amperecomputing.com> Change-Id: Ic9619f93b8a49c578a8a0d733872a636ec6fc100
Diffstat (limited to 'meta-ampere/meta-mitchell')
-rw-r--r--meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere-platform-init.service3
-rw-r--r--meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh26
2 files changed, 6 insertions, 23 deletions
diff --git a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere-platform-init.service b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere-platform-init.service
index 72a34cba64..a19cf906fc 100644
--- a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere-platform-init.service
+++ b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere-platform-init.service
@@ -1,5 +1,6 @@
[Unit]
Description = Ampere Platform Initialization
+Before=org.openbmc.control.Power@0.service
[Service]
Restart=no
@@ -8,4 +9,4 @@ Type=oneshot
ExecStart=/usr/sbin/ampere_platform_init.sh
[Install]
-WantedBy=sysinit.target
+WantedBy=multi-user.target
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 f5fefc3785..57a951abda 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
@@ -19,33 +19,15 @@ 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
-
+ pgood=$(gpioget $(gpiofind power-chassis-good))
if [ "$pgood" == '1' ]; then
echo "PSU is on. Setting PSON to 0"
gpioset $(gpiofind 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=$(gpioget $(gpiofind power-chassis-good))
- if [ "$pgood" == '0' ]; then
- echo "power-chassis-good reponse as 0. Confirm PSU is off. Setting PSON to 1."
- gpioset $(gpiofind power-chassis-control)=1
- fi
+ echo "PSU is off. Setting PSON to 1"
+ gpioset $(gpiofind power-chassis-control)=1
fi
+
gpioset $(gpiofind host0-sysreset-n)=1
# gpio-leds is controlling bmc-ready, not by gpio