All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] kirkwood: added common config file mv-config.h
  2010-09-30 17:53 ` [U-Boot] [PATCH] kirkwood: added common config file mv-config.h Prafulla Wadaskar
@ 2010-09-30 13:54   ` Rogan Dawes
  2010-09-30 14:33     ` Prafulla Wadaskar
  2010-09-30 17:54   ` [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support Prafulla Wadaskar
  1 sibling, 1 reply; 26+ messages in thread
From: Rogan Dawes @ 2010-09-30 13:54 UTC (permalink / raw)
  To: u-boot

On 2010/09/30 7:53 PM, Prafulla Wadaskar wrote:

> diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h

> @@ -0,0 +1,230 @@
> +#ifndef _MV_COMMON_H
> +#define _MV_COMMON_H
> +
> +/*
> + * High Level Configuration Options (easy to change)
> + */
> +#define CONFIG_MARVELL		1
> +#define CONFIG_ARM926EJS	1	/* Basic Architecture */
> +
> +#if defined(CONFIG_KIRKWOOD)
> +#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 support */

krikwood?

> +#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
> +#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII Pad voltage to 1.8V */
> +#define CONFIG_KIRKWOOD_PCIE_INIT       /* Enable PCIE Port0 for kernel */
> +
> +#define CONFIG_I2C_MVTWSI_BASE	KW_TWSI_BASE

> +#define MV_UART0_BASE		KW_UART0_BASE
> +#define MV_UART0_BASE		KW_UART0_BASE

dup?

> +/*
> + * IDe Support on SATA port0
> + */

IDe?

Rogan

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] kirkwood: added common config file mv-config.h
  2010-09-30 13:54   ` Rogan Dawes
@ 2010-09-30 14:33     ` Prafulla Wadaskar
  2010-09-30 15:26       ` Rogan Dawes
  2010-09-30 15:35       ` Albert ARIBAUD
  0 siblings, 2 replies; 26+ messages in thread
From: Prafulla Wadaskar @ 2010-09-30 14:33 UTC (permalink / raw)
  To: u-boot

 

> -----Original Message-----
> From: Rogan Dawes [mailto:rogan.dawes at gmail.com] On Behalf Of 
> Rogan Dawes
> Sent: Thursday, September 30, 2010 7:24 PM
> To: Prafulla Wadaskar
> Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
> Subject: Re: [U-Boot] [PATCH] kirkwood: added common config 
> file mv-config.h
> 
> On 2010/09/30 7:53 PM, Prafulla Wadaskar wrote:
> 
> > diff --git a/include/configs/mv-common.h 
> b/include/configs/mv-common.h
> 
> > @@ -0,0 +1,230 @@
> > +#ifndef _MV_COMMON_H
> > +#define _MV_COMMON_H
> > +
> > +/*
> > + * High Level Configuration Options (easy to change)
> > + */
> > +#define CONFIG_MARVELL		1
> > +#define CONFIG_ARM926EJS	1	/* Basic Architecture */
> > +
> > +#if defined(CONFIG_KIRKWOOD)
> > +#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 
> support */
> 
> krikwood?

Thanks I will correct this.

> 
> > +#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 
> for kernel */
> > +#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII 
> Pad voltage to 1.8V */
> > +#define CONFIG_KIRKWOOD_PCIE_INIT       /* Enable PCIE 
> Port0 for kernel */
> > +
> > +#define CONFIG_I2C_MVTWSI_BASE	KW_TWSI_BASE
> 
> > +#define MV_UART0_BASE		KW_UART0_BASE
> > +#define MV_UART0_BASE		KW_UART0_BASE
> 
> dup?

!! I will remove this additional line

> 
> > +/*
> > + * IDe Support on SATA port0
> > + */
> 
> IDe?

I think Ide can be removed, right?

Regards..
Prafulla . .

> 
> Rogan
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] kirkwood: added common config file mv-config.h
  2010-09-30 14:33     ` Prafulla Wadaskar
@ 2010-09-30 15:26       ` Rogan Dawes
  2010-09-30 15:35       ` Albert ARIBAUD
  1 sibling, 0 replies; 26+ messages in thread
From: Rogan Dawes @ 2010-09-30 15:26 UTC (permalink / raw)
  To: u-boot

On 2010/09/30 4:33 PM, Prafulla Wadaskar wrote:

>>> +/*
>>> + * IDe Support on SATA port0
>>> + */
>>
>> IDe?
> 
> I think Ide can be removed, right?

I was just commenting on the (mis-)capitalisation.

Rogan

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] kirkwood: added common config file mv-config.h
  2010-09-30 14:33     ` Prafulla Wadaskar
  2010-09-30 15:26       ` Rogan Dawes
@ 2010-09-30 15:35       ` Albert ARIBAUD
  2010-10-01  6:10         ` Prafulla Wadaskar
  1 sibling, 1 reply; 26+ messages in thread
From: Albert ARIBAUD @ 2010-09-30 15:35 UTC (permalink / raw)
  To: u-boot

Le 30/09/2010 16:33, Prafulla Wadaskar a ?crit :

>>> +/*
>>> + * IDe Support on SATA port0
>>> + */
>>
>> IDe?
>
> I think Ide can be removed, right?

Do none of the boards have disks? At least openrd-base should have IDE 
(and openrd-client as well if the patch to introduced it is finally merged).

So IDE should stay IMO, but the IDE stuff should be split into 
board-specifics (basically the defines for the IDE0 and, if it exists, 
IDE1 base addresses) and SoC-specifics (basically everything else, i.e. 
all that is required for cmd_ide.c to compile).

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
  2010-09-30 17:53 [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c Prafulla Wadaskar
@ 2010-09-30 15:39 ` Heiko Schocher
  2010-10-01  5:59   ` Prafulla Wadaskar
  2010-09-30 17:29 ` Wolfgang Denk
  2010-09-30 17:53 ` [U-Boot] [PATCH] kirkwood: added common config file mv-config.h Prafulla Wadaskar
  2 siblings, 1 reply; 26+ messages in thread
From: Heiko Schocher @ 2010-09-30 15:39 UTC (permalink / raw)
  To: u-boot

Hello Prafulla,

Prafulla Wadaskar wrote:
> For all Kirkwood boards so far dram_init function is duplicated
> dram_init function is moved to dram.c and relevant code from all
> board specific files removed
> 
> If any board needs specific dram init handling than standard one,
> then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in
> board config header file and the dram_init function can be put
> in board specific source file
> For ex. keymile boards
> 
> Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
> ---
>  arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22 ++++++++++++++++++++++
>  board/Marvell/guruplug/guruplug.c               |   11 -----------
>  board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 -----------
>  board/Marvell/openrd_base/openrd_base.c         |   11 -----------
>  board/Marvell/rd6281a/rd6281a.c                 |   11 -----------
>  board/Marvell/sheevaplug/sheevaplug.c           |   11 -----------
>  include/configs/keymile-common.h                |    1 +
>  7 files changed, 23 insertions(+), 55 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> index 8f2a18a..d929d7a 100644
> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> @@ -23,8 +23,11 @@
>   */
>  
>  #include <config.h>
> +#include <common.h>
>  #include <asm/arch/kirkwood.h>
>  
> +DECLARE_GLOBAL_DATA_PTR;
> +
>  #define KW_REG_CPUCS_WIN_BAR(x)		(KW_REGISTER(0x1500) + (x * 0x08))
>  #define KW_REG_CPUCS_WIN_SZ(x)		(KW_REGISTER(0x1504) + (x * 0x08))
>  /*
> @@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
>  	result += 0x01000000;
>  	return result;
>  }
> +
> +#ifndef CONFIG_SYS_BOARD_DRAM_INIT
> +int dram_init(void)
> +{
> +	int i;
> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> +	gd->ram_size = 0;
> +#endif
> +	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
> +		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
> +		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> +		gd->ram_size += gd->bd->bi_dram[i].size;

This is only OK, if the memory banks are consecutive without
gaps ... is this true for all boards?

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support
  2010-09-30 17:54   ` [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support Prafulla Wadaskar
@ 2010-09-30 15:40     ` Heiko Schocher
  2010-09-30 16:21       ` Albert ARIBAUD
                         ` (2 more replies)
  2010-09-30 17:34     ` Wolfgang Denk
  1 sibling, 3 replies; 26+ messages in thread
From: Heiko Schocher @ 2010-09-30 15:40 UTC (permalink / raw)
  To: u-boot

Hello Prafulla,

Prafulla Wadaskar wrote:
> All Kirkwood based boards are supported for this new implementation
> ref: dovs/README.arm-relocation

should be docs/README.arm-relocation

> Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
> ---
>  include/configs/mv-common.h |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h
> index ca9f33b..b80ad00 100644
> --- a/include/configs/mv-common.h
> +++ b/include/configs/mv-common.h
> @@ -56,6 +56,12 @@
>  #error "Unsupported SoC"
>  #endif
>  
> +/* additions for new ARM relocation support */
> +#undef CONFIG_RELOC_FIXUP_WORKS

Should not be necessary.

> +#define CONFIG_SYS_SDRAM_BASE		0x00000000
> +#define CONFIG_SYS_INIT_SP_ADDR		(0x00000000 + 0x1000 - \
> +					CONFIG_SYS_GBL_DATA_SIZE)

I setup the initial stack in the SDRAM, because I didn;t know,
if there is on this cpu family a better place for the initial stack.
(Some cpu internal ram?)

Do you know, if we have something like this on this cpu family?

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support
  2010-09-30 15:40     ` Heiko Schocher
@ 2010-09-30 16:21       ` Albert ARIBAUD
  2010-09-30 17:50         ` Wolfgang Denk
  2010-09-30 17:49       ` Wolfgang Denk
  2010-10-01  7:21       ` Prafulla Wadaskar
  2 siblings, 1 reply; 26+ messages in thread
From: Albert ARIBAUD @ 2010-09-30 16:21 UTC (permalink / raw)
  To: u-boot

Le 30/09/2010 17:40, Heiko Schocher a ?crit :
> Hello Prafulla,
>
> Prafulla Wadaskar wrote:
>> All Kirkwood based boards are supported for this new implementation
>> ref: dovs/README.arm-relocation
>
> should be docs/README.arm-relocation
>
>> Signed-off-by: Prafulla Wadaskar<prafulla@marvell.com>
>> ---
>>   include/configs/mv-common.h |    6 ++++++
>>   1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h
>> index ca9f33b..b80ad00 100644
>> --- a/include/configs/mv-common.h
>> +++ b/include/configs/mv-common.h
>> @@ -56,6 +56,12 @@
>>   #error "Unsupported SoC"
>>   #endif
>>
>> +/* additions for new ARM relocation support */
>> +#undef CONFIG_RELOC_FIXUP_WORKS
>
> Should not be necessary.
>
>> +#define CONFIG_SYS_SDRAM_BASE		0x00000000
>> +#define CONFIG_SYS_INIT_SP_ADDR		(0x00000000 + 0x1000 - \
>> +					CONFIG_SYS_GBL_DATA_SIZE)
>
> I setup the initial stack in the SDRAM, because I didn;t know,
> if there is on this cpu family a better place for the initial stack.
> (Some cpu internal ram?)
>
> Do you know, if we have something like this on this cpu family?
>
> bye,
> Heiko

Kirkwood has no internal RAM.

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
  2010-09-30 17:53 [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c Prafulla Wadaskar
  2010-09-30 15:39 ` Heiko Schocher
