Re: [U-Boot] [PATCH 3/6] P1021: add P1021MDS board support

2011-01-31 Thread Wolfgang Denk
Dear Kumar Gala,

In message  you wrote:
> 
> >>> +LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
> >>> +endif
> >>> +endif
> >>> +endif
> >> 
> >> Why is this config.mk needed?  Can you not do all this in the board
> >> config file instead?
> > Do you mean the board header file or arch/powerpc/config.mk? I did not
> see any LDSCRIPT defined in Freescale board header file.
> 
> I think something like:
> 
> diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h
> index e6b60cf..f2d6cdb 100644
> --- a/include/configs/MPC8572DS.h
> +++ b/include/configs/MPC8572DS.h
> @@ -37,6 +37,7 @@
>  #define CONFIG_NAND_U_BOOT
>  #define CONFIG_RAMBOOT_NAND
>  #ifdef CONFIG_NAND_SPL
> +#define CONFIG_SYS_LDSCRIPT "arch/powerpc/cpu/mpc85xx/u-boot-nand.lds"

This will eventually break with out of tree builds.

Rather use

#define CONFIG_SYS_LDSCRIPT $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds

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: w...@denx.de
There's a way out of any cage.
-- Captain Christopher Pike, "The Menagerie" ("The Cage"),
   stardate unknown.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] P1021: add P1021MDS board support

2011-01-31 Thread Wolfgang Denk
Dear Haiying Wang,

In message <1296509955.2049.543.camel@haiying-laptop> you wrote:
>
> > Why is this config.mk needed?  Can you not do all this in the board
> > config file instead?
> Do you mean the board header file or arch/powerpc/config.mk? I did not see 
> any LDSCRIPT defined in Freescale board header file.

I mean the board config header file, include/configs/.h

> > > diff --git a/board/freescale/p1021mds/ddr.c 
> > > b/board/freescale/p1021mds/ddr.c
> > > new file mode 100644
> > > index 000..594a4a8
> > > --- /dev/null
> > > +++ b/board/freescale/p1021mds/ddr.c
> > 
> > It seems there are a number of functions here which ar actually shared
> > with other files, for example board/freescale/p1022ds/ddr.c.
> Every boards has its board specific ddr parameters which are defined the its 
> own board ddr.c. The common code for ddr has been defined in 
> arch/powerpc/cpu/mpc8xxx/ddr/.

Well, but there is tons of common code. For example, all of

board/freescale/corenet_ds/ddr.c
board/freescale/mpc8536ds/ddr.c
board/freescale/mpc8540ads/ddr.c
board/freescale/mpc8541cds/ddr.c
board/freescale/mpc8544ds/ddr.c
board/freescale/mpc8548cds/ddr.c
board/freescale/mpc8555cds/ddr.c
board/freescale/mpc8560ads/ddr.c
board/freescale/mpc8568mds/ddr.c
board/freescale/mpc8569mds/ddr.c
board/freescale/mpc8572ds/ddr.c
board/freescale/mpc8610hpcd/ddr.c
board/freescale/mpc8641hpcn/ddr.c
board/freescale/p1021mds/ddr.c
board/freescale/p1022ds/ddr.c
board/freescale/p2020ds/ddr.c

share the same function

unsigned int fsl_ddr_get_mem_data_rate(void)
{
return get_ddr_freq(0);
}

And

board/freescale/p1021mds/ddr.c
board/freescale/p1022ds/ddr.c

share (except for the comment) the same

void fsl_ddr_get_spd(ddr3_spd_eeprom_t *ctrl_dimms_spd, unsigned int 
ctrl_num)

while
board/freescale/corenet_ds/ddr.c
board/freescale/mpc8569mds/ddr.c

use another variant, but again both boards the same one.


> If you go to see each ddr.c, you can find there is
> fsl_ddr_board_options() which defines the different values for each
> board. Also fsl_ddr_get_spd() is also highly dependent on board, like
> ddr type(ddr2 or ddr3), i2c spd eeprom address, ddr controller# etc.

Actually this is not quite true. See examples above.

> > > +void board_lmb_reserve(struct lmb *lmb)
> > > +{
> > > + cpu_mp_lmb_reserve(lmb);
> > > +}
> > 
> > How many board/freescale//.c file share this same code?
> There are some, but I don't know whether there will be difference coming in 
> later.

Then we can use a common implementation for all where it fits, and
use board specific code only where needed.

> > > diff --git a/board/freescale/p1021mds/tlb.c 
> > > b/board/freescale/p1021mds/tlb.c
> > > new file mode 100644
> > > index 000..30af6dd
> > > --- /dev/null
> > > +++ b/board/freescale/p1021mds/tlb.c
> > 
> > How much of this is actually different from - say -
> > board/freescale/p1022ds/tlb.c ?
> The tlb.c is also a highly board dependent file. Different boards have 
> different supported peripherals. If you look at p1021 and p1022's tlb.c 
> files, you can see p1022ds has 3 PCIE, P1021 has 2, P1022ds has NOR flash, 
> P1021MDS only has NAND flash... etc

Yes, there are differences. But it seems there is more common code
than differing one?

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: w...@denx.de
A penny saved is a penny to squander.
- Ambrose Bierce
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] P1021: add P1021MDS board support

2011-01-31 Thread Kumar Gala

On Jan 31, 2011, at 3:39 PM, Haiying Wang wrote:

> On Mon, 2011-01-31 at 21:03 +0100, Wolfgang Denk wrote:
>> Dear haiying.w...@freescale.com,
>>> diff --git a/board/freescale/p1021mds/config.mk 
>>> b/board/freescale/p1021mds/config.mk
>>> new file mode 100644
>>> index 000..3888f61
>>> --- /dev/null
>>> +++ b/board/freescale/p1021mds/config.mk
>> ...
>>> +ifndef NAND_SPL
>>> +ifndef IN_TPL
>>> +ifeq ($(CONFIG_NAND), y)
>>> +LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
>>> +endif
>>> +endif
>>> +endif
>> 
>> Why is this config.mk needed?  Can you not do all this in the board
>> config file instead?
> Do you mean the board header file or arch/powerpc/config.mk? I did not see 
> any LDSCRIPT defined in Freescale board header file.

I think something like:

diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h
index e6b60cf..f2d6cdb 100644
--- a/include/configs/MPC8572DS.h
+++ b/include/configs/MPC8572DS.h
@@ -37,6 +37,7 @@
 #define CONFIG_NAND_U_BOOT
 #define CONFIG_RAMBOOT_NAND
 #ifdef CONFIG_NAND_SPL
+#define CONFIG_SYS_LDSCRIPT "arch/powerpc/cpu/mpc85xx/u-boot-nand.lds"
 #define CONFIG_SYS_TEXT_BASE_SPL 0xfff0
 #define CONFIG_SYS_MONITOR_BASECONFIG_SYS_TEXT_BASE_SPL /* start of mon

- k
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] P1021: add P1021MDS board support

2011-01-31 Thread Kumar Gala
> It seems there are a number of functions here which ar actually shared
> with other files, for example board/freescale/p1022ds/ddr.c.
> 
> I wonder if it is not possible to use more common code here - especially
> given the fact that we already have a nice collection of such files:
> 
>   board/freescale/corenet_ds/ddr.c
>   board/freescale/mpc8536ds/ddr.c
>   board/freescale/mpc8540ads/ddr.c
>   board/freescale/mpc8541cds/ddr.c
>   board/freescale/mpc8544ds/ddr.c
>   board/freescale/mpc8548cds/ddr.c
>   board/freescale/mpc8555cds/ddr.c
>   board/freescale/mpc8560ads/ddr.c
>   board/freescale/mpc8568mds/ddr.c
>   board/freescale/mpc8569mds/ddr.c
>   board/freescale/mpc8572ds/ddr.c
>   board/freescale/mpc8610hpcd/ddr.c
>   board/freescale/mpc8641hpcn/ddr.c
>   board/freescale/p1022ds/ddr.c
>   board/freescale/p1_p2_rdb/ddr.c
>   board/freescale/p2020ds/ddr.c

We've already done that, the code in these files is board specific 
params/tuning of DDR params.


>   
>> diff --git a/board/freescale/p1021mds/p1021mds.c 
>> b/board/freescale/p1021mds/p1021mds.c
>> new file mode 100644
>> index 000..c7a7e57
>> --- /dev/null
>> +++ b/board/freescale/p1021mds/p1021mds.c
> ...
>> +extern void cpu_mp_lmb_reserve(struct lmb *lmb);

We have this in  already.

Will cleanup the other guys

> Please move prototypes to header file.
> 
>> +void board_lmb_reserve(struct lmb *lmb)
>> +{
>> +cpu_mp_lmb_reserve(lmb);
>> +}
> 
> How many board/freescale//.c file share this same code?

