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

Wolfgang Denk wd at denx.de
Mon Mar 16 09:55:36 CET 2009


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?

> 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?


> @@ -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.

> 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...]
> +}
> 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?

> diff --git a/cpu/mpc85xx/cpu_init.c b/cpu/mpc85xx/cpu_init.c
> index 0b7c609..f2fd168 100644
> --- a/cpu/mpc85xx/cpu_init.c
> +++ b/cpu/mpc85xx/cpu_init.c
> @@ -1,5 +1,9 @@
>  /*
> - * Copyright 2007 Freescale Semiconductor.
> + * Copyright (C) 2007,2009 Freescale Semiconductor, Inc.
> + *
> + * (C) 2009 Freescale Semiconductor, Inc.
> + * Modified by Jason Jin, Jason.jin at freescale.com,
> + * 	       Mingkai hu, Mingkai.hu at freescale.com

Please do not add such "Modified by" comments. We use git to track the
history of changes.

> +#if (CONFIG_SYS_CCSRBAR_DEFAULT != CONFIG_SYS_CCSRBAR_PHYS)
> +	{
> +		u32 temp;
> +		temp = in_be32((volatile u32 *)CONFIG_SYS_CCSRBAR_DEFAULT);
> +		out_be32((volatile u32 *)CONFIG_SYS_CCSRBAR_DEFAULT, CONFIG_SYS_CCSRBAR_PHYS >> 12);

Line length.

> -#ifdef CONFIG_SYS_RAMBOOT
> +#if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_SDCARD_U_BOOT)

Please create a new config name to invoid an ever growing list of
...||...||...||...

> +#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.

> diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
> index bbb448d..b19f028 100644
> --- a/include/configs/MPC8536DS.h
> +++ b/include/configs/MPC8536DS.h
> @@ -116,7 +116,7 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
>  #define CONFIG_SYS_SPD_BUS_NUM		1
>  
>  /* These are used when DDR doesn't use SPD. */
> -#define CONFIG_SYS_SDRAM_SIZE		256		/* DDR is 256MB */
> +#define CONFIG_SYS_SDRAM_SIZE		512		/* DDR is 512MB */

Line length.

>  #define CONFIG_SYS_DDR_CS0_BNDS	0x0000001F
>  #define CONFIG_SYS_DDR_CS0_CONFIG	0x80010102	/* Enable, no interleaving */
>  #define CONFIG_SYS_DDR_TIMING_3	0x00000000
> @@ -235,9 +235,15 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
>  #define PIXIS_VCLKL		0x1A	/* VELA VCLKL register */
>  #define CONFIG_SYS_PIXIS_VBOOT_MASK	0xc0
>  
> +#if !defined(CONFIG_SDCARD_U_BOOT)
>  #define CONFIG_SYS_INIT_RAM_LOCK	1
>  #define CONFIG_SYS_INIT_RAM_ADDR	0xffd00000	/* Initial L1 address */
>  #define CONFIG_SYS_INIT_RAM_END	0x00004000	/* End of used area in RAM */
> +#else
> +#undef  CONFIG_SYS_INIT_RAM_LOCK
> +#define CONFIG_SYS_INIT_RAM_ADDR	0x07d00000	/* unused memory region */
> +#define CONFIG_SYS_INIT_RAM_END	0x4000          /* we have SDRAM initialized */

Line length.


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


More information about the U-Boot mailing list