diff options
author | Arnaud Ferraris <arnaud.ferraris@collabora.com> | 2023-10-27 15:40:44 +0200 |
---|---|---|
committer | Fabio Estevam <festevam@gmail.com> | 2023-12-13 10:00:43 -0300 |
commit | 4ae3fcdf7b5cb9625e78110183392d0d4e8fe783 (patch) | |
tree | cd32dd9ee54446e3e35ac1a3af9c8229ba288bbe /board | |
parent | 4c303a389545dc8ba76ba9fe4928b20ae94502ec (diff) | |
download | u-boot-4ae3fcdf7b5cb9625e78110183392d0d4e8fe783.zip u-boot-4ae3fcdf7b5cb9625e78110183392d0d4e8fe783.tar.gz u-boot-4ae3fcdf7b5cb9625e78110183392d0d4e8fe783.tar.bz2 |
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>
Diffstat (limited to 'board')
-rw-r--r-- | board/purism/librem5/librem5.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/board/purism/librem5/librem5.c b/board/purism/librem5/librem5.c index 386ed1b..d0249e7 100644 --- a/board/purism/librem5/librem5.c +++ b/board/purism/librem5/librem5.c @@ -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()) { |