[U-Boot] [PATCH][RFC][for next] 5xxx, fdt: move fdt_fixup_memory() to cpu.c file
Wolfgang Denk
wd at denx.de
Mon Dec 7 22:50:08 CET 2009
Dear Heiko Schocher,
In message <4B1790D6.6030303 at denx.de> you wrote:
> u-boot updates, before starting Linux, the memory node in the
> DTS. As this is a "standard" feature, move this functionality
> to the cpu.c file for mpc5xxx and mpc512x processors.
>
> Signed-off-by: Heiko Schocher <hs at denx.de>
I generally agree with this patch, but...
> --- a/board/cm5200/cm5200.c
> +++ b/board/cm5200/cm5200.c
> @@ -271,13 +271,6 @@ static void ft_blob_update(void *blob, bd_t *bd)
> if (ret < 0)
> printf("ft_blob_update(): cannot set /model property err:%s\n",
> fdt_strerror(ret));
> -
> - ret = fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
> -
> - if (ret < 0) {
> - printf("ft_blob_update(): cannot set /memory/reg "
> - "property err:%s\n", fdt_strerror(ret));
> - }
Here we do some error checking, which is always a Good Thing (TM).
> diff --git a/cpu/mpc512x/cpu.c b/cpu/mpc512x/cpu.c
> index 42ccd81..dac48db 100644
> --- a/cpu/mpc512x/cpu.c
> +++ b/cpu/mpc512x/cpu.c
> @@ -197,6 +197,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
> #ifdef CONFIG_HAS_ETH0
> fdt_fixup_ethernet(blob);
> #endif
> + fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
> }
> #endif
>
> diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c
> index efa64c7..2a28df4 100644
> --- a/cpu/mpc5xxx/cpu.c
> +++ b/cpu/mpc5xxx/cpu.c
> @@ -157,6 +157,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
> }
>
> #endif
> + fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
> }
> #endif
May I suggest to add the same error checking in these two files, then?
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: wd at denx.de
"Text processing has made it possible to right-justify any idea, even
one which cannot be justified on any other grounds."
-- J. Finnegan, USC.
More information about the U-Boot
mailing list