fsl,imx8qxp-pwm lsio_pwm0-7 device tree nodes

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

fsl,imx8qxp-pwm lsio_pwm0-7 device tree nodes

Jump to solution
2,160 Views
petero5
Contributor III

Hi

imx8-ss-dma.dtsi has e.g. adma_pwm_lpcg *and* adma_pwm
but imx8-ss-lsio.dtsi has only e.g. pwm3_lpcg, not lsio_pwm3 (or similar)?

Found this similar question:
https://community.nxp.com/t5/i-MX-Processors/Enable-IMX8QXP-LSIO-PWM/m-p/966483/
but the solution references things that are no longer in lf-5.15.y

So based on that, and adma_pwm, have cobbled together the following. Seems to work. But just incase, are there any mistakes in it?

lsio_pwm3: pwm@5d030000 {
compatible = "fsl,imx8qxp-pwm", "fsl,imx27-pwm";
reg = <0x0 0x5d030000 0 0x1000>;
clocks = <&pwm3_lpcg 0>, <&pwm3_lpcg 1>;
clock-names = "ipg", "per";
assigned-clocks = <&clk IMX_SC_R_PWM_3 IMX_SC_PM_CLK_PER>;
assigned-clock-rates = <24000000>;
#pwm-cells = <2>;
power-domains = <&pd IMX_SC_R_PWM_3>;

pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lsio_pwm3>;
status = "okay";
};

pinctrl_lsio_pwm3: lsio_pwm3_grp {
fsl,pins = <
IMX8QXP_UART1_CTS_B_LSIO_PWM3_OUT 0xC8000020
>;
};

Thank you
-- Peter

Tags (1)
0 Kudos
Reply
1 Solution
2,070 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

I made a mistake on your last post, sorry about that, no you shouldn't use the 5 listed there you may use only 2 of them and also yes you may use the definition of it for a shorter name, as you did in your first post.

I see no problem with your device tree as you did.

Best regards,
Aldo.

View solution in original post

6 Replies
2,128 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

Yes, it looks correct if it is working then even better.

Just to make sure that you have the correct reference you may refer to the following:
https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/arch/arm64/boot/dts/freescale/imx8qxp-ss-lvds.dt...

Best regards,
Aldo.

0 Kudos
Reply
2,109 Views
petero5
Contributor III

Hi Aldo

Thank you. Question:

adma_pwm/adma_pwm_lpcg has two clocks: "per" and "ipg".

https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi#L...

pwm_mipi_lvds0/mipi0_pwm_lpcg has "per", "ipg", "32k"

https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/arch/arm64/boot/dts/freescale/imx8qxp-ss-lvds.dt...

pwm3_lpcg has 5 clocks...

https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/arch/arm64/boot/dts/freescale/imx8-ss-lsio.dtsi#...

clocks = <&clk IMX_SC_R_PWM_3 IMX_SC_PM_CLK_PER>,
<&clk IMX_SC_R_PWM_3 IMX_SC_PM_CLK_PER>,
<&clk IMX_SC_R_PWM_3 IMX_SC_PM_CLK_PER>,
<&lsio_bus_clk>,
<&clk IMX_SC_R_PWM_3 IMX_SC_PM_CLK_PER>;

clock-output-names = "pwm3_lpcg_ipg_clk",
"pwm3_lpcg_ipg_hf_clk",
"pwm3_lpcg_ipg_s_clk",
"pwm3_lpcg_ipg_slv_clk",
"pwm3_lpcg_ipg_mstr_clk";

Well four of the five are the same, but the fourth entry is different (&lsio_bus_clk).

Should I be using all 5, and if so should I be using those names, or shorter names?

Or ...?

Thank you

-- Peter

0 Kudos
Reply
2,105 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

Yes, please use them and do use the same macro names since they are called from the clock driver with this macro names.

Best regards,
Aldo.

0 Kudos
Reply
2,088 Views
petero5
Contributor III

Hi Aldo

Thank you, however I'm still not clear.
The driver pwm-imx27.c expects "ipg", "per" and optionally "32k".
https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/drivers/pwm/pwm-imx27.c#L385

However, pwm3_lpcg has five clocks
https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/arch/arm64/boot/dts/freescale/imx8-ss-lsio.dtsi#...
that it calls
"pwm3_lpcg_ipg_clk", "pwm3_lpcg_ipg_hf_clk", "pwm3_lpcg_ipg_s_clk", "pwm3_lpcg_ipg_slv_clk", "pwm3_lpcg_ipg_mstr_clk";

If I use those same long names in my node
lsio_pwm3: pwm@5d030000 {
compatible = "fsl,imx8qxp-pwm", "fsl,imx27-pwm";
...
then I get:
[ 2.718368] pwm-imx27 5d030000.pwm: error -ENOENT: getting ipg clock failed

And if I change mine to use short versions of those names e.g.
clock-names = "ipg", "hf", "s", "slv", "mstr";
then I get:
[ 2.711906] pwm-imx27 5d030000.pwm: error -ENOENT: failed to get peripheral clock

So if I'm using compatible "fsl,imx27-pwm", then I can only use the names "ipg", "per" and optionally "32k".
I guess "ipg" relates to clocks = <&pwm3_lpcg 0> but not sure which of the five "per" and "32k" would relate to?
Is compatible = "fsl,imx8qxp-pwm", "fsl,imx27-pwm"; correct or should I be using a different pwm driver that is expecting five clocks rather than three?

Thank you
-- Peter

0 Kudos
Reply
2,071 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

I made a mistake on your last post, sorry about that, no you shouldn't use the 5 listed there you may use only 2 of them and also yes you may use the definition of it for a shorter name, as you did in your first post.

I see no problem with your device tree as you did.

Best regards,
Aldo.

2,067 Views
petero5
Contributor III
Hi Aldo, thank you for confirming!