Re: [U-Boot] [PATCH 3/7] Add support for third program loader

2010-11-24 Thread Haiying Wang
On Tue, 2010-11-23 at 13:57 -0700, Wolfgang Denk wrote:
> Dear Haiying Wang,
> > Does CONFIG_TPL_UBOOT make sense to you if I replace
> CONFIG_SYS_TPL_BOOT
> > with it?
> 
> I cannot answer this. Don't understand any of this.
> 
> Maybe you can re-think this again and try to make it less complex, and
> the add a description of the then used new variables to the README.
> We need this documentation anyway.  Maybe I can understand this
> documentation then, and provide better comment.  Sorry,

Sorry for the unclear statement in patch. A new patch is sending out
soon to only address the changes in Makefile and add the description in
README.

Thanks.

Haiying



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


Re: [U-Boot] [PATCH 3/7] Add support for third program loader

2010-11-23 Thread Scott Wood
On Tue, 23 Nov 2010 21:57:04 +0100
Wolfgang Denk  wrote:

> Dear Haiying Wang,
> 
> In message <1290525198.1932.3.ca...@haiying-laptop> you wrote:
> >
> > > Please use only one such name (CONFIG_SYS_TPL_BOOT).
> > CONFIG_SYS_TPL_BOOT is used as CONFIG_NAND_U_BOOT in Makefile and header
> > file.
> > CONFIG_TPL_BOOT is used as CONFIG_NAND_SPL in header file.
> 
> I'm sorry, but I have to admit that I don;t understand what you are
> trying to tell me.
> 
> Why do you need XXX when you use it as YYY? Why don't you use YYY
> directly?

CONFIG_NAND_U_BOOT indicates that there is a NAND SPL involved, and is
set in both build stages.

CONFIG_NAND_SPL is set only when building the SPL code itself.

When Haiying said "used as CONFIG_NAND_...", I believe she meant that
the difference between these two symbols is analagous to the difference
between the two NAND symbols -- not that they can be used
interchangeably.

I think the names need to be differentiated by more than just "_SYS",
though.

-Scott

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


Re: [U-Boot] [PATCH 3/7] Add support for third program loader

2010-11-23 Thread Wolfgang Denk
Dear Haiying Wang,

In message <1290525198.1932.3.ca...@haiying-laptop> you wrote:
>
> > Please use only one such name (CONFIG_SYS_TPL_BOOT).
> CONFIG_SYS_TPL_BOOT is used as CONFIG_NAND_U_BOOT in Makefile and header
> file.
> CONFIG_TPL_BOOT is used as CONFIG_NAND_SPL in header file.

I'm sorry, but I have to admit that I don;t understand what you are
trying to tell me.

Why do you need XXX when you use it as YYY? Why don't you use YYY
directly?

> Does CONFIG_TPL_UBOOT make sense to you if I replace CONFIG_SYS_TPL_BOOT
> with it?

I cannot answer this. Don't understand any of this.

Maybe you can re-think this again and try to make it less complex, and
the add a description of the then used new variables to the README.
We need this documentation anyway.  Maybe I can understand this
documentation then, and provide better comment.  Sorry,

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
For every complex problem, there is a solution that is simple,  neat,
and wrong.   - Mark Twain
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/7] Add support for third program loader

2010-11-23 Thread Haiying Wang
On Mon, 2010-11-22 at 21:58 -0700, Wolfgang Denk wrote:
> Dear haiying.w...@freescale.com,
> 
> In message
> <1290462446-1459-3-git-send-email-haiying.w...@freescale.com> you
> wrote:
> > From: Haiying Wang 
> >
> > This patch introduces the third program loader(TPL) to load the
> final uboot
> > image after the spl code. Once the CONFIG_SYS_TPL_BOOT is defined,
> > the CONFIG_TPL_BOOT is enabled to generate the u-boot-tpl.bin. There
> are two
> 
> This makes no sense to me.  Why do you need an additional variable
> CONFIG_TPL_BOOT when you already have CONFIG_SYS_TPL_BOOT ?
> 
> Please use only one such name (CONFIG_SYS_TPL_BOOT).
CONFIG_SYS_TPL_BOOT is used as CONFIG_NAND_U_BOOT in Makefile and header
file.
CONFIG_TPL_BOOT is used as CONFIG_NAND_SPL in header file.

Does CONFIG_TPL_UBOOT make sense to you if I replace CONFIG_SYS_TPL_BOOT
with it?

Thanks.

Haiying



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


Re: [U-Boot] [PATCH 3/7] Add support for third program loader

2010-11-22 Thread Wolfgang Denk
Dear haiying.w...@freescale.com,

In message <1290462446-1459-3-git-send-email-haiying.w...@freescale.com> you 
wrote:
> From: Haiying Wang 
> 
> This patch introduces the third program loader(TPL) to load the final uboot
> image after the spl code. Once the CONFIG_SYS_TPL_BOOT is defined,
> the CONFIG_TPL_BOOT is enabled to generate the u-boot-tpl.bin. There are two

This makes no sense to me.  Why do you need an additional variable
CONFIG_TPL_BOOT when you already have CONFIG_SYS_TPL_BOOT ?

Please use only one such name (CONFIG_SYS_TPL_BOOT).

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: w...@denx.de
The first 90% of a project takes 90% of the time, the last 10%  takes
the other 90% of the time.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/7] Add support for third program loader

2010-11-22 Thread Haiying.Wang
From: Haiying Wang 