@ 2010-09-30 17:29 ` Wolfgang Denk
  2010-10-01  7:23   ` Prafulla Wadaskar
  2010-09-30 17:53 ` [U-Boot] [PATCH] kirkwood: added common config file mv-config.h Prafulla Wadaskar
  2 siblings, 1 reply; 26+ messages in thread
From: Wolfgang Denk @ 2010-09-30 17:29 UTC (permalink / raw)
  To: u-boot

Dear Prafulla Wadaskar,

In message <1285869240-17251-1-git-send-email-prafulla@marvell.com> you wrote:
> For all Kirkwood boards so far dram_init function is duplicated
> dram_init function is moved to dram.c and relevant code from all
> board specific files removed
> 
> If any board needs specific dram init handling than standard one,
> then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in
> board config header file and the dram_init function can be put
> in board specific source file
> For ex. keymile boards

Thanks, I really appreciate this patch, but I have a minor request for
change:

> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> +	gd->ram_size = 0;
> +#endif
> +	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
> +		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
> +		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> +		gd->ram_size += gd->bd->bi_dram[i].size;
> +#endif

When you touch this board now and make it work with
CONFIG_SYS_ARM_WITHOUT_RELOC not defined, we should also drop all
references to CONFIG_SYS_ARM_WITHOUT_RELOC from the code to make it
obvious that this board has been adapted.

Thanks.

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 at denx.de
Anyone who doesn't believe in miracles is not a realist.
                                                   - David Ben Gurion

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support
  2010-09-30 17:54   ` [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support Prafulla Wadaskar
  2010-09-30 15:40     ` Heiko Schocher
@ 2010-09-30 17:34     ` Wolfgang Denk
  1 sibling, 0 replies; 26+ messages in thread
From: Wolfgang Denk @ 2010-09-30 17:34 UTC (permalink / raw)
  To: u-boot

Dear Prafulla Wadaskar,

In message <1285869240-17251-3-git-send-email-prafulla@marvell.com> you wrote:
> All Kirkwood based boards are supported for this new implementation
> ref: dovs/README.arm-relocation
> 
> Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
> ---
>  include/configs/mv-common.h |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h
> index ca9f33b..b80ad00 100644
> --- a/include/configs/mv-common.h
> +++ b/include/configs/mv-common.h
> @@ -56,6 +56,12 @@
>  #error "Unsupported SoC"
>  #endif
>  
> +/* additions for new ARM relocation support */
> +#undef CONFIG_RELOC_FIXUP_WORKS

Is this really needed?  As far as I can see CONFIG_RELOC_FIXUP_WORKS
is not defined anywhere in any ARM related fiole, so there shouldbe no
need to undef it.

> +#define CONFIG_SYS_SDRAM_BASE		0x00000000
> +#define CONFIG_SYS_INIT_SP_ADDR		(0x00000000 + 0x1000 - \
> +					CONFIG_SYS_GBL_DATA_SIZE)

This is wrong. You must not use RAM for the initial stack, or it
cannot be initialized / tested as it should be.  If you hav eno static
RAM or other on-chip memory that could be used, you might try and lock
(some part of) the data cache and use this as storage for the initial
global data and stack.

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 at denx.de
He is truly wise who gains wisdom from another's mishap.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support
  2010-09-30 15:40     ` Heiko Schocher
  2010-09-30 16:21       ` Albert ARIBAUD
@ 2010-09-30 17:49       ` Wolfgang Denk
  2010-09-30 22:06         ` Marek Vasut
  2010-10-01  7:21       ` Prafulla Wadaskar
  2 siblings, 1 reply; 26+ messages in thread
From: Wolfgang Denk @ 2010-09-30 17:49 UTC (permalink / raw)
  To: u-boot

Dear Heiko Schocher,

In message <4CA4AF81.4000105@denx.de> you wrote:
> 
> I setup the initial stack in the SDRAM, because I didn;t know,
> if there is on this cpu family a better place for the initial stack.
> (Some cpu internal ram?)

As mentioned before: if ther eios no SRAM or other on-chip memory, we
can lock the data cache, or parts of it.  This has been done on other
boards before.

I think Marek has patches in his queue that implement this for PXA, so
maybe these may be interesting for other ARM families as well.

Marek, maybe you can post your stuff, even if preliminary?  Thanks.

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 at denx.de
"The  release  of  emotion  is  what  keeps  us  health.  Emotionally
healthy."
"That may be, Doctor. However, I have noted that the healthy  release
of emotion is frequently unhealthy for those closest to you."
	-- McCoy and Spock, "Plato's Stepchildren", stardate 5784.3

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support
  2010-09-30 16:21       ` Albert ARIBAUD
@ 2010-09-30 17:50         ` Wolfgang Denk
  0 siblings, 0 replies; 26+ messages in thread
From: Wolfgang Denk @ 2010-09-30 17:50 UTC (permalink / raw)
  To: u-boot

Dear Albert ARIBAUD,

In message <4CA4B922.1040008@free.fr> you wrote:
>
> Kirkwood has no internal RAM.

But Data Cache, which is nothing else but fast RAM :-)

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 at denx.de
e-credibility: the non-guaranteeable likelihood that  the  electronic
data you're seeing is genuine rather than somebody's made-up crap.
- Karl Lehenbauer

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
@ 2010-09-30 17:53 Prafulla Wadaskar
  2010-09-30 15:39 ` Heiko Schocher
                   ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Prafulla Wadaskar @ 2010-09-30 17:53 UTC (permalink / raw)
  To: u-boot

For all Kirkwood boards so far dram_init function is duplicated
dram_init function is moved to dram.c and relevant code from all
board specific files removed

If any board needs specific dram init handling than standard one,
then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in
board config header file and the dram_init function can be put
in board specific source file
For ex. keymile boards

Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
---
 arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22 ++++++++++++++++++++++
 board/Marvell/guruplug/guruplug.c               |   11 -----------
 board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 -----------
 board/Marvell/openrd_base/openrd_base.c         |   11 -----------
 board/Marvell/rd6281a/rd6281a.c                 |   11 -----------
 board/Marvell/sheevaplug/sheevaplug.c           |   11 -----------
 include/configs/keymile-common.h                |    1 +
 7 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
index 8f2a18a..d929d7a 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
@@ -23,8 +23,11 @@
  */
 
 #include <config.h>
+#include <common.h>
 #include <asm/arch/kirkwood.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define KW_REG_CPUCS_WIN_BAR(x)		(KW_REGISTER(0x1500) + (x * 0x08))
 #define KW_REG_CPUCS_WIN_SZ(x)		(KW_REGISTER(0x1504) + (x * 0x08))
 /*
@@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
 	result += 0x01000000;
 	return result;
 }
+
+#ifndef CONFIG_SYS_BOARD_DRAM_INIT
+int dram_init(void)
+{
+	int i;
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+	gd->ram_size = 0;
+#endif
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
+		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+		gd->ram_size += gd->bd->bi_dram[i].size;
+#endif
+	}
+	return 0;
+}
+#endif /* CONFIG_SYS_KWDRAM_INIT */
+
diff --git a/board/Marvell/guruplug/guruplug.c b/board/Marvell/guruplug/guruplug.c
index c028a53..4df4e9b 100644
--- a/board/Marvell/guruplug/guruplug.c
+++ b/board/Marvell/guruplug/guruplug.c
@@ -108,17 +108,6 @@ int board_init(void)
 	return 0;
 }
 
-int dram_init(void)
-{
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
-	}
-	return 0;
-}
-
 #ifdef CONFIG_RESET_PHY_R
 void mv_phy_88e1121_init(char *name)
 {
diff --git a/board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c b/board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c
index c959bf8..93d1400 100644
--- a/board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c
+++ b/board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c
@@ -110,17 +110,6 @@ int board_init(void)
 	return 0;
 }
 
-int dram_init(void)
-{
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
-	}
-	return 0;
-}
-
 #ifdef CONFIG_MV88E61XX_SWITCH
 void reset_phy(void)
 {
diff --git a/board/Marvell/openrd_base/openrd_base.c b/board/Marvell/openrd_base/openrd_base.c
index c00a08a..d006b2d 100644
--- a/board/Marvell/openrd_base/openrd_base.c
+++ b/board/Marvell/openrd_base/openrd_base.c
@@ -113,17 +113,6 @@ int board_init(void)
 	return 0;
 }
 
-int dram_init(void)
-{
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
-	}
-	return 0;
-}
-
 #ifdef CONFIG_RESET_PHY_R
 /* Configure and enable MV88E1116 PHY */
 void reset_phy(void)
diff --git a/board/Marvell/rd6281a/rd6281a.c b/board/Marvell/rd6281a/rd6281a.c
index 8713a3c..0d76146 100644
--- a/board/Marvell/rd6281a/rd6281a.c
+++ b/board/Marvell/rd6281a/rd6281a.c
@@ -109,17 +109,6 @@ int board_init(void)
 	return 0;
 }
 
-int dram_init(void)
-{
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
-	}
-	return 0;
-}
-
 void mv_phy_88e1116_init(char *name)
 {
 	u16 reg;
diff --git a/board/Marvell/sheevaplug/sheevaplug.c b/board/Marvell/sheevaplug/sheevaplug.c
index 547126a..173a7b8 100644
--- a/board/Marvell/sheevaplug/sheevaplug.c
+++ b/board/Marvell/sheevaplug/sheevaplug.c
@@ -108,17 +108,6 @@ int board_init(void)
 	return 0;
 }
 
-int dram_init(void)
-{
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
-	}
-	return 0;
-}
-
 #ifdef CONFIG_RESET_PHY_R
 /* Configure and enable MV88E1116 PHY */
 void reset_phy(void)
diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h
index 6c14ca0..62d21f6 100644
--- a/include/configs/keymile-common.h
+++ b/include/configs/keymile-common.h
@@ -85,6 +85,7 @@
 
 #define CONFIG_LOADS_ECHO	1	/* echo on for serial download */
 #define CONFIG_SYS_LOADS_BAUD_CHANGE	1	/* allow baudrate change */
+#define CONFIG_SYS_BOARD_DRAM_INIT	/* Used board specific dram_init */
 
 /*
  * How to get access to the slot ID.  Put this here to make it easy
-- 
1.5.3.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] kirkwood: added common config file mv-config.h
  2010-09-30 17:53 [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c Prafulla Wadaskar
  2010-09-30 15:39 ` Heiko Schocher
  2010-09-30 17:29 ` Wolfgang Denk
@ 2010-09-30 17:53 ` Prafulla Wadaskar
  2010-09-30 13:54   ` Rogan Dawes
  2010-09-30 17:54   ` [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support Prafulla Wadaskar
  2 siblings, 2 replies; 26+ messages in thread
From: Prafulla Wadaskar @ 2010-09-30 17:53 UTC (permalink / raw)
  To: u-boot

It is observed that, in most of the board configs the code is being
duplicated, also for any common change all board files needs update
This issue was under discussion from long on mailing list and we
converge on introducing common config file.

With this patch-
1. Total Kirkwood specific configuration code is reduced by 210 lines
2. All common configuration can be shared by multiple boards
3. Easy to manage common updates like ARM relocation changes

mv-config.h file is added to include/configs/
It contains all common configuration supported for all Kirkwood boards
The respective board configs are updated for its usage

Build tested for guruplug, mv88f6281gtw_ge, openrd_base,
rd6281a and sheevaplug
Binary execution tested for sheevaplug

Todo:
1. Other custom Kirkwood boards to be synced
2. After ARM relocation patches mvgbe driver is broken for network
activity (need to be addressed)
3. The support to be extended for Orion5X based boards

Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
---
 include/configs/guruplug.h        |  102 +----------------
 include/configs/mv-common.h       |  230 +++++++++++++++++++++++++++++++++++++
 include/configs/mv88f6281gtw_ge.h |  120 ++-----------------
 include/configs/openrd_base.h     |  144 +-----------------------
 include/configs/rd6281a.h         |   98 +---------------
 include/configs/sheevaplug.h      |  104 +----------------
 6 files changed, 255 insertions(+), 543 deletions(-)
 create mode 100644 include/configs/mv-common.h

diff --git a/include/configs/guruplug.h b/include/configs/guruplug.h
index eb3fa57..c2a5370 100644
--- a/include/configs/guruplug.h
+++ b/include/configs/guruplug.h
@@ -33,58 +33,12 @@
 /*
  * High Level Configuration Options (easy to change)
  */
-#define CONFIG_MARVELL		1
-#define CONFIG_ARM926EJS	1	/* Basic Architecture */
 #define CONFIG_SHEEVA_88SV131	1	/* CPU Core subversion */
 #define CONFIG_KIRKWOOD		1	/* SOC Family Name */
 #define CONFIG_KW88F6281	1	/* SOC Name */
 #define CONFIG_MACH_GURUPLUG	/* Machine type */
