Skip to content

PCI: imx6: select the PCIe REF_CLK source on i.MX8MQ

Rudi Heitbaum imx linux-arm-kernel linux-devicetree linux-pci lkml sashiko-reviews 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3dt-bindings: pci: fsl,imx6q-pcie: Add extref clock for i.MX8MQDocumentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml+6 -20 replies
2/3PCI: imx6: Use the external clock as REF_CLK when needed for i.MX8MQdrivers/pci/controller/dwc/pci-imx6.c+7 -24 replies
3/3arm64: dts: imx8mq: Declare the PCIe extref clockarch/arm64/boot/dts/freescale/imx8mq-evk.dts arch/arm64/boot/dts/freescale/imx8mq-kontron-pitx-imx8m.dts arch/arm64/boot/dts/freescale/imx8mq-mnt-reform2.dts +2 more+27 -90 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchRichard Zhu
1/3
2/3A-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] 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