Skip to contentSkip to conversation

sandbox: Initialize sysreset before relocation

PATCH Superseded Michal Suchanek 2 participants 4 messages Sep 25, 2022 – Oct 5, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sandbox: Initialize sysreset before relocation

Without this the early sysreset code cannot be tested.

---

 arch/sandbox/dts/sandbox.dtsi | 1 +
 arch/sandbox/dts/test.dts     | 2 ++
 2 files changed, 3 insertions(+)
arch/sandbox/dts/sandbox.dtsi +1 -0
index 56e6b38bfa..9e96ff12a1 100644
@@ -239,6 +239,7 @@
 
 	reset@1 {
 		compatible = "sandbox,reset";
+		u-boot,dm-pre-reloc;
 	};
 
 	rng {
arch/sandbox/dts/test.dts +2 -0
index 2761588f0d..c59b118e96 100644
@@ -1119,10 +1119,12 @@
 
 	reset@0 {
 		compatible = "sandbox,warm-reset";
+		u-boot,dm-pre-reloc;
 	};
 
 	reset@1 {
 		compatible = "sandbox,reset";
+		u-boot,dm-pre-reloc;
 	};
 
 	resetc: reset-ctl {
Signature · 1 line
2.37.3
#1 lore raw

PATCH 2/2 common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset info.

Also print the symbolic error when reporting sysreset failure.

Fixes 23471aed5c ("board_f: Add reset status printing")

---

 common/board_f.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)
common/board_f.c +19 -12
index 18e2246733..0835b376bc 100644
@@ -55,7 +55,7 @@
 #include <asm/io.h>
 #include <asm/sections.h>
 #include <dm/root.h>
-#include <linux/errno.h>
+#include <errno.h>
 
 /*
  * Pointer to initial global data area
@@ -163,20 +163,27 @@ static int print_resetinfo(void)
 {
 	struct udevice *dev;
 	char status[256];
+	bool first = true;
 	int ret;
 
-	ret = uclass_first_device_err(UCLASS_SYSRESET, &dev);
-	if (ret) {
-		debug("%s: No sysreset device found (error: %d)\n",
-		      __func__, ret);
-		/* Not all boards have sysreset drivers available during early
-		 * boot, so don't fail if one can't be found.
-		 */
-		return 0;
-	}
+	/* Not all boards have sysreset drivers available during early
+	 * boot, so don't fail if one can't be found.
+	 */
+	for (ret = uclass_first_device_check(UCLASS_SYSRESET, &dev); dev;
+			ret = uclass_next_device_check(&dev)) {
+		if (ret) {
+			debug("%s: %s sysreset device (error: %d %s)\n",
+			      __func__, dev->name, ret, errno_str(ret));
+			continue;
+		}
 
-	if (!sysreset_get_status(dev, status, sizeof(status)))
-		printf("%s", status);
+		if (!sysreset_get_status(dev, status, sizeof(status))) {
+			printf("%s%s", first ? "" : " ", status);
+			first = false;
+		}
+	}
+	if (!first)
+		printf("\n");
 
 	return 0;
 }
Signature · 1 line
2.37.3
#2 lore raw

Re: [PATCH 2/2] common: board_f: Print information for all sysresets

Quoted 5 lines · Michal Suchanek

Boards can have multiple sysresets, iterate all when printing sysreset info.

Also print the symbolic error when reporting sysreset failure.

Please no

Quoted 7 lines
Fixes 23471aed5c ("board_f: Add reset status printing")

---

 common/board_f.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)