diff mbox

[U-Boot,2/3] KW: Add kw_adjust_dram() weak function

Message ID 1340712914-3193-2-git-send-email-marex@denx.de
State Superseded
Delegated to: Marek Vasut
Headers show

Commit Message

Marek Vasut June 26, 2012, 12:15 p.m. UTC
This function shall allow a board to adjust DRAM parameters in case
there are multiple versions of the board with different DRAM sizes.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Cc: Wolfgang Denk <wd@denx.de>
---
 arch/arm/cpu/arm926ejs/kirkwood/dram.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Prafulla Wadaskar June 26, 2012, 12:33 p.m. UTC | #1
> -----Original Message-----
> From: Marek Vasut [mailto:marex@denx.de]
> Sent: 26 June 2012 17:45
> To: u-boot@lists.denx.de
> Cc: Marek Vasut; Prafulla Wadaskar; Wolfgang Denk
> Subject: [PATCH 2/3] KW: Add kw_adjust_dram() weak function
> 
> This function shall allow a board to adjust DRAM parameters in case
> there are multiple versions of the board with different DRAM sizes.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Prafulla Wadaskar <prafulla@marvell.com>
> Cc: Wolfgang Denk <wd@denx.de>
> ---
>  arch/arm/cpu/arm926ejs/kirkwood/dram.c |   11 +++++++++++

Instead I would like to suggest to add function name as __kw_post_kwbconfig()

This typically addresses to reconfigure the default configuration done by kwbimage.cfg, so the scope is not limited to DRAM configuration.

Regards..
Prafulla . . .
Marek Vasut June 26, 2012, 12:47 p.m. UTC | #2
Dear Prafulla Wadaskar,

> > -----Original Message-----
> > From: Marek Vasut [mailto:marex@denx.de]
> > Sent: 26 June 2012 17:45
> > To: u-boot@lists.denx.de
> > Cc: Marek Vasut; Prafulla Wadaskar; Wolfgang Denk
> > Subject: [PATCH 2/3] KW: Add kw_adjust_dram() weak function
> > 
> > This function shall allow a board to adjust DRAM parameters in case
> > there are multiple versions of the board with different DRAM sizes.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Prafulla Wadaskar <prafulla@marvell.com>
> > Cc: Wolfgang Denk <wd@denx.de>
> > ---
> > 
> >  arch/arm/cpu/arm926ejs/kirkwood/dram.c |   11 +++++++++++
> 
> Instead I would like to suggest to add function name as
> __kw_post_kwbconfig()

what about using board_early_init_f() ?

> This typically addresses to reconfigure the default configuration done by
> kwbimage.cfg, so the scope is not limited to DRAM configuration.
> 
> Regards..
> Prafulla . . .

Best regards,
Marek Vasut
Prafulla Wadaskar June 26, 2012, 1:19 p.m. UTC | #3
> -----Original Message-----
> From: Marek Vasut [mailto:marex@denx.de]
> Sent: 26 June 2012 18:18
> To: Prafulla Wadaskar
> Cc: u-boot@lists.denx.de; Wolfgang Denk
> Subject: Re: [PATCH 2/3] KW: Add kw_adjust_dram() weak function
> 
> Dear Prafulla Wadaskar,
> 
> > > -----Original Message-----
> > > From: Marek Vasut [mailto:marex@denx.de]
> > > Sent: 26 June 2012 17:45
> > > To: u-boot@lists.denx.de
> > > Cc: Marek Vasut; Prafulla Wadaskar; Wolfgang Denk
> > > Subject: [PATCH 2/3] KW: Add kw_adjust_dram() weak function
> > >
> > > This function shall allow a board to adjust DRAM parameters in
> case
> > > there are multiple versions of the board with different DRAM
> sizes.
> > >
> > > Signed-off-by: Marek Vasut <marex@denx.de>
> > > Cc: Prafulla Wadaskar <prafulla@marvell.com>
> > > Cc: Wolfgang Denk <wd@denx.de>
> > > ---
> > >
> > >  arch/arm/cpu/arm926ejs/kirkwood/dram.c |   11 +++++++++++
> >
> > Instead I would like to suggest to add function name as
> > __kw_post_kwbconfig()
> 
> what about using board_early_init_f() ?

I think that sound good.
In that case you don't need to create any new function.

Regards..
Prafulla . . .
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
index ccb6b03..cdf0d21 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
@@ -60,6 +60,15 @@  u32 kw_sdram_bs(enum memory_bank bank)
 	return result;
 }
 
+/*
+ * kw_adjust_sdram - allow post init adjustment of DRAM size
+ */
+void __kw_adjust_dram(void)
+{
+}
+
+void kw_adjust_dram(void) __attribute__((weak, alias("__kw_adjust_dram")));
+
 #ifndef CONFIG_SYS_BOARD_DRAM_INIT
 int dram_init(void)
 {
@@ -91,6 +100,8 @@  int dram_init(void)
 		gd->bd->bi_dram[i].size = 0;
 	}
 
+	kw_adjust_dram();
+
 	return 0;
 }