-
-#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 support */
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
-#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
-#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII Pad voltage to 1.8V */
-
-/*
- * CLKs configurations
- */
-#define CONFIG_SYS_HZ		1000
-
-/*
- * NS16550 Configuration
- */
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-#define CONFIG_SYS_NS16550_CLK		CONFIG_SYS_TCLK
-#define CONFIG_SYS_NS16550_COM1		KW_UART0_BASE
-
-/*
- * Serial Port configuration
- * The following definitions let you select what serial you want to use
- * for your console driver.
- */
-
-#define CONFIG_CONS_INDEX	1	/*Console on UART0 */
-#define CONFIG_BAUDRATE			115200
-#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, \
-					  115200,230400, 460800, 921600 }
-/* auto boot */
-#define CONFIG_BOOTDELAY	3	/* default enable autoboot */
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs  */
-#define CONFIG_INITRD_TAG	1	/* enable INITRD tag */
-#define CONFIG_SETUP_MEMORY_TAGS 1	/* enable memory tag */
 
-#define	CONFIG_SYS_PROMPT	"Marvell>> "	/* Command Prompt */
-#define	CONFIG_SYS_CBSIZE	1024	/* Console I/O Buff Size */
-#define	CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE \
-		+sizeof(CONFIG_SYS_PROMPT) + 16)	/* Print Buff */
 /*
  * Commands configuration
  */
@@ -96,18 +50,11 @@
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_USB
-
 /*
- * NAND configuration
+ * mv-common.h should be defined after CMD configs since it used them
+ * to enable certain macros
  */
-#ifdef CONFIG_CMD_NAND
-#define CONFIG_NAND_KIRKWOOD
-#define CONFIG_SYS_MAX_NAND_DEVICE	1
-#define NAND_MAX_CHIPS			1
-#define CONFIG_SYS_NAND_BASE		0xD8000000	/* KW_DEFADR_NANDF */
-#define NAND_ALLOW_ERASE_ALL		1
-#define CONFIG_SYS_64BIT_VSPRINTF	/* needed for nand_util.c */
-#endif
+#include "mv-common.h"
 
 /*
  *  Environment variables configurations
@@ -143,56 +90,13 @@
 	"x_bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0"
 
 /*
- * Size of malloc() pool
- */
-#define CONFIG_SYS_MALLOC_LEN	(1024 * 128) /* 128kB for malloc() */
-/* size in bytes reserved for initial data */
-#define CONFIG_SYS_GBL_DATA_SIZE	128
-
-/*
- * Other required configurations
- */
-#define CONFIG_CONSOLE_INFO_QUIET	/* some code reduction */
-#define CONFIG_ARCH_CPU_INIT	/* call arch_cpu_init() */
-#define CONFIG_ARCH_MISC_INIT	/* call arch_misc_init() */
-#define CONFIG_DISPLAY_CPUINFO	/* Display cpu info */
-#define CONFIG_NR_DRAM_BANKS	4
-#define CONFIG_STACKSIZE	0x00100000	/* regular stack- 1M */
-#define CONFIG_SYS_LOAD_ADDR	0x00800000	/* default load adr- 8M */
-#define CONFIG_SYS_MEMTEST_START 0x00800000	/* 8M */
-#define CONFIG_SYS_MEMTEST_END	0x1fffffff	/*(_512M -1) */
-#define CONFIG_SYS_RESET_ADDRESS 0xffff0000	/* Rst Vector Adr */
-#define CONFIG_SYS_MAXARGS	16	/* max number of command args */
-
-/*
  * Ethernet Driver configuration
  */
 #ifdef CONFIG_CMD_NET
-#define CONFIG_NETCONSOLE	/* include NetConsole support   */
-#define CONFIG_NET_MULTI	/* specify more that one ports available */
-#define CONFIG_MII		/* expose smi ove miiphy interface */
-#define CONFIG_CMD_MII
-#define CONFIG_MVGBE		/* Enable Marvell Gbe Controller Driver */
-#define CONFIG_SYS_FAULT_ECHO_LINK_DOWN	/* detect link using phy */
 #define CONFIG_MVGBE_PORTS	{1, 1}	/* enable both ports */
 #define CONFIG_PHY_BASE_ADR	0
-#define CONFIG_ENV_OVERWRITE	/* ethaddr can be reprogrammed */
-#define CONFIG_RESET_PHY_R	/* use reset_phy() to init mv88e1121 PHY */
 #endif /* CONFIG_CMD_NET */
 
-/*
- * USB/EHCI
- */
-#ifdef CONFIG_CMD_USB
-#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
-#define CONFIG_USB_EHCI_KIRKWOOD	/* on Kirkwood platform	*/
-#define CONFIG_EHCI_IS_TDI
-#define CONFIG_USB_STORAGE
-#define CONFIG_DOS_PARTITION
-#define CONFIG_ISO_PARTITION
-#define CONFIG_SUPPORT_VFAT
-#endif /* CONFIG_CMD_USB */
-
 #define CONFIG_SYS_ALT_MEMTEST
 
 #endif /* _CONFIG_GURUPLUG_H */
diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h
new file mode 100644
index 0000000..ca9f33b
--- /dev/null
+++ b/include/configs/mv-common.h
@@ -0,0 +1,230 @@
+/*
+ * (C) Copyright 2010
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+/*
+ * This file contains Marvell Board Specific common defincations.
+ * This file should be included in board config header file.
+ *
+ * It supports common definations for Kirkwood platform
+ * TBD: support for Orion5X platforms
+ */
+
+#ifndef _MV_COMMON_H
+#define _MV_COMMON_H
+
+/*
+ * High Level Configuration Options (easy to change)
+ */
+#define CONFIG_MARVELL		1
+#define CONFIG_ARM926EJS	1	/* Basic Architecture */
+
+#if defined(CONFIG_KIRKWOOD)
+#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 support */
+#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
+#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII Pad voltage to 1.8V */
+#define CONFIG_KIRKWOOD_PCIE_INIT       /* Enable PCIE Port0 for kernel */
+
+#define CONFIG_I2C_MVTWSI_BASE	KW_TWSI_BASE
+#define MV_UART0_BASE		KW_UART0_BASE
+#define MV_UART0_BASE		KW_UART0_BASE
+#define MV_SATA_BASE		KW_SATA_BASE
+#define MV_SATA_PORT0_OFFSET	KW_SATA_PORT0_OFFSET
+#define MV_SATA_PORT1_OFFSET	KW_SATA_PORT1_OFFSET
+
+#else
+#error "Unsupported SoC"
+#endif
+
+/*
+ * CLKs configurations
+ */
+#define CONFIG_SYS_HZ		1000
+
+/*
+ * NS16550 Configuration
+ */
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE	(-4)
+#define CONFIG_SYS_NS16550_CLK		CONFIG_SYS_TCLK
+#define CONFIG_SYS_NS16550_COM1		MV_UART0_BASE
+
+/*
+ * Serial Port configuration
+ * The following definitions let you select what serial you want to use
+ * for your console driver.
+ */
+
+#define CONFIG_CONS_INDEX	1	/*Console on UART0 */
+#define CONFIG_BAUDRATE			115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, \
+					  115200,230400, 460800, 921600 }
+/* auto boot */
+#define CONFIG_BOOTDELAY	3	/* default enable autoboot */
+
+/*
+ * For booting Linux, the board info and command line data
+ * have to be in the first 8 MB of memory, since this is
+ * the maximum mapped by the Linux kernel during initialization.
+ */
+#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs  */
+#define CONFIG_INITRD_TAG	1	/* enable INITRD tag */
+#define CONFIG_SETUP_MEMORY_TAGS 1	/* enable memory tag */
+
+#define	CONFIG_SYS_PROMPT	"Marvell>> "	/* Command Prompt */
+#define	CONFIG_SYS_CBSIZE	1024	/* Console I/O Buff Size */
+#define	CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE \
+		+sizeof(CONFIG_SYS_PROMPT) + 16)	/* Print Buff */
+
+/*
+ * NAND configuration
+ */
+#ifdef CONFIG_CMD_NAND
+#define CONFIG_NAND_KIRKWOOD
+#define CONFIG_SYS_MAX_NAND_DEVICE	1
+#define NAND_MAX_CHIPS			1
+#define CONFIG_SYS_NAND_BASE		0xD8000000	/* MV_DEFADR_NANDF */
+#define NAND_ALLOW_ERASE_ALL		1
+#define CONFIG_SYS_64BIT_VSPRINTF	/* needed for nand_util.c */
+#endif
+
+/*
+ * SPI Flash configuration
+ */
+#ifdef CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH		1
+#define CONFIG_HARD_SPI			1
+#define CONFIG_KIRKWOOD_SPI		1
+#define CONFIG_SPI_FLASH_MACRONIX	1
+#define CONFIG_ENV_SPI_BUS		0
+#define CONFIG_ENV_SPI_CS		0
+#define CONFIG_ENV_SPI_MAX_HZ		50000000	/*50Mhz */
+#endif
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN	(1024 * 1024) /* 1MiB for malloc() */
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE	128
+
+/*
+ * Other required minimal configurations
+ */
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_CONSOLE_INFO_QUIET	/* some code reduction */
+#define CONFIG_ARCH_CPU_INIT	/* call arch_cpu_init() */
+#define CONFIG_ARCH_MISC_INIT	/* call arch_misc_init() */
+#define CONFIG_DISPLAY_CPUINFO	/* Display cpu info */
+#define CONFIG_NR_DRAM_BANKS	4
+#define CONFIG_STACKSIZE	0x00100000	/* regular stack- 1M */
+#define CONFIG_SYS_LOAD_ADDR	0x00800000	/* default load adr- 8M */
+#define CONFIG_SYS_MEMTEST_START 0x00400000	/* 4M */
+#define CONFIG_SYS_MEMTEST_END	0x007fffff	/*(_8M -1) */
+#define CONFIG_SYS_RESET_ADDRESS 0xffff0000	/* Rst Vector Adr */
+#define CONFIG_SYS_MAXARGS	16	/* max number of command args */
+
+/*
+ * Ethernet Driver configuration
+ */
+#ifdef CONFIG_CMD_NET
+#define CONFIG_CMD_MII
+#define CONFIG_NETCONSOLE	/* include NetConsole support   */
+#define CONFIG_NET_MULTI	/* specify more that one ports available */
+#define	CONFIG_MII		/* expose smi ove miiphy interface */
+#define CONFIG_MVGBE		/* Enable Marvell Gbe Controller Driver */
+#define CONFIG_SYS_FAULT_ECHO_LINK_DOWN	/* detect link using phy */
+#define CONFIG_ENV_OVERWRITE	/* ethaddr can be reprogrammed */
+#define CONFIG_RESET_PHY_R	/* use reset_phy() to init mv8831116 PHY */
+#endif /* CONFIG_CMD_NET */
+
+/*
+ * USB/EHCI
+ */
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI		/* Enable EHCI USB support */
+#define CONFIG_USB_EHCI_KIRKWOOD
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define CONFIG_DOS_PARTITION
+#define CONFIG_ISO_PARTITION
+#define CONFIG_SUPPORT_VFAT
+#endif /* CONFIG_CMD_USB */
+
+/*
+ * IDe Support on SATA port0
+ */
+#ifdef CONFIG_CMD_IDE
+#define __io
+#define CONFIG_CMD_EXT2
+#define CONFIG_MVSATA_IDE
+#define CONFIG_IDE_PREINIT
+#define CONFIG_MVSATA_IDE_USE_PORT1
+/* Needs byte-swapping for ATA data register */
+#define CONFIG_IDE_SWAP_IO
+/* Data, registers and alternate blocks are at the same offset */
+#define CONFIG_SYS_ATA_DATA_OFFSET	(0x0100)
+#define CONFIG_SYS_ATA_REG_OFFSET	(0x0100)
+#define CONFIG_SYS_ATA_ALT_OFFSET	(0x0100)
+/* Each 8-bit ATA register is aligned to a 4-bytes address */
+#define CONFIG_SYS_ATA_STRIDE		4
+/* Controller supports 48-bits LBA addressing */
+#define CONFIG_LBA48
+/* CONFIG_CMD_IDE requires some #defines for ATA registers */
+#define CONFIG_SYS_IDE_MAXBUS		2
+#define CONFIG_SYS_IDE_MAXDEVICE	2
+/* ATA registers base is at SATA controller base */
+#define CONFIG_SYS_ATA_BASE_ADDR	MV_SATA_BASE
+/* ATA bus 0 is Kirkwood port 0 on openrd */
+#define CONFIG_SYS_ATA_IDE0_OFFSET	MV_SATA_PORT0_OFFSET
+/* ATA bus 1 is Kirkwood port 1 on openrd */
+#define CONFIG_SYS_ATA_IDE1_OFFSET	MV_SATA_PORT1_OFFSET
+#endif /* CONFIG_CMD_IDE */
+
+/*
+ * I2C related stuff
+ */
+#ifdef CONFIG_CMD_I2C
+#define CONFIG_I2C_MVTWSI
+#define CONFIG_SYS_I2C_SLAVE		0x0
+#define CONFIG_SYS_I2C_SPEED		100000
+#endif
+
+/*
+ * File system
+ */
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_JFFS2
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_UBI
+#define CONFIG_CMD_UBIFS
+#define CONFIG_RBTREE
+#define CONFIG_MTD_DEVICE               /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_LZO
+
+#endif /* _CONFIG_OPENRD_BASE_H */
diff --git a/include/configs/mv88f6281gtw_ge.h b/include/configs/mv88f6281gtw_ge.h
index 9ef03a6..d323829 100644
--- a/include/configs/mv88f6281gtw_ge.h
+++ b/include/configs/mv88f6281gtw_ge.h
@@ -33,66 +33,19 @@
 /*
  * High Level Configuration Options (easy to change)
  */
