Skip to content

Commit

Permalink
pci: tegra: Use PCI_CONF1_EXT_ADDRESS() macro
Browse files Browse the repository at this point in the history
PCI tegra driver uses extended format of Config Address for PCI
Configuration Mechanism #1 but with cleared Enable bit.

So use new U-Boot macro PCI_CONF1_EXT_ADDRESS() with clearing
PCI_CONF1_ENABLE bit and remove old custom driver address function.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
  • Loading branch information
pali authored and trini committed Jan 12, 2022
1 parent d0dd49f commit 86be29e
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/pci/pci_tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,6 @@ static void rp_writel(struct tegra_pcie_port *port, unsigned long value,
writel(value, port->regs.start + offset);
}

static unsigned long tegra_pcie_conf_offset(pci_dev_t bdf, int where)
{
return ((where & 0xf00) << 16) | (PCI_BUS(bdf) << 16) |
(PCI_DEV(bdf) << 11) | (PCI_FUNC(bdf) << 8) |
(where & 0xfc);
}

static int tegra_pcie_conf_address(struct tegra_pcie *pcie, pci_dev_t bdf,
int where, unsigned long *address)
{
Expand All @@ -305,7 +298,9 @@ static int tegra_pcie_conf_address(struct tegra_pcie *pcie, pci_dev_t bdf,
return -EFAULT;
#endif

*address = pcie->cs.start + tegra_pcie_conf_offset(bdf, where);
*address = pcie->cs.start +
(PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf),
PCI_FUNC(bdf), where) & ~PCI_CONF1_ENABLE);
return 0;
}
}
Expand Down

0 comments on commit 86be29e

Please sign in to comment.