All of our multicore parts do this, we could move this into other places like 
arch_lmb_reserve().

>> diff --git a/board/freescale/p1021mds/tlb.c b/board/freescale/p1021mds/tlb.c
>> new file mode 100644
>> index 000..30af6dd
>> --- /dev/null
>> +++ b/board/freescale/p1021mds/tlb.c
> 
> How much of this is actually different from - say -
> board/freescale/p1022ds/tlb.c ?

Its mostly board specific.

- k
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] P1021: add P1021MDS board support

2011-01-31 Thread Haiying Wang
On Mon, 2011-01-31 at 21:03 +0100, Wolfgang Denk wrote:
> Dear haiying.w...@freescale.com,
> > diff --git a/board/freescale/p1021mds/config.mk 
> > b/board/freescale/p1021mds/config.mk
> > new file mode 100644
> > index 000..3888f61
> > --- /dev/null
> > +++ b/board/freescale/p1021mds/config.mk
> ...
> > +ifndef NAND_SPL
> > +ifndef IN_TPL
> > +ifeq ($(CONFIG_NAND), y)
> > +LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
> > +endif
> > +endif
> > +endif
> 
> Why is this config.mk needed?  Can you not do all this in the board
> config file instead?
Do you mean the board header file or arch/powerpc/config.mk? I did not see any 
LDSCRIPT defined in Freescale board header file.

> > diff --git a/board/freescale/p1021mds/ddr.c b/board/freescale/p1021mds/ddr.c
> > new file mode 100644
> > index 000..594a4a8
> > --- /dev/null
> > +++ b/board/freescale/p1021mds/ddr.c
> 
> It seems there are a number of functions here which ar actually shared
> with other files, for example board/freescale/p1022ds/ddr.c.
Every boards has its board specific ddr parameters which are defined the its 
own board ddr.c. The common code for ddr has been defined in 
arch/powerpc/cpu/mpc8xxx/ddr/.

> I wonder if it is not possible to use more common code here - especially
> given the fact that we already have a nice collection of such files:
> 
>   board/freescale/corenet_ds/ddr.c
>   board/freescale/mpc8536ds/ddr.c
>   board/freescale/mpc8540ads/ddr.c
>   board/freescale/mpc8541cds/ddr.c
>   board/freescale/mpc8544ds/ddr.c
>   board/freescale/mpc8548cds/ddr.c
>   board/freescale/mpc8555cds/ddr.c
>   board/freescale/mpc8560ads/ddr.c
>   board/freescale/mpc8568mds/ddr.c
>   board/freescale/mpc8569mds/ddr.c
>   board/freescale/mpc8572ds/ddr.c
>   board/freescale/mpc8610hpcd/ddr.c
>   board/freescale/mpc8641hpcn/ddr.c
>   board/freescale/p1022ds/ddr.c
>   board/freescale/p1_p2_rdb/ddr.c
>   board/freescale/p2020ds/ddr.c
If you go to see each ddr.c, you can find there is
fsl_ddr_board_options() which defines the different values for each
board. Also fsl_ddr_get_spd() is also highly dependent on board, like
ddr type(ddr2 or ddr3), i2c spd eeprom address, ddr controller# etc.
Only  fsl_ddr_get_mem_data_rate()might be moved to common code.

> > +void board_lmb_reserve(struct lmb *lmb)
> > +{
> > +   cpu_mp_lmb_reserve(lmb);
> > +}
> 
> How many board/freescale//.c file share this same code?
There are some, but I don't know whether there will be difference coming in 
later.

> 
> > diff --git a/board/freescale/p1021mds/tlb.c b/board/freescale/p1021mds/tlb.c
> > new file mode 100644
> > index 000..30af6dd
> > --- /dev/null
> > +++ b/board/freescale/p1021mds/tlb.c
> 
> How much of this is actually different from - say -
> board/freescale/p1022ds/tlb.c ?
The tlb.c is also a highly board dependent file. Different boards have 
different supported peripherals. If you look at p1021 and p1022's tlb.c files, 
you can see p1022ds has 3 PCIE, P1021 has 2, P1022ds has NOR flash, P1021MDS 
only has NAND flash... etc.


Haiying



___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] P1021: add P1021MDS board support

2011-01-31 Thread Scott Wood
On Mon, 31 Jan 2011 21:18:35 +0100
Wolfgang Denk  wrote:

