public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC] cmd: fdt: memory fixup
@ 2017-01-31  2:35 Ladislav Michl
  2017-01-31 23:12 ` Ladislav Michl
  2017-02-05 16:36 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Ladislav Michl @ 2017-01-31  2:35 UTC (permalink / raw)
  To: u-boot

To get Falcon mode working with zImage is currently non trivial as zImages
do not fit into U-Boot's image concept too well. Fortunately at least for
ARM boards it seems getting memory node right is quite sufficient.
What about changing 'fdt memory' command to update memory node according to
detected memory layout when called without parameters?

	ladis

diff --git a/cmd/fdt.c b/cmd/fdt.c
index 95dd673b95..e08296d51c 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -517,11 +517,23 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	 * memory command
 	 */
 	} else if (strncmp(argv[1], "me", 2) == 0) {
-		uint64_t addr, size;
 		int err;
-		addr = simple_strtoull(argv[2], NULL, 16);
-		size = simple_strtoull(argv[3], NULL, 16);
-		err = fdt_fixup_memory(working_fdt, addr, size);
+		if (argc < 4) {
+			int i;
+			uint64_t start[CONFIG_NR_DRAM_BANKS];
+			uint64_t size[CONFIG_NR_DRAM_BANKS];
+			bd_t *bd = gd->bd;
+			for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+				start[i] = bd->bi_dram[i].start;
+				size[i] = bd->bi_dram[i].size;
+			}
+			err = fdt_fixup_memory_banks(working_fdt, start, size,
+						CONFIG_NR_DRAM_BANKS);
+		} else {
+			uint64_t addr = simple_strtoull(argv[2], NULL, 16);
+			uint64_t size = simple_strtoull(argv[3], NULL, 16);
+			err = fdt_fixup_memory(working_fdt, addr, size);
+		}
 		if (err < 0)
 			return err;
 

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

end of thread, other threads:[~2017-02-05 16:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-31  2:35 [U-Boot] [RFC] cmd: fdt: memory fixup Ladislav Michl
2017-01-31 23:12 ` Ladislav Michl
2017-02-05 16:36 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox