Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
* [PATCH v2] PCI: imx6: Move clock enable after core reset assertion
@ 2026-08-13  9:50 hongxing.zhu
  2026-08-13  9:57 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: hongxing.zhu @ 2026-08-13  9:50 UTC (permalink / raw)
  To: leoreis.costa, fra.schnyder, francesco, frank.li, l.stach,
	lpieralisi, kwilczynski, mani, robh, bhelgaas, s.hauer, kernel,
	festevam
  Cc: linux-pci, linux-arm-kernel, imx, linux-kernel, Richard Zhu,
	stable

From: Richard Zhu <hongxing.zhu@nxp.com>

Commit 610fa91d9863 ("PCI: imx6: Assert PERST# before enabling regulators")
inadvertently moved clock enablement before core reset assertion, breaking
PCI device initialization on i.MX6Q Apalis platforms with
ASM1061/ASM1062 SATA controllers connected.

NOTE: It is not 100% clear if the issue is specific to the ASM1061/ASM1062
device or on the specific power-up sequence (reset vs cold-power-on).

Logs:
root@apalis-imx6-11486042:~# dmesg | grep pcie
imx6q-pcie 1ffc000.pcie: host bridge /soc/pcie@1ffc000 ranges:
imx6q-pcie 1ffc000.pcie:       IO 0x0001f80000..0x0001f8ffff -> 0x0000000000
imx6q-pcie 1ffc000.pcie:      MEM 0x0001000000..0x0001efffff -> 0x0001000000
imx6q-pcie 1ffc000.pcie: config reg[1] 0x01f00000 == cpu 0x01f00000
imx6q-pcie 1ffc000.pcie: iATU: unroll F, 4 ob, 4 ib, align 64K, limit 4G
imx6q-pcie 1ffc000.pcie: Link: Only Gen1 is enabled
imx6q-pcie 1ffc000.pcie: Link failed to come up. LTSSM: POLL_CONFIG
imx6q-pcie 1ffc000.pcie: probe with driver imx6q-pcie failed with error -110

To fix this regression, restore the original sequence where clocks are
enabled after asserting core reset and configuring the controller type.

Fixes: 610fa91d9863 ("PCI: imx6: Assert PERST# before enabling regulators")
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reported-by: Leonardo Costa <leoreis.costa@gmail.com>
Closes: https://lore.kernel.org/all/bl7i3obu2clzsgeoct2a4mtfhv6typcjdqmgneropf3hpgwve6@n2m5uhlduw57/T/#u
Reported-by: Franz Schnyder <fra.schnyder@gmail.com>
Closes: https://lore.kernel.org/all/t65y5d54axtksbfs7r4olcefqhwm6m4dz3njgnrnf7fcotj74i@o7avoznlafbj/
Cc: stable@vger.kernel.org # 7.2+
---
Changes in v2:
Update the commit message refer to Francesco' suggestions.
---
 drivers/pci/controller/dwc/pci-imx6.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 39790e66b98dc..f7a2eb257c169 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1394,12 +1394,6 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
 		}
 	}
 
