From: Frank Li <Frank.li@nxp.com>
To: Richard Zhu <hongxing.zhu@nxp.com>
Cc: l.stach@pengutronix.de, lpieralisi@kernel.org,
kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@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,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/3] PCI: imx6: Add external reference clock mode support
Date: Thu, 26 Jun 2025 14:44:40 -0400 [thread overview]
Message-ID: <aF2VGNojndeg3v8L@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250626073804.3113757-4-hongxing.zhu@nxp.com>
On Thu, Jun 26, 2025 at 03:38:04PM +0800, Richard Zhu wrote:
> The PCI Express reference clock of i.MX9 PCIes might come from external
> clock source. Add the external reference clock mode support.
>
> 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 5a38cfaf989b..9309959874c0 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;
> }
> @@ -1600,7 +1602,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);
> @@ -1651,6 +1653,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 = true;
> + for (i = 0; i < imx_pcie->num_clks; i++)
> + if (strncmp(imx_pcie->clks[i].id, "ref", 3) == 0)
> + imx_pcie->enable_ext_refclk = false;
>
> if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_PHYDRV)) {
> imx_pcie->phy = devm_phy_get(dev, "pcie-phy");
> --
> 2.37.1
>
prev parent reply other threads:[~2025-06-26 18:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 7:38 [PATCH v4 0/3] PCI: imx6: Add external reference clock mode support Richard Zhu
2025-06-26 7:38 ` [PATCH v4 1/3] dt-bindings: PCI: dwc: Add one more reference clock Richard Zhu
2025-06-26 18:31 ` Frank Li
2025-06-26 20:52 ` Bjorn Helgaas
2025-06-27 6:54 ` Krzysztof Kozlowski
2025-06-27 20:09 ` Frank Li
2025-06-28 12:34 ` Krzysztof Kozlowski
2025-06-28 15:33 ` Frank Li
2025-06-30 8:25 ` Krzysztof Kozlowski
2025-06-30 15:08 ` Frank Li
2025-06-26 7:38 ` [PATCH v4 2/3] dt-binding: pci-imx6: Add external reference clock mode support Richard Zhu
2025-06-26 18:43 ` Frank Li
2025-06-26 20:53 ` Bjorn Helgaas
2025-06-28 12:35 ` Krzysztof Kozlowski
2025-06-26 7:38 ` [PATCH v4 3/3] PCI: imx6: " Richard Zhu
2025-06-26 18:44 ` Frank Li [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aF2VGNojndeg3v8L@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=bhelgaas@google.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=hongxing.zhu@nxp.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=l.stach@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox