summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2024-06-25 10:26:15 +0200
committerFabio Estevam <festevam@gmail.com>2024-07-06 09:24:05 -0300
commitdcb1b7b6449e82a79b06e31af052628c3d58dc70 (patch)
treef291d1aca6695153f4a95097fa3fc25fc755a315
parentfd46ea0e701920eb205c2bce9d527bf0dec10b59 (diff)
downloadu-boot-dcb1b7b6449e82a79b06e31af052628c3d58dc70.tar.gz
u-boot-dcb1b7b6449e82a79b06e31af052628c3d58dc70.tar.bz2
u-boot-dcb1b7b6449e82a79b06e31af052628c3d58dc70.zip
ARM: imx: verdin-imx8mm: Set CAN oscillator frequency based on model
The older i.MX8M Mini Verdin SoMs may came with 20 MHz SPI CAN controller oscillator, the newer SoMs always use 40 MHz oscillator. Handle both by overriding the oscillator frequency just before booting the kernel. These are the known variants with 20 MHz oscillator: - 0055, V1.1A, V1.1B, V1.1C and V1.1D, use a 20MHz oscillator - 0059, V1.1A and V1.1B, use a 20MHz oscillator Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
-rw-r--r--board/toradex/verdin-imx8mm/verdin-imx8mm.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
index 4230f417d1..9359e0ac6b 100644
--- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
+++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
@@ -126,6 +126,35 @@ int board_phys_sdram_size(phys_size_t *size)
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, struct bd_info *bd)
{
+ const char *canoscpath = "/oscillator";
+ int freq = 40000000; /* 40 MHz is used on most variants */
+ int canoscoff, ret;
+
+ canoscoff = fdt_path_offset(blob, canoscpath);
+ if (canoscoff < 0) /* No CAN oscillator found. */
+ goto exit;
+
+ /*
+ * The following "prodid" (PID4 in Toradex naming) use
+ * a 20MHz CAN oscillator:
+ * - 0055, V1.1A, V1.1B, V1.1C and V1.1D
+ * - 0059, V1.1A and V1.1B
+ */
+ if ((tdx_hw_tag.ver_major == 1 && tdx_hw_tag.ver_minor == 1) &&
+ ((tdx_hw_tag.prodid == VERDIN_IMX8MMQ_IT &&
+ tdx_hw_tag.ver_assembly <= 1) || /* 0059 rev. A or B */
+ (tdx_hw_tag.prodid == VERDIN_IMX8MMQ_WIFI_BT_IT &&
+ tdx_hw_tag.ver_assembly <= 3))) { /* 0055 rev. A/B/C/D */
+ freq = 20000000;
+ }
+
+ ret = fdt_setprop_u32(blob, canoscoff, "clock-frequency", freq);
+ if (ret < 0) {
+ printf("Failed to set CAN oscillator clock-frequency, ret=%d\n",
+ ret);
+ }
+
+exit:
return ft_common_board_setup(blob, bd);
}
#endif