[U-Boot] [PATCH 1/2] ARM: bootm: allow skipping fdt memory node fixup

Wolfgang Denk wd at denx.de
Tue Feb 19 20:26:51 CET 2013


Dear Rob Herring,

In message <1359085160-28675-1-git-send-email-robherring2 at gmail.com> you wrote:
> 
> Currently, u-boot will always fixup the DT memory node on ARM. If the dtb
> has correct memory information, then we don't want or need u-boot to touch
> the memory node. Allow platforms to skip this by not filling in dram bank
> information.

Well, if this is what you want, then please implement just this, and
do not do much more.

>  void __dram_init_banksize(void)
>  {
> +#if CONFIG_NR_DRAM_BANKS
>  	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
>  	gd->bd->bi_dram[0].size =  gd->ram_size;
> +#endif
>  }

This change will leave the memory information in struct bd_info
uninitialized, so the "bdinfo" command will print just bogus data.

This is not a good idea.

> --- a/arch/arm/lib/bootm.c
> +++ b/arch/arm/lib/bootm.c
> @@ -79,6 +79,7 @@ void arch_lmb_reserve(struct lmb *lmb)
>  #ifdef CONFIG_OF_LIBFDT
>  static int fixup_memory_node(void *blob)
>  {
> +#if CONFIG_NR_DRAM_BANKS
>  	bd_t	*bd = gd->bd;
>  	int bank;
>  	u64 start[CONFIG_NR_DRAM_BANKS];
> @@ -90,6 +91,9 @@ static int fixup_memory_node(void *blob)
>  	}
>  
>  	return fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
> +#else
> +	return 0;
> +#endif

I dislike this.  If you want to make a property of your device tree
"immutable", then you should mark it there as such.  Instead of
removing the code here, U-Boot should then check for such a property
and leave the value unchanged.

Actually you are reaching here a point where it seems necessary that
U-Boot itself is able to read the DT to configure itself correctly,
i. e. the memory size information it holds should then also be
extracted from the DT.

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 faster I go, the behinder I get.                 -- Lewis Carroll


More information about the U-Boot mailing list