This patch introduces the third program loader(TPL) to load the final uboot
image after the spl code. Once the CONFIG_SYS_TPL_BOOT is defined,
the CONFIG_TPL_BOOT is enabled to generate the u-boot-tpl.bin. There are two
examples to use tpl:
1. NAND boot. The 4K NAND SPL uboot can not enable ddr through spd code because
of the 4k size limitation, and the l2/l3 as SRAM also is not large enough to
accommodate the final uboot image.
2. SD/eSPI boot. We don't want to statically init ddr in SD/eSPI's configuration
structure in ROM, but the l2/l3 SRAM size is small for final uboot.

It can also be used for other cases which need to execute the necessary init
steps before loading the final uboot image.

Signed-off-by: Haiying Wang 
---
 Makefile |   14 
 arch/powerpc/cpu/mpc85xx/cpu_init_nand.c |   34 ++-
 arch/powerpc/cpu/mpc85xx/start.S |   11 +++
 arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds  |   98 ++
 nand_spl/nand_boot_fsl_elbc.c|6 ++-
 5 files changed, 160 insertions(+), 3 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds

diff --git a/Makefile b/Makefile
index b4aae89..71aaa9c 100644
--- a/Makefile
+++ b/Makefile
@@ -287,6 +287,10 @@ LDPPFLAGS += \
$(shell $(LD) --version | \
  sed -ne 's/GNU ld version 
\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
 
+ifeq ($(CONFIG_SYS_TPL_BOOT),y)
+TPL_BOOT = tpl
+endif
+
 ifeq ($(CONFIG_NAND_U_BOOT),y)
 NAND_SPL = nand_spl
 U_BOOT_NAND = $(obj)u-boot-nand.bin
@@ -404,8 +408,16 @@ $(obj)u-boot.lds: $(LDSCRIPT)
 $(NAND_SPL):   $(TIMESTAMP_FILE) $(VERSION_FILE) depend
$(MAKE) -C nand_spl/board/$(BOARDDIR) all
 
+$(TPL_BOOT):   $(TIMESTAMP_FILE) $(VERSION_FILE) depend
+   $(MAKE) -C tpl/board/$(BOARDDIR) all
+
+ifeq ($(CONFIG_SYS_TPL_BOOT),y)
+$(U_BOOT_NAND): $(NAND_SPL) $(TPL_BOOT) $(obj)u-boot.bin
+   cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)tpl/u-boot-tpl.bin 
$(obj)u-boot.bin > $(obj)u-boot-nand.bin
+else
 $(U_BOOT_NAND):$(NAND_SPL) $(obj)u-boot.bin
cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > 
$(obj)u-boot-nand.bin
+endif
 
 $(ONENAND_IPL):$(TIMESTAMP_FILE) $(VERSION_FILE) 
$(obj)include/autoconf.mk
$(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
@@ -1223,6 +1235,7 @@ clean:
@rm -f $(obj)lib/asm-offsets.s
@rm -f $(obj)nand_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,System.map}
@rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map}
+   @rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.map}
@rm -f $(ONENAND_BIN)
@rm -f $(obj)onenand_ipl/u-boot.lds
@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
@@ -1247,6 +1260,7 @@ clobber:  clean
@rm -fr $(obj)include/generated
@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l 
-print | xargs rm -f
@[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l 
-print | xargs rm -f
+   @[ ! -d $(obj)tpl ] || find $(obj)tpl -name "*" -type l -print | xargs 
rm -f
 
 ifeq ($(OBJTREE),$(SRCTREE))
 mrproper \
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init_nand.c 
b/arch/powerpc/cpu/mpc85xx/cpu_init_nand.c
index 8fb27ab..decedca 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init_nand.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init_nand.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Freescale Semiconductor, Inc.
+ * Copyright 2010 Freescale Semiconductor, Inc.
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -40,7 +40,8 @@ void cpu_init_f(void)
 #error  CONFIG_NAND_BR_PRELIM, CONFIG_NAND_OR_PRELIM must be defined
 #endif
 
-#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L2_ADDR)
+#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L2_ADDR) \
+   && !defined(CONFIG_TPL_BOOT)
ccsr_l2cache_t *l2cache = (void *)CONFIG_SYS_MPC85xx_L2_ADDR;
char *l2srbar;
int i;
@@ -60,4 +61,33 @@ void cpu_init_f(void)
for (i = 0; i < CONFIG_SYS_L2_SIZE; i++)
l2srbar[i] = 0;
 #endif
+#ifdef CONFIG_TPL_BOOT
+   init_used_tlb_cams();
+#endif
+}
+
+#ifdef CONFIG_TPL_BOOT
+/*
+ * Because the primary cpu's info is enough for the 2nd stage,  we define the
+ * cpu number to 1 so as to keep code size for 2nd stage binary as small as
+ * possible.
+ */
+int cpu_numcores()
+{
+   return 1;
+}
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Get timebase clock frequency
+ */
+unsigned long get_tbclk(void)
+{
+#ifdef CONFIG_FSL_CORENET
+   return (gd->bus_clk + 8) / 16;
+#else
+   return (gd->bus_clk + 4UL)/8UL;
+#endif
 }
+#endif /* CONFIG_TPL_BOOT */
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 945c1b8..91f9eeb 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -58,12 +58,14 @@
GOT_ENTRY(_GOT2_TABLE_)
GOT_ENTRY(_FIXUP_TABLE_)
 
+#ifnd