Merge tag 'irq-core-2020-12-23' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / pci / controller / pcie-xilinx-nwl.c
index 22135df..07e3666 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/of_platform.h>
 #include <linux/of_irq.h>
 #include <linux/pci.h>
+#include <linux/pci-ecam.h>
 #include <linux/platform_device.h>
 #include <linux/irqchip/chained_irq.h>
 
 #define E_ECAM_CR_ENABLE               BIT(0)
 #define E_ECAM_SIZE_LOC                        GENMASK(20, 16)
 #define E_ECAM_SIZE_SHIFT              16
-#define ECAM_BUS_LOC_SHIFT             20
-#define ECAM_DEV_LOC_SHIFT             12
 #define NWL_ECAM_VALUE_DEFAULT         12
 
 #define CFG_DMA_REG_BAR                        GENMASK(2, 0)
@@ -240,15 +239,11 @@ static void __iomem *nwl_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
                                      int where)
 {
        struct nwl_pcie *pcie = bus->sysdata;
-       int relbus;
 
        if (!nwl_pcie_valid_device(bus, devfn))
                return NULL;
 
-       relbus = (bus->number << ECAM_BUS_LOC_SHIFT) |
-                       (devfn << ECAM_DEV_LOC_SHIFT);
-
-       return pcie->ecam_base + relbus + where;
+       return pcie->ecam_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);
 }
 
 /* PCIe operations */