Skip to contentSkip to conversation

arm: ioremap: Remove pci_ioremap_io() and mvebu_pci_host_probe()

PATCH Applied Pali Rohár 5 participants 12 messages Nov 24, 2021 – Dec 1, 2021

Subsystems (8)
lore
Share & tools
lore

Pali Rohár

author maintainer
#0 lore raw

cover arm: ioremap: Remove pci_ioremap_io() and mvebu_pci_host_probe()

This patch series removes ARM specific functions pci_ioremap_io() and mvebu_pci_host_probe() functions.

pci_ioremap_io() is replaced by standard PCI core function pci_remap_iospace() and mvebu_pci_host_probe() by standard PCI core function pci_host_probe().

ARM needs custom implementation of pci_remap_iospace() because of pci_ioremap_set_mem_type() hook used by Marvell Armada 375, 38x and 39x platforms due to HW errata.

Patch series was compile-tested for all affected platforms and runtime tested on Armada 385 with pci-mvebu.c driver.

Pali Rohár (5):
arm: ioremap: Implement standard PCI function pci_remap_iospace()
PCI: mvebu: Replace pci_ioremap_io() usage by devm_pci_remap_iospace()
PCI: mvebu: Remove custom mvebu_pci_host_probe() function
arm: ioremap: Replace pci_ioremap_io() usage by pci_remap_iospace()
arm: ioremap: Remove unused ARM-specific function pci_ioremap_io()

 arch/arm/include/asm/io.h          |  5 ++-
 arch/arm/mach-dove/pcie.c          |  9 ++---
 arch/arm/mach-iop32x/pci.c         |  5 ++-
 arch/arm/mach-mv78xx0/pcie.c       |  5 ++-
 arch/arm/mach-orion5x/pci.c        | 10 ++++--
 arch/arm/mm/ioremap.c              | 16 +++++----
 drivers/pci/controller/pci-mvebu.c | 54 +++---------------------------
 drivers/pcmcia/at91_cf.c           |  6 +++-
 8 files changed, 45 insertions(+), 65 deletions(-)
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH 1/5 arm: ioremap: Implement standard PCI function pci_remap_iospace()

pci_remap_iospace() is standard PCI core function. Architecture code can reimplement default core implementation if needs custom arch specific functionality.

ARM needs custom implementation due to pci_ioremap_set_mem_type() hook which allows ARM platforms to change mem type for iospace.

Implement this pci_remap_iospace() function for ARM architecture to correctly handle pci_ioremap_set_mem_type() hook, which allows usage of this standard PCI core function also for platforms which needs different mem type (e.g. Marvell Armada 375, 38x and 39x).

---
 arch/arm/include/asm/io.h |  5 +++++
 arch/arm/mm/ioremap.c     | 15 +++++++++++++++
 2 files changed, 20 insertions(+)
arch/arm/include/asm/io.h +5 -0
index c576fa7d9bf8..12eca75bdee9 100644
@@ -182,6 +182,11 @@ static inline void pci_ioremap_set_mem_type(int mem_type) {}
 
 extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr);
 
