Hi NXP Community !
Subject:
I want to use the General Purpose Timer 1 in INPUT Capture mode on the i.MX8MM.
I've used the following patches described here: https://lwn.net/ml/linux-kernel/20220210084335.1979778-1-jian.jiang@nxp.com/
In device tree i've added those following lines:
gpt1: gpt@302d0000 {
compatible = "fsl,imx8mm-gpt";
reg = <0x302d0000 0x10000>;
interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8MM_CLK_GPT1_ROOT>,
<&clk IMX8MM_CLK_GPT1_ROOT>,
<&clk IMX8MM_CLK_GPT_3M>;
clock-names = "ipg", "per", "osc_per";
};
I've also disabled SAI3 and SAI5 to avoid any reconfiguration.
But i get the following error on boot logs:
i.MX timer: unable to get clk
According the driver in /drivers/clocksource/timer-imx-gpt.c, it seems that is because it didn't manage to use any clock for the device (clk_per).
I've followed this link :https://community.nxp.com/t5/i-MX-Processors/GPT-capture-sample-on-M4-seems-to-hang-on-Linux-boot/m-...
It says that the linux part is disabling the clock. Why that?
I've followed this link also : https://community.nxp.com/t5/i-MX-Processors/GPT-on-i-MX-8M-Mini/m-p/1206969#M167291
I don't really understand the answer, tried it, I got the clocksource initialized:
[0.008172] clocksource: mxc_timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 637086815595 ns
But the kernel stops at the middle of the boot process.
Any advices?
I obviously added CONFIG_CLKSRC_IMX_GPT=y to enable the driver, as some logs shown above came from that driver.
So device tree seems fines.
Config seems fines.
I suspect a clocking problem.
Thanks!
Solved! Go to Solution.
Hi @c_guerr,
Dhruvit Vasavada.
To be more precise, it's seems that the GPT Driver probed earlier than the clk-imx8mm driver.
I've already see a patch to change the clock driver to get probed earlier by using CLK_OF_DECLARE instead of module_platform_driver.
But this doesn't works well even if the clocksource get initialized. The problem is that lot of other clock in the imx8mm use clock which aren't initialized. So the kernel stop at the begginnin.
So I guess the only solution is to Defer the probing of this driver.
I tried to return EPROBE_DEFER without any success.
Hi @c_guerr,
I'm good thanks, hope you too!
Thanks for your fast reply!
Any other solution to count the rising edge of a signal using IMX8mm ?
Is the input capture function something we can suspect arriving in the next Linux bsp version?
Thanks again
Hi @c_guerr,
Dhruvit Vasavada.
Is there anything to figure out when doing Input capture by the M4 Core ?
Is there things to enable/disable from Linux part on cortex A53?
And by the way, does it affect the pinout of the board ? I mean, i've done a bit of hardware arround the pin for GPT1 Input Capture. I assume they share the same pin right?
Thanks again for your fast reply!
I managed to make the GPT working on the CORTEX M4 instead of using the CORTEX-A53 through Linux.
Thanks for the support.
I would do new topics if I encounter other problems (rpmsg, gpt hang on linux boot etc).