All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Othacehe <othacehe@gnu.org>
To: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Tom Rini <trini@konsulko.com>, Paul Barker <paul@pbarker.dev>,
	Peng Fan <peng.fan@nxp.com>,
	Sam Protsenko <semen.protsenko@linaro.org>,
	Mathieu Othacehe <othacehe@gnu.org>,
	u-boot@lists.denx.de
Cc: anton.reding@landisgyr.com
Subject: [PATCH] board: rzg2l: Do not expect a DTB blob from the TF-A.
Date: Thu, 18 Sep 2025 14:48:27 +0200	[thread overview]
Message-ID: <20250918124827.5577-1-othacehe@gnu.org> (raw)

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 <othacehe@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	other threads:[~2025-09-18 12:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18 12:48 Mathieu Othacehe [this message]
2025-09-18 13:17 ` [PATCH] board: rzg2l: Do not expect a DTB blob from the TF-A Marek Vasut
2025-09-18 14:39   ` Mathieu Othacehe
2025-09-18 15:06     ` Marek Vasut
2025-09-22 16:30       ` Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250918124827.5577-1-othacehe@gnu.org \
    --to=othacehe@gnu.org \
    --cc=anton.reding@landisgyr.com \
    --cc=iwamatsu@nigauri.org \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=paul@pbarker.dev \
    --cc=peng.fan@nxp.com \
    --cc=semen.protsenko@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.