Yocto 3.0 imx8qxp support pwm2

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

Yocto 3.0 imx8qxp support pwm2

Jump to solution
950 Views
zhengguang_yang
Contributor II

Hello:

I'm using imx8qxp, Yocto 3.0

I am working with a custom board that requires UART1_RTS_B to be used as a PWM output. 

But I did not see any nodes in these files for the LSIO PWM modules and I did not see them enabled in the device tree for the IMX8QXP MEK. 

0 Kudos
1 Solution
934 Views
igorpadykov
NXP Employee
NXP Employee
0 Kudos
6 Replies
944 Views
igorpadykov
NXP Employee
NXP Employee

Hi Zhengguang

 

patch was sent you via mail.

 

Best regards
igor

0 Kudos
939 Views
zhengguang_yang
Contributor II

Hi Igorpadykov:

Thank you for your reply.

This patch can be used in yocto 2.5, but the code structure of yocto 3.0 changes greatly, such as drivers/clk/imx/clk-imx8qxp.c. It seems that this patch cannot be used directly in yocto 3.0.

0 Kudos
937 Views
zhengguang_yang
Contributor II

The kernel version we use is 5.4.

Part of the code of drivers/clk/imx/clk-imx8qxp.c is as follows

static int imx8qxp_clk_probe(struct platform_device *pdev)
{
const struct of_device_id *of_id =
of_match_device(imx8qxp_match, &pdev->dev);
struct device_node *ccm_node = pdev->dev.of_node;
int ret;

ret = imx_clk_scu_init(ccm_node, of_id->data);
if (ret)
return ret;

/* ARM core */
imx_clk_scu("a35_clk", IMX_SC_R_A35, IMX_SC_PM_CLK_CPU);
imx_clk_scu("a53_clk", IMX_SC_R_A53, IMX_SC_PM_CLK_CPU);
imx_clk_scu("a72_clk", IMX_SC_R_A72, IMX_SC_PM_CLK_CPU);

/* LSIO SS */
imx_clk_scu("pwm0_clk", IMX_SC_R_PWM_0, IMX_SC_PM_CLK_PER);
imx_clk_scu("pwm1_clk", IMX_SC_R_PWM_1, IMX_SC_PM_CLK_PER);
imx_clk_scu("pwm2_clk", IMX_SC_R_PWM_2, IMX_SC_PM_CLK_PER);
imx_clk_scu("pwm3_clk", IMX_SC_R_PWM_3, IMX_SC_PM_CLK_PER);
imx_clk_scu("pwm4_clk", IMX_SC_R_PWM_4, IMX_SC_PM_CLK_PER);
imx_clk_scu("pwm5_clk", IMX_SC_R_PWM_5, IMX_SC_PM_CLK_PER);
imx_clk_scu("pwm6_clk", IMX_SC_R_PWM_6, IMX_SC_PM_CLK_PER);
imx_clk_scu("pwm7_clk", IMX_SC_R_PWM_7, IMX_SC_PM_CLK_PER);
imx_clk_scu("gpt1_clk", IMX_SC_R_GPT_1, IMX_SC_PM_CLK_PER);
imx_clk_scu("gpt2_clk", IMX_SC_R_GPT_2, IMX_SC_PM_CLK_PER);
imx_clk_scu("gpt3_clk", IMX_SC_R_GPT_3, IMX_SC_PM_CLK_PER);
imx_clk_scu("gpt4_clk", IMX_SC_R_GPT_4, IMX_SC_PM_CLK_PER);
imx_clk_scu("fspi0_clk", IMX_SC_R_FSPI_0, IMX_SC_PM_CLK_PER);
imx_clk_scu("fspi1_clk", IMX_SC_R_FSPI_1, IMX_SC_PM_CLK_PER);

0 Kudos
935 Views
igorpadykov
NXP Employee
NXP Employee
0 Kudos
927 Views
zhengguang_yang
Contributor II

I tried this method and it didn't work

My modification is as follows:

imx8qxp.dtsi:

pwm2: pwm@5d020000 {
compatible = "fsl,imx8qm-pwm", "fsl,imx27-pwm";
reg = <0x5d020000 0x10000>;
clock-names = "ipg", "per";
clocks = <&pwm2_lpcg 4>,
<&pwm2_lpcg 1>;
assigned-clocks = <&clk IMX_SC_R_PWM_2 IMX_SC_PM_CLK_PER>;
assigned-clock-rates = <24000000>;
#pwm-cells = <2>;
status = "disabled";
};

Add the following content to the DTS file of our board

pinctrl_pwm_d: pwmd {
fsl,pins = <
IMX8QXP_UART1_RTS_B_LSIO_PWM2_OUT 0x60 /* SODIMM 67 */
>;
};

&pwm2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm_d>;
#pwm-cells = <2>;
};

0 Kudos
915 Views
zhengguang_yang
Contributor II

 

The test is normal after modifying the following contents:

reg = <0x0 0x5d020000 0 0x10000>;

Thank you very much

 

0 Kudos