2053556_en-US

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2053556_en-US

2053556_en-US

How to configure the clock source of TPM in iMX8ULP dts?

Dear all,

    I want to enable TPM4,7,8 on iMX8ULP,but the dts doesn't have device note.

    So, I add TPM8 device node by myself.

    But during probe, the kernel crashes.

    Therefore, how to configure the clock source of TPM?

    log and dts are as below.

i.MX8ULP回复: How to configure the clock source of TPM in iMX8ULP dts?

Thanks a lot !!! It works well!

回复: How to configure the clock source of TPM in iMX8ULP dts?

Hello,

Thank you for the update, please try by not commenting the assigned-clock-rates & clock-names properties in the tpm node.

Also, please enable the clock to be configured early on ATF:

https://github.com/nxp-imx/imx-atf/blob/lf-6.6.36-2.1.0/plat/imx/imx8ulp/imx8ulp_bl31_setup.c#L68

void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
static console_t console;

+ /* config the TPM7 clock */
+ mmio_write_32(IMX_CGC1_BASE + 0x908, 0x300);
+

/* config the TPM5 clock */
mmio_write_32(IMX_PCC3_BASE + 0xd0, 0x92000000);
mmio_write_32(IMX_PCC3_BASE + 0xd0, 0xd2000000);

Please try it and let me know of your results.

Best regards/Saludos,
Aldo.

回复: How to configure the clock source of TPM in iMX8ULP dts?

Hello!

Here are some updates  I'd like to share with you.

Fortunately, I enable TPM7 CH5(PTF25) successfully, but there is no output waveform.

my device node  :

+tpm7: tpm@29830000 {
+ //compatible = "fsl,imx8ulp-tpm", "fsl,imx7ulp-tpm";
+ compatible = "fsl,imx7ulp-pwm";
+ reg = <0x29830000 0x10000>;
+ //interrupts = ;
+ clocks = <&pcc4 IMX8ULP_CLK_TPM7>, <&pcc4 IMX8ULP_CLK_TPM7>;
+ assigned-clocks = <&pcc4 IMX8ULP_CLK_TPM7>;
+ assigned-clock-parents = <&cgc1 IMX8ULP_CLK_FROSC_DIV2>;
+ //assigned-clock-rates = <48000000>;
+ //clock-names = "ipg", "per";
+ status = "okay";
+};

+&tpm7 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_tpm7>;
+ #pwm-cells = <3>;
+};

pinctrl_tpm7: tpm7grp {
                fsl,pins = <
                        MX8ULP_PAD_PTF25__TPM7_CH5      0x2
                >;
};
 
my commands :
root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8# echo 5 > export
root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8# cd pwm5/
root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8/pwm5# echo 400000 > period
root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8/pwm5# echo 200000 > duty_cycle
root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8/pwm5# echo 1 > enable
root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8/pwm5#
Re: How to configure the clock source of TPM in iMX8ULP dts?

I successfully enable pwm signal of TPM7 CH5(PTF25), but there is no output waveform


tpm7: tpm@29830000 {
//compatible = "fsl,imx8ulp-tpm", "fsl,imx7ulp-tpm";
compatible = "fsl,imx7ulp-pwm";
reg = <0x29830000 0x10000>;
//interrupts = ;
clocks = <&pcc4 IMX8ULP_CLK_TPM7>, <&pcc4 IMX8ULP_CLK_TPM7>;
assigned-clocks = <&pcc4 IMX8ULP_CLK_TPM7>;
assigned-clock-parents = <&cgc1 IMX8ULP_CLK_FROSC_DIV2>;
//assigned-clock-rates = <48000000>;
//clock-names = "ipg", "per";
status = "okay";
};

&tpm7 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_tpm7>;
#pwm-cells = <3>;
};

pinctrl_tpm7: tpm7grp {
fsl,pins = <
MX8ULP_PAD_PTF25__TPM7_CH5 0x2
>;
};

root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8/pwm5# echo 400000 > period
root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8/pwm5# echo 200000 > duty_cycle
root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8/pwm5# echo 1 > enable

Re: How to configure the clock source of TPM in iMX8ULP dts?

Now, the kernel starts normally.But when I enable PWM channal, it will report an error!

root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8/pwm5# echo 100000 > period
root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8/pwm5# echo 50000 > duty_cycle
root@imx8ulp-lpddr4-evk:/sys/class/pwm/pwmchip8/pwm5# echo 1 > enable
-sh: echo: write error: Timer expired

Re: How to configure the clock source of TPM in iMX8ULP dts?

ok, I will show it for you.

node TPM7,8 are added by myself.

Re: How to configure the clock source of TPM in iMX8ULP dts?

Hello,

Could you share the full device tree that you are using?
Also, the node you have added seems to be incomplete that may be part of the reason as to why it does fail to boot correctly.

Best regards/Saludos,
Aldo.

Tags (1)
No ratings
Version history
Last update:
‎11-21-2025 04:28 PM
Updated by: