]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: imx6: Identify controller via 'linux,pci-domain', not address
authorRichard Zhu <hongxing.zhu@nxp.com>
Wed, 26 Feb 2025 02:42:56 +0000 (10:42 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Sat, 15 Mar 2025 18:12:00 +0000 (13:12 -0500)
Instead of testing the controller register address to distinguish
controller 1 from controller 0 on i.MX8MQ platforms, use the PCI domain
number, which comes from the devicetree 'linux,pci-domain' property.

All relevant devicetrees should already supply 'linux,pci-domain', which
was added by c0b70f05c87f ("arm64: dts: imx8mq: use_dt_domains for pci
node").

Instead of being set directly in imx_pcie_probe(), pci->dbi_base will be
set by the DWC core in dw_pcie_get_resources().

No functional changes intended.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
[bhelgaas: commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20250226024256.1678103-3-hongxing.zhu@nxp.com
drivers/pci/controller/dwc/pci-imx6.c

index 90ace941090f90d8b95abe5c979a794638b88255..d165a7e36a351d02da18206a7fad84f8603923ae 100644 (file)
@@ -41,7 +41,6 @@
 #define IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE       BIT(11)
 #define IMX8MQ_GPR_PCIE_VREG_BYPASS            BIT(12)
 #define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE    GENMASK(11, 8)
-#define IMX8MQ_PCIE2_BASE_ADDR                 0x33c00000
 
 #define IMX95_PCIE_PHY_GEN_CTRL                        0x0
 #define IMX95_PCIE_REF_USE_PAD                 BIT(17)
@@ -1474,9 +1473,8 @@ static int imx_pcie_probe(struct platform_device *pdev)
        struct dw_pcie *pci;
        struct imx_pcie *imx_pcie;
        struct device_node *np;
-       struct resource *dbi_base;
        struct device_node *node = dev->of_node;
-       int i, ret, req_cnt;
+       int i, ret, req_cnt, domain;
        u16 val;
 
        imx_pcie = devm_kzalloc(dev, sizeof(*imx_pcie), GFP_KERNEL);
@@ -1515,10 +1513,6 @@ static int imx_pcie_probe(struct platform_device *pdev)
                        return PTR_ERR(imx_pcie->phy_base);
        }
 
-       pci->dbi_base = devm_platform_get_and_ioremap_resource(pdev, 0, &dbi_base);
-       if (IS_ERR(pci->dbi_base))
-               return PTR_ERR(pci->dbi_base);
-
        /* Fetch GPIOs */
        imx_pcie->reset_gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(imx_pcie->reset_gpiod))
@@ -1565,8 +1559,11 @@ static int imx_pcie_probe(struct platform_device *pdev)
        switch (imx_pcie->drvdata->variant) {
        case IMX8MQ:
        case IMX8MQ_EP:
-               if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR)
-                       imx_pcie->controller_id = 1;
+               domain = of_get_pci_domain_nr(node);
+               if (domain < 0 || domain > 1)
+                       return dev_err_probe(dev, -ENODEV, "no \"linux,pci-domain\" property in devicetree\n");
+
+               imx_pcie->controller_id = domain;
                break;
        default:
                break;