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(-)
--
2.20.1
This function is not used by any driver anymore. So completely remove it.
Signed-off-by: Pali Rohár <[email protected]>
---
arch/arm/include/asm/io.h | 2 --
arch/arm/mm/ioremap.c | 11 -----------
2 files changed, 13 deletions(-)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 12eca75bdee9..0c70eb688a00 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -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
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index fa3bde48d6a7..197f8eb3a775 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -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,
--
2.20.1
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.
Signed-off-by: Pali Rohár <[email protected]>
---
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(-)
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index ee91ac6b5ebf..2a493bdfffc6 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -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
diff --git a/arch/arm/mach-iop32x/pci.c b/arch/arm/mach-iop32x/pci.c
index ab0010dc3145..7a215d2ee7e2 100644
--- a/arch/arm/mach-iop32x/pci.c
+++ b/arch/arm/mach-iop32x/pci.c
@@ -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;
}
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
index 636d84b40466..e15646af7f26 100644
--- a/arch/arm/mach-mv78xx0/pcie.c
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -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);
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index 76951bfbacf5..92e938bba20d 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -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
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 6b1edfc890a3..92df2c2c5d07 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -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;
--
2.20.1
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.
Signed-off-by: Pali Rohár <[email protected]>
---
drivers/pci/controller/pci-mvebu.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
index ed13e81cd691..a55b8bd5eb62 100644
--- a/drivers/pci/controller/pci-mvebu.c
+++ b/drivers/pci/controller/pci-mvebu.c
@@ -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;
/*
--
2.20.1
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.
Signed-off-by: Pali Rohár <[email protected]>
---
drivers/pci/controller/pci-mvebu.c | 41 +-----------------------------
1 file changed, 1 insertion(+), 40 deletions(-)
diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
index a55b8bd5eb62..f2180e4630a1 100644
--- a/drivers/pci/controller/pci-mvebu.c
+++ b/drivers/pci/controller/pci-mvebu.c
@@ -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[] = {
--
2.20.1
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).
Signed-off-by: Pali Rohár <[email protected]>
---
arch/arm/include/asm/io.h | 5 +++++
arch/arm/mm/ioremap.c | 15 +++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index c576fa7d9bf8..12eca75bdee9 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -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.
*
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 6e830b9418c9..fa3bde48d6a7 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -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);
--
2.20.1
On Wed, Nov 24, 2021 at 04:41:12PM +0100, Pali Roh?r wrote:
> 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).
>
> Signed-off-by: Pali Roh?r <[email protected]>
Reviewed-by: Russell King (Oracle) <[email protected]>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
On Wed, Nov 24, 2021 at 04:41:15PM +0100, Pali Roh?r wrote:
> 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.
>
> Signed-off-by: Pali Roh?r <[email protected]>
Reviewed-by: Russell King (Oracle) <[email protected]>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
On Wed, Nov 24, 2021 at 04:41:16PM +0100, Pali Roh?r wrote:
> This function is not used by any driver anymore. So completely remove it.
>
> Signed-off-by: Pali Roh?r <[email protected]>
Reviewed-by: Russell King (Oracle) <[email protected]>
Thanks!
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
On 24/11/2021 16:41:15+0100, Pali Roh?r wrote:
> 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.
>
> Signed-off-by: Pali Roh?r <[email protected]>
Reviewed-by: Alexandre Belloni <[email protected]>
> ---
> 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(-)
>
> diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
> index ee91ac6b5ebf..2a493bdfffc6 100644
> --- a/arch/arm/mach-dove/pcie.c
> +++ b/arch/arm/mach-dove/pcie.c
> @@ -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
> diff --git a/arch/arm/mach-iop32x/pci.c b/arch/arm/mach-iop32x/pci.c
> index ab0010dc3145..7a215d2ee7e2 100644
> --- a/arch/arm/mach-iop32x/pci.c
> +++ b/arch/arm/mach-iop32x/pci.c
> @@ -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;
> }
> diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
> index 636d84b40466..e15646af7f26 100644
> --- a/arch/arm/mach-mv78xx0/pcie.c
> +++ b/arch/arm/mach-mv78xx0/pcie.c
> @@ -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);
>
> diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
> index 76951bfbacf5..92e938bba20d 100644
> --- a/arch/arm/mach-orion5x/pci.c
> +++ b/arch/arm/mach-orion5x/pci.c
> @@ -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
> diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
> index 6b1edfc890a3..92df2c2c5d07 100644
> --- a/drivers/pcmcia/at91_cf.c
> +++ b/drivers/pcmcia/at91_cf.c
> @@ -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;
>
> --
> 2.20.1
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
On Wed, 24 Nov 2021 16:41:11 +0100, Pali Rohár wrote:
> 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
On Tue, Nov 30, 2021 at 11:11:43AM +0000, Lorenzo Pieralisi wrote:
> On Wed, 24 Nov 2021 16:41:11 +0100, Pali Roh?r wrote:
> > 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
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/