[1/1] PCI: layerscape(ep): Implement common 'dbi' reg-names for dbi_base
Commit Message
Apply 'dbi' as the primary name for dbi_base register space in line with
Designware common binding. Attempt resource acquisition using 'dbi' first
via platform_get_resource_byname(). If encountering older device tree
files, gracefully fallback to 'regs', issuing a warning message.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
drivers/pci/controller/dwc/pci-layerscape-ep.c | 7 ++++++-
drivers/pci/controller/dwc/pci-layerscape.c | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
@@ -259,7 +259,12 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev)
pcie->pci = pci;
pcie->ls_epc = ls_epc;
- dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
+ dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
+ if (!dbi_base) {
+ dev_warn(dev, "Please update your dtb, reg-names 'regs' should be 'dbi'");
+ dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
+ }
+
pci->dbi_base = devm_pci_remap_cfg_resource(dev, dbi_base);
if (IS_ERR(pci->dbi_base))
return PTR_ERR(pci->dbi_base);
@@ -345,7 +345,12 @@ static int ls_pcie_probe(struct platform_device *pdev)
pcie->pci = pci;
pci->pp.ops = pcie->drvdata->ops;
- dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
+ dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
+ if (!dbi_base) {
+ dev_err(dev, "Please update your dtb, reg-names 'regs' should be 'dbi'");
+ dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
+ }
+
pci->dbi_base = devm_pci_remap_cfg_resource(dev, dbi_base);
if (IS_ERR(pci->dbi_base))
return PTR_ERR(pci->dbi_base);