[U-Boot] [PATCH 07/10] arm: Add option to display customised memory information

Simon Glass sjg at chromium.org
Fri Nov 2 00:42:07 CET 2012


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.

Any example of the DRAM: output is below, just for illustration:

U-Boot 2011.12-02470-gd64a0f8-dirty (Sep 14 2012 - 10:46:39) for SMDK5250

CPU:   S5PC520 @ 1700MHz
I2C:   ready
DRAM:  2 GiB Samsung DDR3 @ 800MHz
MMC:   S5P MSHC0: 0, S5P MSHC1: 1
Using default environment

Signed-off-by: Simon Glass <sjg at chromium.org>
---
 arch/arm/lib/board.c |   12 ++++++++++--
 include/common.h     |    9 +++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index b879507..d420307 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -133,6 +133,15 @@ static int display_banner(void)
 	return (0);
 }
 
+inline void __board_show_dram(ulong size)
+{
+	puts("DRAM:  ");
+	print_size(size, "\n");
+}
+
+void board_show_dram(ulong size)
+	__attribute__((weak, alias("__board_show_dram")));
+
 /*
  * WARNING: this code looks "cleaner" than the PowerPC version, but
  * has the disadvantage that you either get nothing, or everything.
@@ -157,8 +166,7 @@ static int display_dram_config(void)
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
 		size += gd->bd->bi_dram[i].size;
 
-	puts("DRAM:  ");
-	print_size(size, "\n");
+	board_show_dram(size);
 #endif
 
 	return (0);
diff --git a/include/common.h b/include/common.h
index b23e90b..6270b44 100644
--- a/include/common.h
+++ b/include/common.h
@@ -311,6 +311,15 @@ int mac_read_from_eeprom(void);
 extern u8 _binary_dt_dtb_start[];	/* embedded device tree blob */
 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 */
 void flash_perror (int);
 
-- 
1.7.7.3



More information about the U-Boot mailing list