[PATCH 2/2] renesas: rcar3: Load the correct device tree

Detlev Casanova detlev.casanova at collabora.com
Fri Jun 9 18:00:16 CEST 2023


The Renesas R-Car Gen3 H3e (Starter Kit Premier) uses a different
device tree than the default one.

This uses the sysinfo's board id to determine if the board needs a
specific device tree.

Signed-off-by: Detlev Casanova <detlev.casanova at collabora.com>
---
 board/renesas/ulcb/ulcb.c    | 34 ++++++++++++++++++++++++++++++++++
 configs/rcar3_ulcb_defconfig |  1 +
 2 files changed, 35 insertions(+)

diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c
index 1477750f921..3e2fe3a3ca9 100644
--- a/board/renesas/ulcb/ulcb.c
+++ b/board/renesas/ulcb/ulcb.c
@@ -28,6 +28,8 @@
 #include <i2c.h>
 #include <mmc.h>
 
+#include "../../../drivers/sysinfo/rcar3.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #define DVFS_MSTP926		BIT(26)
@@ -65,6 +67,38 @@ int board_init(void)
 	return 0;
 }
 
+int misc_init_r(void)
+{
+	struct udevice *dev;
+	int board_id;
+	int ret = sysinfo_get(&dev);
+        if (ret) {
+		debug("Cannot get sysinfo: %d\n", ret);
+		return 0;
+	}
+
+	ret = sysinfo_detect(dev);
+	if (ret) {
+		debug("Cannot detect sysinfo: %d\n", ret);
+		return 0;
+	}
+
+	ret = sysinfo_get_int(dev,
+		SYSINFO_ID_BOARD_MODEL,
+		&board_id);
+
+	if (ret) {
+		debug("Cannot get sysinfo int: %d\n", ret);
+		return 0;
+	}
+
+	if (board_id == BOARD_STARTER_KIT_PRE) {
+		env_set("fdtfile", "renesas/r8a779m1-ulcb.dtb");
+	}
+
+	return 0;
+}
+
 #ifdef CONFIG_MULTI_DTB_FIT
 int board_fit_config_name_match(const char *name)
 {
diff --git a/configs/rcar3_ulcb_defconfig b/configs/rcar3_ulcb_defconfig
index b8fdb5e3826..752d33d77ec 100644
--- a/configs/rcar3_ulcb_defconfig
+++ b/configs/rcar3_ulcb_defconfig
@@ -111,3 +111,4 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
 CONFIG_USB_STORAGE=y
+CONFIG_MISC_INIT_R=y
-- 
2.39.3



More information about the U-Boot mailing list