+struct resource;
+
+#define pci_remap_iospace pci_remap_iospace
+int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr);
+
 /*
  * PCI configuration space mapping function.
  *
arch/arm/mm/ioremap.c +15 -0
index 6e830b9418c9..fa3bde48d6a7 100644
@@ -459,6 +459,21 @@ void pci_ioremap_set_mem_type(int mem_type)
 	pci_ioremap_mem_type = mem_type;
 }
 
+int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr)
+{
+	unsigned long vaddr = (unsigned long)PCI_IOBASE + res->start;
+
+	if (!(res->flags & IORESOURCE_IO))
+		return -EINVAL;
+
+	if (res->end > IO_SPACE_LIMIT)
+		return -EINVAL;
+
+	return ioremap_page_range(vaddr, vaddr + resource_size(res), phys_addr,
+				  __pgprot(get_mem_type(pci_ioremap_mem_type)->prot_pte));
+}
+EXPORT_SYMBOL(pci_remap_iospace);
+
 int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr)
 {
 	BUG_ON(offset + SZ_64K - 1 > IO_SPACE_LIMIT);
Signature · 1 line
2.20.1
maintainer Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] arm: ioremap: Implement standard PCI function pci_remap_iospace()

Quoted 7 lines · Pali Rohár

pci_remap_iospace() is standard PCI core function. Architecture code can reimplement default core implementation if needs custom arch specific functionality.

ARM needs custom implementation due to pci_ioremap_set_mem_type() hook which allows ARM platforms to change mem type for iospace.

Quoted 6 lines

Implement this pci_remap_iospace() function for ARM architecture to correctly handle pci_ioremap_set_mem_type() hook, which allows usage of this standard PCI core function also for platforms which needs different mem type (e.g. Marvell Armada 375, 38x and 39x).

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
author maintainer
#3 lore raw

PATCH 2/5 PCI: mvebu: Replace pci_ioremap_io() usage by devm_pci_remap_iospace()

In reply to Pali Rohár

Now when ARM architecture code also provides standard PCI core function pci_remap_iospace(), use its devm_pci_remap_iospace() variant in pci-mvebu.c driver instead of old ARM-specific pci_ioremap_io() function.

Call devm_pci_remap_iospace() before adding IO resource to host bridge structure, at the place where it should be.

---
 drivers/pci/controller/pci-mvebu.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/pci/controller/pci-mvebu.c +4 -9
index ed13e81cd691..a55b8bd5eb62 100644
@@ -992,6 +992,10 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
 					 resource_size(&pcie->io) - 1);
 		pcie->realio.name = "PCI I/O";
 
+		ret = devm_pci_remap_iospace(dev, &pcie->realio, pcie->io.start);
+		if (ret)
+			return ret;
+
 		pci_add_resource(&bridge->windows, &pcie->realio);
 		ret = devm_request_resource(dev, &ioport_resource, &pcie->realio);
 		if (ret)
@@ -1010,7 +1014,6 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
  */
 static int mvebu_pci_host_probe(struct pci_host_bridge *bridge)
 {
-	struct mvebu_pcie *pcie;
 	struct pci_bus *bus, *child;
 	int ret;
 
@@ -1020,14 +1023,6 @@ static int mvebu_pci_host_probe(struct pci_host_bridge *bridge)
 		return ret;
 	}
 
-	pcie = pci_host_bridge_priv(bridge);
-	if (resource_size(&pcie->io) != 0) {
-		unsigned int i;
-
-		for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K)
-			pci_ioremap_io(i, pcie->io.start + i);
-	}
-
 	bus = bridge->bus;
 
 	/*
Signature · 1 line
2.20.1
author maintainer
#4 lore raw

PATCH 3/5 PCI: mvebu: Remove custom mvebu_pci_host_probe() function

In reply to Pali Rohár

Now after pci_ioremap_io() usage was replaced by devm_pci_remap_iospace() function, there is no need to use custom mvebu_pci_host_probe() function. Current implementation of mvebu_pci_host_probe() is same as standard PCI core functionn pci_host_probe(). So replace mvebu_pci_host_probe() call by pci_host_probe() and remove custom mvebu_pci_host_probe() function.

---
 drivers/pci/controller/pci-mvebu.c | 41 +-----------------------------
 1 file changed, 1 insertion(+), 40 deletions(-)
drivers/pci/controller/pci-mvebu.c +1 -40
index a55b8bd5eb62..f2180e4630a1 100644
@@ -1005,45 +1005,6 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
 	return 0;
 }
 
-/*
- * This is a copy of pci_host_probe(), except that it does the I/O
- * remap as the last step, once we are sure we won't fail.
- *
- * It should be removed once the I/O remap error handling issue has
- * been sorted out.
- */
-static int mvebu_pci_host_probe(struct pci_host_bridge *bridge)
-{
-	struct pci_bus *bus, *child;
-	int ret;
-
-	ret = pci_scan_root_bus_bridge(bridge);
-	if (ret < 0) {
-		dev_err(bridge->dev.parent, "Scanning root bridge failed");
-		return ret;
-	}
-
-	bus = bridge->bus;
-
-	/*
-	 * We insert PCI resources into the iomem_resource and
-	 * ioport_resource trees in either pci_bus_claim_resources()
-	 * or pci_bus_assign_resources().
-	 */
-	if (pci_has_flag(PCI_PROBE_ONLY)) {
-		pci_bus_claim_resources(bus);
-	} else {
-		pci_bus_size_bridges(bus);
-		pci_bus_assign_resources(bus);
-
-		list_for_each_entry(child, &bus->children, node)
-			pcie_bus_configure_settings(child);
-	}
-
-	pci_bus_add_devices(bus);
-	return 0;
-}
-
 static int mvebu_pcie_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -1118,7 +1079,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 	bridge->ops = &mvebu_pcie_ops;
 	bridge->align_resource = mvebu_pcie_align_resource;
 
-	return mvebu_pci_host_probe(bridge);
+	return pci_host_probe(bridge);
 }
 
 static const struct of_device_id mvebu_pcie_of_match_table[] = {
Signature · 1 line
2.20.1
author maintainer
#5 lore raw

PATCH 4/5 arm: ioremap: Replace pci_ioremap_io() usage by pci_remap_iospace()

In reply to Pali Rohár

Replace all usage of ARM specific pci_ioremap_io() function by standard PCI core API function pci_remap_iospace() in all drivers and arm march code.

---
 arch/arm/mach-dove/pcie.c    |  9 +++++----
 arch/arm/mach-iop32x/pci.c   |  5 ++++-
 arch/arm/mach-mv78xx0/pcie.c |  5 ++++-
 arch/arm/mach-orion5x/pci.c  | 10 ++++++++--
 drivers/pcmcia/at91_cf.c     |  6 +++++-
 5 files changed, 26 insertions(+), 9 deletions(-)
arch/arm/mach-dove/pcie.c +5 -4
index ee91ac6b5ebf..2a493bdfffc6 100644
@@ -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
arch/arm/mach-iop32x/pci.c +4 -1
index ab0010dc3145..7a215d2ee7e2 100644
@@ -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;
 }
arch/arm/mach-mv78xx0/pcie.c +4 -1
index 636d84b40466..e15646af7f26 100644
@@ -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);
 
arch/arm/mach-orion5x/pci.c +8 -2
index 76951bfbacf5..92e938bba20d 100644
@@ -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
drivers/pcmcia/at91_cf.c +5 -1
index 6b1edfc890a3..92df2c2c5d07 100644
@@ -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;
 
Signature · 1 line
2.20.1
maintainer Reviewed-by on v1 4/5
#6 lore raw

Re: [PATCH 4/5] arm: ioremap: Replace pci_ioremap_io() usage by pci_remap_iospace()

Quoted 4 lines · Pali Rohár

Replace all usage of ARM specific pci_ioremap_io() function by standard PCI core API function pci_remap_iospace() in all drivers and arm march code.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
maintainer Reviewed-by on v1 4/5
#7 lore raw

Re: [PATCH 4/5] arm: ioremap: Replace pci_ioremap_io() usage by pci_remap_iospace()

In reply to Pali Rohár
Quoted 4 lines · Pali Rohár

Replace all usage of ARM specific pci_ioremap_io() function by standard PCI core API function pci_remap_iospace() in all drivers and arm march code.

Quoted 157 lines
---
 arch/arm/mach-dove/pcie.c    |  9 +++++----
 arch/arm/mach-iop32x/pci.c   |  5 ++++-
 arch/arm/mach-mv78xx0/pcie.c |  5 ++++-
 arch/arm/mach-orion5x/pci.c  | 10 ++++++++--
 drivers/pcmcia/at91_cf.c     |  6 +++++-
 5 files changed, 26 insertions(+), 9 deletions(-)
arch/arm/mach-dove/pcie.c +5 -4
index ee91ac6b5ebf..2a493bdfffc6 100644
@@ -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
arch/arm/mach-iop32x/pci.c +4 -1
index ab0010dc3145..7a215d2ee7e2 100644
@@ -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;
 }
arch/arm/mach-mv78xx0/pcie.c +4 -1
index 636d84b40466..e15646af7f26 100644
@@ -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);
 
arch/arm/mach-orion5x/pci.c +8 -2
index 76951bfbacf5..92e938bba20d 100644
@@ -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
drivers/pcmcia/at91_cf.c +5 -1
index 6b1edfc890a3..92df2c2c5d07 100644
@@ -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;
 
Signature · 1 line
2.20.1
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author maintainer
#8 lore raw

PATCH 5/5 arm: ioremap: Remove unused ARM-specific function pci_ioremap_io()

In reply to Pali Rohár

This function is not used by any driver anymore. So completely remove it.

---
 arch/arm/include/asm/io.h |  2 --
 arch/arm/mm/ioremap.c     | 11 -----------
 2 files changed, 13 deletions(-)
arch/arm/include/asm/io.h +0 -2
index 12eca75bdee9..0c70eb688a00 100644
@@ -180,8 +180,6 @@ void pci_ioremap_set_mem_type(int mem_type);
 static inline void pci_ioremap_set_mem_type(int mem_type) {}
 #endif
 
-extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr);
-
 struct resource;
 
 #define pci_remap_iospace pci_remap_iospace
