]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
board: tqma6: add kernel device tree handling for environment
authorPaul Gerber <Paul.Gerber@tq-group.com>
Mon, 13 Jul 2026 13:01:06 +0000 (15:01 +0200)
committerFabio Estevam <festevam@gmail.com>
Mon, 27 Jul 2026 16:05:07 +0000 (13:05 -0300)
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@tq-group.com>
Signed-off-by: Markus Niebel <Markus.Niebel@ew.tq-group.com>
Signed-off-by: Max Merchel <Max.Merchel@ew.tq-group.com>
board/tq/tqma6/tqma6.c
board/tq/tqma6/tqma6.h

index b740ac7d5b1236caded1b31795f653c2becab92d..f4cd9915185c74190689f0e6a9c1879474bc4909 100644 (file)
@@ -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 */
index 0cf38a4d1e33a1cc5abace5b76193f5206cbafa1..bc09087e3df6d67ebda9d63909e6a9645d4d791d 100644 (file)
@@ -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 */