u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] sandbox: Initialize sysreset before relocation
@ 2022-09-25 13:27 Michal Suchanek
  2022-09-25 13:27 ` [PATCH 2/2] common: board_f: Print information for all sysresets Michal Suchanek
  2022-10-05  0:44 ` [PATCH 1/2] sandbox: Initialize sysreset before relocation Simon Glass
  0 siblings, 2 replies; 4+ messages in thread
From: Michal Suchanek @ 2022-09-25 13:27 UTC (permalink / raw)
  To: u-boot
  Cc: Michal Suchanek, Andrew Scull, Etienne Carriere,
	Heinrich Schuchardt, Marek Behún, Philippe Reynes,
	Ramon Fried, Sean Anderson, Simon Glass

Without this the early sysreset code cannot be tested.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---

 arch/sandbox/dts/sandbox.dtsi | 1 +
 arch/sandbox/dts/test.dts     | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi
index 56e6b38bfa..9e96ff12a1 100644
--- a/arch/sandbox/dts/sandbox.dtsi
+++ b/arch/sandbox/dts/sandbox.dtsi
@@ -239,6 +239,7 @@
 
 	reset@1 {
 		compatible = "sandbox,reset";
+		u-boot,dm-pre-reloc;
 	};
 
 	rng {
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 2761588f0d..c59b118e96 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -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 {
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] common: board_f: Print information for all sysresets
  2022-09-25 13:27 [PATCH 1/2] sandbox: Initialize sysreset before relocation Michal Suchanek
@ 2022-09-25 13:27 ` Michal Suchanek
  2022-10-05  0:44   ` Simon Glass
  2022-10-05  0:44 ` [PATCH 1/2] sandbox: Initialize sysreset before relocation Simon Glass
  1 sibling, 1 reply; 4+ messages in thread
From: Michal Suchanek @ 2022-09-25 13:27 UTC (permalink / raw)
  To: u-boot
  Cc: Michal Suchanek, Marek Vasut, Mario Six, Michal Simek, Rick Chen,
	Simon Glass

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")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---

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

diff --git a/common/board_f.c b/common/board_f.c
index 18e2246733..0835b376bc 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -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;
 }
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] sandbox: Initialize sysreset before relocation
  2022-09-25 13:27 [PATCH 1/2] sandbox: Initialize sysreset before relocation Michal Suchanek
  2022-09-25 13:27 ` [PATCH 2/2] common: board_f: Print information for all sysresets Michal Suchanek
@ 2022-10-05  0:44 ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Glass @ 2022-10-05  0:44 UTC (permalink / raw)
  To: Michal Suchanek
  Cc: u-boot, Andrew Scull, Etienne Carriere, Heinrich Schuchardt,
	Marek Behún, Philippe Reynes, Ramon Fried, Sean Anderson

On Sun, 25 Sept 2022 at 07:27, Michal Suchanek <msuchanek@suse.de> wrote:
>
> Without this the early sysreset code cannot be tested.
>
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>
>  arch/sandbox/dts/sandbox.dtsi | 1 +
>  arch/sandbox/dts/test.dts     | 2 ++
>  2 files changed, 3 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] common: board_f: Print information for all sysresets
  2022-09-25 13:27 ` [PATCH 2/2] common: board_f: Print information for all sysresets Michal Suchanek
@ 2022-10-05  0:44   ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2022-10-05  0:44 UTC (permalink / raw)
  To: Michal Suchanek; +Cc: u-boot, Marek Vasut, Mario Six, Michal Simek, Rick Chen

On Sun, 25 Sept 2022 at 07:27, Michal Suchanek <msuchanek@suse.de> wrote:
>
> Boards can have multiple sysresets, iterate all when printing sysreset
> info.
>
> Also print the symbolic error when reporting sysreset failure.

Please no


>
> Fixes: 23471aed5c ("board_f: Add reset status printing")
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>
>  common/board_f.c | 31 +++++++++++++++++++------------
>  1 file changed, 19 insertions(+), 12 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-05  0:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25 13:27 [PATCH 1/2] sandbox: Initialize sysreset before relocation Michal Suchanek
2022-09-25 13:27 ` [PATCH 2/2] common: board_f: Print information for all sysresets Michal Suchanek
2022-10-05  0:44   ` Simon Glass
2022-10-05  0:44 ` [PATCH 1/2] sandbox: Initialize sysreset before relocation Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).