mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 07:04:28 +00:00
librem5: properly set the fdtfile
env variable
In order to use the generic "distro boot" using an extlinux.conf file, the `fdtfile` environment variable is mandatory. This commit ensure this variable is properly constructed based on the detected board revision. Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This commit is contained in:
parent
4c303a3895
commit
4ae3fcdf7b
1 changed files with 26 additions and 1 deletions
|
@ -399,21 +399,46 @@ int board_init(void)
|
|||
int board_late_init(void)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) {
|
||||
u32 rev;
|
||||
/*
|
||||
* Use the r4 dtb by default as those are the most
|
||||
* widespread devices.
|
||||
*/
|
||||
u32 rev, dtb_rev = 4;
|
||||
char rev_str[3];
|
||||
char fdt_str[50];
|
||||
|
||||
env_set("board_name", "librem5");
|
||||
if (fuse_read(9, 0, &rev)) {
|
||||
env_set("board_rev", BOARD_REV_ERROR);
|
||||
} else if (rev == 0) {
|
||||
/*
|
||||
* If the fuses aren't burnt we should use either the
|
||||
* r2 or r3 DTB. The latter makes more sense as there
|
||||
* are far more r3 devices out there.
|
||||
*/
|
||||
dtb_rev = 3;
|
||||
env_set("board_rev", BOARD_REV_UNKNOWN);
|
||||
} else if (rev > 0) {
|
||||
if (rev == 1)
|
||||
dtb_rev = 2;
|
||||
else if (rev < dtb_rev)
|
||||
dtb_rev = rev;
|
||||
/*
|
||||
* FCC-approved devices report '5' as their board
|
||||
* revision but use the r4 DTB as the PCB's are
|
||||
* functionally identical.
|
||||
*/
|
||||
else if (rev == 5)
|
||||
dtb_rev = 4;
|
||||
sprintf(rev_str, "%u", rev);
|
||||
env_set("board_rev", rev_str);
|
||||
}
|
||||
|
||||
printf("Board name: %s\n", env_get("board_name"));
|
||||
printf("Board rev: %s\n", env_get("board_rev"));
|
||||
|
||||
sprintf(fdt_str, "freescale/imx8mq-librem5-r%u.dtb", dtb_rev);
|
||||
env_set("fdtfile", fdt_str);
|
||||
}
|
||||
|
||||
if (is_usb_boot()) {
|
||||
|
|
Loading…
Reference in a new issue