devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock
  2025-09-17  3:51 [PATCH v6 0/3] " Richard Zhu
@ 2025-09-17  3:51 ` Richard Zhu
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Zhu @ 2025-09-17  3:51 UTC (permalink / raw)
  To: frank.li, l.stach, lpieralisi, kwilczynski, mani, robh, krzk+dt,
	conor+dt, bhelgaas, shawnguo, s.hauer, kernel, festevam
  Cc: linux-pci, linux-arm-kernel, devicetree, imx, linux-kernel,
	Richard Zhu

Add one more reference clock "extref" for a reference clock that comes
from external crystal oscillator.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
 .../devicetree/bindings/pci/snps,dw-pcie-common.yaml        | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml b/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
index 34594972d8db..0134a759185e 100644
--- a/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
+++ b/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
@@ -105,6 +105,12 @@ properties:
             define it with this name (for instance pipe, core and aux can
             be connected to a single source of the periodic signal).
           const: ref
+        - description:
+            Some dwc wrappers (like i.MX95 PCIes) have two reference clock
+            inputs, one from an internal PLL, the other from an off-chip crystal
+            oscillator. If present, 'extref' refers to a reference clock from
+            an external oscillator.
+          const: extref
         - description:
             Clock for the PHY registers interface. Originally this is
             a PHY-viewport-based interface, but some platform may have
-- 
2.37.1


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

* [PATCH v6 0/3] PCI: imx6: Add external reference clock mode support
@ 2025-09-17  4:52 Richard Zhu
  2025-09-17  4:52 ` [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock Richard Zhu
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Richard Zhu @ 2025-09-17  4:52 UTC (permalink / raw)
  To: frank.li, l.stach, lpieralisi, kwilczynski, mani, robh, krzk+dt,
	conor+dt, bhelgaas, shawnguo, s.hauer, kernel, festevam
  Cc: linux-pci, linux-arm-kernel, devicetree, imx, linux-kernel

i.MX95 PCIes have two reference clock inputs: one from internal PLL,
the other from off chip crystal oscillator. Use extref clock name to be
onhalf of the reference clock comes from external crystal oscillator.

Add external reference clock mode support when extref clock is present.

Main change in v6:
- Refer to Krzysztof's comments, let i.MX95 PCIes has the "ref" clock
  since it is wired actually, and add one more optional "extref" clock
  for i.MX95 PCIes.

Main change in v5:
- Update the commit message of first patch refer to Bejorn's comments.
- Correct the typo error and update the description of property in the
  first patch.
https://lore.kernel.org/imx/20250915035348.3252353-1-hongxing.zhu@nxp.com/

Main change in v4:
- Add one more reference clock "extref" to be onhalf the reference clock
  that comes from external crystal oscillator.
https://lore.kernel.org/imx/20250626073804.3113757-1-hongxing.zhu@nxp.com/

Main change in v3:
- Update the logic check external reference clock mode is enabled or
  not in the driver codes.
https://lore.kernel.org/imx/20250620031350.674442-1-hongxing.zhu@nxp.com/

Main change in v2:
- Fix yamllint warning.
- Refine the driver codes.
https://lore.kernel.org/imx/20250619091004.338419-1-hongxing.zhu@nxp.com/

[PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock
[PATCH v6 2/3] dt-bindings: pci-imx6: Add one more external reference
[PATCH v6 3/3] PCI: imx6: Add external reference clock mode support

Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml      |  3 +++
Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml |  6 ++++++
drivers/pci/controller/dwc/pci-imx6.c                          | 20 +++++++++++++-------
3 files changed, 22 insertions(+), 7 deletions(-)


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

* [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock
  2025-09-17  4:52 [PATCH v6 0/3] PCI: imx6: Add external reference clock mode support Richard Zhu
@ 2025-09-17  4:52 ` Richard Zhu
  2025-09-17 22:13   ` Bjorn Helgaas
  2025-09-22 16:50   ` Rob Herring
  2025-09-17  4:52 ` [PATCH v6 2/3] dt-bindings: pci-imx6: Add one more external " Richard Zhu
  2025-09-17  4:52 ` [PATCH v6 3/3] PCI: imx6: Add external reference clock mode support Richard Zhu
  2 siblings, 2 replies; 8+ messages in thread
From: Richard Zhu @ 2025-09-17  4:52 UTC (permalink / raw)
  To: frank.li, l.stach, lpieralisi, kwilczynski, mani, robh, krzk+dt,
	conor+dt, bhelgaas, shawnguo, s.hauer, kernel, festevam
  Cc: linux-pci, linux-arm-kernel, devicetree, imx, linux-kernel,
	Richard Zhu, Frank Li

Add one more reference clock "extref" for a reference clock that comes
from external crystal oscillator.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 .../devicetree/bindings/pci/snps,dw-pcie-common.yaml        | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml b/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
index 34594972d8db..0134a759185e 100644
--- a/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
+++ b/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
@@ -105,6 +105,12 @@ properties:
             define it with this name (for instance pipe, core and aux can
             be connected to a single source of the periodic signal).
           const: ref
+        - description:
+            Some dwc wrappers (like i.MX95 PCIes) have two reference clock
+            inputs, one from an internal PLL, the other from an off-chip crystal
+            oscillator. If present, 'extref' refers to a reference clock from
+            an external oscillator.
+          const: extref
         - description:
             Clock for the PHY registers interface. Originally this is
             a PHY-viewport-based interface, but some platform may have
-- 
2.37.1


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

* [PATCH v6 2/3] dt-bindings: pci-imx6: Add one more external reference clock
  2025-09-17  4:52 [PATCH v6 0/3] PCI: imx6: Add external reference clock mode support Richard Zhu
  2025-09-17  4:52 ` [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock Richard Zhu
@ 2025-09-17  4:52 ` Richard Zhu
  2025-09-17 22:17   ` Bjorn Helgaas
  2025-09-17  4:52 ` [PATCH v6 3/3] PCI: imx6: Add external reference clock mode support Richard Zhu
  2 siblings, 1 reply; 8+ messages in thread
From: Richard Zhu @ 2025-09-17  4:52 UTC (permalink / raw)
  To: frank.li, l.stach, lpieralisi, kwilczynski, mani, robh, krzk+dt,
	conor+dt, bhelgaas, shawnguo, s.hauer, kernel, festevam
  Cc: linux-pci, linux-arm-kernel, devicetree, imx, linux-kernel,
	Richard Zhu, Frank Li

i.MX95 PCIes have two reference clock inputs: one from internal PLL,
the other from off chip crystal oscillator. Use extref clock name to be
onhalf of the reference clock comes from external crystal oscillator.

Add one more external reference clock for i.MX95 PCIes.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
index ca5f2970f217..b4c40d0573dc 100644
--- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
@@ -212,14 +212,17 @@ allOf:
     then:
       properties:
         clocks:
+          minItems: 4
           maxItems: 5
         clock-names:
+          minItems: 4
           items:
             - const: pcie
             - const: pcie_bus
             - const: pcie_phy
             - const: pcie_aux
             - const: ref
+            - const: extref  # Optional
 
 unevaluatedProperties: false
 
-- 
2.37.1


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

* [PATCH v6 3/3] PCI: imx6: Add external reference clock mode support
  2025-09-17  4:52 [PATCH v6 0/3] PCI: imx6: Add external reference clock mode support Richard Zhu
  2025-09-17  4:52 ` [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock Richard Zhu
  2025-09-17  4:52 ` [PATCH v6 2/3] dt-bindings: pci-imx6: Add one more external " Richard Zhu
@ 2025-09-17  4:52 ` Richard Zhu
  2 siblings, 0 replies; 8+ messages in thread
From: Richard Zhu @ 2025-09-17  4:52 UTC (permalink / raw)
  To: frank.li, l.stach, lpieralisi, kwilczynski, mani, robh, krzk+dt,
	conor+dt, bhelgaas, shawnguo, s.hauer, kernel, festevam
  Cc: linux-pci, linux-arm-kernel, devicetree, imx, linux-kernel,
	Richard Zhu, Frank Li

i.MX95 PCIes have two reference clock inputs: one from internal PLL,
the other from off chip crystal oscillator. Use extref clock name to be
onhalf of the reference clock comes from external crystal oscillator.

Add external reference clock mode support when extref clock is present.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 80e48746bbaf..e2ca8b036253 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -149,6 +149,7 @@ struct imx_pcie {
 	struct gpio_desc	*reset_gpiod;
 	struct clk_bulk_data	*clks;
 	int			num_clks;
+	bool			enable_ext_refclk;
 	struct regmap		*iomuxc_gpr;
 	u16			msi_ctrl;
 	u32			controller_id;
@@ -241,6 +242,8 @@ static unsigned int imx_pcie_grp_offset(const struct imx_pcie *imx_pcie)
 
 static int imx95_pcie_init_phy(struct imx_pcie *imx_pcie)
 {
+	bool ext = imx_pcie->enable_ext_refclk;
+
 	/*
 	 * ERR051624: The Controller Without Vaux Cannot Exit L23 Ready
 	 * Through Beacon or PERST# De-assertion
@@ -259,13 +262,12 @@ static int imx95_pcie_init_phy(struct imx_pcie *imx_pcie)
 			IMX95_PCIE_PHY_CR_PARA_SEL,
 			IMX95_PCIE_PHY_CR_PARA_SEL);
 
-	regmap_update_bits(imx_pcie->iomuxc_gpr,
-			   IMX95_PCIE_PHY_GEN_CTRL,
-			   IMX95_PCIE_REF_USE_PAD, 0);
-	regmap_update_bits(imx_pcie->iomuxc_gpr,
-			   IMX95_PCIE_SS_RW_REG_0,
+	regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_PHY_GEN_CTRL,
+			   ext ? IMX95_PCIE_REF_USE_PAD : 0,
+			   IMX95_PCIE_REF_USE_PAD);
+	regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_SS_RW_REG_0,
 			   IMX95_PCIE_REF_CLKEN,
-			   IMX95_PCIE_REF_CLKEN);
+			   ext ? 0 : IMX95_PCIE_REF_CLKEN);
 
 	return 0;
 }
@@ -1606,7 +1608,7 @@ static int imx_pcie_probe(struct platform_device *pdev)
 	struct imx_pcie *imx_pcie;
 	struct device_node *np;
 	struct device_node *node = dev->of_node;
-	int ret, domain;
+	int i, ret, domain;
 	u16 val;
 
 	imx_pcie = devm_kzalloc(dev, sizeof(*imx_pcie), GFP_KERNEL);
@@ -1657,6 +1659,10 @@ static int imx_pcie_probe(struct platform_device *pdev)
 	if (imx_pcie->num_clks < 0)
 		return dev_err_probe(dev, imx_pcie->num_clks,
 				     "failed to get clocks\n");
+	imx_pcie->enable_ext_refclk = false;
+	for (i = 0; i < imx_pcie->num_clks; i++)
+		if (strncmp(imx_pcie->clks[i].id, "extref", 6) == 0)
+			imx_pcie->enable_ext_refclk = true;
 
 	if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_PHYDRV)) {
 		imx_pcie->phy = devm_phy_get(dev, "pcie-phy");
-- 
2.37.1


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

* Re: [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock
  2025-09-17  4:52 ` [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock Richard Zhu
@ 2025-09-17 22:13   ` Bjorn Helgaas
  2025-09-22 16:50   ` Rob Herring
  1 sibling, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2025-09-17 22:13 UTC (permalink / raw)
  To: Richard Zhu
  Cc: frank.li, l.stach, lpieralisi, kwilczynski, mani, robh, krzk+dt,
	conor+dt, bhelgaas, shawnguo, s.hauer, kernel, festevam,
	linux-pci, linux-arm-kernel, devicetree, imx, linux-kernel

In the subject, can you replace "one more" with something specific?
E.g., maybe "Add external reference clock input" or similar?

On Wed, Sep 17, 2025 at 12:52:36PM +0800, Richard Zhu wrote:
> Add one more reference clock "extref" for a reference clock that comes
> from external crystal oscillator.
> 
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
>  .../devicetree/bindings/pci/snps,dw-pcie-common.yaml        | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml b/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
> index 34594972d8db..0134a759185e 100644
> --- a/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
> +++ b/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
> @@ -105,6 +105,12 @@ properties:
>              define it with this name (for instance pipe, core and aux can
>              be connected to a single source of the periodic signal).
>            const: ref
> +        - description:
> +            Some dwc wrappers (like i.MX95 PCIes) have two reference clock
> +            inputs, one from an internal PLL, the other from an off-chip crystal
> +            oscillator. If present, 'extref' refers to a reference clock from
> +            an external oscillator.
> +          const: extref
>          - description:
>              Clock for the PHY registers interface. Originally this is
>              a PHY-viewport-based interface, but some platform may have
> -- 
> 2.37.1
> 

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

* Re: [PATCH v6 2/3] dt-bindings: pci-imx6: Add one more external reference clock
  2025-09-17  4:52 ` [PATCH v6 2/3] dt-bindings: pci-imx6: Add one more external " Richard Zhu
@ 2025-09-17 22:17   ` Bjorn Helgaas
  0 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2025-09-17 22:17 UTC (permalink / raw)
  To: Richard Zhu
  Cc: frank.li, l.stach, lpieralisi, kwilczynski, mani, robh, krzk+dt,
	conor+dt, bhelgaas, shawnguo, s.hauer, kernel, festevam,
	linux-pci, linux-arm-kernel, devicetree, imx, linux-kernel

Update subject line similar to patch 1/3?

Also, I notice most binding commits include "PCI:", e.g.,

  dt-bindings: PCI: brcm,stb-pcie: ...
  dt-bindings: PCI: qcom: ...
  dt-bindings: PCI: altera ...

On Wed, Sep 17, 2025 at 12:52:37PM +0800, Richard Zhu wrote:
> i.MX95 PCIes have two reference clock inputs: one from internal PLL,
> the other from off chip crystal oscillator. Use extref clock name to be
> onhalf of the reference clock comes from external crystal oscillator.

Not sure what "onhalf" means.  Maybe it means something like this?

  The "extref" clock refers to a reference clock from an external
  crystal oscillator.

Same issue in patch 3/3.

> Add one more external reference clock for i.MX95 PCIes.

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

* Re: [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock
  2025-09-17  4:52 ` [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock Richard Zhu
  2025-09-17 22:13   ` Bjorn Helgaas
@ 2025-09-22 16:50   ` Rob Herring
  1 sibling, 0 replies; 8+ messages in thread
From: Rob Herring @ 2025-09-22 16:50 UTC (permalink / raw)
  To: Richard Zhu
  Cc: frank.li, l.stach, lpieralisi, kwilczynski, mani, krzk+dt,
	conor+dt, bhelgaas, shawnguo, s.hauer, kernel, festevam,
	linux-pci, linux-arm-kernel, devicetree, imx, linux-kernel

On Wed, Sep 17, 2025 at 12:52:36PM +0800, Richard Zhu wrote:
> Add one more reference clock "extref" for a reference clock that comes
> from external crystal oscillator.

See what I just commented on v5.

> 
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
>  .../devicetree/bindings/pci/snps,dw-pcie-common.yaml        | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml b/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
> index 34594972d8db..0134a759185e 100644
> --- a/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
> +++ b/Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
> @@ -105,6 +105,12 @@ properties:
>              define it with this name (for instance pipe, core and aux can
>              be connected to a single source of the periodic signal).
>            const: ref
> +        - description:
> +            Some dwc wrappers (like i.MX95 PCIes) have two reference clock
> +            inputs, one from an internal PLL, the other from an off-chip crystal
> +            oscillator. If present, 'extref' refers to a reference clock from
> +            an external oscillator.
> +          const: extref
>          - description:
>              Clock for the PHY registers interface. Originally this is
>              a PHY-viewport-based interface, but some platform may have
> -- 
> 2.37.1
> 

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

end of thread, other threads:[~2025-09-22 16:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-17  4:52 [PATCH v6 0/3] PCI: imx6: Add external reference clock mode support Richard Zhu
2025-09-17  4:52 ` [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock Richard Zhu
2025-09-17 22:13   ` Bjorn Helgaas
2025-09-22 16:50   ` Rob Herring
2025-09-17  4:52 ` [PATCH v6 2/3] dt-bindings: pci-imx6: Add one more external " Richard Zhu
2025-09-17 22:17   ` Bjorn Helgaas
2025-09-17  4:52 ` [PATCH v6 3/3] PCI: imx6: Add external reference clock mode support Richard Zhu
  -- strict thread matches above, loose matches on Subject: below --
2025-09-17  3:51 [PATCH v6 0/3] " Richard Zhu
2025-09-17  3:51 ` [PATCH v6 1/3] dt-bindings: PCI: dwc: Add one more reference clock Richard Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).