]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
PCI: imx6: Configure PHY based on Root Complex or Endpoint mode
authorFrank Li <Frank.Li@nxp.com>
Tue, 19 Nov 2024 19:44:24 +0000 (14:44 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Feb 2025 09:02:03 +0000 (10:02 +0100)
[ Upstream commit de22e20589b79f35f92543119c33051f8179dba0 ]

Pass PHY_MODE_PCIE_EP if the PCI controller operates in Endpoint (EP) mode,
and fix the Root Complex (RC) mode being hardcoded using a drvdata mode
check.

Fixes: 8026f2d8e8a9 ("PCI: imx6: Call common PHY API to set mode, speed, and submode")
Link: https://lore.kernel.org/r/20241119-pci_fixup_addr-v8-6-c4bfa5193288@nxp.com
Signed-off-by: Frank Li <Frank.Li@nxp.com>
[kwilczynski: commit log]
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/controller/dwc/pci-imx6.c

index c8d5c90aa4d45b05b3ebea520a061bbd87464b6f..9d61e7c47208272ad09d095eb2c8888b7558ccf0 100644 (file)
@@ -966,7 +966,9 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
                        goto err_clk_disable;
                }
 
-               ret = phy_set_mode_ext(imx_pcie->phy, PHY_MODE_PCIE, PHY_MODE_PCIE_RC);
+               ret = phy_set_mode_ext(imx_pcie->phy, PHY_MODE_PCIE,
+                                      imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE ?
+                                               PHY_MODE_PCIE_EP : PHY_MODE_PCIE_RC);
                if (ret) {
                        dev_err(dev, "unable to set PCIe PHY mode\n");
                        goto err_phy_exit;