> Dear Scott Wood,
> 
> In message <20110131140801.33609...@udp111988uds.am.freescale.net> you wrote:
> >
> > > Please rather omit the setting instead of using fillers that are of no
> > > practical value.
> > 
> > Well, they do make it easier for a user to quickly see what the names
> > are that U-Boot expects for such commonly used things, rather than
> > having to scan the manual.
> 
> I doubt both the "quicly see" part (in such a long list of settings)
> and the "rather than having to scan the manual" part.

I've found it convenient, along with the more meaningful error
messages if I forget to replace one of them.  YMMV.

> > > > +   "ramdiskfile=your.ramdisk.u-boot\0" 
> > > > \
> > > 
> > > Ditto. [BTW: why "ramdisk.u-boot"? U-Boot does not use ramdisks.
> > > The ramdisk is only used for some OS, so that should probably be
> > > "...ramdisk.linux" instead?]
> > 
> > We often use the ".u-boot" suffix on ramdisks that have been wrapped
> > with a uImage header.
> 
> That would be a "uRamdisk" then (similar to uImage).

Is anyone actually calling it that?  What if I have multiple ramdisk
images that I want to call different names?

FWIW, for non-Linux OS images we sometimes use .uImage as a suffix.

-Scott

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] P1021: add P1021MDS board support

2011-01-31 Thread Wolfgang Denk
Dear Scott Wood,

In message <20110131140801.33609...@udp111988uds.am.freescale.net> you wrote:
>
> > Please rather omit the setting instead of using fillers that are of no
> > practical value.
> 
> Well, they do make it easier for a user to quickly see what the names
> are that U-Boot expects for such commonly used things, rather than
> having to scan the manual.

I doubt both the "quicly see" part (in such a long list of settings)
and the "rather than having to scan the manual" part.

> > > + "ramdiskfile=your.ramdisk.u-boot\0" \
> > 
> > Ditto. [BTW: why "ramdisk.u-boot"? U-Boot does not use ramdisks.
> > The ramdisk is only used for some OS, so that should probably be
> > "...ramdisk.linux" instead?]
> 
> We often use the ".u-boot" suffix on ramdisks that have been wrapped
> with a uImage header.

That would be a "uRamdisk" then (similar to uImage).

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: w...@denx.de
It usually takes more than three weeks to prepare  a  good  impromptu
speech.  - Mark Twain
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] P1021: add P1021MDS board support

2011-01-31 Thread Scott Wood
On Mon, 31 Jan 2011 21:03:17 +0100
Wolfgang Denk  wrote:

> > +/*
> > + * Environment Configuration
> > + */
> > +#define CONFIG_HOSTNAMEp1021mds
> > +#define CONFIG_ROOTPATH/nfsroot
> > +#define CONFIG_BOOTFILEyour.uImage
> 
> Please rather omit the setting instead of using fillers that are of no
> practical value.

Well, they do make it easier for a user to quickly see what the names
are that U-Boot expects for such commonly used things, rather than
having to scan the manual.

> > +#define CONFIG_LOADADDR100   /*default location for tftp and 
> > bootm*/
> > +
> > +#define CONFIG_BOOTDELAY 10   /* -1 disables auto-boot */
> > +#undef  CONFIG_BOOTARGS   /* the boot command will set bootargs*/
> > +
> > +#defineCONFIG_EXTRA_ENV_SETTINGS   
> > \
> > +   "netdev=eth0\0" \
> > +   "consoledev=ttyS0\0"\
> > +   "ramdiskaddr=200\0" \
> > +   "ramdiskfile=your.ramdisk.u-boot\0" \
> 
> Ditto. [BTW: why "ramdisk.u-boot"? U-Boot does not use ramdisks.
> The ramdisk is only used for some OS, so that should probably be
> "...ramdisk.linux" instead?]

We often use the ".u-boot" suffix on ramdisks that have been wrapped
with a uImage header.

-Scott

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] P1021: add P1021MDS board support

2011-01-31 Thread Wolfgang Denk
Dear haiying.w...@freescale.com,

