board: tqma6: add kernel device tree handling for environment
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>
This commit is contained in:
committed by
Fabio Estevam
parent
17abea6ca0
commit
1aae8d914d
+23
-5
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user