PCI: imx6: select the PCIe REF_CLK source on i.MX8MQ
Subsystems (6)
cover PCI: imx6: select the PCIe REF_CLK source on i.MX8MQ
i.MX8MQ can take PCIe REF_CLK either from an off-chip oscillator or from the internal PLL, but imx8mq_pcie_init_phy() has always selected the oscillator unconditionally:
/* TODO: This code assumes external oscillator is being used */
Boards that wire an oscillator to the pad describe it as the "pcie_bus" clock, but nothing in the driver looks that clock up by name, so it does not select anything - the unconditional IMX8MQ_GPR_PCIE_REF_USE_PAD is what actually makes those boards work.
Commit d8574ce57d76 ("PCI: imx6: Add external reference clock input mode support") added a generic enable_ext_refclk flag, set when an "extref" clock is supplied, and wired it up for i.MX95. This series extends the same mechanism to i.MX8MQ, which resolves the TODO above.
Patch 1 allows an optional fifth "extref" clock for fsl,imx8mq-pcie. Patch 2 makes the driver honour enable_ext_refclk on i.MX8MQ. Patch 3 names the oscillator on the in-tree i.MX8MQ boards that have one.
Patch 2 must not land before patch 3. On its own it would stop setting REF_USE_PAD on any board that has not declared an "extref" clock, which is all of them today. The reverse order is safe: patch 3 only adds a clock that the driver ignores until patch 2 is applied.
Patch 3 touches arch/arm64/boot/dts/freescale and would normally go via the i.MX tree rather than the PCI tree. Given the ordering constraint above, either all three through one tree, or 1 and 3 first with 2 following, would work - whichever the maintainers prefer.
Patch 3 is deliberately additive: each board keeps the "pcie_bus" entry it already has and gains a fifth clock naming the same oscillator, so the set of clocks being enabled is unchanged.
Tested on a Google Coral Dev Board (imx8mq-phanbell, not yet enabled in mainline), where pcie1 takes the off-chip oscillator and pcie0 the internal PLL. With the extref clock declared, clock-names reads
pcie pcie_bus pcie_phy pcie_aux extref
pcie1 links at Gen2 and the endpoint enumerates.
The five boards touched by patch 3 are untested - I have no access to them. The change is intended to preserve their current behaviour exactly, and review from anyone who has the hardware would be welcome.
Rudi Heitbaum (3):
dt-bindings: pci: fsl,imx6q-pcie: Add extref clock for i.MX8MQ
PCI: imx6: Select the PCIe REF_CLK source on i.MX8MQ
arm64: dts: imx8mq: Declare the PCIe extref clock
.../devicetree/bindings/pci/fsl,imx6q-pcie.yaml | 8 ++++++-- arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 8 ++++++-- .../boot/dts/freescale/imx8mq-kontron-pitx-imx8m.dts | 8 ++++++-- arch/arm64/boot/dts/freescale/imx8mq-mnt-reform2.dts | 4 +++- arch/arm64/boot/dts/freescale/imx8mq-tqma8mq-mba8mx.dts | 8 ++++++-- arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi | 8 ++++++-- drivers/pci/controller/dwc/pci-imx6.c | 9 +++++++-- 7 files changed, 40 insertions(+), 13 deletions(-)
Signature · 1 line
2.53.1
PATCH 1/3 dt-bindings: pci: fsl,imx6q-pcie: Add extref clock for i.MX8MQ
i.MX8MQ can drive PCIe REF_CLK either from the internal PLL or from an off-chip oscillator. Allow an optional fifth "extref" clock to describe the latter, matching the name already used for i.MX95.
--- Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +6 -2
@@ -46,7 +46,8 @@ properties: - description: PCIe PHY clock. - description: Additional required clock entry for imx6sx-pcie, imx6sx-pcie-ep, imx8mq-pcie, imx8mq-pcie-ep. - - description: PCIe internal reference clock. + - description: PCIe internal reference clock for imx95-pcie, or the + external reference clock for imx8mq-pcie. - description: PCIe additional external reference clock. clock-names:
@@ -173,13 +174,16 @@ allOf: then: properties: clocks: - maxItems: 4 + minItems: 4 + maxItems: 5 clock-names: + minItems: 4 items: - const: pcie - const: pcie_bus - const: pcie_phy - const: pcie_aux + - const: extref # Optional - if: properties:
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 1/3] dt-bindings: pci: fsl,imx6q-pcie: Add extref clock for i.MX8MQ
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The optional 'extref' clock was added to the Root Complex binding for i.MX8MQ but omitted from…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The optional 'extref' clock was added to the Root Complex binding for i.MX8MQ but omitted from the corresponding Endpoint mode binding, resulting in schema validation failure if the endpoint uses the clock. --
--- Patch [1]: [PATCH 1/3] dt-bindings: pci: fsl,imx6q-pcie: Add extref clock for i.MX8MQ --- commit 4169458ec9055f45e1c7d18a9eea850e75cf9b6a
Author: Rudi Heitbaum <[email protected]>
dt-bindings: pci: fsl,imx6q-pcie: Add extref clock for i.MX8MQ
i.MX8MQ can drive PCIe REF_CLK either from the internal PLL or from an off-chip oscillator. This allows an optional fifth extref clock to describe the latter, matching the name already used for i.MX95.
Quoted 4 lines
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +0
-0
[ ... ]
Quoted 5 lines
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +0
-1@@ -173,13 +174,16 @@ allOf: then: properties: clocks: - maxItems: 4
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml allOf: · line 186
Quoted 10 lines
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +4
-0+ minItems: 4 + maxItems: 5 clock-names: + minItems: 4 items: - const: pcie - const: pcie_bus - const: pcie_phy - const: pcie_aux + - const: extref # Optional
[Severity: Medium]
Will this same clock be used when the hardware is configured in endpoint mode?
Currently, this adds the optional extref clock to the root complex binding for fsl,imx8mq-pcie, expanding the maximum items to 5. However, the corresponding endpoint schema in fsl,imx6q-pcie-ep.yaml for fsl,imx8mq-pcie-ep still restricts clocks to exactly 4 items:
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml:
- if:
properties:
compatible:
enum:
- fsl,imx8mq-pcie-ep
- fsl,imx95-pcie-ep
then:
properties:
clocks:
minItems: 4
maxItems: 4
If an endpoint device tree describes the hardware using this 5th extref clock, will it fail schema validation because the endpoint binding was not also updated?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH 2/3 PCI: imx6: Use the external clock as REF_CLK when needed for i.MX8MQ
In reply to Rudi Heitbaumi.MX8MQ has two PCIe REF_CLK sources: an off-chip oscillator and the internal PLL. The driver unconditionally selected the oscillator, which is what the
/* TODO: This code assumes external oscillator is being used */
comment refers to. Boards wiring an oscillator to the pad describe it as the "pcie_bus" clock, but nothing in the driver looks that clock up by name, so it does not select anything.
Reuse the generic enable_ext_refclk flag, set when an "extref" clock is supplied, to select between the two, as is already done for i.MX95 in commit d8574ce57d76 ("PCI: imx6: Add external reference clock input mode support").
--- drivers/pci/controller/dwc/pci-imx6.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +7 -2
@@ -445,11 +445,16 @@ static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data)static int imx8mq_pcie_init_phy (struct imx_pcie *imx_pcie) { -/* TODO: This code assumes external oscillator is being used */ +bool ext = imx_pcie->enable_ext_refclk; + +/* +* Select the off-chip oscillator as REF_CLK when an "extref" clock is +* supplied, otherwise fall back to the internal PLL. +*/ regmap_update_bits (imx_pcie->iomuxc_gpr,imx_pcie_grp_offset (imx_pcie),IMX8MQ_GPR_PCIE_REF_USE_PAD , -IMX8MQ_GPR_PCIE_REF_USE_PAD ); + ext ?IMX8MQ_GPR_PCIE_REF_USE_PAD :0 );/* * Per the datasheet, the PCIE_VPH is suggested to be 1.8V. If the * PCIE_VPH is supplied by 3.3V, the VREG_BYPASS should be cleared
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 2/3] PCI: imx6: Use the external clock as REF_CLK when needed for i.MX8MQ
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The patch breaks backward compatibility with existing i.MX8MQ device trees by changing the default…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch breaks backward compatibility with existing i.MX8MQ device trees by changing the default reference clock source, causing PCIe initialization to fail. --
--- Patch [2]: [PATCH 2/3] PCI: imx6: Use the external clock as REF_CLK when needed for i.MX8MQ --- commit 6f37370c304d3692e11e97087dc50e68e2389b9e
Author: Rudi Heitbaum <[email protected]>
PCI: imx6: Use the external clock as REF_CLK when needed for i.MX8MQ
This commit updates the i.MX8MQ PCIe PHY initialization to conditionally select the external oscillator as the reference clock based on the enable_ext_refclk flag. It falls back to the internal PLL if an "extref" clock is not supplied.
Quoted 10 lines
drivers/pci/controller/dwc/pci-imx6.c +1
-1@@ -445,11 +445,16 @@ static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data)static int imx8mq_pcie_init_phy (struct imx_pcie *imx_pcie) { -/* TODO: This code assumes external oscillator is being used */ +bool ext = imx_pcie->enable_ext_refclk;
drivers/pci/controller/dwc/pci-imx6.c static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data) · line 457
Quoted 10 lines
drivers/pci/controller/dwc/pci-imx6.c +6
-1+ +/* +* Select the off-chip oscillator as REF_CLK when an "extref" clock is +* supplied, otherwise fall back to the internal PLL. +*/ regmap_update_bits (imx_pcie->iomuxc_gpr,imx_pcie_grp_offset (imx_pcie),IMX8MQ_GPR_PCIE_REF_USE_PAD , -IMX8MQ_GPR_PCIE_REF_USE_PAD ); + ext ?IMX8MQ_GPR_PCIE_REF_USE_PAD :0 );
[Severity: High]
Will this change break backward compatibility with existing i.MX8MQ device trees?
Looking at imx8mq_pcie_init_phy() in drivers/pci/controller/dwc/pci-imx6.c, if a legacy device tree does not provide a clock named "extref", imx_pcie->enable_ext_refclk evaluates to false.
This causes the driver to clear IMX8MQ_GPR_PCIE_REF_USE_PAD and fall back to the internal PLL. On boards that previously relied on the unconditional external oscillator selection, this regression will cause PCIe initialization to fail.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 2/3] PCI: imx6: Use the external clock as REF_CLK when needed for i.MX8MQ
Quoted 31 lines · On Sun, Aug 02, 2026 at 11:49:27AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch breaks backward compatibility with existing i.MX8MQ device trees by changing the default reference clock source, causing PCIe initialization to fail. ----- Patch [2]: [PATCH 2/3] PCI: imx6: Use the external clock as
REF_CLKwhen needed for i.MX8MQ --- commit6f37370c304d3692e11e97087dc50e68e2389b9e
Author: Rudi Heitbaum <[email protected]>PCI: imx6: Use the external clock as
REF_CLKwhen needed for i.MX8MQThis commit updates the i.MX8MQ PCIe PHY initialization to conditionally select the external oscillator as the reference clock based on the
enable_ext_refclkflag. It falls back to the internal PLL if an "extref" clock is not supplied.Quoted 16 lines
drivers/pci/controller/dwc/pci-imx6.c +6
-1@@ -445,11 +445,16 @@ static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data)static int imx8mq_pcie_init_phy (struct imx_pcie *imx_pcie) { -/* TODO: This code assumes external oscillator is being used */ +bool ext = imx_pcie->enable_ext_refclk; + +/* +* Select the off-chip oscillator as REF_CLK when an "extref" clock is +* supplied, otherwise fall back to the internal PLL. +*/ regmap_update_bits(imx_pcie->iomuxc_gpr,
Quoted 8 lines
drivers/pci/controller/dwc/pci-imx6.c static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data) · line 457
Quoted 4 lines
drivers/pci/controller/dwc/pci-imx6.c +1
-1imx_pcie_grp_offset (imx_pcie),IMX8MQ_GPR_PCIE_REF_USE_PAD , - IMX8MQ_GPR_PCIE_REF_USE_PAD); + ext ? IMX8MQ_GPR_PCIE_REF_USE_PAD : 0);[Severity: High]
Will this change break backward compatibility with existing i.MX8MQ device trees?
This is problem. enable_ext_refclk is good direction to align imx95. but need find way to avoid break backward compatibility.
Frank
Quoted 12 lines
Looking at
imx8mq_pcie_init_phy()indrivers/pci/controller/dwc/pci-imx6.c, if a legacy device tree does not provide a clock named "extref",imx_pcie->enable_ext_refclkevaluates to false.This causes the driver to clear
IMX8MQ_GPR_PCIE_REF_USE_PADand fall back to the internal PLL. On boards that previously relied on the unconditional external oscillator selection, this regression will cause PCIe initialization to fail.--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 2/3] PCI: imx6: Use the external clock as REF_CLK when needed for i.MX8MQ
Quoted 41 lines · Frank Li
Quoted 31 lines · On Sun, Aug 02, 2026 at 11:49:27AM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch breaks backward compatibility with existing i.MX8MQ device trees by changing the default reference clock source, causing PCIe initialization to fail. ----- Patch [2]: [PATCH 2/3] PCI: imx6: Use the external clock as
REF_CLKwhen needed for i.MX8MQ --- commit6f37370c304d3692e11e97087dc50e68e2389b9e
Author: Rudi Heitbaum <[email protected]>PCI: imx6: Use the external clock as
REF_CLKwhen needed for i.MX8MQThis commit updates the i.MX8MQ PCIe PHY initialization to conditionally select the external oscillator as the reference clock based on the
enable_ext_refclkflag. It falls back to the internal PLL if an "extref" clock is not supplied.Quoted 16 lines
drivers/pci/controller/dwc/pci-imx6.c +6
-1@@ -445,11 +445,16 @@ static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data)static int imx8mq_pcie_init_phy (struct imx_pcie *imx_pcie) { -/* TODO: This code assumes external oscillator is being used */ +bool ext = imx_pcie->enable_ext_refclk; + +/* +* Select the off-chip oscillator as REF_CLK when an "extref" clock is +* supplied, otherwise fall back to the internal PLL. +*/ regmap_update_bits(imx_pcie->iomuxc_gpr,Quoted 8 lines
drivers/pci/controller/dwc/pci-imx6.c static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data) · line 457
Quoted 4 lines
drivers/pci/controller/dwc/pci-imx6.c +1
-1imx_pcie_grp_offset (imx_pcie),IMX8MQ_GPR_PCIE_REF_USE_PAD , - IMX8MQ_GPR_PCIE_REF_USE_PAD); + ext ? IMX8MQ_GPR_PCIE_REF_USE_PAD : 0);[Severity: High]
Will this change break backward compatibility with existing i.MX8MQ device trees?
Quoted 4 lines
This is problem.
enable_ext_refclkis good direction to align imx95. but need find way to avoid break backward compatibility.Frank
Thanks for looking into this.
The difficulty is that on i.MX8MQ the absence of "extref" is ambiguous. It means "existing devicetree, reference on the pad", and I was also using it to mean "this board drives REF_CLK from the internal PLL".
Align with i.MX95, how would you prefer the internal-PLL case to be described?
The only consumer is a follow-up, "arm64: dts: imx8mq-phanbell: Enable pcie0 and pcie1" from the "arm64: dts: imx8mq-phanbell: Google Coral Dev Board enablement" series - so I am happy to create a 2/3 whichever way you suggest.
Rudi
Quoted 11 lines
Quoted 11 lines
Looking at
imx8mq_pcie_init_phy()indrivers/pci/controller/dwc/pci-imx6.c, if a legacy device tree does not provide a clock named "extref",imx_pcie->enable_ext_refclkevaluates to false.This causes the driver to clear
IMX8MQ_GPR_PCIE_REF_USE_PADand fall back to the internal PLL. On boards that previously relied on the unconditional external oscillator selection, this regression will cause PCIe initialization to fail.--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
RE: [PATCH 2/3] PCI: imx6: Use the external clock as REF_CLK when needed for i.MX8MQ
In reply to Rudi HeitbaumQuoted 27 lines
-----Original Message-----
From: Rudi Heitbaum <[email protected]>
Sent: Sunday, August 2, 2026 7:32 PM
To: Hongxing Zhu <[email protected]>; Lucas Stach <[email protected]>; Frank Li <[email protected]>; Sascha Hauer <[email protected]>
Cc: Lorenzo Pieralisi <[email protected]>; Krzysztof Wilczyński <[email protected]>; Manivannan Sadhasivam <[email protected]>; Rob Herring <[email protected]>; Bjorn Helgaas <[email protected]>; Krzysztof Kozlowski <[email protected]>; Conor Dooley <[email protected]>; Fabio Estevam <[email protected]>; linux- [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: [PATCH 2/3] PCI: imx6: Use the external clock asREF_CLKwhen needed for i.MX8MQi.MX8MQ has two PCIe
REF_CLKsources: an off-chip oscillator and the internal PLL. The driver unconditionally selected the oscillator, which is what the/* TODO: This code assumes external oscillator is being used */comment refers to. Boards wiring an oscillator to the pad describe it as the "
pcie_bus" clock, but nothing in the driver looks that clock up by name, so it does not select anything.
Quoted 6 lines
Reuse the generic
enable_ext_refclkflag, set when an "extref" clock is supplied, to select between the two, as is already done for i.MX95 in commitd8574ce57d76("PCI: imx6: Add external reference clock input mode support").Signed-off-by Rudi Heitbaum <[email protected]>
Sorry for the late reply.
The code changes look good to me.
However, I'm concerned about backward compatibility. This patch changes the default REF_CLK source from external oscillator to internal PLL when no "extref" clock is specified, which could break existing i.MX8MQ boards.
If the dt-binding maintainers approve this ABI change.
Best Regards
Richard Zhu
Quoted 30 lines
--- drivers/pci/controller/dwc/pci-imx6.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/pci/controller/dwc/pci-imx6.c +7
-3@@ -445,11 +445,16 @@ static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data)static int imx8mq_pcie_init_phy (struct imx_pcie *imx_pcie) { -/* TODO: This code assumes external oscillator is being used */ +bool ext = imx_pcie->enable_ext_refclk; + +/* +* Select the off-chip oscillator as REF_CLK when an "extref" clock is +* supplied, otherwise fall back to the internal PLL. +*/ regmap_update_bits (imx_pcie->iomuxc_gpr,imx_pcie_grp_offset (imx_pcie),IMX8MQ_GPR_PCIE_REF_USE_PAD , -IMX8MQ_GPR_PCIE_REF_USE_PAD ); + ext ?IMX8MQ_GPR_PCIE_REF_USE_PAD :0 );/* * Per the datasheet, the PCIE_VPH is suggested to be 1.8V. If the * PCIE_VPH is supplied by 3.3V, the VREG_BYPASS should be cleared -- 2.53.0
Manivannan Sadhasivam
maintainerRe: [PATCH 2/3] PCI: imx6: Use the external clock as REF_CLK when needed for i.MX8MQ
Quoted 32 lines · Hongxing Zhu
Quoted 32 lines
-----Original Message-----
From: Rudi Heitbaum <[email protected]>
Sent: Sunday, August 2, 2026 7:32 PM
To: Hongxing Zhu <[email protected]>; Lucas Stach <[email protected]>; Frank Li <[email protected]>; Sascha Hauer <[email protected]>
Cc: Lorenzo Pieralisi <[email protected]>; Krzysztof Wilczyński <[email protected]>; Manivannan Sadhasivam <[email protected]>; Rob Herring <[email protected]>; Bjorn Helgaas <[email protected]>; Krzysztof Kozlowski <[email protected]>; Conor Dooley <[email protected]>; Fabio Estevam <[email protected]>; linux- [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: [PATCH 2/3] PCI: imx6: Use the external clock asREF_CLKwhen needed for i.MX8MQi.MX8MQ has two PCIe
REF_CLKsources: an off-chip oscillator and the internal PLL. The driver unconditionally selected the oscillator, which is what the/* TODO: This code assumes external oscillator is being used */comment refers to. Boards wiring an oscillator to the pad describe it as the "
pcie_bus" clock, but nothing in the driver looks that clock up by name, so it does not select anything.Reuse the generic
enable_ext_refclkflag, set when an "extref" clock is supplied, to select between the two, as is already done for i.MX95 in commitd8574ce57d76("PCI: imx6: Add external reference clock input mode support").
Quoted 9 lines
Quoted 1 line
Signed-off-by Rudi Heitbaum <[email protected]>Sorry for the late reply.
The code changes look good to me.
However, I'm concerned about backward compatibility. This patch changes the default
REF_CLKsource from external oscillator to internal PLL when no "extref" clock is specified, which could break existing i.MX8MQ boards.
This clocks is marked as 'optional' in the binding. So the driver should continue to work with older DTs that don't specify this clock.
If this clock is truly required, then it should not be defined as optional in the binding and the ABI break should be justified in both binding and driver commit messages.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
PATCH 3/3 arm64: dts: imx8mq: Declare the PCIe extref clock
In reply to Rudi HeitbaumBoards feeding PCIe REF_CLK from an off-chip oscillator described it as the "pcie_bus" clock, which the driver never looks up by name and which therefore selects nothing. The oscillator was used only because the driver forced IMX8MQ_GPR_PCIE_REF_USE_PAD unconditionally.
Now that the selection follows the "extref" clock, name the oscillator explicitly on every board that depends on it so the behaviour is unchanged. The "pcie_bus" entries are left alone.
Endpoint nodes are not touched: they are all disabled and use a separate binding.
--- arch/arm64/boot/dts/freescale/imx8mq-evk.dts | 8 ++++++-- .../boot/dts/freescale/imx8mq-kontron-pitx-imx8m.dts | 8 ++++++-- arch/arm64/boot/dts/freescale/imx8mq-mnt-reform2.dts | 4 +++- arch/arm64/boot/dts/freescale/imx8mq-tqma8mq-mba8mx.dts | 8 ++++++-- arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi | 8 ++++++-- 5 files changed, 27 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/freescale/imx8mq-evk.dts +6 -2
@@ -374,7 +374,9 @@ &pcie0 { clocks = <&clk IMX8MQ_CLK_PCIE1_ROOT>, <&pcie0_refclk>, <&clk IMX8MQ_CLK_PCIE1_PHY>, - <&clk IMX8MQ_CLK_PCIE1_AUX>; + <&clk IMX8MQ_CLK_PCIE1_AUX>, + <&pcie0_refclk>; + clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "extref"; vph-supply = <&vgen5_reg>; supports-clkreq; status = "okay";
@@ -402,7 +404,9 @@ &pcie1 { clocks = <&clk IMX8MQ_CLK_PCIE2_ROOT>, <&pcie0_refclk>, <&clk IMX8MQ_CLK_PCIE2_PHY>, - <&clk IMX8MQ_CLK_PCIE2_AUX>; + <&clk IMX8MQ_CLK_PCIE2_AUX>, + <&pcie0_refclk>; + clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "extref"; vpcie-supply = <®_pcie1>; vpcie3v3aux-supply = <®_pcie1>; vph-supply = <&vgen5_reg>;
arch/arm64/boot/dts/freescale/imx8mq-kontron-pitx-imx8m.dts +6 -2
@@ -247,7 +247,9 @@ &pcie0 { clocks = <&clk IMX8MQ_CLK_PCIE1_ROOT>, <&pcie0_refclk>, <&clk IMX8MQ_CLK_PCIE1_PHY>, - <&clk IMX8MQ_CLK_PCIE1_AUX>; + <&clk IMX8MQ_CLK_PCIE1_AUX>, + <&pcie0_refclk>; + clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "extref"; status = "okay"; };
@@ -256,7 +258,9 @@ &pcie1 { clocks = <&clk IMX8MQ_CLK_PCIE2_ROOT>, <&pcie1_refclk>, <&clk IMX8MQ_CLK_PCIE2_PHY>, - <&clk IMX8MQ_CLK_PCIE2_AUX>; + <&clk IMX8MQ_CLK_PCIE2_AUX>, + <&pcie1_refclk>; + clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "extref"; fsl,max-link-speed = <1>; status = "okay"; };
arch/arm64/boot/dts/freescale/imx8mq-mnt-reform2.dts +3 -1
@@ -199,7 +199,9 @@ &pcie1 { clocks = <&clk IMX8MQ_CLK_PCIE2_ROOT>, <&pcie1_refclk>, <&clk IMX8MQ_CLK_PCIE2_PHY>, - <&clk IMX8MQ_CLK_PCIE2_AUX>; + <&clk IMX8MQ_CLK_PCIE2_AUX>, + <&pcie1_refclk>; + clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "extref"; status = "okay"; };
arch/arm64/boot/dts/freescale/imx8mq-tqma8mq-mba8mx.dts +6 -2
@@ -97,7 +97,9 @@ &pcie0 { clocks = <&clk IMX8MQ_CLK_PCIE1_ROOT>, <&pcieclk 3>, <&pcieclk 2>, - <&clk IMX8MQ_CLK_PCIE1_AUX>; + <&clk IMX8MQ_CLK_PCIE1_AUX>, + <&pcieclk 3>; + clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "extref"; status = "okay"; };
@@ -109,7 +111,9 @@ &pcie1 { clocks = <&clk IMX8MQ_CLK_PCIE2_ROOT>, <&pcieclk 1>, <&pcieclk 0>, - <&clk IMX8MQ_CLK_PCIE2_AUX>; + <&clk IMX8MQ_CLK_PCIE2_AUX>, + <&pcieclk 1>; + clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "extref"; status = "okay"; };
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi +6 -2
@@ -551,7 +551,9 @@ &pcie0 { clocks = <&clk IMX8MQ_CLK_PCIE1_ROOT>, <&pcie0_refclk>, <&clk IMX8MQ_CLK_PCIE1_PHY>, - <&clk IMX8MQ_CLK_PCIE1_AUX>; + <&clk IMX8MQ_CLK_PCIE1_AUX>, + <&pcie0_refclk>; + clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "extref"; vph-supply = <&vgen5_reg>; status = "okay"; };
@@ -563,7 +565,9 @@ &pcie1 { clocks = <&clk IMX8MQ_CLK_PCIE2_ROOT>, <&pcie1_refclk>, <&clk IMX8MQ_CLK_PCIE2_PHY>, - <&clk IMX8MQ_CLK_PCIE2_AUX>; + <&clk IMX8MQ_CLK_PCIE2_AUX>, + <&pcie1_refclk>; + clock-names = "pcie", "pcie_bus", "pcie_phy", "pcie_aux", "extref"; vph-supply = <&vgen5_reg>; status = "okay"; };
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 3/3] arm64: dts: imx8mq: Declare the PCIe extref clock
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Critical] The requirement for a new 'extref' clock name breaks PCIe on older device trees for i.MX8MQ…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] The requirement for a new 'extref' clock name breaks PCIe on older device trees for i.MX8MQ boards that rely on an external oscillator.
- [High] PCIe endpoint nodes on boards with external oscillators are intentionally omitted from the 'extref' clock update, which will misconfigure the PHY to use the internal PLL and break the link when endpoint mode is enabled. --
--- Patch [3]: [PATCH 3/3] arm64: dts: imx8mq: Declare the PCIe extref clock --- commit ad57d8a5f5ec29362d83c5dccc786006a9f4c2cb
Author: Rudi Heitbaum <[email protected]>
arm64: dts: imx8mq: Declare the PCIe extref clock
This commit updates i.MX8MQ board device trees to explicitly define the "extref" clock for PCIe nodes, keeping "pcie_bus" entries intact. The change aligns the device trees with a driver update that relies on the "extref" clock name to configure the external oscillator.
Quoted 10 lines
arm64: dts: imx8mq: Declare the PCIe extref clock
Boards feeding PCIe
REF_CLKfrom an off-chip oscillator described it as the "pcie_bus" clock, which the driver never looks up by name and which therefore selects nothing. The oscillator was used only because the driver forcedIMX8MQ_GPR_PCIE_REF_USE_PADunconditionally.Now that the selection follows the "extref" clock, name the oscillator explicitly on every board that depends on it so the behaviour is unchanged. The "
pcie_bus" entries are left alone.
[Severity: Critical]
Does this break backward compatibility for older device trees?
If a user upgrades to a kernel with the new driver behavior but boots with an older DTB that lacks the newly introduced "extref" clock name, will the driver in drivers/pci/controller/dwc/pci-imx6.c:imx8mq_pcie_init_phy() clear the IMX8MQ_GPR_PCIE_REF_USE_PAD bit because "extref" is absent?
Device trees represent a stable ABI, and older deployed DTBs might lose PCIe functionality if they rely on the external oscillator and this bit is cleared.
Quoted 2 lines
Endpoint nodes are not touched: they are all disabled and use a separate binding.
[Severity: High]
Since endpoint mode initialization also goes through the same PHY setup routine, will omitting the "extref" clock from endpoint nodes misconfigure the PHY for endpoint operations?
If a user enables the pcie0_ep or pcie1_ep node on an affected board like the EVK, the driver will not find the "extref" clock and imx8mq_pcie_init_phy() will incorrectly clear IMX8MQ_GPR_PCIE_REF_USE_PAD.
Does this mean the PHY will be misconfigured to use the internal PLL instead of the required external oscillator, breaking the link when endpoint mode is enabled?
Quoted 1 line
Signed-off-by Rudi Heitbaum <[email protected]>
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3