Skip to content

Commit 6198461

Browse files
paliLorenzo Pieralisi
authored andcommitted
arm: ioremap: Replace pci_ioremap_io() usage by pci_remap_iospace()
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>
1 parent 873883f commit 6198461

5 files changed

Lines changed: 26 additions & 9 deletions

File tree

arch/arm/mach-dove/pcie.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static int num_pcie_ports;
3838
static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
3939
{
4040
struct pcie_port *pp;
41+
struct resource realio;
4142

4243
if (nr >= num_pcie_ports)
4344
return 0;
@@ -53,10 +54,10 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
5354

5455
orion_pcie_setup(pp->base);
5556

56-
if (pp->index == 0)
57-
pci_ioremap_io(sys->busnr * SZ_64K, DOVE_PCIE0_IO_PHYS_BASE);
58-
else
59-
pci_ioremap_io(sys->busnr * SZ_64K, DOVE_PCIE1_IO_PHYS_BASE);
57+
realio.start = sys->busnr * SZ_64K;
58+
realio.end = realio.start + SZ_64K - 1;
59+
pci_remap_iospace(&realio, pp->index == 0 ? DOVE_PCIE0_IO_PHYS_BASE :
60+
DOVE_PCIE1_IO_PHYS_BASE);
6061

6162
/*
6263
* IORESOURCE_MEM

arch/arm/mach-iop32x/pci.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ iop3xx_pci_abort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
185185
int iop3xx_pci_setup(int nr, struct pci_sys_data *sys)
186186
{
187187
struct resource *res;
188+
struct resource realio;
188189

189190
if (nr != 0)
190191
return 0;
@@ -206,7 +207,9 @@ int iop3xx_pci_setup(int nr, struct pci_sys_data *sys)
206207

207208
pci_add_resource_offset(&sys->resources, res, sys->mem_offset);
208209

209-
pci_ioremap_io(0, IOP3XX_PCI_LOWER_IO_PA);
210+
realio.start = 0;
211+
realio.end = realio.start + SZ_64K - 1;
212+
pci_remap_iospace(&realio, IOP3XX_PCI_LOWER_IO_PA);
210213

211214
return 1;
212215
}

arch/arm/mach-mv78xx0/pcie.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ static void __init mv78xx0_pcie_preinit(void)
101101
static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
102102
{
103103
struct pcie_port *pp;
104+
struct resource realio;
104105

105106
if (nr >= num_pcie_ports)
106107
return 0;
@@ -115,7 +116,9 @@ static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
115116
orion_pcie_set_local_bus_nr(pp->base, sys->busnr);
116117
orion_pcie_setup(pp->base);
117118

118-
pci_ioremap_io(nr * SZ_64K, MV78XX0_PCIE_IO_PHYS_BASE(nr));
119+
realio.start = nr * SZ_64K;
120+
realio.end = realio.start + SZ_64K - 1;
121+
pci_remap_iospace(&realio, MV78XX0_PCIE_IO_PHYS_BASE(nr));
119122

120123
pci_add_resource_offset(&sys->resources, &pp->res, sys->mem_offset);
121124

arch/arm/mach-orion5x/pci.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ static struct pci_ops pcie_ops = {
142142
static int __init pcie_setup(struct pci_sys_data *sys)
143143
{
144144
struct resource *res;
145+
struct resource realio;
145146
int dev;
146147

147148
/*
@@ -164,7 +165,9 @@ static int __init pcie_setup(struct pci_sys_data *sys)
164165
pcie_ops.read = pcie_rd_conf_wa;
165166
}
166167

167-
pci_ioremap_io(sys->busnr * SZ_64K, ORION5X_PCIE_IO_PHYS_BASE);
168+
realio.start = sys->busnr * SZ_64K;
169+
realio.end = realio.start + SZ_64K - 1;
170+
pci_remap_iospace(&realio, ORION5X_PCIE_IO_PHYS_BASE);
168171

169172
/*
170173
* Request resources.
@@ -466,6 +469,7 @@ static void __init orion5x_setup_pci_wins(void)
466469
static int __init pci_setup(struct pci_sys_data *sys)
467470
{
468471
struct resource *res;
472+
struct resource realio;
469473

470474
/*
471475
* Point PCI unit MBUS decode windows to DRAM space.
@@ -482,7 +486,9 @@ static int __init pci_setup(struct pci_sys_data *sys)
482486
*/
483487
orion5x_setbits(PCI_CMD, PCI_CMD_HOST_REORDER);
484488

485-
pci_ioremap_io(sys->busnr * SZ_64K, ORION5X_PCI_IO_PHYS_BASE);
489+
realio.start = sys->busnr * SZ_64K;
490+
realio.end = realio.start + SZ_64K - 1;
491+
pci_remap_iospace(&realio, ORION5X_PCI_IO_PHYS_BASE);
486492

487493
/*
488494
* Request resources

drivers/pcmcia/at91_cf.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/of.h>
2121
#include <linux/of_device.h>
2222
#include <linux/of_gpio.h>
23+
#include <linux/pci.h>
2324
#include <linux/regmap.h>
2425

2526
#include <pcmcia/ss.h>
@@ -230,6 +231,7 @@ static int at91_cf_probe(struct platform_device *pdev)
230231
struct at91_cf_socket *cf;
231232
struct at91_cf_data *board;
232233
struct resource *io;
234+
struct resource realio;
233235
int status;
234236

235237
board = devm_kzalloc(&pdev->dev, sizeof(*board), GFP_KERNEL);
@@ -307,7 +309,9 @@ static int at91_cf_probe(struct platform_device *pdev)
307309
* io_offset is set to 0x10000 to avoid the check in static_find_io().
308310
* */
309311
cf->socket.io_offset = 0x10000;
310-
status = pci_ioremap_io(0x10000, cf->phys_baseaddr + CF_IO_PHYS);
312+
realio.start = cf->socket.io_offset;
313+
realio.end = realio.start + SZ_64K - 1;
314+
status = pci_remap_iospace(&realio, cf->phys_baseaddr + CF_IO_PHYS);
311315
if (status)
312316
goto fail0a;
313317

0 commit comments

Comments
 (0)