All of lore.kernel.org
 help / color / mirror / Atom feed
* RFC: imx8qm: imx-scu-clk: probe of clk failed
@ 2020-02-27 12:57 ` Oliver Graute
  0 siblings, 0 replies; 8+ messages in thread
From: Oliver Graute @ 2020-02-27 12:57 UTC (permalink / raw)
  To: aisheng.dong, anson.huang
  Cc: festevam, linux-imx, linux-clk, s.hauer, mturquette,
	leonard.crestez, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RFC: imx8qm: imx-scu-clk: probe of clk failed
@ 2020-02-27 12:57 ` Oliver Graute
  0 siblings, 0 replies; 8+ messages in thread
From: Oliver Graute @ 2020-02-27 12:57 UTC (permalink / raw)
  To: aisheng.dong, anson.huang
  Cc: mturquette, linux-clk, linux-imx, leonard.crestez, festevam,
	s.hauer, linux-arm-kernel

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFC: imx8qm: imx-scu-clk: probe of clk failed
  2020-02-27 12:57 ` Oliver Graute
@ 2020-02-27 15:31   ` Oliver Graute
  -1 siblings, 0 replies; 8+ messages in thread
From: Oliver Graute @ 2020-02-27 15:31 UTC (permalink / raw)
  To: aisheng.dong, anson.huang
  Cc: festevam, linux-imx, linux-clk, s.hauer, mturquette,
	leonard.crestez, linux-arm-kernel

On 27/02/20, Oliver Graute wrote:
> 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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFC: imx8qm: imx-scu-clk: probe of clk failed
@ 2020-02-27 15:31   ` Oliver Graute
  0 siblings, 0 replies; 8+ messages in thread
From: Oliver Graute @ 2020-02-27 15:31 UTC (permalink / raw)
  To: aisheng.dong, anson.huang
  Cc: mturquette, linux-clk, linux-imx, leonard.crestez, festevam,
	s.hauer, linux-arm-kernel

On 27/02/20, Oliver Graute wrote:
> 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

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: RFC: imx8qm: imx-scu-clk: probe of clk failed
  2020-02-27 15:31   ` Oliver Graute
@ 2020-02-28  0:40     ` Anson Huang
  -1 siblings, 0 replies; 8+ messages in thread
From: Anson Huang @ 2020-02-28  0:40 UTC (permalink / raw)
  To: Oliver Graute, Aisheng Dong
  Cc: festevam, dl-linux-imx, linux-clk, s.hauer, mturquette,
	Leonard Crestez, linux-arm-kernel

Hi, Oliver

> Subject: Re: RFC: imx8qm: imx-scu-clk: probe of clk failed
> 
> On 27/02/20, Oliver Graute wrote:
> > 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
> 
> 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.

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: RFC: imx8qm: imx-scu-clk: probe of clk failed
@ 2020-02-28  0:40     ` Anson Huang
  0 siblings, 0 replies; 8+ messages in thread
From: Anson Huang @ 2020-02-28  0:40 UTC (permalink / raw)
  To: Oliver Graute, Aisheng Dong
  Cc: mturquette, linux-clk, dl-linux-imx, Leonard Crestez, festevam,
	s.hauer, linux-arm-kernel

Hi, Oliver

> Subject: Re: RFC: imx8qm: imx-scu-clk: probe of clk failed
> 
> On 27/02/20, Oliver Graute wrote:
> > 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
> 
> 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.

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFC: imx8qm: imx-scu-clk: probe of clk failed
  2020-02-28  0:40     ` Anson Huang
@ 2020-02-28  9:14       ` Oliver Graute
  -1 siblings, 0 replies; 8+ messages in thread
From: Oliver Graute @ 2020-02-28  9:14 UTC (permalink / raw)
  To: Anson Huang
  Cc: Aisheng Dong, festevam, dl-linux-imx, linux-clk, s.hauer,
	mturquette, Leonard Crestez, linux-arm-kernel

On 28/02/20, Anson Huang wrote:
> Hi, Oliver
> 
> > Subject: Re: RFC: imx8qm: imx-scu-clk: probe of clk failed
> > 
> > On 27/02/20, Oliver Graute wrote:
> > > 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
> > 
> > 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.
> 
> 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?
> 
> 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:

--- a/include/dt-bindings/clock/imx8-clock.h
+++ b/include/dt-bindings/clock/imx8-clock.h
@@ -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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFC: imx8qm: imx-scu-clk: probe of clk failed
@ 2020-02-28  9:14       ` Oliver Graute
  0 siblings, 0 replies; 8+ messages in thread
From: Oliver Graute @ 2020-02-28  9:14 UTC (permalink / raw)
  To: Anson Huang
  Cc: Aisheng Dong, mturquette, linux-clk, dl-linux-imx,
	Leonard Crestez, festevam, s.hauer, linux-arm-kernel

On 28/02/20, Anson Huang wrote:
> Hi, Oliver
> 
> > Subject: Re: RFC: imx8qm: imx-scu-clk: probe of clk failed
> > 
> > On 27/02/20, Oliver Graute wrote:
> > > 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
> > 
> > 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.
> 
> 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?
> 
> 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:

--- a/include/dt-bindings/clock/imx8-clock.h
+++ b/include/dt-bindings/clock/imx8-clock.h
@@ -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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-02-28  9:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27 12:57 RFC: imx8qm: imx-scu-clk: probe of clk failed Oliver Graute
2020-02-27 12:57 ` Oliver Graute
2020-02-27 15:31 ` Oliver Graute
2020-02-27 15:31   ` Oliver Graute
2020-02-28  0:40   ` Anson Huang
2020-02-28  0:40     ` Anson Huang
2020-02-28  9:14     ` Oliver Graute
2020-02-28  9:14       ` Oliver Graute

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.