[U-Boot] [PATCH 5/7] Make a special uboot used for booting from SDcard or SPI flash

Hu Mingkai-B21284 Mingkai.Hu at freescale.com
Tue Mar 17 13:16:00 CET 2009


 

> -----Original Message-----
> From: Wolfgang Denk [mailto:wd at denx.de] 
> Sent: Monday, March 16, 2009 4:56 PM
> To: Hu Mingkai-B21284
> Cc: Fleming Andy-AFLEMING; u-boot at lists.denx.de; Jin Zhengxiong-R64188
> Subject: Re: [U-Boot] [PATCH 5/7] Make a special uboot used 
> for booting from SDcard or SPI flash
> 
> Dear Mingkai Hu,
> 
> In message 
> <1237171943-11938-5-git-send-email-Mingkai.hu at freescale.com> 
> you wrote:
> > This patch is used to generate a special version u-boot, 
> together with 
> > the data structure on the SDcard/SPI flash, can be used to booting 
> > from SDcard/SPI flash on 8536DS board.
> > 
> > The boot ROM in CPU and the data structure on SD card will 
> initialize 
> > the DDR, set a large tlb0 for DDR and CCSR, set law0 for DDR. The 
> > special version uboot avoid initializing the DDR. Try to reseve the 
> > law0 for DDR by adding a CONFIG_SYS_RESERVED_LAW0 macro for 
> the "dynamic law allocation"
> > code. But keep the original tlb initialize code for DDR, 
> disabled the 
> > large tlb0 which was set in the boot ROM.
> > 
> > This patch is intend for those who are interested in the 
> function of 
> > booting from SD card on 8536DS board and not for opensource.
> -------------------------------------------^^^^^^^^^^^^^^^^^^^^
> 
> Can you please explain what exactly this is supposed to mean?
> 

Oh, it should be deleted :-)

> > An utility is needed to write the data structure and the special 
> > version u-boot onto the SD card which has filesystem on it 
> or onto the 
> > SPI flash.
> 
> Cannot this be done with U-Boot, or with Linux running on any 
> other system that das a SDCard reader/writer attached to it?
> 

It's hard to do that, in order to support booting from the SDCard,
we place the data structure onto the unused space on the MBR
on the SDCard.

> > @@ -2360,6 +2360,18 @@ ATUM8548_config:	unconfig
> >  MPC8536DS_config:       unconfig
> >  	@$(MKCONFIG) $(@:_config=) ppc mpc85xx mpc8536ds freescale
> >  
> > +MPC8536DS_SPIFLASH_config \
> > +MPC8536DS_SDCARD_config:	unconfig
> > +	@echo "" >$(obj)include/config.h;
> > +	@if [ "$(findstring _SPIFLASH_,$@)" ] ; then \
> > +		echo "#define CONFIG_SPIFLASH_U_BOOT" >> 
> $(obj)include/config.h ; \
> > +	fi ;
> > +	@echo "#define CONFIG_SDCARD_U_BOOT" >> $(obj)include/config.h ;
> > +	@$(MKCONFIG) -a MPC8536DS ppc mpc85xx mpc8536ds freescale ; \
> > +		echo "TEXT_BASE = 0x11001000" > 
> $(obj)board/freescale/mpc8536ds/config.tmp ; \
> > +		echo "#define CONFIG_SDCARD_U_BOOT" >> 
> $(obj)include/config.h ;  \
> > +		echo "CONFIG_SDCARD_U_BOOT = y" >> 
> $(obj)include/config.mk ;
> > +
> 
> Please do noty swamp the top level Makefile with 
> configuration options for one board.
> 

Could you give me some suggestion? ;-)
Where is the proper position to handle this?

> > diff --git a/board/freescale/mpc8536ds/tlb.c 
> > b/board/freescale/mpc8536ds/tlb.c index 35a13d4..cb570ef 100644
> > --- a/board/freescale/mpc8536ds/tlb.c
> > +++ b/board/freescale/mpc8536ds/tlb.c
> > @@ -27,6 +27,8 @@
> >  #include <asm/mmu.h>
> >  
> >  struct fsl_e_tlb_entry tlb_table[] = {
> > +
> > +#if !defined(CONFIG_SDCARD_U_BOOT)
> >  	/* TLB 0 - for temp stack in cache */
> >  	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR, 
> CONFIG_SYS_INIT_RAM_ADDR,
> >  		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
> > @@ -40,6 +42,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
> >  	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024 , 
> > CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024,
> 
> Line length. [I know this is old code, anyway...]

Ok, I'll fix the line length issue.

> > +}
> > diff --git a/config.mk b/config.mk
> > index b1254e9..3300b75 100644
> > --- a/config.mk
> > +++ b/config.mk
> > @@ -112,8 +112,8 @@ DBGFLAGS= -g # -DDEBUG  OPTFLAGS= -Os 
> > #-fomit-frame-pointer  ifndef LDSCRIPT  #LDSCRIPT := 
> > $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
> > -ifeq ($(CONFIG_NAND_U_BOOT),y)
> > -LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
> > +ifeq ($(CONFIG_SDCARD_U_BOOT),y)
> > +LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-sdboot.lds
> >  else
> >  LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
> >  endif
> 
> Is it absolutely necessary to set this in the top level 
> config.mk file?
> 
Maybe combined with u-boot.lds.

> > +#if !defined(CONFIG_SDCARD_U_BOOT)
> >  	bl	cpu_init_early_f
> > +#else
> > +	bl	cpu_init_early_f_sd
> > +
> > +	/*Then switch to space 1*/
> > +	lis     r3,(MSR_CE|MSR_ME|MSR_DE|MSR_IS|MSR_DS)@h
> > +	ori     r3,r3,(MSR_CE|MSR_ME|MSR_DE|MSR_IS|MSR_DS)@l
> > +	mtmsr	r3
> > +	isync
> > +	msync
> > +
> > +	bl	cpu_init_early_f_sd_continue
> > +#endif
> 
> Please swap cases and use positive logic instead.
> 
Oh, thanks, I'll fix it.

> 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
> Sometimes, too long is too long.                          - Joe Crowe
> 
> 

Thanks,
Mingkai


More information about the U-Boot mailing list