Re: [PATCH 2/3] PCI: imx6: Use the external clock as REF_CLK when needed for i.MX8MQ

[email protected] Sun, 02 Aug 2026 11:49:27 +0000
Newsgroups dev.linux.lists.imx,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-pci
Message-ID <[email protected]>
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 devi=
ce trees by changing the default reference clock source, causing PCIe initi=
alization to fail.
--

--- Patch [2]: [PATCH 2/3] PCI: imx6: Use the external clock as REF_CLK whe=
n 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.

> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controll=
er/dwc/pci-imx6.c
> index 98e1db751132a..9e3b64fecb451 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -445,11 +445,16 @@ static int pcie_phy_write(struct imx_pcie *imx_pcie=
, int addr, u16 data)
> =20
>  static int imx8mq_pcie_init_phy(struct imx_pcie *imx_pcie)
>  {
> -	/* TODO: This code assumes external oscillator is being used */
> +	bool ext =3D 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);

[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 initializati=
on
to fail.

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1785669457.gi=
[email protected]?part=3D2