-	ret = imx_pcie_clk_enable(imx_pcie);
-	if (ret) {
-		dev_err(dev, "unable to enable pcie clocks: %d\n", ret);
-		goto err_pwrctrl_power_off;
-	}
-
 	if (pp->bridge && imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_LUT)) {
 		pp->bridge->enable_device = imx_pcie_enable_device;
 		pp->bridge->disable_device = imx_pcie_disable_device;
@@ -1415,6 +1409,12 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
 
 	imx_pcie_configure_type(imx_pcie);
 
+	ret = imx_pcie_clk_enable(imx_pcie);
+	if (ret) {
+		dev_err(dev, "unable to enable pcie clocks: %d\n", ret);
+		goto err_pwrctrl_power_off;
+	}
+
 	if (imx_pcie->phy) {
 		ret = phy_init(imx_pcie->phy);
 		if (ret) {

base-commit: 28d012efb4327f9c75d5e042a7c91e9a542efa98
-- 
2.34.1


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

* Re: [PATCH v2] PCI: imx6: Move clock enable after core reset assertion
  2026-08-13  9:50 [PATCH v2] PCI: imx6: Move clock enable after core reset assertion hongxing.zhu
@ 2026-08-13  9:57 ` sashiko-bot
  2026-08-31  9:30 ` Francesco Dolcini
  2026-09-02 14:15 ` Manivannan Sadhasivam
  2 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-08-13  9:57 UTC (permalink / raw)
  To: hongxing.zhu; +Cc: Frank.Li, linux-pci, imx

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The return value of `imx_pcie_host_init()` is ignored in `imx_add_pcie_ep()`, allowing initialization to proceed even if critical hardware resources failed to enable.
--

--- Patch [1]: [PATCH v2] PCI: imx6: Move clock enable after core reset assertion ---
commit e96724a712688ba6f907245675d12f392129c5de
Author: Richard Zhu <hongxing.zhu@nxp.com>

PCI: imx6: Move clock enable after core reset assertion

Restores the sequence where clocks are enabled after asserting core reset
and configuring the controller type. Fixes a regression on i.MX6Q Apalis
platforms with ASM1061/ASM1062 SATA controllers connected.

Link: https://lore.kernel.org/all/bl7i3obu2clzsgeoct2a4mtfhv6typcjdqmgneropf3hpgwve6@n2m5uhlduw57/T/#u
Link: https://lore.kernel.org/all/t65y5d54axtksbfs7r4olcefqhwm6m4dz3njgnrnf7fcotj74i@o7avoznlafbj/

> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 39790e66b98dc..f7a2eb257c169 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
[ ... ]
> @@ -1415,6 +1409,12 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
>  
>  	imx_pcie_configure_type(imx_pcie);
>  
> +	ret = imx_pcie_clk_enable(imx_pcie);
> +	if (ret) {
> +		dev_err(dev, "unable to enable pcie clocks: %d\n", ret);
> +		goto err_pwrctrl_power_off;
> +	}

[Severity: High]
This isn't a bug introduced by this patch, but is it safe to ignore the
return value of imx_pcie_host_init() in imx_add_pcie_ep()?

drivers/pci/controller/dwc/pci-imx6.c:imx_add_pcie_ep() {
	...
	imx_pcie_host_init(pp);
	ep = &pci->ep;
	...
}

If imx_pcie_host_init() fails (for example, if imx_pcie_clk_enable() fails
here), the error is discarded and the endpoint initialization proceeds.

Could this lead to a kernel panic or synchronous external abort when
dw_pcie_ep_init() subsequently attempts to access unclocked or unpowered
PCIe registers?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813095003.356062-1-hongxing.zhu@oss.nxp.com?part=1

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

* Re: [PATCH v2] PCI: imx6: Move clock enable after core reset assertion
  2026-08-13  9:50 [PATCH v2] PCI: imx6: Move clock enable after core reset assertion hongxing.zhu
  2026-08-13  9:57 ` sashiko-bot
@ 2026-08-31  9:30 ` Francesco Dolcini
  2026-09-02 14:15 ` Manivannan Sadhasivam
  2 siblings, 0 replies; 6+ messages in thread
From: Francesco Dolcini @ 2026-08-31  9:30 UTC (permalink / raw)
  To: hongxing.zhu
  Cc: leoreis.costa, fra.schnyder, francesco, frank.li, l.stach,
	lpieralisi, kwilczynski, mani, robh, bhelgaas, s.hauer, kernel,
	festevam, linux-pci, linux-arm-kernel, imx, linux-kernel,
	Richard Zhu, stable

Hello all,

On Thu, Aug 13, 2026 at 05:50:03PM +0800, hongxing.zhu@oss.nxp.com wrote:
> From: Richard Zhu <hongxing.zhu@nxp.com>
> 
> Commit 610fa91d9863 ("PCI: imx6: Assert PERST# before enabling regulators")
> inadvertently moved clock enablement before core reset assertion, breaking
> PCI device initialization on i.MX6Q Apalis platforms with
> ASM1061/ASM1062 SATA controllers connected.
> 
> NOTE: It is not 100% clear if the issue is specific to the ASM1061/ASM1062
> device or on the specific power-up sequence (reset vs cold-power-on).
> 
> Logs:
> root@apalis-imx6-11486042:~# dmesg | grep pcie
> imx6q-pcie 1ffc000.pcie: host bridge /soc/pcie@1ffc000 ranges:
> imx6q-pcie 1ffc000.pcie:       IO 0x0001f80000..0x0001f8ffff -> 0x0000000000
> imx6q-pcie 1ffc000.pcie:      MEM 0x0001000000..0x0001efffff -> 0x0001000000
> imx6q-pcie 1ffc000.pcie: config reg[1] 0x01f00000 == cpu 0x01f00000
> imx6q-pcie 1ffc000.pcie: iATU: unroll F, 4 ob, 4 ib, align 64K, limit 4G
> imx6q-pcie 1ffc000.pcie: Link: Only Gen1 is enabled
> imx6q-pcie 1ffc000.pcie: Link failed to come up. LTSSM: POLL_CONFIG
> imx6q-pcie 1ffc000.pcie: probe with driver imx6q-pcie failed with error -110
> 
> To fix this regression, restore the original sequence where clocks are
> enabled after asserting core reset and configuring the controller type.
> 
> Fixes: 610fa91d9863 ("PCI: imx6: Assert PERST# before enabling regulators")
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> Reported-by: Leonardo Costa <leoreis.costa@gmail.com>
> Closes: https://lore.kernel.org/all/bl7i3obu2clzsgeoct2a4mtfhv6typcjdqmgneropf3hpgwve6@n2m5uhlduw57/T/#u
> Reported-by: Franz Schnyder <fra.schnyder@gmail.com>
> Closes: https://lore.kernel.org/all/t65y5d54axtksbfs7r4olcefqhwm6m4dz3njgnrnf7fcotj74i@o7avoznlafbj/
> Cc: stable@vger.kernel.org # 7.2+

gentle ping on this, it fixes a regression from kernel 7.2

Thanks,
Francesco


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

* Re: [PATCH v2] PCI: imx6: Move clock enable after core reset assertion
  2026-08-13  9:50 [PATCH v2] PCI: imx6: Move clock enable after core reset assertion hongxing.zhu
  2026-08-13  9:57 ` sashiko-bot
  2026-08-31  9:30 ` Francesco Dolcini
@ 2026-09-02 14:15 ` Manivannan Sadhasivam
  2026-09-17 11:08   ` Thorsten Leemhuis
  2 siblings, 1 reply; 6+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-02 14:15 UTC (permalink / raw)
  To: leoreis.costa, fra.schnyder, francesco, frank.li, l.stach,
	lpieralisi, kwilczynski, mani, robh, bhelgaas, s.hauer, kernel,
	festevam, hongxing.zhu
  Cc: linux-pci, linux-arm-kernel, imx, linux-kernel, Richard Zhu,
	stable


On Thu, 13 Aug 2026 17:50:03 +0800, hongxing.zhu@oss.nxp.com wrote:
> Commit 610fa91d9863 ("PCI: imx6: Assert PERST# before enabling regulators")
> inadvertently moved clock enablement before core reset assertion, breaking
> PCI device initialization on i.MX6Q Apalis platforms with
> ASM1061/ASM1062 SATA controllers connected.
> 
> NOTE: It is not 100% clear if the issue is specific to the ASM1061/ASM1062
> device or on the specific power-up sequence (reset vs cold-power-on).
> 
> [...]

Applied, thanks!

[1/1] PCI: imx6: Move clock enable after core reset assertion
      commit: 16929741a622eb345057e41c7b335d9b297890e1

Best regards,
-- 
மணிவண்ணன் சதாசிவம்



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

* Re: [PATCH v2] PCI: imx6: Move clock enable after core reset assertion
  2026-09-02 14:15 ` Manivannan Sadhasivam
@ 2026-09-17 11:08   ` Thorsten Leemhuis
  2026-09-17 21:58     ` Bjorn Helgaas
  0 siblings, 1 reply; 6+ messages in thread
From: Thorsten Leemhuis @ 2026-09-17 11:08 UTC (permalink / raw)
  To: Manivannan Sadhasivam, leoreis.costa, fra.schnyder, francesco,
	frank.li, l.stach, lpieralisi, kwilczynski, mani, robh, bhelgaas,
	s.hauer, kernel, festevam, hongxing.zhu
  Cc: linux-pci, linux-arm-kernel, imx, linux-kernel, Richard Zhu,
	stable, Linux kernel regressions list

On 9/2/26 16:15, Manivannan Sadhasivam wrote:
> 
> On Thu, 13 Aug 2026 17:50:03 +0800, hongxing.zhu@oss.nxp.com wrote:
>> Commit 610fa91d9863 ("PCI: imx6: Assert PERST# before enabling regulators")
>> inadvertently moved clock enablement before core reset assertion, breaking
>> PCI device initialization on i.MX6Q Apalis platforms with
>> ASM1061/ASM1062 SATA controllers connected.
>>
>> NOTE: It is not 100% clear if the issue is specific to the ASM1061/ASM1062
>> device or on the specific power-up sequence (reset vs cold-power-on).
>>
>> [...]
> 
> Applied, thanks!
> 
> [1/1] PCI: imx6: Move clock enable after core reset assertion
>       commit: 16929741a622eb345057e41c7b335d9b297890e1
Thx Mani.

Mani, Bjorn, what's the status of this patch? Is it heading to mainline
any time soon? This (unless I got confused, which is possible!) afaics
fixes a 7.2 regression that annoyed quite a few people -- which is why
it was even briefly considered to revert about a Dozent changes shortly
before the 7.2 final:
https://lore.kernel.org/all/20260811214900.GA763236@bhelgaas/

Didn't come to this, but it afaics would be good to finally resolve
this. Or am I missing/confused something?

Ciao, Thorsten

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

* Re: [PATCH v2] PCI: imx6: Move clock enable after core reset assertion
  2026-09-17 11:08   ` Thorsten Leemhuis
@ 2026-09-17 21:58     ` Bjorn Helgaas
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2026-09-17 21:58 UTC (permalink / raw)
  To: Thorsten Leemhuis
  Cc: Manivannan Sadhasivam, leoreis.costa, fra.schnyder, francesco,
	frank.li, l.stach, lpieralisi, kwilczynski, mani, robh, bhelgaas,
	s.hauer, kernel, festevam, hongxing.zhu, linux-pci,
	linux-arm-kernel, imx, linux-kernel, Richard Zhu, stable,
	Linux kernel regressions list

On Thu, Sep 17, 2026 at 01:08:03PM +0200, Thorsten Leemhuis wrote:
> On 9/2/26 16:15, Manivannan Sadhasivam wrote:
> > On Thu, 13 Aug 2026 17:50:03 +0800, hongxing.zhu@oss.nxp.com wrote:
> >> Commit 610fa91d9863 ("PCI: imx6: Assert PERST# before enabling regulators")
> >> inadvertently moved clock enablement before core reset assertion, breaking
> >> PCI device initialization on i.MX6Q Apalis platforms with
> >> ASM1061/ASM1062 SATA controllers connected.
> >>
> >> NOTE: It is not 100% clear if the issue is specific to the ASM1061/ASM1062
> >> device or on the specific power-up sequence (reset vs cold-power-on).
> >>
> >> [...]
> > 
> > Applied, thanks!
> > 
> > [1/1] PCI: imx6: Move clock enable after core reset assertion
> >       commit: 16929741a622eb345057e41c7b335d9b297890e1
> Thx Mani.
> 
> Mani, Bjorn, what's the status of this patch? Is it heading to mainline
> any time soon? This (unless I got confused, which is possible!) afaics
> fixes a 7.2 regression that annoyed quite a few people -- which is why
> it was even briefly considered to revert about a Dozent changes shortly
> before the 7.2 final:
> https://lore.kernel.org/all/20260811214900.GA763236@bhelgaas/
> 
> Didn't come to this, but it afaics would be good to finally resolve
> this. Or am I missing/confused something?

It's in pci/next, but probably should be in for-linus.

I moved it to pci/for-linus for v7.3, thanks for the heads-up.

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

end of thread, other threads:[~2026-09-17 21:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13  9:50 [PATCH v2] PCI: imx6: Move clock enable after core reset assertion hongxing.zhu
2026-08-13  9:57 ` sashiko-bot
2026-08-31  9:30 ` Francesco Dolcini
2026-09-02 14:15 ` Manivannan Sadhasivam
2026-09-17 11:08   ` Thorsten Leemhuis
2026-09-17 21:58     ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox