summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-11-30 13:01:20 (GMT)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2013-01-10 21:22:12 (GMT)
commit15a33e49decc81f34b35998a61757bfe2becae83 (patch)
tree84080d0270f2514380d32e1f693a0afba7a92194 /common
parente2e3e2b1be703e0c93d0e49cac9a0dd2e1ba8f6e (diff)
downloadu-boot-fsl-qoriq-15a33e49decc81f34b35998a61757bfe2becae83.tar.xz
Add option to display customised memory information
Some boards want to report more than just memory size. For example, it might be useful to display the memory type (DDR2, DDR3) or manufacturer. Add a weak function to support this requirement, accessed through a new 'meminfo' command. Any example of the DRAM: output is below, just for illustration: SMDK5250 # meminfo DRAM: 2 GiB Elpida DDR3 @ 800MHz Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_mem.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 4d64cff..0f3ffc8 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 []);
@@ -1203,6 +1206,22 @@ U_BOOT_CMD(
#endif
+#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;
+}
+#endif
+
U_BOOT_CMD(
base, 2, 1, do_mem_base,
"print or set address offset",
@@ -1243,3 +1262,11 @@ U_BOOT_CMD(
"[.b, .w, .l] address value delay(ms)"
);
#endif /* CONFIG_MX_CYCLIC */
+
+#ifdef CONFIG_CMD_MEMINFO
+U_BOOT_CMD(
+ meminfo, 3, 1, do_mem_info,
+ "display memory information",
+ ""
+);
+#endif