diff mbox

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

Message ID 1351813330-23741-7-git-send-email-sjg@chromium.org
State Superseded, archived
Delegated to: Albert ARIBAUD
Headers show

Commit Message

Simon Glass Nov. 1, 2012, 11:42 p.m. UTC
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@chromium.org>
---
 arch/arm/lib/board.c |   12 ++++++++++--
 include/common.h     |    9 +++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

Comments

Wolfgang Denk Nov. 3, 2012, 2:54 p.m. UTC | #1
Dear Simon Glass,

In message <1351813330-23741-7-git-send-email-sjg@chromium.org> you wrote:
> 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

NAK.

Such information does not belong into the standard boot messages.
These should containonly the necessary information to see that U-Boot
is coming up correctly and give indication where it might be hanging
if it does.

All other information should be printed by commands that may be called
by users who are actually interested in such information.  You may
even add such commands to your "preboot" settings, but please make
sure that users not interested in such stuff can change this and get
only minimal output (as may be needed for minimal boot times).

Best regards,

Wolfgang Denk
Simon Glass Nov. 15, 2012, 10:45 p.m. UTC | #2
Hi Wolfgang,

On Sat, Nov 3, 2012 at 7:54 AM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Simon Glass,
>
> In message <1351813330-23741-7-git-send-email-sjg@chromium.org> you wrote:
>> 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
>
> NAK.
>
> Such information does not belong into the standard boot messages.
> These should containonly the necessary information to see that U-Boot
> is coming up correctly and give indication where it might be hanging
> if it does.
>
> All other information should be printed by commands that may be called
> by users who are actually interested in such information.  You may
> even add such commands to your "preboot" settings, but please make
> sure that users not interested in such stuff can change this and get
> only minimal output (as may be needed for minimal boot times).

A key reason for not coming up correctly is the memory being
configured incorrectly - e.g. timings or type incorrect.

I will see if I can add a command for this.

Regards,
Simon

>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
> If a person (a) is poorly, (b) receives treatment  intended  to  make
> him  better, and (c) gets better, then no power of reasoning known to
> medical science can convince him  that  it  may  not  have  been  the
> treatment that restored his health.
> - Sir Peter Medawar, The Art of the Soluble
diff mbox

Patch

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);