Skip to content

Commit

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

So use new U-Boot macro PCI_CONF1_EXT_ADDRESS() and remove old custom
driver address macros.

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 f146bd9 commit d0dd49f
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions drivers/pci/pci_mvebu.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@
#define PCIE_WIN5_BASE_OFF 0x1884
#define PCIE_WIN5_REMAP_OFF 0x188c
#define PCIE_CONF_ADDR_OFF 0x18f8
#define PCIE_CONF_ADDR_EN BIT(31)
#define PCIE_CONF_REG(r) ((((r) & 0xf00) << 16) | ((r) & 0xfc))
#define PCIE_CONF_BUS(b) (((b) & 0xff) << 16)
#define PCIE_CONF_DEV(d) (((d) & 0x1f) << 11)
#define PCIE_CONF_FUNC(f) (((f) & 0x7) << 8)
#define PCIE_CONF_ADDR(b, d, f, reg) \
(PCIE_CONF_BUS(b) | PCIE_CONF_DEV(d) | \
PCIE_CONF_FUNC(f) | PCIE_CONF_REG(reg) | \
PCIE_CONF_ADDR_EN)
#define PCIE_CONF_DATA_OFF 0x18fc
#define PCIE_MASK_OFF 0x1910
#define PCIE_MASK_ENABLE_INTS (0xf << 24)
Expand Down Expand Up @@ -186,9 +177,9 @@ static int mvebu_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
* secondary bus with device number 1.
*/
if (busno == pcie->first_busno)
addr = PCIE_CONF_ADDR(pcie->sec_busno, 1, 0, offset);
addr = PCI_CONF1_EXT_ADDRESS(pcie->sec_busno, 1, 0, offset);
else
addr = PCIE_CONF_ADDR(busno, PCI_DEV(bdf), PCI_FUNC(bdf), offset);
addr = PCI_CONF1_EXT_ADDRESS(busno, PCI_DEV(bdf), PCI_FUNC(bdf), offset);

/* write address */
writel(addr, pcie->base + PCIE_CONF_ADDR_OFF);
Expand Down Expand Up @@ -284,9 +275,9 @@ static int mvebu_pcie_write_config(struct udevice *bus, pci_dev_t bdf,
* secondary bus with device number 1.
*/
if (busno == pcie->first_busno)
addr = PCIE_CONF_ADDR(pcie->sec_busno, 1, 0, offset);
addr = PCI_CONF1_EXT_ADDRESS(pcie->sec_busno, 1, 0, offset);
else
addr = PCIE_CONF_ADDR(busno, PCI_DEV(bdf), PCI_FUNC(bdf), offset);
addr = PCI_CONF1_EXT_ADDRESS(busno, PCI_DEV(bdf), PCI_FUNC(bdf), offset);

/* write address */
writel(addr, pcie->base + PCIE_CONF_ADDR_OFF);
Expand Down

0 comments on commit d0dd49f

Please sign in to comment.