-#define CONFIG_MARVELL		1
-#define CONFIG_ARM926EJS	1	/* Basic Architecture */
 #define CONFIG_FEROCEON_88FR131	1	/* CPU Core subversion */
 #define CONFIG_KIRKWOOD		1	/* SOC Family Name */
 #define CONFIG_KW88F6281	1	/* SOC Name */
 #define CONFIG_MACH_MV88F6281GTW_GE	/* Machine type */
-
-#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 support */
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
-#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
-#define CONFIG_KIRKWOOD_PCIE_INIT	/* Enable PCIE Port0 for kernel */
-#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII Pad voltage to 1.8V */
 
 /*
- * CLKs configurations
- */
-#define CONFIG_SYS_HZ		1000
-
-/*
- * NS16550 Configuration
- */
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-#define CONFIG_SYS_NS16550_CLK		CONFIG_SYS_TCLK
-#define CONFIG_SYS_NS16550_COM1		KW_UART0_BASE
-
-/*
- * Serial Port configuration
- * The following definitions let you select what serial you want to use
- * for your console driver.
- */
-
-#define CONFIG_CONS_INDEX	1	/*Console on UART0 */
-#define CONFIG_BAUDRATE			115200
-#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, \
-					  115200,230400, 460800, 921600 }
-/* auto boot */
-#define CONFIG_BOOTDELAY	3	/* default enable autoboot */
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs  */
-#define CONFIG_INITRD_TAG	1	/* enable INITRD tag */
-#define CONFIG_SETUP_MEMORY_TAGS 1	/* enable memory tag */
-
-#define	CONFIG_SYS_PROMPT	"Marvell>> "	/* Command Prompt */
-#define	CONFIG_SYS_CBSIZE	1024	/* Console I/O Buff Size */
-#define	CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE \
-		+sizeof(CONFIG_SYS_PROMPT) + 16)	/* Print Buff */
-/*
  * Commands configuration
  */
 #define CONFIG_SYS_NO_FLASH		/* Declare no flash (NOR/SPI) */
 #include <config_cmd_default.h>
-#define CONFIG_CMD_AUTOSCRIPT
 #define CONFIG_CMD_DHCP
+#define CONFIG_CMD_PING
 #define CONFIG_CMD_ENV
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_PING
@@ -100,17 +53,18 @@
 #define CONFIG_CMD_USB
 
 /*
- * Flash configuration
+ * mv-common.h should be defined after CMD configs since it used them
+ * to enable certain macros
  */
-#ifdef CONFIG_CMD_SF
-#define CONFIG_SPI_FLASH		1
-#define CONFIG_HARD_SPI			1
-#define CONFIG_KIRKWOOD_SPI		1
-#define CONFIG_SPI_FLASH_MACRONIX	1
-#define CONFIG_ENV_SPI_BUS		0
-#define CONFIG_ENV_SPI_CS		0
-#define CONFIG_ENV_SPI_MAX_HZ		50000000	/*50Mhz */
-#endif
+#include "mv-common.h"
+
+/* Unwanted stuffs from mv-common.h */
+#undef	CONFIG_CMD_EXT2
+#undef	CONFIG_CMD_JFFS2
+#undef	CONFIG_CMD_FAT
+#undef	CONFIG_CMD_UBI
+#undef	CONFIG_CMD_UBIFS
+#undef	CONFIG_RBTREE
 
 /*
  *  Environment variables configurations
@@ -142,59 +96,11 @@
 	"x_bootargs_root=root=/dev/mtdblock3 ro rootfstype=squashfs\0"
 
 /*
- * Size of malloc() pool
- */
-#define CONFIG_SYS_MALLOC_LEN	(1024 * 128) /* 128kB for malloc() */
-/* size in bytes reserved for initial data */
-#define CONFIG_SYS_GBL_DATA_SIZE	128
-
-/*
- * Other required minimal configurations
- */
-#define CONFIG_CONSOLE_INFO_QUIET	/* some code reduction */
-#define CONFIG_ARCH_CPU_INIT	/* call arch_cpu_init() */
-#define CONFIG_ARCH_MISC_INIT	/* call arch_misc_init() */
-#define CONFIG_DISPLAY_CPUINFO	/* Display cpu info */
-#define CONFIG_NR_DRAM_BANKS	4
-#define CONFIG_STACKSIZE	0x00100000	/* regular stack- 1M */
-#define CONFIG_SYS_LOAD_ADDR	0x00800000	/* default load adr- 8M */
-#define CONFIG_SYS_MEMTEST_START 0x00400000	/* 4M */
-#define CONFIG_SYS_MEMTEST_END	0x007fffff	/*(_8M -1) */
-#define CONFIG_SYS_RESET_ADDRESS 0xffff0000	/* Rst Vector Adr */
-#define CONFIG_SYS_MAXARGS	16	/* max number of command args */
-
-/*
  * Ethernet Driver configuration
  */
 #ifdef CONFIG_CMD_NET
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_PING
-#define CONFIG_NETCONSOLE	/* include NetConsole support   */
-#define CONFIG_NET_MULTI	/* specify more that one ports available */
-#define	CONFIG_MII		/* expose smi ove miiphy interface */
-#define CONFIG_MVGBE		/* Enable Marvell Gbe Controller Driver */
-#define CONFIG_SYS_FAULT_ECHO_LINK_DOWN	/* detect link using phy */
 #define CONFIG_MVGBE_PORTS	{1, 0}	/* enable port 0 only */
-#define CONFIG_ENV_OVERWRITE	/* ethaddr can be reprogrammed */
-#endif /* CONFIG_CMD_NET */
-
-/*
- * Marvell 88Exxxx Switch configurations
- */
-#define CONFIG_RESET_PHY_R	/* use reset_phy() to init phy/swtich */
 #define CONFIG_MV88E61XX_SWITCH	/* Enable mv88e61xx switch driver */
-
-/*
- * USB/EHCI
- */
-#ifdef CONFIG_CMD_USB
-#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
-#define CONFIG_USB_EHCI_KIRKWOOD	/* on Kirkwood platform	*/
-#define CONFIG_EHCI_IS_TDI
-#define CONFIG_USB_STORAGE
-#define CONFIG_DOS_PARTITION
-#define CONFIG_ISO_PARTITION
-#define CONFIG_SUPPORT_VFAT
-#endif /* CONFIG_CMD_USB */
+#endif /* CONFIG_CMD_NET */
 
 #endif /* _CONFIG_MV88F6281GTW_GE_H */
diff --git a/include/configs/openrd_base.h b/include/configs/openrd_base.h
index 846dfcd..6a4814a 100644
--- a/include/configs/openrd_base.h
+++ b/include/configs/openrd_base.h
@@ -38,59 +38,12 @@
 /*
  * High Level Configuration Options (easy to change)
  */
-#define CONFIG_MARVELL		1
-#define CONFIG_ARM926EJS	1	/* Basic Architecture */
 #define CONFIG_SHEEVA_88SV131	1	/* CPU Core subversion */
 #define CONFIG_KIRKWOOD		1	/* SOC Family Name */
 #define CONFIG_KW88F6281	1	/* SOC Name */
 #define CONFIG_MACH_OPENRD_BASE	/* Machine type */
-
-#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 support */
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
-#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
-#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII Pad voltage to 1.8V */
-#define CONFIG_KIRKWOOD_PCIE_INIT       /* Enable PCIE Port0 for kernel */
-
-/*
- * CLKs configurations
- */
-#define CONFIG_SYS_HZ		1000
-
-/*
- * NS16550 Configuration
- */
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-#define CONFIG_SYS_NS16550_CLK		CONFIG_SYS_TCLK
-#define CONFIG_SYS_NS16550_COM1		KW_UART0_BASE
-
-/*
- * Serial Port configuration
- * The following definitions let you select what serial you want to use
- * for your console driver.
- */
-
-#define CONFIG_CONS_INDEX	1	/*Console on UART0 */
-#define CONFIG_BAUDRATE			115200
-#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, \
-					  115200,230400, 460800, 921600 }
-/* auto boot */
-#define CONFIG_BOOTDELAY	3	/* default enable autoboot */
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs  */
-#define CONFIG_INITRD_TAG	1	/* enable INITRD tag */
-#define CONFIG_SETUP_MEMORY_TAGS 1	/* enable memory tag */
 
-#define	CONFIG_SYS_PROMPT	"Marvell>> "	/* Command Prompt */
-#define	CONFIG_SYS_CBSIZE	1024	/* Console I/O Buff Size */
-#define	CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE \
-		+sizeof(CONFIG_SYS_PROMPT) + 16)	/* Print Buff */
 /*
  * Commands configuration
  */
@@ -106,15 +59,10 @@
 #define CONFIG_CMD_IDE
 
 /*
- * NAND configuration
+ * mv-common.h should be defined after CMD configs since it used them
+ * to enable certain macros
  */
-#ifdef CONFIG_CMD_NAND
-#define CONFIG_NAND_KIRKWOOD
-#define CONFIG_SYS_MAX_NAND_DEVICE	1
-#define NAND_MAX_CHIPS			1
-#define CONFIG_SYS_NAND_BASE		0xD8000000	/* KW_DEFADR_NANDF */
-#define NAND_ALLOW_ERASE_ALL		1
-#endif
+#include "mv-common.h"
 
 /*
  *  Environment variables configurations
@@ -154,97 +102,11 @@
 	"mtdparts="MTDPARTS_DEFAULT"\0"
 
 /*
- * Size of malloc() pool
- */
-#define CONFIG_SYS_MALLOC_LEN	(1024 * 1024) /* 1MiB for malloc() */
-/* size in bytes reserved for initial data */
-#define CONFIG_SYS_GBL_DATA_SIZE	128
-
-/*
- * Other required minimal configurations
- */
-#define CONFIG_SYS_LONGHELP
-#define CONFIG_AUTO_COMPLETE
-#define CONFIG_CMDLINE_EDITING
-#define CONFIG_ARCH_CPU_INIT	/* call arch_cpu_init() */
-#define CONFIG_ARCH_MISC_INIT	/* call arch_misc_init() */
-#define CONFIG_DISPLAY_CPUINFO	/* Display cpu info */
-#define CONFIG_NR_DRAM_BANKS	4
-#define CONFIG_STACKSIZE	0x00100000	/* regular stack- 1M */
-#define CONFIG_SYS_LOAD_ADDR	0x00800000	/* default load adr- 8M */
-#define CONFIG_SYS_MEMTEST_START 0x00400000	/* 4M */
-#define CONFIG_SYS_MEMTEST_END	0x007fffff	/*(_8M -1) */
-#define CONFIG_SYS_RESET_ADDRESS 0xffff0000	/* Rst Vector Adr */
-#define CONFIG_SYS_MAXARGS	16	/* max number of command args */
-
-/*
  * Ethernet Driver configuration
  */
 #ifdef CONFIG_CMD_NET
