Skip to content
Snippets Groups Projects
Commit 15a33e49 authored by Simon Glass's avatar Simon Glass Committed by Albert ARIBAUD
Browse files

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: default avatarSimon Glass <sjg@chromium.org>
parent e2e3e2b1
No related branches found
No related tags found
No related merge requests found
...@@ -849,6 +849,7 @@ The following options need to be configured: ...@@ -849,6 +849,7 @@ The following options need to be configured:
CONFIG_CMD_LOADS loads CONFIG_CMD_LOADS loads
CONFIG_CMD_MD5SUM print md5 message digest CONFIG_CMD_MD5SUM print md5 message digest
(requires CONFIG_CMD_MEMORY and CONFIG_MD5) (requires CONFIG_CMD_MEMORY and CONFIG_MD5)
CONFIG_CMD_MEMINFO * Display detailed memory information
CONFIG_CMD_MEMORY md, mm, nm, mw, cp, cmp, crc, base, CONFIG_CMD_MEMORY md, mm, nm, mw, cp, cmp, crc, base,
loop, loopw, mtest loop, loopw, mtest
CONFIG_CMD_MISC Misc functions like sleep etc CONFIG_CMD_MISC Misc functions like sleep etc
......
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
#include <dataflash.h> #include <dataflash.h>
#endif #endif
#include <watchdog.h> #include <watchdog.h>
#include <linux/compiler.h>
DECLARE_GLOBAL_DATA_PTR;
static int mod_mem(cmd_tbl_t *, int, int, int, char * const []); static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
...@@ -1203,6 +1206,22 @@ U_BOOT_CMD( ...@@ -1203,6 +1206,22 @@ U_BOOT_CMD(
#endif #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( U_BOOT_CMD(
base, 2, 1, do_mem_base, base, 2, 1, do_mem_base,
"print or set address offset", "print or set address offset",
...@@ -1243,3 +1262,11 @@ U_BOOT_CMD( ...@@ -1243,3 +1262,11 @@ U_BOOT_CMD(
"[.b, .w, .l] address value delay(ms)" "[.b, .w, .l] address value delay(ms)"
); );
#endif /* CONFIG_MX_CYCLIC */ #endif /* CONFIG_MX_CYCLIC */
#ifdef CONFIG_CMD_MEMINFO
U_BOOT_CMD(
meminfo, 3, 1, do_mem_info,
"display memory information",
""
);
#endif
...@@ -311,6 +311,15 @@ int mac_read_from_eeprom(void); ...@@ -311,6 +311,15 @@ int mac_read_from_eeprom(void);
extern u8 _binary_dt_dtb_start[]; /* embedded device tree blob */ extern u8 _binary_dt_dtb_start[]; /* embedded device tree blob */
int set_cpu_clk_info(void); int set_cpu_clk_info(void);
/**
* Show the DRAM size in a board-specific way
*
* This is used by boards to display DRAM information in their own way.
*
* @param size Size of DRAM (which should be displayed along with other info)
*/
void board_show_dram(ulong size);
/* common/flash.c */ /* common/flash.c */
void flash_perror (int); void flash_perror (int);
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#define CONFIG_CMD_LICENSE /* console license display */ #define CONFIG_CMD_LICENSE /* console license display */
#define CONFIG_CMD_LOADB /* loadb */ #define CONFIG_CMD_LOADB /* loadb */
#define CONFIG_CMD_LOADS /* loads */ #define CONFIG_CMD_LOADS /* loads */
#define CONFIG_CMD_MEMINFO /* meminfo */
#define CONFIG_CMD_MEMORY /* md mm nm mw cp cmp crc base loop mtest */ #define CONFIG_CMD_MEMORY /* md mm nm mw cp cmp crc base loop mtest */
#define CONFIG_CMD_MFSL /* FSL support for Microblaze */ #define CONFIG_CMD_MFSL /* FSL support for Microblaze */
#define CONFIG_CMD_MII /* MII support */ #define CONFIG_CMD_MII /* MII support */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment