arm: ioremap: Replace pci_ioremap_io() usage by pci_remap_iospace()
authorPali Rohár <pali@kernel.org>
Wed, 24 Nov 2021 15:41:15 +0000 (16:41 +0100)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tue, 7 Dec 2021 17:36:16 +0000 (17:36 +0000)
Replace all usage of ARM specific pci_ioremap_io() function by standard
PCI core API function pci_remap_iospace() in all drivers and ARM mach
code.

Link: https://lore.kernel.org/r/20211124154116.916-5-pali@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
arch/arm/mach-dove/pcie.c
arch/arm/mach-iop32x/pci.c
arch/arm/mach-mv78xx0/pcie.c
arch/arm/mach-orion5x/pci.c
drivers/pcmcia/at91_cf.c

index ee91ac6..2a493bd 100644 (file)
@@ -38,6 +38,7 @@ static int num_pcie_ports;
 static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
 {
        struct pcie_port *pp;
+       struct resource realio;
 
        if (nr >= num_pcie_ports)
                return 0;
@@ -53,10 +54,10 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
 
        orion_pcie_setup(pp->base);
 
-       if (pp->index == 0)
-               pci_ioremap_io(sys->busnr * SZ_64K, DOVE_PCIE0_IO_PHYS_BASE);
-       else
-               pci_ioremap_io(sys->busnr * SZ_64K, DOVE_PCIE1_IO_PHYS_BASE);
+       realio.start = sys->busnr * SZ_64K;
+       realio.end = realio.start + SZ_64K - 1;
+       pci_remap_iospace(&realio, pp->index == 0 ? DOVE_PCIE0_IO_PHYS_BASE :
+                                                   DOVE_PCIE1_IO_PHYS_BASE);
 
        /*
         * IORESOURCE_MEM
index ab0010d..7a215d2 100644 (file)
@@ -185,6 +185,7 @@ iop3xx_pci_abort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
 int iop3xx_pci_setup(int nr, struct pci_sys_data *sys)
 {
        struct resource *res;
+       struct resource realio;
 
        if (nr != 0)
                return 0;
@@ -206,7 +207,9 @@ int iop3xx_pci_setup(int nr, struct pci_sys_data *sys)
 
        pci_add_resource_offset(&sys->resources, res, sys->mem_offset);
 
-       pci_ioremap_io(0, IOP3XX_PCI_LOWER_IO_PA);
+       realio.start = 0;
+       realio.end = realio.start + SZ_64K - 1;
+       pci_remap_iospace(&realio, IOP3XX_PCI_LOWER_IO_PA);
 
        return 1;
 }
index 636d84b..e15646a 100644 (file)
@@ -101,6 +101,7 @@ static void __init mv78xx0_pcie_preinit(void)
 static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
 {
        struct pcie_port *pp;
+       struct resource realio;
 
        if (nr >= num_pcie_ports)
                return 0;
@@ -115,7 +116,9 @@ static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
        orion_pcie_set_local_bus_nr(pp->base, sys->busnr);
        orion_pcie_setup(pp->base);
 
-       pci_ioremap_io(nr * SZ_64K, MV78XX0_PCIE_IO_PHYS_BASE(nr));
+       realio.start = nr * SZ_64K;
+       realio.end = realio.start + SZ_64K - 1;
+       pci_remap_iospace(&realio, MV78XX0_PCIE_IO_PHYS_BASE(nr));
 
        pci_add_resource_offset(&sys->resources, &pp->res, sys->mem_offset);
 
index 76951bf..92e938b 100644 (file)
@@ -142,6 +142,7 @@ static struct pci_ops pcie_ops = {
 static int __init pcie_setup(struct pci_sys_data *sys)
 {
        struct resource *res;
+       struct resource realio;
        int dev;
 
        /*
@@ -164,7 +165,9 @@ static int __init pcie_setup(struct pci_sys_data *sys)
                pcie_ops.read = pcie_rd_conf_wa;
        }
 
-       pci_ioremap_io(sys->busnr * SZ_64K, ORION5X_PCIE_IO_PHYS_BASE);
+       realio.start = sys->busnr * SZ_64K;
+       realio.end = realio.start + SZ_64K - 1;
+       pci_remap_iospace(&realio, ORION5X_PCIE_IO_PHYS_BASE);
 
        /*
         * Request resources.
@@ -466,6 +469,7 @@ static void __init orion5x_setup_pci_wins(void)
 static int __init pci_setup(struct pci_sys_data *sys)
 {
        struct resource *res;
+       struct resource realio;
 
        /*
         * Point PCI unit MBUS decode windows to DRAM space.
@@ -482,7 +486,9 @@ static int __init pci_setup(struct pci_sys_data *sys)
         */
        orion5x_setbits(PCI_CMD, PCI_CMD_HOST_REORDER);
 
-       pci_ioremap_io(sys->busnr * SZ_64K, ORION5X_PCI_IO_PHYS_BASE);
+       realio.start = sys->busnr * SZ_64K;
+       realio.end = realio.start + SZ_64K - 1;
+       pci_remap_iospace(&realio, ORION5X_PCI_IO_PHYS_BASE);
 
        /*
         * Request resources
index 6b1edfc..92df2c2 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_gpio.h>
+#include <linux/pci.h>
 #include <linux/regmap.h>
 
 #include <pcmcia/ss.h>
@@ -230,6 +231,7 @@ static int at91_cf_probe(struct platform_device *pdev)
        struct at91_cf_socket   *cf;
        struct at91_cf_data     *board;
        struct resource         *io;
+       struct resource         realio;
        int                     status;
 
        board = devm_kzalloc(&pdev->dev, sizeof(*board), GFP_KERNEL);
@@ -307,7 +309,9 @@ static int at91_cf_probe(struct platform_device *pdev)
         * io_offset is set to 0x10000 to avoid the check in static_find_io().
         * */
        cf->socket.io_offset = 0x10000;
-       status = pci_ioremap_io(0x10000, cf->phys_baseaddr + CF_IO_PHYS);
+       realio.start = cf->socket.io_offset;
+       realio.end = realio.start + SZ_64K - 1;
+       status = pci_remap_iospace(&realio, cf->phys_baseaddr + CF_IO_PHYS);
        if (status)
                goto fail0a;