-#define CONFIG_NETCONSOLE	/* include NetConsole support   */
-#define CONFIG_NET_MULTI	/* specify more that one ports available */
-#define	CONFIG_MII		/* expose smi ove miiphy interface */
-#define CONFIG_MVGBE		/* Enable Marvell Gbe Controller Driver */
-#define CONFIG_SYS_FAULT_ECHO_LINK_DOWN	/* detect link using phy */
 #define CONFIG_MVGBE_PORTS	{1, 0}	/* enable port 0 only */
 #define CONFIG_PHY_BASE_ADR	0x8
-#define CONFIG_ENV_OVERWRITE	/* ethaddr can be reprogrammed */
-#define CONFIG_RESET_PHY_R	/* use reset_phy() to init mv8831116 PHY */
 #endif /* CONFIG_CMD_NET */
 
-/*
- * USB/EHCI
- */
-#ifdef CONFIG_CMD_USB
-#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
-#define CONFIG_USB_EHCI_KIRKWOOD	/* on Kirkwood platform	*/
-#define CONFIG_EHCI_IS_TDI
-#define CONFIG_USB_STORAGE
-#define CONFIG_DOS_PARTITION
-#define CONFIG_ISO_PARTITION
-#define CONFIG_SUPPORT_VFAT
-#endif /* CONFIG_CMD_USB */
-
-/*
- * IDe Support on SATA port0
- */
-#ifdef CONFIG_CMD_IDE
-#define __io
-#define CONFIG_CMD_EXT2
-#define CONFIG_MVSATA_IDE
-#define CONFIG_IDE_PREINIT
-#define CONFIG_MVSATA_IDE_USE_PORT1
-/* Needs byte-swapping for ATA data register */
-#define CONFIG_IDE_SWAP_IO
-/* Data, registers and alternate blocks are at the same offset */
-#define CONFIG_SYS_ATA_DATA_OFFSET	(0x0100)
-#define CONFIG_SYS_ATA_REG_OFFSET	(0x0100)
-#define CONFIG_SYS_ATA_ALT_OFFSET	(0x0100)
-/* Each 8-bit ATA register is aligned to a 4-bytes address */
-#define CONFIG_SYS_ATA_STRIDE		4
-/* Controller supports 48-bits LBA addressing */
-#define CONFIG_LBA48
-/* CONFIG_CMD_IDE requires some #defines for ATA registers */
-#define CONFIG_SYS_IDE_MAXBUS		2
-#define CONFIG_SYS_IDE_MAXDEVICE	2
-/* ATA registers base is at SATA controller base */
-#define CONFIG_SYS_ATA_BASE_ADDR	KW_SATA_BASE
-/* ATA bus 0 is Kirkwood port 0 on openrd */
-#define CONFIG_SYS_ATA_IDE0_OFFSET	KW_SATA_PORT0_OFFSET
-/* ATA bus 1 is Kirkwood port 1 on openrd */
-#define CONFIG_SYS_ATA_IDE1_OFFSET	KW_SATA_PORT1_OFFSET
-#endif /* CONFIG_CMD_IDE */
-
-/*
- * File system
- */
-#define CONFIG_CMD_FAT
-#define CONFIG_CMD_UBI
-#define CONFIG_CMD_UBIFS
-#define CONFIG_RBTREE
-#define CONFIG_MTD_DEVICE               /* needed for mtdparts commands */
-#define CONFIG_MTD_PARTITIONS
-#define CONFIG_CMD_MTDPARTS
-#define CONFIG_LZO
-
 #endif /* _CONFIG_OPENRD_BASE_H */
diff --git a/include/configs/rd6281a.h b/include/configs/rd6281a.h
index 5857301..bd92f6b 100644
--- a/include/configs/rd6281a.h
+++ b/include/configs/rd6281a.h
@@ -33,59 +33,13 @@
 /*
  * High Level Configuration Options (easy to change)
  */
-#define CONFIG_MARVELL		1
-#define CONFIG_ARM926EJS	1	/* Basic Architecture */
 #define CONFIG_FEROCEON_88FR131	1	/* CPU Core subversion */
 #define CONFIG_KIRKWOOD		1	/* SOC Family Name */
 #define CONFIG_KW88F6281	1	/* SOC Name */
 #define CONFIG_MACH_RD6281A		/* Machine type */
-
-#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 support */
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
-#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
-#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII Pad voltage to 1.8V */
-
-/*
- * CLKs configurations
- */
-#define CONFIG_SYS_HZ		1000
-
-/*
- * NS16550 Configuration
- */
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-#define CONFIG_SYS_NS16550_CLK		CONFIG_SYS_TCLK
-#define CONFIG_SYS_NS16550_COM1		KW_UART0_BASE
 
 /*
- * Serial Port configuration
- * The following definitions let you select what serial you want to use
- * for your console driver.
- */
-
-#define CONFIG_CONS_INDEX	1	/*Console on UART0 */
-#define CONFIG_BAUDRATE			115200
-#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, \
-					  115200,230400, 460800, 921600 }
-/* auto boot */
-#define CONFIG_BOOTDELAY	3	/* default enable autoboot */
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs */
-#define CONFIG_INITRD_TAG	1	/* enable INITRD tag */
-#define CONFIG_SETUP_MEMORY_TAGS 1	/* enable memory tag */
-
-#define	CONFIG_SYS_PROMPT	"Marvell>> "	/* Command Prompt */
-#define	CONFIG_SYS_CBSIZE	1024	/* Console I/O Buff Size */
-#define	CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE \
-		+sizeof(CONFIG_SYS_PROMPT) + 16)	/* Print Buff */
-/*
  * Commands configuration
  */
 #define CONFIG_SYS_NO_FLASH		/* Declare no flash (NOR/SPI) */
@@ -99,15 +53,10 @@
 #define CONFIG_CMD_USB
 
 /*
- * NAND configuration
+ * mv-common.h should be defined after CMD configs since it used them
+ * to enable certain macros
  */
-#ifdef CONFIG_CMD_NAND
-#define CONFIG_NAND_KIRKWOOD
-#define CONFIG_SYS_MAX_NAND_DEVICE	1
-#define NAND_MAX_CHIPS			1
-#define CONFIG_SYS_NAND_BASE		0xD8000000	/* KW_DEFADR_NANDF */
-#define NAND_ALLOW_ERASE_ALL		1
-#endif
+#include "mv-common.h"
 
 /*
  * Environment variables configurations
@@ -143,56 +92,15 @@
 	"x_bootargs_root=root=/dev/mtdblock3 rw rootfstype=jffs2\0"
 
 /*
- * Size of malloc() pool
- */
-#define CONFIG_SYS_MALLOC_LEN	(1024 * 128) /* 128kB for malloc() */
-/* size in bytes reserved for initial data */
-#define CONFIG_SYS_GBL_DATA_SIZE	128
-
-/*
- * Other required minimal configurations
- */
-#define CONFIG_CONSOLE_INFO_QUIET	/* some code reduction */
-#define CONFIG_ARCH_CPU_INIT	/* call arch_cpu_init() */
-#define CONFIG_ARCH_MISC_INIT	/* call arch_misc_init() */
-#define CONFIG_DISPLAY_CPUINFO	/* Display cpu info */
-#define CONFIG_NR_DRAM_BANKS	4
-#define CONFIG_STACKSIZE	0x00100000	/* regular stack- 1M */
-#define CONFIG_SYS_LOAD_ADDR	0x00800000	/* default load adr- 8M */
-#define CONFIG_SYS_MEMTEST_START 0x00400000	/* 4M */
-#define CONFIG_SYS_MEMTEST_END	0x007fffff	/*(_8M -1) */
-#define CONFIG_SYS_RESET_ADDRESS 0xffff0000	/* Rst Vector Adr */
-#define CONFIG_SYS_MAXARGS	16	/* max number of command args */
-
-/*
  * Ethernet Driver configuration
  */
 #ifdef CONFIG_CMD_NET
-#define CONFIG_NETCONSOLE	/* include NetConsole support */
-#define CONFIG_NET_MULTI	/* specify more that one ports available */
-#define CONFIG_MII		/* expose smi ove miiphy interface */
-#define CONFIG_MVGBE		/* Enable Marvell Gbe Controller Driver */
 #define CONFIG_MVGBE_PORTS	{1, 1}	/* enable both ports */
 #define CONFIG_MV88E61XX_MULTICHIP_ADRMODE
 #define CONFIG_DIS_AUTO_NEG_SPEED_GMII /*Disable Auto speed negociation */
 #define CONFIG_PHY_SPEED	_1000BASET	/*Force PHYspeed to 1GBPs */
 #define CONFIG_PHY_BASE_ADR	0x0A
-#define CONFIG_ENV_OVERWRITE	/* ethaddr can be reprogrammed */
-#define CONFIG_RESET_PHY_R	/* use reset_phy() to init switch and PHY */
 #define CONFIG_MV88E61XX_SWITCH	/* Enable MV88E61XX switch driver */
 #endif /* CONFIG_CMD_NET */
 
-/*
- * USB/EHCI
- */
-#ifdef CONFIG_CMD_USB
-#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
-#define CONFIG_USB_EHCI_KIRKWOOD	/* on Kirkwood platform	*/
-#define CONFIG_EHCI_IS_TDI
-#define CONFIG_USB_STORAGE
-#define CONFIG_DOS_PARTITION
-#define CONFIG_ISO_PARTITION
-#define CONFIG_SUPPORT_VFAT
-#endif /* CONFIG_CMD_USB */
-
 #endif /* _CONFIG_RD6281A_H */
diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
index c5de86e..83dd8ff 100644
--- a/include/configs/sheevaplug.h
+++ b/include/configs/sheevaplug.h
@@ -33,82 +33,28 @@
 /*
  * High Level Configuration Options (easy to change)
  */
-#define CONFIG_MARVELL		1
-#define CONFIG_ARM926EJS	1	/* Basic Architecture */
 #define CONFIG_FEROCEON_88FR131	1	/* CPU Core subversion */
 #define CONFIG_KIRKWOOD		1	/* SOC Family Name */
 #define CONFIG_KW88F6281	1	/* SOC Name */
 #define CONFIG_MACH_SHEEVAPLUG	/* Machine type */
-
-#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 support */
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
-#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
-#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII Pad voltage to 1.8V */
-
-/*
- * CLKs configurations
- */
-#define CONFIG_SYS_HZ		1000
-
-/*
- * NS16550 Configuration
- */
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-#define CONFIG_SYS_NS16550_CLK		CONFIG_SYS_TCLK
-#define CONFIG_SYS_NS16550_COM1		KW_UART0_BASE
-
-/*
- * Serial Port configuration
- * The following definitions let you select what serial you want to use
- * for your console driver.
- */
-
-#define CONFIG_CONS_INDEX	1	/*Console on UART0 */
-#define CONFIG_BAUDRATE			115200
-#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, \
-					  115200,230400, 460800, 921600 }
-/* auto boot */
-#define CONFIG_BOOTDELAY	3	/* default enable autoboot */
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs  */
-#define CONFIG_INITRD_TAG	1	/* enable INITRD tag */
-#define CONFIG_SETUP_MEMORY_TAGS 1	/* enable memory tag */
-
-#define	CONFIG_SYS_PROMPT	"Marvell>> "	/* Command Prompt */
-#define	CONFIG_SYS_CBSIZE	1024	/* Console I/O Buff Size */
-#define	CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE \
-		+sizeof(CONFIG_SYS_PROMPT) + 16)	/* Print Buff */
 
 /*
  * Commands configuration
  */
 #define CONFIG_SYS_NO_FLASH		/* Declare no flash (NOR/SPI) */
 #include <config_cmd_default.h>
-#define CONFIG_CMD_AUTOSCRIPT
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ENV
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_USB
-
 /*
- * NAND configuration
+ * mv-common.h should be defined after CMD configs since it used them
+ * to enable certain macros
  */
