summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranz Schnyder <franz.schnyder@toradex.com>2026-08-13 10:00:31 +0200
committerFabio Estevam <festevam@gmail.com>2026-08-14 16:20:09 -0300
commit7ee9f267c72e9af46e8011aa955b8994e7fc985d (patch)
tree29c0b4372526fb8976aae92af2d451b5c9505a7e
parentf0ddc167f547eede89d34e3f22a1fbd646f39d58 (diff)
downloadu-boot-7ee9f267c72e9af46e8011aa955b8994e7fc985d.tar.gz
u-boot-7ee9f267c72e9af46e8011aa955b8994e7fc985d.zip
toradex: apalis-imx8: select QP/QM device tree from OTP fuse
The Apalis iMX8QM and iMX8QP can be distinguished reading out the OTP fuse word 6. This logic is already used for memory layout selection and can also be reused to select the corresponding device tree. Decouple the device tree selection from the Toradex product PID table by moving the OTP-based QP/QM detection into a helper function used by both memory layout and device tree selection. Signed-off-by: Franz Schnyder <franz.schnyder@toradex.com> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
-rw-r--r--board/toradex/apalis-imx8/apalis-imx8.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
index b915673d9e3..ec30ceb3a68 100644
--- a/board/toradex/apalis-imx8/apalis-imx8.c
+++ b/board/toradex/apalis-imx8/apalis-imx8.c
@@ -120,20 +120,26 @@ static void get_tdx_user_fuse(struct tdx_user_fuses *tdxuserfuse)
tdxuserfuse->ramid = fuse_block & GENMASK(3, 0);
}
-void board_mem_get_layout(u64 *phys_sdram_1_start,
- u64 *phys_sdram_1_size,
- u64 *phys_sdram_2_start,
- u64 *phys_sdram_2_size)
+static bool is_imx8qp(void)
{
- u32 is_quadplus = 0, val = 0;
- struct tdx_user_fuses tdxramfuses;
+ u32 val = 0;
int scierr = sc_misc_otp_fuse_read(-1, 6, &val);
if (!scierr) {
/* QP has one A72 core disabled */
- is_quadplus = ((val >> 4) & 0x3) != 0x0;
+ return ((val >> 4) & 0x3) != 0x0;
}
+ return false;
+}
+
+void board_mem_get_layout(u64 *phys_sdram_1_start,
+ u64 *phys_sdram_1_size,
+ u64 *phys_sdram_2_start,
+ u64 *phys_sdram_2_size)
+{
+ struct tdx_user_fuses tdxramfuses;
+
get_tdx_user_fuse(&tdxramfuses);
*phys_sdram_1_start = PHYS_SDRAM_1;
@@ -154,7 +160,7 @@ void board_mem_get_layout(u64 *phys_sdram_1_start,
*phys_sdram_2_size = SZ_4G + SZ_2G;
break;
default:
- if (is_quadplus)
+ if (is_imx8qp())
/* Our QP based SKUs only have 2 GB RAM (PHYS_SDRAM_1_SIZE) */
*phys_sdram_2_size = 0x0UL;
else
@@ -245,18 +251,10 @@ static void select_dt_from_module_version(void)
else
env_set("variant", "-v1.1");
- switch (tdx_hw_tag.prodid) {
- /* Select Apalis iMX8QP device trees */
- case APALIS_IMX8QP_WIFI_BT:
- case APALIS_IMX8QP:
- case APALIS_IMX8QP_WIFI_BT_1300MHZ:
- case APALIS_IMX8QP_1300MHZ:
+ if (is_imx8qp())
env_set("soc", "imx8qp");
- break;
- default:
+ else
env_set("soc", "imx8qm");
- break;
- }
}
static int do_select_dt_from_module_version(struct cmd_tbl *cmdtp, int flag,