On the RZG2L platform, the advised
TF-A (https://github.com/renesas-rz/rzg_trusted-firmware-a/tree/v2.5/rzg2l)
does not pass any DTB blob to U-Boot.

On the other hand, the RZG2L part of U-Boot expects a DTB to be passed.  It
means that if one flashes the latest TF-A as well as the mainline U-Boot,
it will crash trying to dereference the NULL DTB pointer before outputing
anything, which is painful to debug.

As the renesas_rzg2l_smarc_defconfig U-Boot configuration (the only RZG2L
supported configuration) is anyway embedding only the
renesas/r9a07g044l2-smarc.dts device-tree, it is fair to assume that we are
booting from that platform.

Remove any DTB blob expectation and assume that we are booting from the
platform we are compiling U-Boot for.

Signed-off-by: Mathieu Othacehe <othac...@gnu.org>
---
 arch/arm/mach-renesas/cpu_info-rzg2l.c | 25 ++--------------
 board/renesas/rzg2l/rzg2l.c            | 40 --------------------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/arch/arm/mach-renesas/cpu_info-rzg2l.c 
b/arch/arm/mach-renesas/cpu_info-rzg2l.c
index ab95ce76388..97e0eb419a4 100644
--- a/arch/arm/mach-renesas/cpu_info-rzg2l.c
+++ b/arch/arm/mach-renesas/cpu_info-rzg2l.c
@@ -10,9 +10,6 @@
 
 #define SYSC_LSI_DEVID         0x11020A04
 
-/* If the firmware passed a device tree, use it for soc identification. */
-extern u64 rcar_atf_boot_args[];
-
 /* CPU information table */
 struct tfa_info {
        const char *soc_name;
@@ -24,32 +21,14 @@ static const struct tfa_info tfa_info[] = {
        { "renesas,r9a07g044l2", "R9A07G044L", RENESAS_CPU_TYPE_R9A07G044L },
 };
 
-static const struct tfa_info invalid_tfa_info = { NULL, "(invalid)", 0 };
-
-static const struct tfa_info *get_tfa_info(void)
-{
-       void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
-
-       if (fdt_magic(atf_fdt_blob) == FDT_MAGIC) {
-               unsigned int i;
-               for (i = 0; i < ARRAY_SIZE(tfa_info); i++) {
-                       if (!fdt_node_check_compatible(atf_fdt_blob, 0,
-                                                      tfa_info[i].soc_name))
-                               return &tfa_info[i];
-               }
-       }
-
-       return &invalid_tfa_info;
-}
-
 const u8 *rzg_get_cpu_name(void)
 {
-       return get_tfa_info()->cpu_name;
+       return tfa_info->cpu_name;
 }
 
 u32 renesas_get_cpu_type(void)
 {
-       return get_tfa_info()->cpu_type;
+       return tfa_info->cpu_type;
 }
 
 u32 renesas_get_cpu_rev_integer(void)
diff --git a/board/renesas/rzg2l/rzg2l.c b/board/renesas/rzg2l/rzg2l.c
index 509c5dbb156..0bdf030eb15 100644
--- a/board/renesas/rzg2l/rzg2l.c
+++ b/board/renesas/rzg2l/rzg2l.c
@@ -7,46 +7,6 @@
 #include <fdtdec.h>
 #include <linux/libfdt.h>
 
-#if IS_ENABLED(CONFIG_MULTI_DTB_FIT)
-/* If the firmware passed a device tree, use it for board identification. */
-extern u64 rcar_atf_boot_args[];
-
-static bool is_rzg2l_board(const char *board_name)
-{
-       void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
-
-       return fdt_node_check_compatible(atf_fdt_blob, 0, board_name) == 0;
-}
-
-int board_fit_config_name_match(const char *name)
-{
-       void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
-
-       if (fdt_magic(atf_fdt_blob) != FDT_MAGIC)
-               return -1;
-
-       if (is_rzg2l_board("renesas,r9a07g044l2"))
-               return strcmp(name, "r9a07g044l2-smarc");
-
-       return -1;
-}
-#endif
-
-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);
-}
-
-int fdtdec_board_setup(const void *fdt_blob)
-{
-       apply_atf_overlay((void *)fdt_blob);
-
-       return 0;
-}
-
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
        return 0;
-- 
2.49.0

Reply via email to