-#ifdef CONFIG_CMD_NAND
-#define CONFIG_NAND_KIRKWOOD
-#define CONFIG_SYS_MAX_NAND_DEVICE	1
-#define NAND_MAX_CHIPS			1
-#define CONFIG_SYS_NAND_BASE		0xD8000000	/* KW_DEFADR_NANDF */
-#define NAND_ALLOW_ERASE_ALL		1
-#endif
+#include "mv-common.h"
 
 /*
  *  Environment variables configurations
@@ -144,58 +90,14 @@
 	"x_bootargs_root=root=/dev/mtdblock3 rw rootfstype=jffs2\0"
 
 /*
- * Size of malloc() pool
- */
-#define CONFIG_SYS_MALLOC_LEN	(1024 * 1024) /* 1 MiB for malloc() */
-/* size in bytes reserved for initial data */
-#define CONFIG_SYS_GBL_DATA_SIZE	128
-
-/*
- * Other required minimal configurations
- */
-#define CONFIG_SYS_LONGHELP
-#define CONFIG_AUTO_COMPLETE
-#define CONFIG_CMDLINE_EDITING
-#define CONFIG_ARCH_CPU_INIT	/* call arch_cpu_init() */
-#define CONFIG_ARCH_MISC_INIT	/* call arch_misc_init() */
-#define CONFIG_DISPLAY_CPUINFO	/* Display cpu info */
-#define CONFIG_NR_DRAM_BANKS	4
-#define CONFIG_STACKSIZE	0x00100000	/* regular stack- 1M */
-#define CONFIG_SYS_LOAD_ADDR	0x00800000	/* default load adr- 8M */
-#define CONFIG_SYS_MEMTEST_START 0x00400000	/* 4M */
-#define CONFIG_SYS_MEMTEST_END	0x007fffff	/*(_8M -1) */
-#define CONFIG_SYS_RESET_ADDRESS 0xffff0000	/* Rst Vector Adr */
-#define CONFIG_SYS_MAXARGS	16	/* max number of command args */
-
-/*
  * Ethernet Driver configuration
  */
 #ifdef CONFIG_CMD_NET
-#define CONFIG_NETCONSOLE	/* include NetConsole support   */
-#define CONFIG_NET_MULTI	/* specify more that one ports available */
-#define	CONFIG_MII		/* expose smi ove miiphy interface */
-#define CONFIG_MVGBE		/* Enable Marvell Gbe Controller Driver */
-#define CONFIG_SYS_FAULT_ECHO_LINK_DOWN	/* detect link using phy */
 #define CONFIG_MVGBE_PORTS	{1, 0}	/* enable port 0 only */
 #define CONFIG_PHY_BASE_ADR	0
-#define CONFIG_ENV_OVERWRITE	/* ethaddr can be reprogrammed */
-#define CONFIG_RESET_PHY_R	/* use reset_phy() to init mv8831116 PHY */
 #endif /* CONFIG_CMD_NET */
 
 /*
- * USB/EHCI
- */
-#ifdef CONFIG_CMD_USB
-#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
-#define CONFIG_USB_EHCI_KIRKWOOD	/* on Kirkwood platform	*/
-#define CONFIG_EHCI_IS_TDI
-#define CONFIG_USB_STORAGE
-#define CONFIG_DOS_PARTITION
-#define CONFIG_ISO_PARTITION
-#define CONFIG_SUPPORT_VFAT
-#endif /* CONFIG_CMD_USB */
-
-/*
  * File system
  */
 #define CONFIG_CMD_EXT2
-- 
1.5.3.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support
  2010-09-30 17:53 ` [U-Boot] [PATCH] kirkwood: added common config file mv-config.h Prafulla Wadaskar
  2010-09-30 13:54   ` Rogan Dawes
@ 2010-09-30 17:54   ` Prafulla Wadaskar
  2010-09-30 15:40     ` Heiko Schocher
  2010-09-30 17:34     ` Wolfgang Denk
  1 sibling, 2 replies; 26+ messages in thread
From: Prafulla Wadaskar @ 2010-09-30 17:54 UTC (permalink / raw)
  To: u-boot

All Kirkwood based boards are supported for this new implementation
ref: dovs/README.arm-relocation

Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
---
 include/configs/mv-common.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h
index ca9f33b..b80ad00 100644
--- a/include/configs/mv-common.h
+++ b/include/configs/mv-common.h
@@ -56,6 +56,12 @@
 #error "Unsupported SoC"
 #endif
 
+/* additions for new ARM relocation support */
+#undef CONFIG_RELOC_FIXUP_WORKS
+#define CONFIG_SYS_SDRAM_BASE		0x00000000
+#define CONFIG_SYS_INIT_SP_ADDR		(0x00000000 + 0x1000 - \
+					CONFIG_SYS_GBL_DATA_SIZE)
+
 /*
  * CLKs configurations
  */
-- 
1.5.3.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support
  2010-09-30 17:49       ` Wolfgang Denk
@ 2010-09-30 22:06         ` Marek Vasut
  0 siblings, 0 replies; 26+ messages in thread
From: Marek Vasut @ 2010-09-30 22:06 UTC (permalink / raw)
  To: u-boot

Dne ?t 30. z??? 2010 19:49:24 Wolfgang Denk napsal(a):
> Dear Heiko Schocher,
> 
> In message <4CA4AF81.4000105@denx.de> you wrote:
> > I setup the initial stack in the SDRAM, because I didn;t know,
> > if there is on this cpu family a better place for the initial stack.
> > (Some cpu internal ram?)
> 
> As mentioned before: if ther eios no SRAM or other on-chip memory, we
> can lock the data cache, or parts of it.  This has been done on other
> boards before.
> 
> I think Marek has patches in his queue that implement this for PXA, so
> maybe these may be interesting for other ARM families as well.
> 
> Marek, maybe you can post your stuff, even if preliminary?  Thanks.
> 
> Best regards,
> 
> Wolfgang Denk
http://git.denx.de/?p=u-boot/u-boot-
pxa.git;a=commitdiff;h=34a7734a0fafffb888f95134c93a627df159add1

See start.S, look for "enable MMU and Dcache as DRAM" ... it should be very 
similar on kirkwood. Also, you need temporary TTB, see at the bottom of the same 
file.

CHeers

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
  2010-09-30 15:39 ` Heiko Schocher
@ 2010-10-01  5:59   ` Prafulla Wadaskar
  2010-10-01  6:17     ` Heiko Schocher
                       ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Prafulla Wadaskar @ 2010-10-01  5:59 UTC (permalink / raw)
  To: u-boot

 

> -----Original Message-----
> From: Heiko Schocher [mailto:hs at denx.de] 
> Sent: Thursday, September 30, 2010 9:10 PM
> To: Prafulla Wadaskar
> Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
> Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
> 
> Hello Prafulla,
> 
> Prafulla Wadaskar wrote:
> > For all Kirkwood boards so far dram_init function is duplicated
> > dram_init function is moved to dram.c and relevant code from all
> > board specific files removed
> > 
> > If any board needs specific dram init handling than standard one,
> > then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in
> > board config header file and the dram_init function can be put
> > in board specific source file
> > For ex. keymile boards
> > 
> > Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
> > ---
> >  arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22 
> ++++++++++++++++++++++
> >  board/Marvell/guruplug/guruplug.c               |   11 -----------
> >  board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 -----------
> >  board/Marvell/openrd_base/openrd_base.c         |   11 -----------
> >  board/Marvell/rd6281a/rd6281a.c                 |   11 -----------
> >  board/Marvell/sheevaplug/sheevaplug.c           |   11 -----------
> >  include/configs/keymile-common.h                |    1 +
> >  7 files changed, 23 insertions(+), 55 deletions(-)
> > 
> > diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c 
> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> > index 8f2a18a..d929d7a 100644
> > --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> > +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> > @@ -23,8 +23,11 @@
> >   */
> >  
> >  #include <config.h>
> > +#include <common.h>
> >  #include <asm/arch/kirkwood.h>
> >  
> > +DECLARE_GLOBAL_DATA_PTR;
> > +
> >  #define KW_REG_CPUCS_WIN_BAR(x)		
> (KW_REGISTER(0x1500) + (x * 0x08))
> >  #define KW_REG_CPUCS_WIN_SZ(x)		
> (KW_REGISTER(0x1504) + (x * 0x08))
> >  /*
> > @@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
> >  	result += 0x01000000;
> >  	return result;
> >  }
> > +
> > +#ifndef CONFIG_SYS_BOARD_DRAM_INIT
> > +int dram_init(void)
> > +{
> > +	int i;
> > +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> > +	gd->ram_size = 0;
> > +#endif
> > +	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
> > +		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
> > +		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
> > +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> > +		gd->ram_size += gd->bd->bi_dram[i].size;
> 
> This is only OK, if the memory banks are consecutive without
> gaps ... is this true for all boards?

Yes, those are consecutive without gaps on all boards so far.
But one can configure with gaps too, for ex. If any new board uses two chips with smaller size then it is possibility of gap insertion.

In that case how it should be?

Regards..
Prafulla . .

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] kirkwood: added common config file mv-config.h
  2010-09-30 15:35       ` Albert ARIBAUD
@ 2010-10-01  6:10         ` Prafulla Wadaskar
  2010-10-01  6:35           ` Albert ARIBAUD
  0 siblings, 1 reply; 26+ messages in thread
From: Prafulla Wadaskar @ 2010-10-01  6:10 UTC (permalink / raw)
  To: u-boot

 

> -----Original Message-----
> From: Albert ARIBAUD [mailto:albert.aribaud at free.fr] 
> Sent: Thursday, September 30, 2010 9:05 PM
> To: Prafulla Wadaskar
> Cc: Rogan Dawes; u-boot at lists.denx.de; Ashish Karkare; 
> Prabhanjan Sarnaik
> Subject: Re: [U-Boot] [PATCH] kirkwood: added common config 
> file mv-config.h
> 
> Le 30/09/2010 16:33, Prafulla Wadaskar a ?crit :
> 
> >>> +/*
> >>> + * IDe Support on SATA port0
> >>> + */
> >>
> >> IDe?
> >
> > I think Ide can be removed, right?

I mean here s/Ide//g

> 
> Do none of the boards have disks? At least openrd-base should 
> have IDE 

Guruplug, openrd_base and rd6281a have disk support

> (and openrd-client as well if the patch to introduced it is 
> finally merged).
> 
> So IDE should stay IMO, but the IDE stuff should be split into 
> board-specifics (basically the defines for the IDE0 and, if 
> it exists, 
> IDE1 base addresses) and SoC-specifics (basically everything 
> else, i.e. 
> all that is required for cmd_ide.c to compile).

At this moment I only see the case with edminiv2 board where ATA bus0 is configured for sata port1.
To extend this support for this board, we can undef and redef the respective macros.

Whereas on all other boards it is one-to-one mapping.

To me setting default configuration make more sense, that avoids code duplication in several files.

