diff mbox

[U-Boot,07/11] Allow setting CONFIG_NR_DRAM_BANKS to a larger value

Message ID 1300435500-4909-8-git-send-email-rogan@dawes.za.net
State Not Applicable
Headers show

Commit Message

Rogan Dawes March 18, 2011, 8:04 a.m. UTC
From: rogan@dawes.za.net <rogan@dawes.za.net>

This allows us to match the exact behaviour of the vendor U-boot in the kernel boot logs
---
 arch/arm/cpu/arm926ejs/orion5x/dram.c |    2 +-
 common/memsize.c                      |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

Comments

Wolfgang Denk April 25, 2011, 9:38 p.m. UTC | #1
Dear rogan@dawes.za.net,

In message <1300435500-4909-8-git-send-email-rogan@dawes.za.net> you wrote:
> From: rogan@dawes.za.net <rogan@dawes.za.net>
> 
> This allows us to match the exact behaviour of the vendor U-boot in the kernel boot logs

Please note that the behaviour of some out of tree port is not exactly
a criterion for how U-Boot should behave.

Could you please describe what exactly you consider wrong witrh the
current implementation?

> --- a/common/memsize.c
> +++ b/common/memsize.c
> @@ -46,6 +46,9 @@ long get_ram_size(volatile long *base, long maxsize)
>  	long           size;
>  	int            i = 0;
>  
> +	if (base == -1)
> +		return 0;
> +

You should never call get_ram_size() with invalid parameters in the
first place.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/orion5x/dram.c b/arch/arm/cpu/arm926ejs/orion5x/dram.c
index 90b0a9c..e677ce4 100644
--- a/arch/arm/cpu/arm926ejs/orion5x/dram.c
+++ b/arch/arm/cpu/arm926ejs/orion5x/dram.c
@@ -44,7 +44,7 @@  u32 orion5x_sdram_bar(enum memory_bank bank)
 	u32 enable = 0x01 & winregs[bank].size;
 
 	if ((!enable) || (bank > BANK3))
-		return 0;
+		return -1;
 
 	result = winregs[bank].base;
 	return result;
diff --git a/common/memsize.c b/common/memsize.c
index 6c275c9..85eca54 100644
--- a/common/memsize.c
+++ b/common/memsize.c
@@ -46,6 +46,9 @@  long get_ram_size(volatile long *base, long maxsize)
 	long           size;
 	int            i = 0;
 
+	if (base == -1)
+		return 0;
+
 	for (cnt = (maxsize / sizeof (long)) >> 1; cnt > 0; cnt >>= 1) {
 		addr = base + cnt;	/* pointer arith! */
 		sync ();