[U-Boot] [PATCH v2 20/23] Add command to show DRAM configuration

Simon Glass sjg at chromium.org
Thu Nov 22 20:13:04 CET 2012


The new meminfo command shows details memory information. It is implemented
by board_show_dram(), which should be implemented by the board.

This is a rewrite of the patch:

   arm: Add option to display customised memory information

according to feedback on the mailing list.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2:
- Rework DRAM info feature to use a command instead of updating arm code

 README           |    8 ++++++++
 common/cmd_mem.c |   25 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/README b/README
index b1379a6..7a81cd4 100644
--- a/README
+++ b/README
@@ -2414,6 +2414,14 @@ CBFS (Coreboot Filesystem) support
 		Note: There is also a sha1sum command, which should perhaps
 		be deprecated in favour of 'hash sha1'.
 
+- Detailed memory information
+		CONFIG_CMD_MEMINFO
+
+		Define this to provide a 'meminfo' command. This prints
+		information on system memory. You can provide a
+		board-specific function board_show_dram() to print this
+		information if the standard message is insufficient.
+
 - Show boot progress:
 		CONFIG_SHOW_BOOT_PROGRESS
 
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 4d64cff..4727abd 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -33,6 +33,9 @@
 #include <dataflash.h>
 #endif
 #include <watchdog.h>
+#include <linux/compiler.h>
+
+DECLARE_GLOBAL_DATA_PTR;
 
 static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
 
@@ -1243,3 +1246,25 @@ U_BOOT_CMD(
 	"[.b, .w, .l] address value delay(ms)"
 );
 #endif /* CONFIG_MX_CYCLIC */
+
+#ifdef CONFIG_CMD_MEMINFO
+__weak void board_show_dram(ulong size)
+{
+	puts("DRAM:  ");
+	print_size(size, "\n");
+}
+
+static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
+		       char * const argv[])
+{
+	board_show_dram(gd->ram_size);
+
+	return 0;
+}
+
+U_BOOT_CMD(
+	meminfo,	3,	1,	do_mem_info,
+	"display memory information",
+	""
+);
+#endif
-- 
1.7.7.3



More information about the U-Boot mailing list