Regards..
Prafulla . .

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
  2010-10-01  5:59   ` Prafulla Wadaskar
@ 2010-10-01  6:17     ` Heiko Schocher
  2010-10-01  8:00       ` Wolfgang Denk
  2010-10-01  6:20     ` Albert ARIBAUD
  2010-10-01  7:53     ` Wolfgang Denk
  2 siblings, 1 reply; 26+ messages in thread
From: Heiko Schocher @ 2010-10-01  6:17 UTC (permalink / raw)
  To: u-boot

Hello Prafulla,

Prafulla Wadaskar wrote:
>  
> 
>> -----Original Message-----
>> From: Heiko Schocher [mailto:hs at denx.de] 
>> Sent: Thursday, September 30, 2010 9:10 PM
>> To: Prafulla Wadaskar
>> Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
>> Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
>>
>> Hello Prafulla,
>>
>> Prafulla Wadaskar wrote:
>>> For all Kirkwood boards so far dram_init function is duplicated
>>> dram_init function is moved to dram.c and relevant code from all
>>> board specific files removed
>>>
>>> If any board needs specific dram init handling than standard one,
>>> then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in
>>> board config header file and the dram_init function can be put
>>> in board specific source file
>>> For ex. keymile boards
>>>
>>> Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
>>> ---
>>>  arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22 
>> ++++++++++++++++++++++
>>>  board/Marvell/guruplug/guruplug.c               |   11 -----------
>>>  board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 -----------
>>>  board/Marvell/openrd_base/openrd_base.c         |   11 -----------
>>>  board/Marvell/rd6281a/rd6281a.c                 |   11 -----------
>>>  board/Marvell/sheevaplug/sheevaplug.c           |   11 -----------
>>>  include/configs/keymile-common.h                |    1 +
>>>  7 files changed, 23 insertions(+), 55 deletions(-)
>>>
>>> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c 
>> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>>> index 8f2a18a..d929d7a 100644
>>> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>>> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>>> @@ -23,8 +23,11 @@
>>>   */
>>>  
>>>  #include <config.h>
>>> +#include <common.h>
>>>  #include <asm/arch/kirkwood.h>
>>>  
>>> +DECLARE_GLOBAL_DATA_PTR;
>>> +
>>>  #define KW_REG_CPUCS_WIN_BAR(x)		
>> (KW_REGISTER(0x1500) + (x * 0x08))
>>>  #define KW_REG_CPUCS_WIN_SZ(x)		
>> (KW_REGISTER(0x1504) + (x * 0x08))
>>>  /*
>>> @@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
>>>  	result += 0x01000000;
>>>  	return result;
>>>  }
>>> +
>>> +#ifndef CONFIG_SYS_BOARD_DRAM_INIT
>>> +int dram_init(void)
>>> +{
>>> +	int i;
>>> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
>>> +	gd->ram_size = 0;
>>> +#endif
>>> +	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
>>> +		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
>>> +		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
>>> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
>>> +		gd->ram_size += gd->bd->bi_dram[i].size;
>> This is only OK, if the memory banks are consecutive without
>> gaps ... is this true for all boards?
> 
> Yes, those are consecutive without gaps on all boards so far.
> But one can configure with gaps too, for ex. If any new board uses two chips with smaller size then it is possibility of gap insertion.
> 
> In that case how it should be?

Good question ... for this case we must adapt in arch/arm/lib/board.c

addr = CONFIG_SYS_SDRAM_BASE + gd->ram_size;

But no idea, where to put u-boot ... at the end of the first
bank? at the end of the last bank?

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
  2010-10-01  5:59   ` Prafulla Wadaskar
  2010-10-01  6:17     ` Heiko Schocher
@ 2010-10-01  6:20     ` Albert ARIBAUD
  2010-10-01  6:25       ` Prafulla Wadaskar
  2010-10-01  7:53     ` Wolfgang Denk
  2 siblings, 1 reply; 26+ messages in thread
From: Albert ARIBAUD @ 2010-10-01  6:20 UTC (permalink / raw)
  To: u-boot

Le 01/10/2010 07:59, Prafulla Wadaskar a ?crit :
>
>
>> -----Original Message-----
>> From: Heiko Schocher [mailto:hs at denx.de]
>> Sent: Thursday, September 30, 2010 9:10 PM
>> To: Prafulla Wadaskar
>> Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
>> Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
>>
>> Hello Prafulla,
>>
>> Prafulla Wadaskar wrote:
>>> For all Kirkwood boards so far dram_init function is duplicated
>>> dram_init function is moved to dram.c and relevant code from all
>>> board specific files removed
>>>
>>> If any board needs specific dram init handling than standard one,
>>> then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in
>>> board config header file and the dram_init function can be put
>>> in board specific source file
>>> For ex. keymile boards
>>>
>>> Signed-off-by: Prafulla Wadaskar<prafulla@marvell.com>
>>> ---
>>>   arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22
>> ++++++++++++++++++++++
>>>   board/Marvell/guruplug/guruplug.c               |   11 -----------
>>>   board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 -----------
>>>   board/Marvell/openrd_base/openrd_base.c         |   11 -----------
>>>   board/Marvell/rd6281a/rd6281a.c                 |   11 -----------
>>>   board/Marvell/sheevaplug/sheevaplug.c           |   11 -----------
>>>   include/configs/keymile-common.h                |    1 +
>>>   7 files changed, 23 insertions(+), 55 deletions(-)
>>>
>>> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>>> index 8f2a18a..d929d7a 100644
>>> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>>> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
>>> @@ -23,8 +23,11 @@
>>>    */
>>>
>>>   #include<config.h>
>>> +#include<common.h>
>>>   #include<asm/arch/kirkwood.h>
>>>
>>> +DECLARE_GLOBAL_DATA_PTR;
>>> +
>>>   #define KW_REG_CPUCS_WIN_BAR(x)		
>> (KW_REGISTER(0x1500) + (x * 0x08))
>>>   #define KW_REG_CPUCS_WIN_SZ(x)		
>> (KW_REGISTER(0x1504) + (x * 0x08))
>>>   /*
>>> @@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
>>>   	result += 0x01000000;
>>>   	return result;
>>>   }
>>> +
>>> +#ifndef CONFIG_SYS_BOARD_DRAM_INIT
>>> +int dram_init(void)
>>> +{
>>> +	int i;
>>> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
>>> +	gd->ram_size = 0;
>>> +#endif
>>> +	for (i = 0; i<  CONFIG_NR_DRAM_BANKS; i++) {
>>> +		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
>>> +		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
>>> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
>>> +		gd->ram_size += gd->bd->bi_dram[i].size;
>>
>> This is only OK, if the memory banks are consecutive without
>> gaps ... is this true for all boards?
>
> Yes, those are consecutive without gaps on all boards so far.
> But one can configure with gaps too, for ex. If any new board uses two chips with smaller size then it is possibility of gap insertion.
>
> In that case how it should be?
>
> Regards..
> Prafulla . .

I guess the most correct approach would be to "lump" together all banks 
until one is found not to be contiguous. The "lump" would be "the RAM".
Technically, if the banks are not in ascending base address order then 
you'd have to sort them out, so the best is to make it a requirement 
that they are in ascending base address order.

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
  2010-10-01  6:20     ` Albert ARIBAUD
@ 2010-10-01  6:25       ` Prafulla Wadaskar
  0 siblings, 0 replies; 26+ messages in thread
From: Prafulla Wadaskar @ 2010-10-01  6:25 UTC (permalink / raw)
  To: u-boot

 

> -----Original Message-----
> From: u-boot-bounces at lists.denx.de 
> [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert ARIBAUD
> Sent: Friday, October 01, 2010 11:51 AM
> To: u-boot at lists.denx.de
> Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
> 
> Le 01/10/2010 07:59, Prafulla Wadaskar a ?crit :
> >
> >
> >> -----Original Message-----
> >> From: Heiko Schocher [mailto:hs at denx.de]
> >> Sent: Thursday, September 30, 2010 9:10 PM
> >> To: Prafulla Wadaskar
> >> Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
> >> Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved 
> to dram.c
> >>
> >> Hello Prafulla,
> >>
> >> Prafulla Wadaskar wrote:
> >>> For all Kirkwood boards so far dram_init function is duplicated
> >>> dram_init function is moved to dram.c and relevant code from all
> >>> board specific files removed
> >>>
> >>> If any board needs specific dram init handling than standard one,
> >>> then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in
> >>> board config header file and the dram_init function can be put
> >>> in board specific source file
> >>> For ex. keymile boards
> >>>
> >>> Signed-off-by: Prafulla Wadaskar<prafulla@marvell.com>
> >>> ---
> >>>   arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22
> >> ++++++++++++++++++++++
> >>>   board/Marvell/guruplug/guruplug.c               |   11 
> -----------
> >>>   board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 
> -----------
> >>>   board/Marvell/openrd_base/openrd_base.c         |   11 
> -----------
> >>>   board/Marvell/rd6281a/rd6281a.c                 |   11 
> -----------
> >>>   board/Marvell/sheevaplug/sheevaplug.c           |   11 
> -----------
> >>>   include/configs/keymile-common.h                |    1 +
> >>>   7 files changed, 23 insertions(+), 55 deletions(-)
> >>>
> >>> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> >> b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> >>> index 8f2a18a..d929d7a 100644
> >>> --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> >>> +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
> >>> @@ -23,8 +23,11 @@
> >>>    */
> >>>
> >>>   #include<config.h>
> >>> +#include<common.h>
> >>>   #include<asm/arch/kirkwood.h>
> >>>
> >>> +DECLARE_GLOBAL_DATA_PTR;
> >>> +
> >>>   #define KW_REG_CPUCS_WIN_BAR(x)		
> >> (KW_REGISTER(0x1500) + (x * 0x08))
> >>>   #define KW_REG_CPUCS_WIN_SZ(x)		
> >> (KW_REGISTER(0x1504) + (x * 0x08))
> >>>   /*
> >>> @@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
> >>>   	result += 0x01000000;
> >>>   	return result;
> >>>   }
> >>> +
> >>> +#ifndef CONFIG_SYS_BOARD_DRAM_INIT
> >>> +int dram_init(void)
> >>> +{
> >>> +	int i;
> >>> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> >>> +	gd->ram_size = 0;
> >>> +#endif
> >>> +	for (i = 0; i<  CONFIG_NR_DRAM_BANKS; i++) {
> >>> +		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
> >>> +		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
> >>> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> >>> +		gd->ram_size += gd->bd->bi_dram[i].size;
> >>
> >> This is only OK, if the memory banks are consecutive without
> >> gaps ... is this true for all boards?
> >
> > Yes, those are consecutive without gaps on all boards so far.
> > But one can configure with gaps too, for ex. If any new 
> board uses two chips with smaller size then it is possibility 
> of gap insertion.
> >
> > In that case how it should be?
> >
> > Regards..
> > Prafulla . .
> 
> I guess the most correct approach would be to "lump" together 
> all banks 
> until one is found not to be contiguous. The "lump" would be 
> "the RAM".
> Technically, if the banks are not in ascending base address 
> order then 
> you'd have to sort them out, so the best is to make it a requirement 
> that they are in ascending base address order.

Okay, At this moment I will keep as it is since we do not have any such use case.

Regards..
Prafulla . .

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] kirkwood: added common config file mv-config.h
  2010-10-01  6:10         ` Prafulla Wadaskar
@ 2010-10-01  6:35           ` Albert ARIBAUD
  2010-10-01  6:45             ` Prafulla Wadaskar
  0 siblings, 1 reply; 26+ messages in thread
From: Albert ARIBAUD @ 2010-10-01  6:35 UTC (permalink / raw)
  To: u-boot

Le 01/10/2010 08:10, Prafulla Wadaskar a ?crit :
>
>
>> -----Original Message-----
>> From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
>> Sent: Thursday, September 30, 2010 9:05 PM
>> To: Prafulla Wadaskar
>> Cc: Rogan Dawes; u-boot at lists.denx.de; Ashish Karkare;
>> Prabhanjan Sarnaik
>> Subject: Re: [U-Boot] [PATCH] kirkwood: added common config
>> file mv-config.h
>>
>> Le 30/09/2010 16:33, Prafulla Wadaskar a ?crit :
>>
>>>>> +/*
>>>>> + * IDe Support on SATA port0
>>>>> + */
>>>>
>>>> IDe?
>>>
>>> I think Ide can be removed, right?
>
> I mean here s/Ide//g
>
>>
>> Do none of the boards have disks? At least openrd-base should
>> have IDE
>
> Guruplug, openrd_base and rd6281a have disk support
>
>> (and openrd-client as well if the patch to introduced it is
>> finally merged).
>>
>> So IDE should stay IMO, but the IDE stuff should be split into
>> board-specifics (basically the defines for the IDE0 and, if
>> it exists,
>> IDE1 base addresses) and SoC-specifics (basically everything
>> else, i.e.
>> all that is required for cmd_ide.c to compile).
>
> At this moment I only see the case with edminiv2 board where ATA bus0 is configured for sata port1.
> To extend this support for this board, we can undef and redef the respective macros.
>
> Whereas on all other boards it is one-to-one mapping.
>
> To me setting default configuration make more sense, that avoids code duplication in several files.
>
> Regards..
> Prafulla . .

