RFC: imx8qm: imx-scu-clk: probe of clk failed
Hello Aisheng,
Hello Anson,
I get the following imx-scu errors when using Linux version 5.6.0-rc1-next-20200214 with scfw Build 3353, Commit 494c97f3
It seems that important clocks are off somehow and that lpspi isn't working because of that. What is the best way to debug such issues?
[ 1.103799] imx-scu scu: NXP i.MX SCU Initialized [ 1.111383] a35_clk: failed to get clock rate -22 [ 1.122843] lcd0-pwm0: failed to power up resource 188 ret -22 [ 1.128438] imx-scu-clk: probe of pwm_clk failed with error -22 [ 1.134746] lcd0: failed to power up resource 187 ret -22 [ 1.139898] imx-scu-clk: probe of lcd_clk failed with error -22 [ 1.151177] mipi_csi0_core_clk: failed to attached the power domain -2 [ 1.157581] mipi_csi0_esc_clk: failed to attached the power domain -2 [ 1.163985] mipi_csi0_i2c0_clk: failed to attached the power domain -2 [ 1.170524] mipi_csi0_pwm0_clk: failed to attached the power domain -2 [ 1.181817] imx8qm-pinctrl scu:pinctrl: initialized IMX pinctrl driver [ 1.211140] random: fast init done [ 1.216039] 5a060000.serial: ttyLP0 at MMIO 0x5a060000 (irq = 8, base_baud = 5000000) is a FSL_LPUAR[ 1.225100] printk: console [ttyLP0] enabled [ 1.225100] printk: console [ttyLP0] enabled [ 1.233543] printk: bootconsole [lpuart32] disabled [ 1.233543] printk: bootconsole [lpuart32] disabled [ 1.243549] fsl-lpuart 5a060000.serial: DMA tx channel request failed, operating without tx DMA [ 1.252275] fsl-lpuart 5a060000.serial: DMA rx channel request failed, operating without rx DMA [ 1.261868] 5a070000.serial: ttyLP1 at MMIO 0x5a070000 (irq = 9, base_baud = 0) is a FSL_LPUART [ 1.270767] fsl-lpuart 5a070000.serial: DMA tx channel request failed, operating without tx DMA [ 1.279481] fsl-lpuart 5a070000.serial: DMA rx channel request failed, operating without rx DMA [ 1.289310] fb_st7789v spi0.0: fbtft_property_value: buswidth = 9 [ 1.296105] fsl_lpspi 5a010000.lpspi: failed to enable clock [ 1.301771] spi_master spi0: failed to prepare transfer hardware: -13 [ 1.308231] fb_st7789v spi0.0: write() failed and returned -13
Best regards,
Oliver
Quoted 11 lines · Oliver Graute
Hello Aisheng,
Hello Anson,I get the following imx-scu errors when using Linux version 5.6.0-rc1-next-20200214 with scfw Build 3353, Commit
494c97f3It seems that important clocks are off somehow and that lpspi isn't working because of that. What is the best way to debug such issues?
[ 1.103799] imx-scu scu: NXP i.MX SCU Initialized [ 1.111383] a35_clk: failed to get clock rate -22
After some deeper digging I saw that the reason for "a35_clk: failed" is an IMX_SC_ERR_PARM = 3. Because he trys to get the resource SC_R_A35 which is only available on imx8qxp and not on imx8qm. No clue why he try that instead of SC_R_A53.
Best regards,
Oliver
Hi, Oliver
Quoted 12 lines
Subject: Re: RFC: imx8qm: imx-scu-clk: probe of clk failed
Quoted 9 lines · Oliver Graute
Hello Aisheng,
Hello Anson,I get the following imx-scu errors when using Linux version 5.6.0-rc1-next-20200214 with scfw Build 3353, Commit
494c97f3It seems that important clocks are off somehow and that lpspi isn't working because of that. What is the best way to debug such issues?
Quoted 7 lines
Quoted 2 lines
[ 1.103799] imx-scu scu: NXP i.MX SCU Initialized [ 1.111383] a35_clk: failed to get clock rate -22After some deeper digging I saw that the reason for "
a35_clk: failed" is anIMX_SC_ERR_PARM= 3. Because he trys to get the resourceSC_R_A35which is only available on imx8qxp and not on imx8qm. No clue why he try that instead ofSC_R_A53.
You are running on i.MX8QM board, right? Is it because the A35/A53/A72 clocks are registered on same clock driver, so that clock core will calculate their rate during clock tree setup? But even A35 clock get rate failed on i.MX8QM, I don't see it will impact lpspi.
i.MX8QM is already supported on our internal v5.4 tree, there are some changes in clk-scu.c, I pasted some code piece as below, maybe you can compare the difference and have a try?
276 static int clk_scu_atf_set_cpu_rate(struct clk_hw *hw, unsigned long rate,
277 unsigned long parent_rate)
278 {
279 struct clk_scu *clk = to_clk_scu(hw); 280 struct arm_smccc_res res; 281 unsigned long cluster_id;
282
283 if (clk->rsrc_id == IMX_SC_R_A35 || clk->rsrc_id == IMX_SC_R_A53)
284 cluster_id = 0;
285 else if (clk->rsrc_id == IMX_SC_R_A72)
286 cluster_id = 1;
287 else
288 return -EINVAL;
471 init.name = name; 472 init.ops = &clk_scu_ops; 473 if (rsrc_id == IMX_SC_R_A35 || rsrc_id == IMX_SC_R_A53 || rsrc_id == IMX_SC_R_A72)
474 init.ops = &clk_scu_cpu_ops;
475 else if (rsrc_id == IMX_SC_R_PI_0_PLL)
476 init.ops = &clk_scu_pi_ops;
477 else
478 init.ops = &clk_scu_ops;
646 static int imx_clk_scu_attach_pd(struct device *dev, u32 rsrc_id) 647 {
648 struct of_phandle_args genpdspec = {
649 .np = pd_np, 650 .args_count = 1, 651 .args[0] = rsrc_id,
652 };
653
654 if ((rsrc_id == IMX_SC_R_A35) || (rsrc_id == IMX_SC_R_A53) ||
655 (rsrc_id == IMX_SC_R_A72))
656 return 0;
Anson
Quoted 22 lines · Anson Huang
Hi, Oliver
Quoted 12 lines
Subject: Re: RFC: imx8qm: imx-scu-clk: probe of clk failed
Quoted 9 lines · Oliver Graute
Hello Aisheng,
Hello Anson,I get the following imx-scu errors when using Linux version 5.6.0-rc1-next-20200214 with scfw Build 3353, Commit
494c97f3It seems that important clocks are off somehow and that lpspi isn't working because of that. What is the best way to debug such issues?
Quoted 7 lines
Quoted 2 lines
[ 1.103799] imx-scu scu: NXP i.MX SCU Initialized [ 1.111383] a35_clk: failed to get clock rate -22After some deeper digging I saw that the reason for "
a35_clk: failed" is anIMX_SC_ERR_PARM= 3. Because he trys to get the resourceSC_R_A35which is only available on imx8qxp and not on imx8qm. No clue why he try that instead ofSC_R_A53.
Quoted 4 lines
You are running on i.MX8QM board, right? Is it because the A35/A53/A72 clocks are registered on same clock driver, so that clock core will calculate their rate during clock tree setup? But even A35 clock get rate failed on i.MX8QM, I don't see it will impact lpspi.
yes I'am using a i.MX8QM based board. Which clocks are needed to get lpspi working on imx8qm?
Quoted 4 lines
i.MX8QM is already supported on our internal v5.4 tree, there are some changes in
clk-scu.c, I pasted some code piece as below, maybe you can compare the difference and have a try?
ok I use your proposed code now. A struct clk_scu_pi_ops is missing for me here. Also I added this:
include/dt-bindings/clock/imx8-clock.h +6 -2
@@ -131,7 +131,9 @@#define IMX_ADMA_PWM_CLK 188#define IMX_ADMA_LCD_CLK 189 -#define IMX_SCU_CLK_END 190 +#define IMX_A53_CLK 190 +#define IMX_A72_CLK 191 +#define IMX_SCU_CLK_END 192 --- a/drivers/clk/imx/clk-imx8qxp.c +++ b/drivers/clk/imx/clk-imx8qxp.c
@@ -60,6 +68,8 @@ static int imx8qxp_clk_probe(struct platform_device *pdev)/* ARM core */ clks[IMX_A35_CLK ] =imx_clk_scu ("a35_clk" ,IMX_SC_R_A35 ,IMX_SC_PM_CLK_CPU , clk_cells); + clks[IMX_A53_CLK ] =imx_clk_scu ("a53_clk" ,IMX_SC_R_A53 ,IMX_SC_PM_CLK_CPU , clk_cells); + clks[IMX_A72_CLK ] =imx_clk_scu ("a72_clk" ,IMX_SC_R_A72 ,IMX_SC_PM_CLK_CPU , clk_cells);
Is it correct to use the imx8qxp clock probing here?
Best regards,
Oliver