Skip to content

Commit 88b8b5b

Browse files
committed
Merge branch 'pci/controller/meson'
- Update DT binding to name DBI region "dbi", not "elbi", and update driver to support both (Manivannan Sadhasivam) * pci/controller/meson: PCI: meson: Fix parsing the DBI register region dt-bindings: PCI: amlogic: Fix the register name of the DBI region
2 parents 9563c34 + eff0306 commit 88b8b5b

3 files changed

Lines changed: 25 additions & 11 deletions

File tree

Documentation/devicetree/bindings/pci/amlogic,axg-pcie.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ properties:
3737

3838
reg:
3939
items:
40-
- description: External local bus interface registers
40+
- description: Data Bus Interface registers
4141
- description: Meson designed configuration registers
4242
- description: PCIe configuration space
4343

4444
reg-names:
4545
items:
46-
- const: elbi
46+
- const: dbi
4747
- const: cfg
4848
- const: config
4949

@@ -114,7 +114,7 @@ examples:
114114
pcie: pcie@f9800000 {
115115
compatible = "amlogic,axg-pcie", "snps,dw-pcie";
116116
reg = <0xf9800000 0x400000>, <0xff646000 0x2000>, <0xf9f00000 0x100000>;
117-
reg-names = "elbi", "cfg", "config";
117+
reg-names = "dbi", "cfg", "config";
118118
interrupts = <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>;
119119
clocks = <&clk_phy>, <&pclk>, <&clk_port>;
120120
clock-names = "general", "pclk", "port";

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,22 @@ static int meson_pcie_get_mems(struct platform_device *pdev,
108108
struct meson_pcie *mp)
109109
{
110110
struct dw_pcie *pci = &mp->pci;
111+
struct resource *res;
111112

112-
pci->dbi_base = devm_platform_ioremap_resource_byname(pdev, "elbi");
113-
if (IS_ERR(pci->dbi_base))
114-
return PTR_ERR(pci->dbi_base);
113+
/*
114+
* For the broken DTs that supply 'dbi' as 'elbi', parse the 'elbi'
115+
* region and assign it to both 'pci->elbi_base' and 'pci->dbi_space' so
116+
* that the DWC core can skip parsing both regions.
117+
*/
118+
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
119+
if (res) {
120+
pci->elbi_base = devm_pci_remap_cfg_resource(pci->dev, res);
121+
if (IS_ERR(pci->elbi_base))
122+
return PTR_ERR(pci->elbi_base);
123+
124+
pci->dbi_base = pci->elbi_base;
125+
pci->dbi_phys_addr = res->start;
126+
}
115127

116128
mp->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
117129
if (IS_ERR(mp->cfg_base))

drivers/pci/controller/dwc/pcie-designware.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,13 @@ int dw_pcie_get_resources(struct dw_pcie *pci)
168168
}
169169

170170
/* ELBI is an optional resource */
171-
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
172-
if (res) {
173-
pci->elbi_base = devm_ioremap_resource(pci->dev, res);
174-
if (IS_ERR(pci->elbi_base))
175-
return PTR_ERR(pci->elbi_base);
171+
if (!pci->elbi_base) {
172+
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
173+
if (res) {
174+
pci->elbi_base = devm_ioremap_resource(pci->dev, res);
175+
if (IS_ERR(pci->elbi_base))
176+
return PTR_ERR(pci->elbi_base);
177+
}
176178
}
177179

178180
/* LLDD is supposed to manually switch the clocks and resets state */

0 commit comments

Comments
 (0)