[PATCH 9/9] board: ge: bx50v3: check b850v3 power management watchdog

Sebastian Reichel sebastian.reichel at collabora.com
Wed Nov 4 17:18:43 CET 2020


From: Ian Ray <ian.ray at ge.com>

Set `bootcause' from b850v3 power management watchdog status.

Boot cause "REVERT" is no longer used, remove it.

Signed-off-by: Ian Ray <ian.ray at ge.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel at collabora.com>
---
 board/ge/bx50v3/bx50v3.c    | 17 +++++++++++++++++
 include/configs/ge_bx50v3.h |  4 +---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 8e7b90a10c76..4754647fb4ad 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -384,6 +384,7 @@ static iomux_v3_cfg_t const misc_pads[] = {
 	MX6_PAD_GPIO_9__WDOG1_B         | MUX_PAD_CTRL(NC_PAD_CTRL),
 };
 #define SUS_S3_OUT	IMX_GPIO_NR(4, 11)
+#define PWGIN_IN	IMX_GPIO_NR(4, 14)
 #define WIFI_EN	IMX_GPIO_NR(6, 14)
 
 int board_early_init_f(void)
@@ -416,6 +417,9 @@ int board_init(void)
 	gpio_request(SUS_S3_OUT, "sus_s3_out");
 	gpio_direction_output(SUS_S3_OUT, 1);
 
+	gpio_request(PWGIN_IN, "pwgin_in");
+	gpio_direction_input(PWGIN_IN);
+
 	gpio_request(WIFI_EN, "wifi_en");
 	gpio_direction_output(WIFI_EN, 1);
 
@@ -465,6 +469,17 @@ void pmic_init(void)
 	}
 }
 
+static void detect_boot_cause(void)
+{
+	const char *cause = "POR";
+
+	if (is_b850v3())
+		if (!gpio_get_value(PWGIN_IN))
+			cause = "PM_WDOG";
+
+	env_set("bootcause", cause);
+}
+
 int board_late_init(void)
 {
 	process_vpd(&vpd);
@@ -478,6 +493,8 @@ int board_late_init(void)
 	else
 		env_set("videoargs", "video=LVDS-1:1024x768 at 65");
 
+	detect_boot_cause();
+
 	/* board specific pmic init */
 	pmic_init();
 
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index c328a12ce172..e5c580b3f910 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -56,7 +56,7 @@
                 "setenv netmask 255.255.255.0; setenv ethaddr ca:fe:de:ca:f0:11; " \
                 "setenv bootargs root=/dev/nfs nfsroot=${nfsserver}:/srv/nfs/,v3,tcp rw rootwait" \
                 "setenv bootargs $bootargs ip=${ipaddr}:${nfsserver}:${gatewayip}:${netmask}::eth0:off " \
-                "setenv bootargs $bootargs cma=128M bootcause=POR ${videoargs} " \
+                "setenv bootargs $bootargs cma=128M bootcause=${bootcause} ${videoargs} " \
                 "setenv bootargs $bootargs systemd.mask=helix-network-defaults.service " \
                 "setenv bootargs $bootargs watchdog.handle_boot_enabled=1\0" \
         "networkboot=" \
@@ -74,7 +74,6 @@
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	NETWORKBOOT \
-	"bootcause=POR\0" \
 	"image=/boot/fitImage\0" \
 	"dev=mmc\0" \
 	"devnum=2\0" \
@@ -104,7 +103,6 @@
 		"setenv partnum 1; run hasfirstboot || setenv partnum 2; " \
 		"run hasfirstboot || setenv partnum 0; " \
 		"if test ${partnum} != 0; then " \
-			"setenv bootcause REVERT; " \
 			"run swappartitions loadimage doboot; " \
 		"fi; " \
 		"run failbootcmd\0" \
-- 
2.28.0



More information about the U-Boot mailing list