Patchwork [U-Boot,v2,2/2] km_arm: enable SDRAM window size fixup

login
register
mail settings
Submitter Gerlando Falauto
Date July 6, 2012, 11:50 a.m.
Message ID <1341575417-7719-2-git-send-email-gerlando.falauto@keymile.com>
Download mbox | patch
Permalink /patch/169460/
State Changes Requested
Delegated to: Prafulla Wadaskar
Headers show

Comments

Gerlando Falauto - July 6, 2012, 11:50 a.m.
Size of the SDRAM chips might differ between any two (otherwise
identical) instances of the same board.

So change board_early_init_f() to use km_sdram_bs_set(), in order to
fixup the window size register at runtime, according to the detected
SDRAM size.

Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Cc: Valentin Longchamp <valentin.longchamp@keymile.com>
Cc: Holger Brunck <holger.brunck@keymile.com>
---
changes for v2:
- rebase to current u-boot-marvell.git master branch

 board/keymile/km_arm/km_arm.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Prafulla Wadaskar - July 20, 2012, 6:30 a.m.
> -----Original Message-----
> From: u-boot-bounces@lists.denx.de [mailto:u-boot-
> bounces@lists.denx.de] On Behalf Of Gerlando Falauto
> Sent: 06 July 2012 17:20
> To: u-boot@lists.denx.de
> Cc: Valentin Longchamp; Holger Brunck; Gerlando Falauto
> Subject: [U-Boot] [PATCH v2 2/2] km_arm: enable SDRAM window size
> fixup
> 
> Size of the SDRAM chips might differ between any two (otherwise
> identical) instances of the same board.
> 
> So change board_early_init_f() to use km_sdram_bs_set(), in order to
> fixup the window size register at runtime, according to the detected
> SDRAM size.
> 
> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> Cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> Cc: Holger Brunck <holger.brunck@keymile.com>
> ---
> changes for v2:
> - rebase to current u-boot-marvell.git master branch
> 
>  board/keymile/km_arm/km_arm.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/board/keymile/km_arm/km_arm.c
> b/board/keymile/km_arm/km_arm.c
> index 2b2ca39..24cf6c7 100644
> --- a/board/keymile/km_arm/km_arm.c
> +++ b/board/keymile/km_arm/km_arm.c
> @@ -241,6 +241,17 @@ int misc_init_r(void)
>  	return 0;
>  }
> 
> +static void dram_size_fixup(void)

The name "fixup" doesn't sound good.

> +{
> +	u32 size;
> +
> +	/* probe currently equipped RAM size */
> +	size = get_ram_size((void *)kw_sdram_bar(0), kw_sdram_bs(0));
> +
> +	/* fixup SDRAM window size accordingly */
> +	kw_sdram_bs_set(0, size);
> +}
> +

This is useful API for other boards too.
I would like to suggest to add this change in dram_init(), the window size can be corrected right after sdram size detection. And that will be applicable for all supported bank.

So may you please push in to dram.c?

Regards...
Prafulla . . .

Patch

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 2b2ca39..24cf6c7 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -241,6 +241,17 @@  int misc_init_r(void)
 	return 0;
 }
 
+static void dram_size_fixup(void)
+{
+	u32 size;
+
+	/* probe currently equipped RAM size */
+	size = get_ram_size((void *)kw_sdram_bar(0), kw_sdram_bs(0));
+
+	/* fixup SDRAM window size accordingly */
+	kw_sdram_bs_set(0, size);
+}
+
 int board_early_init_f(void)
 {
 #if defined(CONFIG_SOFT_I2C)
@@ -251,6 +262,7 @@  int board_early_init_f(void)
 	writel(tmp & (~KM_KIRKWOOD_SOFT_I2C_GPIOS) , KW_GPIO0_BASE + 4);
 #endif
 
+	dram_size_fixup();
 	kirkwood_mpp_conf(kwmpp_config, NULL);
 	return 0;
 }