arch/arm/mm/ioremap.c +0 -11
index fa3bde48d6a7..197f8eb3a775 100644
@@ -474,17 +474,6 @@ int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr)
 }
 EXPORT_SYMBOL(pci_remap_iospace);
 
-int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr)
-{
-	BUG_ON(offset + SZ_64K - 1 > IO_SPACE_LIMIT);
-
-	return ioremap_page_range(PCI_IO_VIRT_BASE + offset,
-				  PCI_IO_VIRT_BASE + offset + SZ_64K,
-				  phys_addr,
-				  __pgprot(get_mem_type(pci_ioremap_mem_type)->prot_pte));
-}
-EXPORT_SYMBOL_GPL(pci_ioremap_io);
-
 void __iomem *pci_remap_cfgspace(resource_size_t res_cookie, size_t size)
 {
 	return arch_ioremap_caller(res_cookie, size, MT_UNCACHED,
Signature · 1 line
2.20.1
maintainer Reviewed-by on v1 5/5
#9 lore raw

Re: [PATCH 5/5] arm: ioremap: Remove unused ARM-specific function pci_ioremap_io()

Quoted 3 lines · Pali Rohár

This function is not used by any driver anymore. So completely remove it.

Thanks!

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#10 lore raw
In reply to Pali Rohár
Quoted 11 lines · Pali Rohár

This patch series removes ARM specific functions pci_ioremap_io() and mvebu_pci_host_probe() functions.

pci_ioremap_io() is replaced by standard PCI core function pci_remap_iospace() and mvebu_pci_host_probe() by standard PCI core function pci_host_probe().

ARM needs custom implementation of pci_remap_iospace() because of pci_ioremap_set_mem_type() hook used by Marvell Armada 375, 38x and 39x platforms due to HW errata.

[...]

Applied to pci/mvebu, thanks!

[1/5] arm: ioremap: Implement standard PCI function pci_remap_iospace()

      https://git.kernel.org/lpieralisi/pci/c/bc02973a06
[2/5] PCI: mvebu: Replace pci_ioremap_io() usage by devm_pci_remap_iospace()
      https://git.kernel.org/lpieralisi/pci/c/c1aa4b55aa
[3/5] PCI: mvebu: Remove custom mvebu_pci_host_probe() function
      https://git.kernel.org/lpieralisi/pci/c/de58d49470
[4/5] arm: ioremap: Replace pci_ioremap_io() usage by pci_remap_iospace()
      https://git.kernel.org/lpieralisi/pci/c/9c8facde92
[5/5] arm: ioremap: Remove unused ARM-specific function pci_ioremap_io()
      https://git.kernel.org/lpieralisi/pci/c/ea76d27fb3

Thanks,
Lorenzo

#11 lore raw
Quoted 16 lines · Lorenzo Pieralisi
Quoted 11 lines · Pali Rohár

This patch series removes ARM specific functions pci_ioremap_io() and mvebu_pci_host_probe() functions.

pci_ioremap_io() is replaced by standard PCI core function pci_remap_iospace() and mvebu_pci_host_probe() by standard PCI core function pci_host_probe().

ARM needs custom implementation of pci_remap_iospace() because of pci_ioremap_set_mem_type() hook used by Marvell Armada 375, 38x and 39x platforms due to HW errata.

[...]

Applied to pci/mvebu, thanks!

[1/5] arm: ioremap: Implement standard PCI function pci_remap_iospace()

Quoted 9 lines
      https://git.kernel.org/lpieralisi/pci/c/bc02973a06
[2/5] PCI: mvebu: Replace pci_ioremap_io() usage by devm_pci_remap_iospace()
      https://git.kernel.org/lpieralisi/pci/c/c1aa4b55aa
[3/5] PCI: mvebu: Remove custom mvebu_pci_host_probe() function
      https://git.kernel.org/lpieralisi/pci/c/de58d49470
[4/5] arm: ioremap: Replace pci_ioremap_io() usage by pci_remap_iospace()
      https://git.kernel.org/lpieralisi/pci/c/9c8facde92
[5/5] arm: ioremap: Remove unused ARM-specific function pci_ioremap_io()
      https://git.kernel.org/lpieralisi/pci/c/ea76d27fb3

Beautiful. I love getting rid of mvebu_pci_host_probe(), thank you!

If there's any occasion to update this branch, typos in the commit logs:

[3/5]: s/functionn/function/
[4/5]: s/arm march code/ARM mach code/