Skip to contentSkip to conversation

renesas: rcar: Apply ATF overlay for reserved-memory

PATCH Superseded Detlev Casanova 2 participants 4 messages Dec 6, 2022 – Mar 23, 2023 Arm/RISC-V/Renesas architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 board/renesas/rcar-common/common.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
board/renesas/rcar-common/common.c +3 -4
index daa1beb14f..6eaa0d1a65 100644
@@ -25,14 +25,12 @@ extern u64 rcar_atf_boot_args[];
 
 #define FDT_RPC_PATH	"/soc/spi@ee200000"
 
-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);
 
Signature · 1 line
2.38.1
#1 lore raw

Hi Detlev,

Quoted 8 lines · Detlev Casanova

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.

Thanks for your patch!

board/renesas/rcar-common/common.c extern u64 rcar_atf_boot_args[]; · line 28

Quoted 8 lines
board/renesas/rcar-common/common.c +1 -1
@@ -25,14 +25,12 @@ extern u64 rcar_atf_boot_args[];
 
 #define FDT_RPC_PATH   "/soc/spi@ee200000"
 
-int fdtdec_board_setup(const void *fdt_blob)
+void apply_atf_overlay(void *fdt_blob)

static?

Quoted 12 lines
board/renesas/rcar-common/common.c +1 -3
 {
        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)

board/renesas/rcar-common/common.c static void update_rpc_status(void *blob) · line 162

Quoted 6 lines
board/renesas/rcar-common/common.c +1 -0
@@ -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 -- [email protected]

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

#2 lore raw

PATCH v2 1/1 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.

---
 board/renesas/rcar-common/common.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
board/renesas/rcar-common/common.c +9 -10
index daa1beb14f..c50d09ef8b 100644
@@ -25,16 +25,6 @@ extern u64 rcar_atf_boot_args[];
 
 #define FDT_RPC_PATH	"/soc/spi@ee200000"
 
-int fdtdec_board_setup(const 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;
-}
-
 int dram_init(void)
 {
 	return fdtdec_setup_mem_size_base();
@@ -48,6 +38,14 @@ int dram_init_banksize(void)
 }
 
 #if defined(CONFIG_OF_BOARD_SETUP)
+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(fdt_blob, 0, atf_fdt_blob, 0);
+}
+
 static int is_mem_overlap(void *blob, int first_mem_node, int curr_mem_node)
 {
 	struct fdt_resource first_mem_res, curr_mem_res;
@@ -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);
 
Signature · 1 line
2.38.1
#3 lore raw

Hi! !

Just bumping up this patch.

Quoted 17 lines · On Tuesday, December 6, 2022 11:06:48 A.M. EDT 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.

---
 board/renesas/rcar-common/common.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
(quoted diff) +0 -0

b/board/renesas/rcar-common/common.c index daa1beb14f..c50d09ef8b 100644

board/renesas/rcar-common/common.c extern u64 rcar_atf_boot_args[]; · line 33

Quoted 9 lines
board/renesas/rcar-common/common.c +0 -6
@@ -25,16 +25,6 @@ extern u64 rcar_atf_boot_args[];
 
 #define FDT_RPC_PATH	"/soc/spi@ee200000"
 
-int fdtdec_board_setup(const 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);

Quoted 23 lines
board/renesas/rcar-common/common.c +8 -4
-
-	return 0;
-}
-
 int dram_init(void)
 {
 	return fdtdec_setup_mem_size_base();
@@ -48,6 +38,14 @@ int dram_init_banksize(void)
 }
 
 #if defined(CONFIG_OF_BOARD_SETUP)
+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(fdt_blob, 0, atf_fdt_blob, 0);
+}
+
 static int is_mem_overlap(void *blob, int first_mem_node, int
 curr_mem_node) {
 	struct fdt_resource first_mem_res, curr_mem_res;

board/renesas/rcar-common/common.c static void update_rpc_status(void *blob) · line 162

Quoted 6 lines
board/renesas/rcar-common/common.c +1 -0
@@ -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);

Regards,

Detlev.