Commit 15a33e49decc81f34b35998a61757bfe2becae83

Authored by Simon Glass
Committed by Albert ARIBAUD
1 parent e2e3e2b1be

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>

Showing 4 changed files with 38 additions and 0 deletions Side-by-side Diff

... ... @@ -849,6 +849,7 @@
849 849 CONFIG_CMD_LOADS loads
850 850 CONFIG_CMD_MD5SUM print md5 message digest
851 851 (requires CONFIG_CMD_MEMORY and CONFIG_MD5)
  852 + CONFIG_CMD_MEMINFO * Display detailed memory information
852 853 CONFIG_CMD_MEMORY md, mm, nm, mw, cp, cmp, crc, base,
853 854 loop, loopw, mtest
854 855 CONFIG_CMD_MISC Misc functions like sleep etc
... ... @@ -33,7 +33,10 @@
33 33 #include <dataflash.h>
34 34 #endif
35 35 #include <watchdog.h>
  36 +#include <linux/compiler.h>
36 37  
  38 +DECLARE_GLOBAL_DATA_PTR;
  39 +
37 40 static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
38 41  
39 42 /* Display values from last command.
... ... @@ -1203,6 +1206,22 @@
1203 1206  
1204 1207 #endif
1205 1208  
  1209 +#ifdef CONFIG_CMD_MEMINFO
  1210 +__weak void board_show_dram(ulong size)
  1211 +{
  1212 + puts("DRAM: ");
  1213 + print_size(size, "\n");
  1214 +}
  1215 +
  1216 +static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
  1217 + char * const argv[])
  1218 +{
  1219 + board_show_dram(gd->ram_size);
  1220 +
  1221 + return 0;
  1222 +}
  1223 +#endif
  1224 +
1206 1225 U_BOOT_CMD(
1207 1226 base, 2, 1, do_mem_base,
1208 1227 "print or set address offset",
... ... @@ -1243,4 +1262,12 @@
1243 1262 "[.b, .w, .l] address value delay(ms)"
1244 1263 );
1245 1264 #endif /* CONFIG_MX_CYCLIC */
  1265 +
  1266 +#ifdef CONFIG_CMD_MEMINFO
  1267 +U_BOOT_CMD(
  1268 + meminfo, 3, 1, do_mem_info,
  1269 + "display memory information",
  1270 + ""
  1271 +);
  1272 +#endif
... ... @@ -311,6 +311,15 @@
311 311 extern u8 _binary_dt_dtb_start[]; /* embedded device tree blob */
312 312 int set_cpu_clk_info(void);
313 313  
  314 +/**
  315 + * Show the DRAM size in a board-specific way
  316 + *
  317 + * This is used by boards to display DRAM information in their own way.
  318 + *
  319 + * @param size Size of DRAM (which should be displayed along with other info)
  320 + */
  321 +void board_show_dram(ulong size);
  322 +
314 323 /* common/flash.c */
315 324 void flash_perror (int);
316 325  
include/config_cmd_all.h
... ... @@ -56,6 +56,7 @@
56 56 #define CONFIG_CMD_LICENSE /* console license display */
57 57 #define CONFIG_CMD_LOADB /* loadb */
58 58 #define CONFIG_CMD_LOADS /* loads */
  59 +#define CONFIG_CMD_MEMINFO /* meminfo */
59 60 #define CONFIG_CMD_MEMORY /* md mm nm mw cp cmp crc base loop mtest */
60 61 #define CONFIG_CMD_MFSL /* FSL support for Microblaze */
61 62 #define CONFIG_CMD_MII /* MII support */