In message <1296499317-26616-4-git-send-email-haiying.w...@freescale.com> you 
wrote:
> From: Haiying Wang 
> 
> Support P1021MDS board to boot from NAND flash (No NOR flash on this
> board). And because P1021 only has 256K L2 SRAM, which can not used for final
> uboot image, this patch also enables the TPL BOOT on P1021MDS so that DDR can
> be initialized in L2 SRAM through SPD code. So there are three stage uboot
> images:
> * nand_spl, pad from 4KB size to 16KB, load tpl_boot from offset 16KB in NAND.
> * tpl_boot, 112KB size. The env variables are copied to offset 128KB
>   in L2 SRAM, so that ddr spd code can get the interleaving mode setting in 
> env.
>   It loads final uboot image from offset 128KB in NAND.
> * final uboot image, size is variable depends on the functions enabled.


> diff --git a/board/freescale/p1021mds/config.mk 
> b/board/freescale/p1021mds/config.mk
> new file mode 100644
> index 000..3888f61
> --- /dev/null
> +++ b/board/freescale/p1021mds/config.mk
...
> +ifndef NAND_SPL
> +ifndef IN_TPL
> +ifeq ($(CONFIG_NAND), y)
> +LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
> +endif
> +endif
> +endif

Why is this config.mk needed?  Can you not do all this in the board
config file instead?

> diff --git a/board/freescale/p1021mds/ddr.c b/board/freescale/p1021mds/ddr.c
> new file mode 100644
> index 000..594a4a8
> --- /dev/null
> +++ b/board/freescale/p1021mds/ddr.c

It seems there are a number of functions here which ar actually shared
with other files, for example board/freescale/p1022ds/ddr.c.

I wonder if it is not possible to use more common code here - especially
given the fact that we already have a nice collection of such files:

board/freescale/corenet_ds/ddr.c
board/freescale/mpc8536ds/ddr.c
board/freescale/mpc8540ads/ddr.c
board/freescale/mpc8541cds/ddr.c
board/freescale/mpc8544ds/ddr.c
board/freescale/mpc8548cds/ddr.c
board/freescale/mpc8555cds/ddr.c
board/freescale/mpc8560ads/ddr.c
board/freescale/mpc8568mds/ddr.c
board/freescale/mpc8569mds/ddr.c
board/freescale/mpc8572ds/ddr.c
board/freescale/mpc8610hpcd/ddr.c
board/freescale/mpc8641hpcn/ddr.c
board/freescale/p1022ds/ddr.c
board/freescale/p1_p2_rdb/ddr.c
board/freescale/p2020ds/ddr.c

> diff --git a/board/freescale/p1021mds/p1021mds.c 
> b/board/freescale/p1021mds/p1021mds.c
> new file mode 100644
> index 000..c7a7e57
> --- /dev/null
> +++ b/board/freescale/p1021mds/p1021mds.c
...
> +extern void cpu_mp_lmb_reserve(struct lmb *lmb);

Please move prototypes to header file.

> +void board_lmb_reserve(struct lmb *lmb)
> +{
> + cpu_mp_lmb_reserve(lmb);
> +}

How many board/freescale//.c file share this same code?


> diff --git a/board/freescale/p1021mds/tlb.c b/board/freescale/p1021mds/tlb.c
> new file mode 100644
> index 000..30af6dd
> --- /dev/null
> +++ b/board/freescale/p1021mds/tlb.c

How much of this is actually different from - say -
board/freescale/p1022ds/tlb.c ?


...
> +/*
> + * Environment Configuration
> + */
> +#define CONFIG_HOSTNAME  p1021mds
> +#define CONFIG_ROOTPATH  /nfsroot
> +#define CONFIG_BOOTFILE  your.uImage

Please rather omit the setting instead of using fillers that are of no
practical value.

> +#define CONFIG_LOADADDR  100   /*default location for tftp and 
> bootm*/
> +
> +#define CONFIG_BOOTDELAY 10   /* -1 disables auto-boot */
> +#undef  CONFIG_BOOTARGS   /* the boot command will set bootargs*/
> +
> +#define  CONFIG_EXTRA_ENV_SETTINGS   
> \
> + "netdev=eth0\0" \
> + "consoledev=ttyS0\0"\
> + "ramdiskaddr=200\0" \
> + "ramdiskfile=your.ramdisk.u-boot\0" \

Ditto. [BTW: why "ramdisk.u-boot"? U-Boot does not use ramdisks.
The ramdisk is only used for some OS, so that should probably be
"...ramdisk.linux" instead?]

> + "fdtaddr=c0\0"  \
> + "fdtfile=your.fdt.dtb\0"\

Ditto. [Are "fdt" and "dtb" not redundant?]