Even if almost all boards have straight rather than cross mappings of 
IDE0/IDE1 to SATA0/SATA1, not all of them have two busses (guruplug has 
only one, and likewise another kirkwood based board I'm working on) so 
half the boards would have to modify the settings anyway.

Besides, having each board explicitely telling what busses is has rather 
than making it half implicit in the SoC common config file has two 
advantages:

- someone looking at the board config file will immediately know without 
if it supports IDE *and* how many busses it actually provides *and* how 
they are mapped;

- boards will always declare "what is there" rather than declaring 
either "what is there" or possibly "what isn't there even though the 
common config said there would be".

After all, this is only one or two lines in the board config, and they 
are always positively informative.

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] kirkwood: added common config file mv-config.h
  2010-10-01  6:35           ` Albert ARIBAUD
@ 2010-10-01  6:45             ` Prafulla Wadaskar
  0 siblings, 0 replies; 26+ messages in thread
From: Prafulla Wadaskar @ 2010-10-01  6:45 UTC (permalink / raw)
  To: u-boot

 

> -----Original Message-----
> From: Albert ARIBAUD [mailto:albert.aribaud at free.fr] 
> Sent: Friday, October 01, 2010 12:06 PM
> To: Prafulla Wadaskar
> Cc: Rogan Dawes; u-boot at lists.denx.de; Ashish Karkare; 
> Prabhanjan Sarnaik
> Subject: Re: [U-Boot] [PATCH] kirkwood: added common config 
> file mv-config.h
> 
> Le 01/10/2010 08:10, Prafulla Wadaskar a ?crit :
> >
> >
> >> -----Original Message-----
> >> From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
> >> Sent: Thursday, September 30, 2010 9:05 PM
> >> To: Prafulla Wadaskar
> >> Cc: Rogan Dawes; u-boot at lists.denx.de; Ashish Karkare;
> >> Prabhanjan Sarnaik
> >> Subject: Re: [U-Boot] [PATCH] kirkwood: added common config
> >> file mv-config.h
> >>
> >> Le 30/09/2010 16:33, Prafulla Wadaskar a ?crit :
> >>
> >>>>> +/*
> >>>>> + * IDe Support on SATA port0
> >>>>> + */
> >>>>
> >>>> IDe?
> >>>
> >>> I think Ide can be removed, right?
> >
> > I mean here s/Ide//g
> >
> >>
> >> Do none of the boards have disks? At least openrd-base should
> >> have IDE
> >
> > Guruplug, openrd_base and rd6281a have disk support
> >
> >> (and openrd-client as well if the patch to introduced it is
> >> finally merged).
> >>
> >> So IDE should stay IMO, but the IDE stuff should be split into
> >> board-specifics (basically the defines for the IDE0 and, if
> >> it exists,
> >> IDE1 base addresses) and SoC-specifics (basically everything
> >> else, i.e.
> >> all that is required for cmd_ide.c to compile).
> >
> > At this moment I only see the case with edminiv2 board 
> where ATA bus0 is configured for sata port1.
> > To extend this support for this board, we can undef and 
> redef the respective macros.
> >
> > Whereas on all other boards it is one-to-one mapping.
> >
> > To me setting default configuration make more sense, that 
> avoids code duplication in several files.
> >
> > Regards..
> > Prafulla . .
> 
> Even if almost all boards have straight rather than cross mappings of 
> IDE0/IDE1 to SATA0/SATA1, not all of them have two busses 
> (guruplug has 
> only one, and likewise another kirkwood based board I'm 
> working on) so 
> half the boards would have to modify the settings anyway.
> 
> Besides, having each board explicitely telling what busses is 
> has rather 
> than making it half implicit in the SoC common config file has two 
> advantages:
> 
> - someone looking at the board config file will immediately 
> know without 
> if it supports IDE *and* how many busses it actually provides 
> *and* how 
> they are mapped;
> 
> - boards will always declare "what is there" rather than declaring 
> either "what is there" or possibly "what isn't there even though the 
> common config said there would be".
> 
> After all, this is only one or two lines in the board config, 
> and they 

Well one can always undef if using only one sataport, as we undef commands configured in config_cmd_default.h
On the other hand one can say I will define the needed config for used sata port. This makes more sense

I do agree, it is positively informative,
I will keep sata port config out of the common definition.

Regards..
Prafulla . .

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support
  2010-09-30 15:40     ` Heiko Schocher
  2010-09-30 16:21       ` Albert ARIBAUD
  2010-09-30 17:49       ` Wolfgang Denk
@ 2010-10-01  7:21       ` Prafulla Wadaskar
  2 siblings, 0 replies; 26+ messages in thread
From: Prafulla Wadaskar @ 2010-10-01  7:21 UTC (permalink / raw)
  To: u-boot

 

> -----Original Message-----
> From: Heiko Schocher [mailto:hs at denx.de] 
> Sent: Thursday, September 30, 2010 9:11 PM
> To: Prafulla Wadaskar
> Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
> Subject: Re: [U-Boot] [PATCH] Kirkwood: Changes specific to 
> ARM relocation support
> 
> Hello Prafulla,
> 
> Prafulla Wadaskar wrote:
> > All Kirkwood based boards are supported for this new implementation
> > ref: dovs/README.arm-relocation
> 
> should be docs/README.arm-relocation
> 
> > Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
> > ---
> >  include/configs/mv-common.h |    6 ++++++
> >  1 files changed, 6 insertions(+), 0 deletions(-)
> > 
> > diff --git a/include/configs/mv-common.h 
> b/include/configs/mv-common.h
> > index ca9f33b..b80ad00 100644
> > --- a/include/configs/mv-common.h
> > +++ b/include/configs/mv-common.h
> > @@ -56,6 +56,12 @@
> >  #error "Unsupported SoC"
> >  #endif
> >  
> > +/* additions for new ARM relocation support */
> > +#undef CONFIG_RELOC_FIXUP_WORKS
> 
> Should not be necessary.

Will remove it

> 
> > +#define CONFIG_SYS_SDRAM_BASE		0x00000000
> > +#define CONFIG_SYS_INIT_SP_ADDR		(0x00000000 + 0x1000 - \
> > +					CONFIG_SYS_GBL_DATA_SIZE)
> 
> I setup the initial stack in the SDRAM, because I didn;t know,
> if there is on this cpu family a better place for the initial stack.
> (Some cpu internal ram?)
> 
> Do you know, if we have something like this on this cpu family?

Yes, Kirkwood do have internal SRAM of 2kB size called Security SRAM
I have never used it before, I will give a try to use it. Otherwise using a data cache will be other option

Regards..
Prafulla . .

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
  2010-09-30 17:29 ` Wolfgang Denk
@ 2010-10-01  7:23   ` Prafulla Wadaskar
  0 siblings, 0 replies; 26+ messages in thread
From: Prafulla Wadaskar @ 2010-10-01  7:23 UTC (permalink / raw)
  To: u-boot

 

> -----Original Message-----
> From: Wolfgang Denk [mailto:wd at denx.de] 
> Sent: Thursday, September 30, 2010 11:00 PM
> To: Prafulla Wadaskar
> Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
> Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
> 
> Dear Prafulla Wadaskar,
> 
> In message 
> <1285869240-17251-1-git-send-email-prafulla@marvell.com> you wrote:
> > For all Kirkwood boards so far dram_init function is duplicated
> > dram_init function is moved to dram.c and relevant code from all
> > board specific files removed
> > 
> > If any board needs specific dram init handling than standard one,
> > then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in
> > board config header file and the dram_init function can be put
> > in board specific source file
> > For ex. keymile boards
> 
> Thanks, I really appreciate this patch, but I have a minor request for
> change:
> 
> > +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> > +	gd->ram_size = 0;
> > +#endif
> > +	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
> > +		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
> > +		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
> > +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> > +		gd->ram_size += gd->bd->bi_dram[i].size;
> > +#endif
> 
> When you touch this board now and make it work with
> CONFIG_SYS_ARM_WITHOUT_RELOC not defined, we should also drop all
> references to CONFIG_SYS_ARM_WITHOUT_RELOC from the code to make it
> obvious that this board has been adapted.

I will remove this dependency 
Thanks and regards..
Prafulla . .

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
  2010-10-01  5:59   ` Prafulla Wadaskar
  2010-10-01  6:17     ` Heiko Schocher
  2010-10-01  6:20     ` Albert ARIBAUD
@ 2010-10-01  7:53     ` Wolfgang Denk
  2 siblings, 0 replies; 26+ messages in thread
From: Wolfgang Denk @ 2010-10-01  7:53 UTC (permalink / raw)
  To: u-boot

Dear Prafulla Wadaskar,

In message <F766E4F80769BD478052FB6533FA745D19A696EA25@SC-VEXCH4.marvell.com> you wrote:
>  
> > This is only OK, if the memory banks are consecutive without
> > gaps ... is this true for all boards?
> 
> Yes, those are consecutive without gaps on all boards so far.
> But one can configure with gaps too, for ex. If any new board uses two chips with smaller size then it is possibility of gap insertion.
> 
> In that case how it should be?

If possible, the memory controller should be configured such that the
banks are mapped at different addresses then, so that they again form
a contiguous RAM area.

If this is not possible (because the bank base addresses cannot be
adjusted), then we have a problem.

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 at denx.de
Pig: An animal (Porcus omnivorous) closely allied to the  human  race
by  the splendor and vivacity of its appetite, which, however, is in-
ferior in scope, for it balks at pig.                - Ambrose Bierce

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c
  2010-10-01  6:17     ` Heiko Schocher
@ 2010-10-01  8:00       ` Wolfgang Denk
  0 siblings, 0 replies; 26+ messages in thread
From: Wolfgang Denk @ 2010-10-01  8:00 UTC (permalink / raw)
  To: u-boot

Dear Heiko Schocher,

[There is no need to always keep the full quote. Please delete parts
that are not interesting for the current diuscussion.]

In message <4CA57CE7.1060209@denx.de> you wrote:
> 
> > But one can configure with gaps too, for ex. If any new board uses two chips with smaller size then it is possibility of gap insertion.
> > 
> > In that case how it should be?
> 
> Good question ... for this case we must adapt in arch/arm/lib/board.c
> 
> addr = CONFIG_SYS_SDRAM_BASE + gd->ram_size;
> 
> But no idea, where to put u-boot ... at the end of the first
> bank? at the end of the last bank?

It seems logical to me to put U-Boot to the end of the bank with the
highest address.

But as mentioned before, this may be not a nice system to use. So far
we kind of assume to have a contiguous area of RAM usable.

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 at denx.de
If it went on at this rate, in several billion  years  he'd  be  rich
beyond his wildest dreams!            - Terry Pratchett, _Soul Music_

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2010-10-01  8:00 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-30 17:53 [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c Prafulla Wadaskar
2010-09-30 15:39 ` Heiko Schocher
2010-10-01  5:59   ` Prafulla Wadaskar
2010-10-01  6:17     ` Heiko Schocher
2010-10-01  8:00       ` Wolfgang Denk
2010-10-01  6:20     ` Albert ARIBAUD
2010-10-01  6:25       ` Prafulla Wadaskar
2010-10-01  7:53     ` Wolfgang Denk
2010-09-30 17:29 ` Wolfgang Denk
2010-10-01  7:23   ` Prafulla Wadaskar
2010-09-30 17:53 ` [U-Boot] [PATCH] kirkwood: added common config file mv-config.h Prafulla Wadaskar
2010-09-30 13:54   ` Rogan Dawes
2010-09-30 14:33     ` Prafulla Wadaskar
2010-09-30 15:26       ` Rogan Dawes
2010-09-30 15:35       ` Albert ARIBAUD
2010-10-01  6:10         ` Prafulla Wadaskar
2010-10-01  6:35           ` Albert ARIBAUD
2010-10-01  6:45             ` Prafulla Wadaskar
2010-09-30 17:54   ` [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support Prafulla Wadaskar
2010-09-30 15:40     ` Heiko Schocher
2010-09-30 16:21       ` Albert ARIBAUD
2010-09-30 17:50         ` Wolfgang Denk
2010-09-30 17:49       ` Wolfgang Denk
2010-09-30 22:06         ` Marek Vasut
2010-10-01  7:21       ` Prafulla Wadaskar
2010-09-30 17:34     ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.