diff mbox

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

Message ID 1353611587-18186-21-git-send-email-sjg@chromium.org
State Superseded, archived
Headers show

Commit Message

Simon Glass Nov. 22, 2012, 7:13 p.m. UTC
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@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(-)

Comments

Simon Glass Dec. 1, 2012, 3:09 p.m. UTC | #1
Hi,

On Thu, Nov 22, 2012 at 11:13 AM, Simon Glass <sjg@chromium.org> wrote:
> 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@chromium.org>

I have ended up with two of these patches since I neglected to drop it
from the arm series. So I would like to drop this one please. I will
mark it superseded in patchwork.

Regards,
Simon
diff mbox

Patch

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