[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240229194559.709182-1-Frank.Li@nxp.com>
Date: Thu, 29 Feb 2024 14:45:58 -0500
From: Frank Li <Frank.Li@....com>
To: Minghuan Lian <minghuan.Lian@....com>,
Mingkai Hu <mingkai.hu@....com>,
Roy Zang <roy.zang@....com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Rob Herring <robh@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
linuxppc-dev@...ts.ozlabs.org (open list:PCI DRIVER FOR FREESCALE LAYERSCAPE),
linux-pci@...r.kernel.org (open list:PCI DRIVER FOR FREESCALE LAYERSCAPE),
linux-arm-kernel@...ts.infradead.org (moderated list:PCI DRIVER FOR FREESCALE LAYERSCAPE),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 1/1] PCI: layerscape(ep): Implement common 'dbi' reg-names for dbi_base
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@....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(-)
diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c b/drivers/pci/controller/dwc/pci-layerscape-ep.c
index 1f6ee1460ec2a..92d4750611d07 100644
--- a/drivers/pci/controller/dwc/pci-layerscape-ep.c
+++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c
@@ -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);
diff --git a/drivers/pci/controller/dwc/pci-layerscape.c b/drivers/pci/controller/dwc/pci-layerscape.c
index ee6f525681337..1985086f6a1f3 100644
--- a/drivers/pci/controller/dwc/pci-layerscape.c
+++ b/drivers/pci/controller/dwc/pci-layerscape.c
@@ -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);
--
2.34.1
Powered by blists - more mailing lists