* [PATCH 1/1] PCI: layerscape(ep): Implement common 'dbi' reg-names for dbi_base
@ 2024-02-29 19:45 Frank Li
0 siblings, 0 replies; only message in thread
From: Frank Li @ 2024-02-29 19:45 UTC (permalink / raw)
To: Minghuan Lian, Mingkai Hu, Roy Zang, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas,
open list:PCI DRIVER FOR FREESCALE LAYERSCAPE,
open list:PCI DRIVER FOR FREESCALE LAYERSCAPE,
moderated list:PCI DRIVER FOR FREESCALE LAYERSCAPE, open list
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(-)
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-29 19:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-29 19:45 [PATCH 1/1] PCI: layerscape(ep): Implement common 'dbi' reg-names for dbi_base Frank Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®