* [PATCH v2 0/2] PCI: imx6: Add a method to handle CLKREQ# override
@ 2025-09-17 9:37 Richard Zhu
2025-09-17 9:37 ` [PATCH v2 1/2] PCI: dwc: Invoke post_init in dw_pcie_resume_noirq() Richard Zhu
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Richard Zhu @ 2025-09-17 9:37 UTC (permalink / raw)
To: frank.li, jingoohan1, l.stach, lpieralisi, kwilczynski, mani,
robh, bhelgaas, shawnguo, s.hauer, kernel, festevam
Cc: linux-pci, linux-arm-kernel, imx, linux-kernel
The CLKREQ# is an open drain, active low signal that is driven low by
the card to request reference clock.
But the CLKREQ# maybe reserved on some old device, compliant with CEM
r3.0 or before. Thus, this signal wouldn't be driven low by these old
devices.
Since the reference clock controlled by CLKREQ# may be required by i.MX
PCIe host too. To make sure this clock is ready even when the CLKREQ#
isn't driven low by the card(e.x old cards described above), force
CLKREQ# override active low for i.MX PCIe host during initialization.
The CLKREQ# override can be cleared safely when supports-clkreq is
present and PCIe link is up later. Because the CLKREQ# would be driven
low by the card in this case.
Main changes in v2:
- Update the commit message, and collect the reviewed-by tag.
[PATCH v2 1/2] PCI: dwc: Invoke post_init in dw_pcie_resume_noirq()
[PATCH v2 2/2] PCI: imx6: Add a method to handle CLKREQ# override
drivers/pci/controller/dwc/pci-imx6.c | 35 +++++++++++++++++++++++++++++++++++
drivers/pci/controller/dwc/pcie-designware-host.c | 3 +++
2 files changed, 38 insertions(+)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] PCI: dwc: Invoke post_init in dw_pcie_resume_noirq()
2025-09-17 9:37 [PATCH v2 0/2] PCI: imx6: Add a method to handle CLKREQ# override Richard Zhu
@ 2025-09-17 9:37 ` Richard Zhu
2025-09-17 9:37 ` [PATCH v2 2/2] PCI: imx6: Add a method to handle CLKREQ# override active low Richard Zhu
2025-09-20 7:34 ` [PATCH v2 0/2] PCI: imx6: Add a method to handle CLKREQ# override Manivannan Sadhasivam
2 siblings, 0 replies; 6+ messages in thread
From: Richard Zhu @ 2025-09-17 9:37 UTC (permalink / raw)
To: frank.li, jingoohan1, l.stach, lpieralisi, kwilczynski, mani,
robh, bhelgaas, shawnguo, s.hauer, kernel, festevam
Cc: linux-pci, linux-arm-kernel, imx, linux-kernel, Richard Zhu,
Frank Li
If the ops has post_init callback, invoke it in dw_pcie_resume_noirq().
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 952f8594b501..f24f4cd5c278 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -1079,6 +1079,9 @@ int dw_pcie_resume_noirq(struct dw_pcie *pci)
if (ret)
return ret;
+ if (pci->pp.ops->post_init)
+ pci->pp.ops->post_init(&pci->pp);
+
return ret;
}
EXPORT_SYMBOL_GPL(dw_pcie_resume_noirq);
--
2.37.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] PCI: imx6: Add a method to handle CLKREQ# override active low
2025-09-17 9:37 [PATCH v2 0/2] PCI: imx6: Add a method to handle CLKREQ# override Richard Zhu
2025-09-17 9:37 ` [PATCH v2 1/2] PCI: dwc: Invoke post_init in dw_pcie_resume_noirq() Richard Zhu
@ 2025-09-17 9:37 ` Richard Zhu
2025-09-17 22:23 ` Bjorn Helgaas
2025-09-20 7:34 ` [PATCH v2 0/2] PCI: imx6: Add a method to handle CLKREQ# override Manivannan Sadhasivam
2 siblings, 1 reply; 6+ messages in thread
From: Richard Zhu @ 2025-09-17 9:37 UTC (permalink / raw)
To: frank.li, jingoohan1, l.stach, lpieralisi, kwilczynski, mani,
robh, bhelgaas, shawnguo, s.hauer, kernel, festevam
Cc: linux-pci, linux-arm-kernel, imx, linux-kernel, Richard Zhu,
Frank Li
The CLKREQ# is an open drain, active low signal that is driven low by
the card to request reference clock.
But the CLKREQ# maybe reserved on some old device, compliant with CEM
r3.0 or before. Thus, this signal wouldn't be driven low by these old
devices.
Since the reference clock controlled by CLKREQ# may be required by i.MX
PCIe host too. To make sure this clock is ready even when the CLKREQ#
isn't driven low by the card(e.x old cards described above), force
CLKREQ# override active low for i.MX PCIe host during initialization.
The CLKREQ# override can be cleared safely when supports-clkreq is
present and PCIe link is up later. Because the CLKREQ# would be driven
low by the card in this case.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
drivers/pci/controller/dwc/pci-imx6.c | 35 +++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 80e48746bbaf..a73632b47e2d 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -52,6 +52,8 @@
#define IMX95_PCIE_REF_CLKEN BIT(23)
#define IMX95_PCIE_PHY_CR_PARA_SEL BIT(9)
#define IMX95_PCIE_SS_RW_REG_1 0xf4
+#define IMX95_PCIE_CLKREQ_OVERRIDE_EN BIT(8)
+#define IMX95_PCIE_CLKREQ_OVERRIDE_VAL BIT(9)
#define IMX95_PCIE_SYS_AUX_PWR_DET BIT(31)
#define IMX95_PE0_GEN_CTRL_1 0x1050
@@ -136,6 +138,7 @@ struct imx_pcie_drvdata {
int (*enable_ref_clk)(struct imx_pcie *pcie, bool enable);
int (*core_reset)(struct imx_pcie *pcie, bool assert);
int (*wait_pll_lock)(struct imx_pcie *pcie);
+ void (*clr_clkreq_override)(struct imx_pcie *pcie);
const struct dw_pcie_host_ops *ops;
};
@@ -149,6 +152,7 @@ struct imx_pcie {
struct gpio_desc *reset_gpiod;
struct clk_bulk_data *clks;
int num_clks;
+ bool supports_clkreq;
struct regmap *iomuxc_gpr;
u16 msi_ctrl;
u32 controller_id;
@@ -267,6 +271,13 @@ static int imx95_pcie_init_phy(struct imx_pcie *imx_pcie)
IMX95_PCIE_REF_CLKEN,
IMX95_PCIE_REF_CLKEN);
+ /* Force CLKREQ# low by override */
+ regmap_update_bits(imx_pcie->iomuxc_gpr,
+ IMX95_PCIE_SS_RW_REG_1,
+ IMX95_PCIE_CLKREQ_OVERRIDE_EN |
+ IMX95_PCIE_CLKREQ_OVERRIDE_VAL,
+ IMX95_PCIE_CLKREQ_OVERRIDE_EN |
+ IMX95_PCIE_CLKREQ_OVERRIDE_VAL);
return 0;
}
@@ -1298,6 +1309,18 @@ static void imx_pcie_host_exit(struct dw_pcie_rp *pp)
regulator_disable(imx_pcie->vpcie);
}
+static void imx8mm_pcie_clr_clkreq_override(struct imx_pcie *imx_pcie)
+{
+ imx8mm_pcie_enable_ref_clk(imx_pcie, false);
+}
+
+static void imx95_pcie_clr_clkreq_override(struct imx_pcie *imx_pcie)
+{
+ regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_SS_RW_REG_1,
+ IMX95_PCIE_CLKREQ_OVERRIDE_EN |
+ IMX95_PCIE_CLKREQ_OVERRIDE_VAL, 0);
+}
+
static void imx_pcie_host_post_init(struct dw_pcie_rp *pp)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
@@ -1322,6 +1345,12 @@ static void imx_pcie_host_post_init(struct dw_pcie_rp *pp)
dw_pcie_writel_dbi(pci, GEN3_RELATED_OFF, val);
dw_pcie_dbi_ro_wr_dis(pci);
}
+
+ /* Clear CLKREQ# override if supports_clkreq is true and link is up */
+ if (dw_pcie_link_up(pci) && imx_pcie->supports_clkreq) {
+ if (imx_pcie->drvdata->clr_clkreq_override)
+ imx_pcie->drvdata->clr_clkreq_override(imx_pcie);
+ }
}
/*
@@ -1745,6 +1774,8 @@ static int imx_pcie_probe(struct platform_device *pdev)
pci->max_link_speed = 1;
of_property_read_u32(node, "fsl,max-link-speed", &pci->max_link_speed);
+ imx_pcie->supports_clkreq =
+ of_property_read_bool(node, "supports-clkreq");
imx_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie");
if (IS_ERR(imx_pcie->vpcie)) {
if (PTR_ERR(imx_pcie->vpcie) != -ENODEV)
@@ -1873,6 +1904,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
.mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE,
.init_phy = imx8mq_pcie_init_phy,
.enable_ref_clk = imx8mm_pcie_enable_ref_clk,
+ .clr_clkreq_override = imx8mm_pcie_clr_clkreq_override,
},
[IMX8MM] = {
.variant = IMX8MM,
@@ -1883,6 +1915,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
.mode_off[0] = IOMUXC_GPR12,
.mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE,
.enable_ref_clk = imx8mm_pcie_enable_ref_clk,
+ .clr_clkreq_override = imx8mm_pcie_clr_clkreq_override,
},
[IMX8MP] = {
.variant = IMX8MP,
@@ -1893,6 +1926,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
.mode_off[0] = IOMUXC_GPR12,
.mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE,
.enable_ref_clk = imx8mm_pcie_enable_ref_clk,
+ .clr_clkreq_override = imx8mm_pcie_clr_clkreq_override,
},
[IMX8Q] = {
.variant = IMX8Q,
@@ -1913,6 +1947,7 @@ static const struct imx_pcie_drvdata drvdata[] = {
.core_reset = imx95_pcie_core_reset,
.init_phy = imx95_pcie_init_phy,
.wait_pll_lock = imx95_pcie_wait_for_phy_pll_lock,
+ .clr_clkreq_override = imx95_pcie_clr_clkreq_override,
},
[IMX8MQ_EP] = {
.variant = IMX8MQ_EP,
--
2.37.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] PCI: imx6: Add a method to handle CLKREQ# override active low
2025-09-17 9:37 ` [PATCH v2 2/2] PCI: imx6: Add a method to handle CLKREQ# override active low Richard Zhu
@ 2025-09-17 22:23 ` Bjorn Helgaas
2025-09-18 3:04 ` Hongxing Zhu
0 siblings, 1 reply; 6+ messages in thread
From: Bjorn Helgaas @ 2025-09-17 22:23 UTC (permalink / raw)
To: Richard Zhu
Cc: frank.li, jingoohan1, l.stach, lpieralisi, kwilczynski, mani,
robh, bhelgaas, shawnguo, s.hauer, kernel, festevam, linux-pci,
linux-arm-kernel, imx, linux-kernel
On Wed, Sep 17, 2025 at 05:37:51PM +0800, Richard Zhu wrote:
> The CLKREQ# is an open drain, active low signal that is driven low by
> the card to request reference clock.
>
> But the CLKREQ# maybe reserved on some old device, compliant with CEM
> r3.0 or before. Thus, this signal wouldn't be driven low by these old
> devices.
Can you include a citation to a relevant section in the CEM spec?
Maybe the point is that CLKREQ# is an optional signal added in PCIe
CEM r4.0, sec 2?
If that's accurate, we can add it when applying, no need to repost for
that.
> Since the reference clock controlled by CLKREQ# may be required by i.MX
> PCIe host too. To make sure this clock is ready even when the CLKREQ#
> isn't driven low by the card(e.x old cards described above), force
> CLKREQ# override active low for i.MX PCIe host during initialization.
>
> The CLKREQ# override can be cleared safely when supports-clkreq is
> present and PCIe link is up later. Because the CLKREQ# would be driven
> low by the card in this case.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2 2/2] PCI: imx6: Add a method to handle CLKREQ# override active low
2025-09-17 22:23 ` Bjorn Helgaas
@ 2025-09-18 3:04 ` Hongxing Zhu
0 siblings, 0 replies; 6+ messages in thread
From: Hongxing Zhu @ 2025-09-18 3:04 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Frank Li, jingoohan1@gmail.com, l.stach@pengutronix.de,
lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org,
robh@kernel.org, bhelgaas@google.com, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
imx@lists.linux.dev, linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Bjorn Helgaas <helgaas@kernel.org>
> Sent: 2025年9月18日 6:24
> To: Hongxing Zhu <hongxing.zhu@nxp.com>
> Cc: Frank Li <frank.li@nxp.com>; jingoohan1@gmail.com;
> l.stach@pengutronix.de; lpieralisi@kernel.org; kwilczynski@kernel.org;
> mani@kernel.org; robh@kernel.org; bhelgaas@google.com;
> shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
> festevam@gmail.com; linux-pci@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; imx@lists.linux.dev;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 2/2] PCI: imx6: Add a method to handle CLKREQ#
> override active low
>
> On Wed, Sep 17, 2025 at 05:37:51PM +0800, Richard Zhu wrote:
> > The CLKREQ# is an open drain, active low signal that is driven low by
> > the card to request reference clock.
> >
> > But the CLKREQ# maybe reserved on some old device, compliant with CEM
> > r3.0 or before. Thus, this signal wouldn't be driven low by these old
> > devices.
>
> Can you include a citation to a relevant section in the CEM spec?
> Maybe the point is that CLKREQ# is an optional signal added in PCIe CEM r4.0,
> sec 2?
>
> If that's accurate, we can add it when applying, no need to repost for that.
Hi Bjorn:
Thanks for your comments.
The Pin12 of connector is reserved refer to CEM spec r3.0 sec6.1 Connector
Pinout. CLKREQ# is defined in CEM spec r4.0, but it's optional refer to CEM
r4.0 sec2. And, the Pin12 of connector is defined as CLKREQ# refer to CEM spec
r4.0 sec6.1 Connector Pinout. That's all.
Should I repost for that?
Best Regards
Richard Zhu
>
> > Since the reference clock controlled by CLKREQ# may be required by
> > i.MX PCIe host too. To make sure this clock is ready even when the
> > CLKREQ# isn't driven low by the card(e.x old cards described above),
> > force CLKREQ# override active low for i.MX PCIe host during initialization.
> >
> > The CLKREQ# override can be cleared safely when supports-clkreq is
> > present and PCIe link is up later. Because the CLKREQ# would be driven
> > low by the card in this case.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] PCI: imx6: Add a method to handle CLKREQ# override
2025-09-17 9:37 [PATCH v2 0/2] PCI: imx6: Add a method to handle CLKREQ# override Richard Zhu
2025-09-17 9:37 ` [PATCH v2 1/2] PCI: dwc: Invoke post_init in dw_pcie_resume_noirq() Richard Zhu
2025-09-17 9:37 ` [PATCH v2 2/2] PCI: imx6: Add a method to handle CLKREQ# override active low Richard Zhu
@ 2025-09-20 7:34 ` Manivannan Sadhasivam
2 siblings, 0 replies; 6+ messages in thread
From: Manivannan Sadhasivam @ 2025-09-20 7:34 UTC (permalink / raw)
To: Richard Zhu
Cc: frank.li, jingoohan1, l.stach, lpieralisi, kwilczynski, robh,
bhelgaas, shawnguo, s.hauer, kernel, festevam, linux-pci,
linux-arm-kernel, imx, linux-kernel
On Wed, Sep 17, 2025 at 05:37:49PM +0800, Richard Zhu wrote:
> The CLKREQ# is an open drain, active low signal that is driven low by
> the card to request reference clock.
>
> But the CLKREQ# maybe reserved on some old device, compliant with CEM
> r3.0 or before. Thus, this signal wouldn't be driven low by these old
> devices.
>
> Since the reference clock controlled by CLKREQ# may be required by i.MX
> PCIe host too. To make sure this clock is ready even when the CLKREQ#
> isn't driven low by the card(e.x old cards described above), force
> CLKREQ# override active low for i.MX PCIe host during initialization.
>
> The CLKREQ# override can be cleared safely when supports-clkreq is
> present and PCIe link is up later. Because the CLKREQ# would be driven
> low by the card in this case.
>
> Main changes in v2:
> - Update the commit message, and collect the reviewed-by tag.
>
> [PATCH v2 1/2] PCI: dwc: Invoke post_init in dw_pcie_resume_noirq()
> [PATCH v2 2/2] PCI: imx6: Add a method to handle CLKREQ# override
>
Patch 2 is not applying on top of 6.17-rc1. Please fix it and resend the series
(along with the CEM 4.0 citation suggested by Bjorn).
- Mani
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-09-20 7:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-17 9:37 [PATCH v2 0/2] PCI: imx6: Add a method to handle CLKREQ# override Richard Zhu
2025-09-17 9:37 ` [PATCH v2 1/2] PCI: dwc: Invoke post_init in dw_pcie_resume_noirq() Richard Zhu
2025-09-17 9:37 ` [PATCH v2 2/2] PCI: imx6: Add a method to handle CLKREQ# override active low Richard Zhu
2025-09-17 22:23 ` Bjorn Helgaas
2025-09-18 3:04 ` Hongxing Zhu
2025-09-20 7:34 ` [PATCH v2 0/2] PCI: imx6: Add a method to handle CLKREQ# override Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox