Skip to content

Commit

Permalink
pci: pcie_dw_rockchip: Disable unused BARs of the root complex
Browse files Browse the repository at this point in the history
The Root Complex BARs default to claim the full 1 GiB memory region on
RK3568, leaving no space for any attached device.

Fix this by disable the unused BAR 0 and BAR 1 of the RC.

Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
  • Loading branch information
keveryang authored and Kwiboo committed Jul 19, 2023
1 parent 28af6a5 commit 0e0bbc8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/pci/pcie_dw_rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ struct rk_pcie {
#define PCIE_CLIENT_DBG_TRANSITION_DATA 0xffff0000
#define PCIE_CLIENT_DBF_EN 0xffff0003

#define PCIE_TYPE0_HDR_DBI2_OFFSET 0x100000

static int rk_pcie_read(void __iomem *addr, int size, u32 *val)
{
if ((uintptr_t)addr & (size - 1)) {
Expand Down Expand Up @@ -158,6 +160,12 @@ static void rk_pcie_configure(struct rk_pcie *pci, u32 cap_speed)
{
dw_pcie_dbi_write_enable(&pci->dw, true);

/* Disable BAR 0 and BAR 1 */
writel(0, pci->dw.dbi_base + PCIE_TYPE0_HDR_DBI2_OFFSET +
PCI_BASE_ADDRESS_0);
writel(0, pci->dw.dbi_base + PCIE_TYPE0_HDR_DBI2_OFFSET +
PCI_BASE_ADDRESS_1);

clrsetbits_le32(pci->dw.dbi_base + PCIE_LINK_CAPABILITY,
TARGET_LINK_SPEED_MASK, cap_speed);

Expand Down

0 comments on commit 0e0bbc8

Please sign in to comment.