All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] fdt: Tidy up the code a bit with fdt addr
@ 2021-07-21 20:55 Simon Glass
  2021-07-21 20:55 ` [PATCH 2/2] fdt: Show the type of devicetree " Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Simon Glass @ 2021-07-21 20:55 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Jerry Van Baren

Clean up the code a little before changing it.

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

 cmd/fdt.c | 37 +++++++++++++------------------------
 1 file changed, 13 insertions(+), 24 deletions(-)

diff --git a/cmd/fdt.c b/cmd/fdt.c
index f1e2fc2fd8b..5acc3ebaf33 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -115,26 +115,20 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	if (argc < 2)
 		return CMD_RET_USAGE;
 
-	/*
-	 * Set the address of the fdt
-	 */
+	/* fdt addr: Set the address of the fdt */
 	if (strncmp(argv[1], "ad", 2) == 0) {
 		unsigned long addr;
 		int control = 0;
 		struct fdt_header *blob;
-		/*
-		 * Set the address [and length] of the fdt.
-		 */
+
+		/* Set the address [and length] of the fdt */
 		argc -= 2;
 		argv += 2;
-/* Temporary #ifdef - some archs don't have fdt_blob yet */
-#ifdef CONFIG_OF_CONTROL
 		if (argc && !strcmp(*argv, "-c")) {
 			control = 1;
 			argc--;
 			argv++;
 		}
-#endif
 		if (argc == 0) {
 			if (control)
 				blob = (struct fdt_header *)gd->fdt_blob;
@@ -160,22 +154,18 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 		if (argc >= 2) {
 			int  len;
 			int  err;
-			/*
-			 * Optional new length
-			 */
+
+			/* Optional new length */
 			len = simple_strtoul(argv[1], NULL, 16);
 			if (len < fdt_totalsize(blob)) {
-				printf ("New length %d < existing length %d, "
-					"ignoring.\n",
-					len, fdt_totalsize(blob));
+				printf("New length %d < existing length %d, ignoring\n",
+				       len, fdt_totalsize(blob));
 			} else {
-				/*
-				 * Open in place with a new length.
-				 */
+				/* Open in place with a new length */
 				err = fdt_open_into(blob, blob, len);
 				if (err != 0) {
-					printf ("libfdt fdt_open_into(): %s\n",
-						fdt_strerror(err));
+					printf("libfdt fdt_open_into(): %s\n",
+					       fdt_strerror(err));
 				}
 			}
 		}
@@ -184,10 +174,9 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	}
 
 	if (!working_fdt) {
-		puts(
-			"No FDT memory address configured. Please configure\n"
-			"the FDT address via \"fdt addr <address>\" command.\n"
-			"Aborting!\n");
+		puts("No FDT memory address configured. Please configure\n"
+		     "the FDT address via \"fdt addr <address>\" command.\n"
+		     "Aborting!\n");
 		return CMD_RET_FAILURE;
 	}
 
-- 
2.32.0.402.g57bb445576-goog


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

* [PATCH 2/2] fdt: Show the type of devicetree with fdt addr
  2021-07-21 20:55 [PATCH 1/2] fdt: Tidy up the code a bit with fdt addr Simon Glass
@ 2021-07-21 20:55 ` Simon Glass
  2021-07-24 21:11 ` Simon Glass
  2021-07-24 21:11 ` [PATCH 1/2] fdt: Tidy up the code a bit " Simon Glass
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-07-21 20:55 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Simon Glass, Jerry Van Baren

It seems useful to show whether the address of the Control or Working
devicetree is being shown. Add support for this. Drop the confusing 0x
prefix since the command itself only accepts hex.

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

 cmd/fdt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cmd/fdt.c b/cmd/fdt.c
index 5acc3ebaf33..baec05529ad 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -136,9 +136,10 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 				blob = working_fdt;
 			if (!blob || !fdt_valid(&blob))
 				return 1;
-			printf("The address of the fdt is %#08lx\n",
+			printf("%s fdt: %08lx\n",
+			       control ? "Control" : "Working",
 			       control ? (ulong)map_to_sysmem(blob) :
-					env_get_hex("fdtaddr", 0));
+			       env_get_hex("fdtaddr", 0));
 			return 0;
 		}
 
-- 
2.32.0.402.g57bb445576-goog


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

* Re: [PATCH 2/2] fdt: Show the type of devicetree with fdt addr
  2021-07-21 20:55 [PATCH 1/2] fdt: Tidy up the code a bit with fdt addr Simon Glass
  2021-07-21 20:55 ` [PATCH 2/2] fdt: Show the type of devicetree " Simon Glass
@ 2021-07-24 21:11 ` Simon Glass
  2021-07-24 21:11 ` [PATCH 1/2] fdt: Tidy up the code a bit " Simon Glass
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-07-24 21:11 UTC (permalink / raw)
  To: Simon Glass; +Cc: Tom Rini, Jerry Van Baren, U-Boot Mailing List

It seems useful to show whether the address of the Control or Working
devicetree is being shown. Add support for this. Drop the confusing 0x
prefix since the command itself only accepts hex.

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

 cmd/fdt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Applied to u-boot-dm, thanks!

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

* Re: [PATCH 1/2] fdt: Tidy up the code a bit with fdt addr
  2021-07-21 20:55 [PATCH 1/2] fdt: Tidy up the code a bit with fdt addr Simon Glass
  2021-07-21 20:55 ` [PATCH 2/2] fdt: Show the type of devicetree " Simon Glass
  2021-07-24 21:11 ` Simon Glass
@ 2021-07-24 21:11 ` Simon Glass
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-07-24 21:11 UTC (permalink / raw)
  To: Simon Glass; +Cc: Tom Rini, Jerry Van Baren, U-Boot Mailing List

Clean up the code a little before changing it.

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

 cmd/fdt.c | 37 +++++++++++++------------------------
 1 file changed, 13 insertions(+), 24 deletions(-)

Applied to u-boot-dm, thanks!

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

end of thread, other threads:[~2021-07-24 21:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 20:55 [PATCH 1/2] fdt: Tidy up the code a bit with fdt addr Simon Glass
2021-07-21 20:55 ` [PATCH 2/2] fdt: Show the type of devicetree " Simon Glass
2021-07-24 21:11 ` Simon Glass
2021-07-24 21:11 ` [PATCH 1/2] fdt: Tidy up the code a bit " Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.