Skip to content

Commit b5d712e

Browse files
shawn1221Mani-Sadhasivam
authored andcommitted
PCI: dw-rockchip: Disable BAR 0 and BAR 1 for Root Port
Some Rockchip PCIe Root Ports report bogus size of 1GiB for the BAR memories and they cause below resource allocation issue during probe. pci 0000:00:00.0: [1d87:3588] type 01 class 0x060400 PCIe Root Port pci 0000:00:00.0: BAR 0 [mem 0x00000000-0x3fffffff] pci 0000:00:00.0: BAR 1 [mem 0x00000000-0x3fffffff] pci 0000:00:00.0: ROM [mem 0x00000000-0x0000ffff pref] ... pci 0000:00:00.0: BAR 0 [mem 0x900000000-0x93fffffff]: assigned pci 0000:00:00.0: BAR 1 [mem size 0x40000000]: can't assign; no space pci 0000:00:00.0: BAR 1 [mem size 0x40000000]: failed to assign pci 0000:00:00.0: ROM [mem 0xf0200000-0xf020ffff pref]: assigned pci 0000:00:00.0: BAR 0 [mem 0x900000000-0x93fffffff]: releasing pci 0000:00:00.0: ROM [mem 0xf0200000-0xf020ffff pref]: releasing pci 0000:00:00.0: BAR 0 [mem 0x900000000-0x93fffffff]: assigned pci 0000:00:00.0: BAR 1 [mem size 0x40000000]: can't assign; no space pci 0000:00:00.0: BAR 1 [mem size 0x40000000]: failed to assign Since there is no use of the Root Port BAR memories, disable both of them. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> [mani: reworded the description and comment] Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://patch.msgid.link/1766570461-138256-1-git-send-email-shawn.lin@rock-chips.com
1 parent 8f0b4cc commit b5d712e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/pci/controller/dwc/pcie-dw-rockchip.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
#define PCIE_LINKUP_MASK GENMASK(17, 16)
8181
#define PCIE_LTSSM_STATUS_MASK GENMASK(5, 0)
8282

83+
#define PCIE_TYPE0_HDR_DBI2_OFFSET 0x100000
84+
8385
struct rockchip_pcie {
8486
struct dw_pcie pci;
8587
void __iomem *apb_base;
@@ -292,6 +294,8 @@ static int rockchip_pcie_host_init(struct dw_pcie_rp *pp)
292294
if (irq < 0)
293295
return irq;
294296

297+
pci->dbi_base2 = pci->dbi_base + PCIE_TYPE0_HDR_DBI2_OFFSET;
298+
295299
ret = rockchip_pcie_init_irq_domain(rockchip);
296300
if (ret < 0)
297301
dev_err(dev, "failed to init irq domain\n");
@@ -302,6 +306,10 @@ static int rockchip_pcie_host_init(struct dw_pcie_rp *pp)
302306
rockchip_pcie_configure_l1ss(pci);
303307
rockchip_pcie_enable_l0s(pci);
304308

309+
/* Disable Root Ports BAR0 and BAR1 as they report bogus size */
310+
dw_pcie_writel_dbi2(pci, PCI_BASE_ADDRESS_0, 0x0);
311+
dw_pcie_writel_dbi2(pci, PCI_BASE_ADDRESS_1, 0x0);
312+
305313
return 0;
306314
}
307315

0 commit comments

Comments
 (0)