> diff --git a/tpl/board/freescale/p1021mds/tpl_boot.c 
> b/tpl/board/freescale/p1021mds/tpl_boot.c
> new file mode 100644
> index 000..386d76c
> --- /dev/null
> +++ b/tpl/board/freescale/p1021mds/tpl_boot.c
...
> +extern void nand_load(unsigned int offs, int uboot_size, uchar *dst);
> +extern phys_size_t init_ddr_dram(void);

Please move prototypes to header files.


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: w...@denx.de
Any sufficiently advanced bug is indisting

[U-Boot] [PATCH 3/6] P1021: add P1021MDS board support

2011-01-31 Thread Haiying.Wang
From: Haiying Wang 

Support P1021MDS board to boot from NAND flash (No NOR flash on this
board). And because P1021 only has 256K L2 SRAM, which can not used for final
uboot image, this patch also enables the TPL BOOT on P1021MDS so that DDR can
be initialized in L2 SRAM through SPD code. So there are three stage uboot
images:
* nand_spl, pad from 4KB size to 16KB, load tpl_boot from offset 16KB in NAND.
* tpl_boot, 112KB size. The env variables are copied to offset 128KB
  in L2 SRAM, so that ddr spd code can get the interleaving mode setting in env.
  It loads final uboot image from offset 128KB in NAND.
* final uboot image, size is variable depends on the functions enabled.

Signed-off-by: Haiying Wang 
Signed-off-by: Mohit Kumar 
Signed-off-by: Yu Liu 
Signed-off-by: Kai Jiang 
---
 MAINTAINERS   |4 +
 board/freescale/p1021mds/Makefile |   52 +++
 board/freescale/p1021mds/config.mk|   31 ++
 board/freescale/p1021mds/ddr.c|  107 +
 board/freescale/p1021mds/law.c|   34 ++
 board/freescale/p1021mds/p1021mds.c   |  133 ++
 board/freescale/p1021mds/tlb.c|  102 +
 boards.cfg|1 +
 include/configs/P1021MDS.h|  535 +
 nand_spl/board/freescale/p1021mds/Makefile|  134 ++
 nand_spl/board/freescale/p1021mds/nand_boot.c |   69 
 nand_spl/nand_boot_fsl_elbc.c |6 +-
 tpl/board/freescale/p1021mds/Makefile |  257 
 tpl/board/freescale/p1021mds/tpl_boot.c   |   79 
 14 files changed, 1543 insertions(+), 1 deletions(-)
 create mode 100644 board/freescale/p1021mds/Makefile
 create mode 100644 board/freescale/p1021mds/config.mk
 create mode 100644 board/freescale/p1021mds/ddr.c
 create mode 100644 board/freescale/p1021mds/law.c
 create mode 100644 board/freescale/p1021mds/p1021mds.c
 create mode 100644 board/freescale/p1021mds/tlb.c
 create mode 100644 include/configs/P1021MDS.h
 create mode 100644 nand_spl/board/freescale/p1021mds/Makefile
 create mode 100644 nand_spl/board/freescale/p1021mds/nand_boot.c
 create mode 100644 tpl/board/freescale/p1021mds/Makefile
 create mode 100644 tpl/board/freescale/p1021mds/tpl_boot.c

diff --git a/MAINTAINERS b/MAINTAINERS
index edd1c5c..da1b2a3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17,6 +17,10 @@
 #  Board   CPU #
 #
 
+Haiying Wang 
+
+   P1021MDSP1021
+
 Poonam Aggrwal 
 
P2020RDBP2020
diff --git a/board/freescale/p1021mds/Makefile 
b/board/freescale/p1021mds/Makefile
new file mode 100644
index 000..50d4743
--- /dev/null
+++ b/board/freescale/p1021mds/Makefile
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2010-2011 Freescale Semiconductor, Inc.
+#
+# 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., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS-y+= $(BOARD).o
+COBJS-y+= law.o
+COBJS-y+= tlb.o
+COBJS-y+= ddr.o
+
+SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+SOBJS  := $(addprefix $(obj),$(SOBJS-y))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS)
+
+clean:
+   rm -f $(OBJS) $(SOBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/freescale/p1021mds/config.mk 
b/board/freescale/p1021mds/config.mk
new file mode 100644
index 000..3888f61
--- /dev/null
+++ b/board/freescale/p1021mds/config.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2010 - 2011 Freescale Semiconductor, Inc.
+#
+# 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 Foundat