Re: [PATCH] renesas: rcar: Apply ATF overlay for reserved-memory
On Fri, Jun 9, 2023 at 10:41 AM Detlev Casanova wrote: > > The function fdtdec_board_setup() is called early and adds the overlay > from ATF to the u-boot device tree. That is necessary so that u-boot > doesn't use reserved memory. > > Linux also needs to know about that reserved memory so the overlay from > ATF needs to be aplied on the linux device tree as well. > > This commit makes sure that the ATF overlay is applied to both device trees. > Thanks for this. I was trying to do this very same thing, but your solution looks cleaner than mine. Reviewed-by: Adam Ford > Signed-off-by: Detlev Casanova > --- > board/renesas/rcar-common/common.c | 10 -- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/board/renesas/rcar-common/common.c > b/board/renesas/rcar-common/common.c > index f38453af82c..f976c99028a 100644 > --- a/board/renesas/rcar-common/common.c > +++ b/board/renesas/rcar-common/common.c > @@ -25,12 +25,17 @@ extern u64 rcar_atf_boot_args[]; > > #define FDT_RPC_PATH "/soc/spi@ee20" > > -int fdtdec_board_setup(const void *fdt_blob) > +static void apply_atf_overlay(void *fdt_blob) > { > void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]); > > if (fdt_magic(atf_fdt_blob) == FDT_MAGIC) > - fdt_overlay_apply_node((void *)fdt_blob, 0, atf_fdt_blob, 0); > + fdt_overlay_apply_node(fdt_blob, 0, atf_fdt_blob, 0); > +} > + > +int fdtdec_board_setup(const void *fdt_blob) > +{ > + apply_atf_overlay((void *)fdt_blob); > > return 0; > } > @@ -159,6 +164,7 @@ static void update_rpc_status(void *blob) > > int ft_board_setup(void *blob, struct bd_info *bd) > { > + apply_atf_overlay(blob); > scrub_duplicate_memory(blob); > update_rpc_status(blob); > > -- > 2.39.3 >
Re: [PATCH] renesas: rcar: Apply ATF overlay for reserved-memory
On 6/9/23 17:19, Detlev Casanova wrote: The function fdtdec_board_setup() is called early and adds the overlay from ATF to the u-boot device tree. That is necessary so that u-boot doesn't use reserved memory. Linux also needs to know about that reserved memory so the overlay from ATF needs to be aplied on the linux device tree as well. This commit makes sure that the ATF overlay is applied to both device trees. Signed-off-by: Detlev Casanova Reviewed-by: Marek Vasut
[PATCH] renesas: rcar: Apply ATF overlay for reserved-memory
The function fdtdec_board_setup() is called early and adds the overlay from ATF to the u-boot device tree. That is necessary so that u-boot doesn't use reserved memory. Linux also needs to know about that reserved memory so the overlay from ATF needs to be aplied on the linux device tree as well. This commit makes sure that the ATF overlay is applied to both device trees. Signed-off-by: Detlev Casanova --- board/renesas/rcar-common/common.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c index f38453af82c..f976c99028a 100644 --- a/board/renesas/rcar-common/common.c +++ b/board/renesas/rcar-common/common.c @@ -25,12 +25,17 @@ extern u64 rcar_atf_boot_args[]; #define FDT_RPC_PATH "/soc/spi@ee20" -int fdtdec_board_setup(const void *fdt_blob) +static void apply_atf_overlay(void *fdt_blob) { void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]); if (fdt_magic(atf_fdt_blob) == FDT_MAGIC) - fdt_overlay_apply_node((void *)fdt_blob, 0, atf_fdt_blob, 0); + fdt_overlay_apply_node(fdt_blob, 0, atf_fdt_blob, 0); +} + +int fdtdec_board_setup(const void *fdt_blob) +{ + apply_atf_overlay((void *)fdt_blob); return 0; } @@ -159,6 +164,7 @@ static void update_rpc_status(void *blob) int ft_board_setup(void *blob, struct bd_info *bd) { + apply_atf_overlay(blob); scrub_duplicate_memory(blob); update_rpc_status(blob); -- 2.39.3
Re: [PATCH] renesas: rcar: Apply ATF overlay for reserved-memory
Hi Detlev, On Tue, Dec 6, 2022 at 4:35 PM Detlev Casanova wrote: > The function fdtdec_board_setup() is only called by fdtdec_setup() which > needs to be called by the board file. > > This is not the case for the renesas boards so rename the > fdtdec_board_setup() function to a local name and call it directly from > ft_board_setup(), before cleaning up the memory nodes. > > Signed-off-by: Detlev Casanova Thanks for your patch! > --- a/board/renesas/rcar-common/common.c > +++ b/board/renesas/rcar-common/common.c > @@ -25,14 +25,12 @@ extern u64 rcar_atf_boot_args[]; > > #define FDT_RPC_PATH "/soc/spi@ee20" > > -int fdtdec_board_setup(const void *fdt_blob) > +void apply_atf_overlay(void *fdt_blob) static? > { > void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]); > > if (fdt_magic(atf_fdt_blob) == FDT_MAGIC) > - fdt_overlay_apply_node((void *)fdt_blob, 0, atf_fdt_blob, 0); > - > - return 0; > + fdt_overlay_apply_node(fdt_blob, 0, atf_fdt_blob, 0); > } > > int dram_init(void) > @@ -159,6 +157,7 @@ static void update_rpc_status(void *blob) > > int ft_board_setup(void *blob, struct bd_info *bd) > { > + apply_atf_overlay(blob); > scrub_duplicate_memory(blob); > update_rpc_status(blob); Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
[PATCH] renesas: rcar: Apply ATF overlay for reserved-memory
The function fdtdec_board_setup() is only called by fdtdec_setup() which needs to be called by the board file. This is not the case for the renesas boards so rename the fdtdec_board_setup() function to a local name and call it directly from ft_board_setup(), before cleaning up the memory nodes. Signed-off-by: Detlev Casanova --- board/renesas/rcar-common/common.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c index daa1beb14f..6eaa0d1a65 100644 --- a/board/renesas/rcar-common/common.c +++ b/board/renesas/rcar-common/common.c @@ -25,14 +25,12 @@ extern u64 rcar_atf_boot_args[]; #define FDT_RPC_PATH "/soc/spi@ee20" -int fdtdec_board_setup(const void *fdt_blob) +void apply_atf_overlay(void *fdt_blob) { void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]); if (fdt_magic(atf_fdt_blob) == FDT_MAGIC) - fdt_overlay_apply_node((void *)fdt_blob, 0, atf_fdt_blob, 0); - - return 0; + fdt_overlay_apply_node(fdt_blob, 0, atf_fdt_blob, 0); } int dram_init(void) @@ -159,6 +157,7 @@ static void update_rpc_status(void *blob) int ft_board_setup(void *blob, struct bd_info *bd) { + apply_atf_overlay(blob); scrub_duplicate_memory(blob); update_rpc_status(blob); -- 2.38.1