Skip to content

Commit 81d1d21

Browse files
Richard Zhubjorn-helgaas
authored andcommitted
PCI: imx6: Identify controller via 'linux,pci-domain', not address
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 c0b70f0 ("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 <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2014c95 commit 81d1d21

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

drivers/pci/controller/dwc/pci-imx6.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#define IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE BIT(11)
4242
#define IMX8MQ_GPR_PCIE_VREG_BYPASS BIT(12)
4343
#define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE GENMASK(11, 8)
44-
#define IMX8MQ_PCIE2_BASE_ADDR 0x33c00000
4544

4645
#define IMX95_PCIE_PHY_GEN_CTRL 0x0
4746
#define IMX95_PCIE_REF_USE_PAD BIT(17)
@@ -1474,9 +1473,8 @@ static int imx_pcie_probe(struct platform_device *pdev)
14741473
struct dw_pcie *pci;
14751474
struct imx_pcie *imx_pcie;
14761475
struct device_node *np;
1477-
struct resource *dbi_base;
14781476
struct device_node *node = dev->of_node;
1479-
int i, ret, req_cnt;
1477+
int i, ret, req_cnt, domain;
14801478
u16 val;
14811479

14821480
imx_pcie = devm_kzalloc(dev, sizeof(*imx_pcie), GFP_KERNEL);
@@ -1515,10 +1513,6 @@ static int imx_pcie_probe(struct platform_device *pdev)
15151513
return PTR_ERR(imx_pcie->phy_base);
15161514
}
15171515

1518-
pci->dbi_base = devm_platform_get_and_ioremap_resource(pdev, 0, &dbi_base);
1519-
if (IS_ERR(pci->dbi_base))
1520-
return PTR_ERR(pci->dbi_base);
1521-
15221516
/* Fetch GPIOs */
15231517
imx_pcie->reset_gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
15241518
if (IS_ERR(imx_pcie->reset_gpiod))
@@ -1565,8 +1559,11 @@ static int imx_pcie_probe(struct platform_device *pdev)
15651559
switch (imx_pcie->drvdata->variant) {
15661560
case IMX8MQ:
15671561
case IMX8MQ_EP:
1568-
if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR)
1569-
imx_pcie->controller_id = 1;
1562+
domain = of_get_pci_domain_nr(node);
1563+
if (domain < 0 || domain > 1)
1564+
return dev_err_probe(dev, -ENODEV, "no \"linux,pci-domain\" property in devicetree\n");
1565+
1566+
imx_pcie->controller_id = domain;
15701567
break;
15711568
default:
15721569
break;

0 commit comments

Comments
 (0)