如何在 IMX8ULP 的设备树中启用 TPM6 如何配置 imx8ulp 设备树以在 A35 上启用 TPM6,以及从自由运行的振荡器 (FRO) 对 TPM6 进行计时需要哪些设备树设置? i.MX 8 系列 | i.MX 8QuadMax (8QM) | 8QuadPlus i.MX 8M | i.MX 8M Mini | i.MX 8M Nano i.MX8ULP Linux Re: How to enable TPM6 in device tree for IMX8ULP 最初,我按照本帖中的步骤操作,并应用了该解决方案提供的补丁: https://community.nxp.com/t5/i-MX-Processors/i-MX8ULP-linux-clocksource-precision/m-p/2139659/highlight/true 不过,这似乎只允许使用系统振荡器,而不允许使用 FRO。 1) 为 TPM6 配置外设时钟控制器 (PCC4),imx8ulp_bl31_setup.c #if defined(IMX8ULP_TPM_TIMERS)
/* config the TPM6 clock with FRODIV2*/
mmio_write_32(IMX_CGC1_BASE + 0x908, 0x3);
mmio_write_32(IMX_PCC4_BASE + 0x08, 0x94000000);
mmio_write_32(IMX_PCC4_BASE + 0x08, 0xd4000000);
#endif 2) 从上面链接的解决方案中修改补丁,使用 frosc_div2,而不是 sosc_div2: From 6db58f97ab7fb7cff89a5386dee7c392f1fdd7cb Mon Sep 17 00:00:00 2001
From: chong feng
Date: Thu, 7 Aug 2025 23:17:29 +0530
Subject: [PATCH 1/3] drivers: clk: imx8ulp tpm4, tpm6 fixed clk gate only
Add clk imx8ulp tpm6 fixed clock gate only
Signed-off-by: Adrian Alonso
Reviewed-by: Jacky Bai
---
drivers/clk/imx/clk-imx8ulp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/imx/clk-imx8ulp.c b/drivers/clk/imx/clk-imx8ulp.c
index 535b6364ca7e..1abef4c54c2e 100644
--- a/drivers/clk/imx/clk-imx8ulp.c
+++ b/drivers/clk/imx/clk-imx8ulp.c
@@ -413,7 +413,8 @@ static int imx8ulp_clk_pcc4_init(struct platform_device *pdev)
return PTR_ERR(base);
clks[IMX8ULP_CLK_FLEXSPI2] = imx8ulp_clk_hw_composite("flexspi2", pcc4_periph_plat_sels, ARRAY_SIZE(pcc4_periph_plat_sels), true, true, true, base + 0x4, 1);
- clks[IMX8ULP_CLK_TPM6] = imx8ulp_clk_hw_composite("tpm6", pcc4_periph_bus_sels, ARRAY_SIZE(pcc4_periph_bus_sels), true, true, true, base + 0x8, 1);
+ // clks[IMX8ULP_CLK_TPM6] = imx8ulp_clk_hw_composite("tpm6", pcc4_periph_bus_sels, ARRAY_SIZE(pcc4_periph_bus_sels), true, true, true, base + 0x8, 1);
+ // clks[IMX8ULP_CLK_TPM6] = imx_clk_hw_gate_flags("tpm6", "sosc_div2", base + 0x08, 30, CLK_IS_CRITICAL);
+ clks[IMX8ULP_CLK_TPM6] = imx_clk_hw_gate_flags("tpm6", "frosc_div2", base + 0x08, 30, CLK_IS_CRITICAL);
clks[IMX8ULP_CLK_TPM7] = imx8ulp_clk_hw_composite("tpm7", pcc4_periph_bus_sels, ARRAY_SIZE(pcc4_periph_bus_sels), true, true, true, base + 0xc, 1);
clks[IMX8ULP_CLK_LPI2C6] = imx8ulp_clk_hw_composite("lpi2c6", pcc4_periph_bus_sels, ARRAY_SIZE(pcc4_periph_bus_sels), true, true, true, base + 0x10, 1);
clks[IMX8ULP_CLK_LPI2C7] = imx8ulp_clk_hw_composite("lpi2c7", pcc4_periph_bus_sels, ARRAY_SIZE(pcc4_periph_bus_sels), true, true, true, base + 0x14, 1);
--
2.25.1
3) 更新设备树。 tpm6: tpm@29820000 {
compatible = "nxp,tpm-timer";
timer-rating = <410>;
status = "okay";
reg = <0x29820000 0x1000>;
interrupts = ;
clock-names = "ipg", "per";
clocks = <&frosc>, <&frosc>;
}; 这些步骤使 linux 时钟摘要显示 TPM6 的时钟频率为 192MHz。这很好,但由于设置了除数 2,频率应为 48MHz。 要在 TPM6 上获得 48MHz 的时钟频率,下一步该怎么做?我需要修改上述任何步骤吗? Re: How to enable TPM6 in device tree for IMX8ULP 你好
要在 A35 内核上为 i.MX8ULP 启用 TPM6 并将其配置为使用自由运行的振荡器 (FRO) 作为其时钟源,您需要对设备树进行特定修改。 ## Device Tree Configuration 1. First, locate the device tree files for the i.MX8ULP in your Linux kernel source directory: - Main path: `arch/arm64/boot/dts/freescale/` 2. Add or modify the TPM6 node in your device tree: ``` tpm6: tpm@2da0000 { compatible = "fsl,imx8ulp-tpm"; reg = ; interrupts = ; clocks = , ; clock-names = "ipg", "per"; assigned-clocks = ; assigned-clock-parents = ; status = "okay"; }; ``` 3. Make sure to reference the TPM6 clock definitions from: - `include/dt-bindings/clock/imx8ulp-clock.h` ## 重要注意事项 -根据 i.MX8ULP 内存映射表,必须可从 A35 内核访问 TPM6 -FRO(自由运行振荡器)必须在 CGC(时钟生成和控制)中正确配置 -您需要根据 i.MX8ULP 参考手册中的方框图(图 6)和内存映射表手动调整设备树 Re: How to enable TPM6 in device tree for IMX8ULP 是的,这些都已核实。您是否可以升级并更详细地回答我的具体问题? Re: How to enable TPM6 in device tree for IMX8ULP 你好
要使用自由运行的振荡器 (FRO) 计时,在设备树中为 A35 内核上的 i.MX8ULP 配置 TPM6,您需要手动修改设备树文件。 你可以参考 i.MX8ULP 设备树绑定来了解时钟定义,网址为:https://github.com/nxp-imx/linux-imx/blob/lf-6.x.y/include/dt-bindings/clock/imx8ulp-clock.h 请参阅 i.MX8ULP 参考手册第 3.2 节(Arm Cortex A35 内核概述),以验证是否可以从 A35 内核访问 TPM6,因为某些外设只能从特定内核访问。
此致
記事全体を表示