[PATCH 6/6] board: tqma6: add kernel device tree handling for environment
Max Merchel
Max.Merchel at ew.tq-group.com
Mon Jul 13 15:01:06 CEST 2026
From: Paul Gerber <Paul.Gerber at tq-group.com>
Set the environment variable 'fdtfile' depending on ENET workaround
detection.
The function tqma6_get_fdt_configuration is implemented to be reusable
for configuration detection in multi-DTB FIT image and therefore returns
the devicetree name without the '.dtb' ending.
Set fdtfile only if CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG is enabled and it
is currently unset.
The model string is loaded from the device tree variant. Therefore, the
overriding of the model string is being removed.
Signed-off-by: Paul Gerber <Paul.Gerber at tq-group.com>
Signed-off-by: Markus Niebel <Markus.Niebel at ew.tq-group.com>
Signed-off-by: Max Merchel <Max.Merchel at ew.tq-group.com>
---
board/tq/tqma6/tqma6.c | 28 +++++++++++++++++++++++-----
board/tq/tqma6/tqma6.h | 1 +
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/board/tq/tqma6/tqma6.c b/board/tq/tqma6/tqma6.c
index b740ac7d5b1..f4cd9915185 100644
--- a/board/tq/tqma6/tqma6.c
+++ b/board/tq/tqma6/tqma6.c
@@ -117,6 +117,16 @@ static const char *tqma6_get_boardname(void)
};
}
+const char *tqma6_get_fdt_configuration(void)
+{
+ if (is_mx6dq())
+ return !tqma6_has_enet_workaround() ? "imx6q-mba6b" : "imx6q-mba6a";
+ if (is_mx6sdl())
+ return !tqma6_has_enet_workaround() ? "imx6dl-mba6b" : "imx6dl-mba6a";
+
+ return NULL;
+}
+
#if CONFIG_IS_ENABLED(DM_PMIC)
/* setup board specific PMIC */
int power_init_board(void)
@@ -137,12 +147,25 @@ int power_init_board(void)
}
#endif
+#define FDTFILE_STRLEN 32u
int board_late_init(void)
{
+ char fdtfile[FDTFILE_STRLEN];
+ const char *config = tqma6_get_fdt_configuration();
+
env_set("board_name", tqma6_get_boardname());
tqma6_detect_enet_workaround();
+ if (!env_get("fdtfile")) {
+ if (config) {
+ snprintf(fdtfile, FDTFILE_STRLEN, "%s.dtb", config);
+ env_set_runtime("fdtfile", fdtfile);
+ } else {
+ pr_err("ENV: Could not set kernel devicetree, ${fdtfile} remains unset\n");
+ }
+ }
+
tq_bb_board_late_init();
printf("Board: %s on a %s\n", tqma6_get_boardname(),
@@ -169,15 +192,10 @@ int board_late_init(void)
* Device Tree Support
*/
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
-#define MODELSTRLEN 32u
int ft_board_setup(void *blob, struct bd_info *bd)
{
struct mmc *mmc = find_mmc_device(0);
- char modelstr[MODELSTRLEN];
- snprintf(modelstr, MODELSTRLEN, "TQ %s on %s", tqma6_get_boardname(),
- tq_bb_get_boardname());
- do_fixup_by_path_string(blob, "/", "model", modelstr);
fdt_fixup_memory(blob, (u64)PHYS_SDRAM, (u64)gd->ram_size);
/* bring in eMMC dsr settings if needed */
diff --git a/board/tq/tqma6/tqma6.h b/board/tq/tqma6/tqma6.h
index 0cf38a4d1e3..bc09087e3df 100644
--- a/board/tq/tqma6/tqma6.h
+++ b/board/tq/tqma6/tqma6.h
@@ -8,6 +8,7 @@
#ifndef __TQMA6_H
#define __TQMA6_H
+const char *tqma6_get_fdt_configuration(void);
int tqma6_has_enet_workaround(void);
#endif /* __TQMA6_H */
--
2.43.0
More information about the U-Boot
mailing list