ARM: ixp4xx: use runtime ioremap hook
authorRob Herring <rob.herring@calxeda.com>
Tue, 6 Mar 2012 21:01:53 +0000 (15:01 -0600)
committerRob Herring <rob.herring@calxeda.com>
Wed, 7 Mar 2012 03:23:18 +0000 (21:23 -0600)
Convert ixp4xx platforms to use run-time ioremap hook instead of the
compile time hook.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Imre Kaloz <kaloz@openwrt.org>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
16 files changed:
arch/arm/mach-ixp4xx/avila-setup.c
arch/arm/mach-ixp4xx/common.c
arch/arm/mach-ixp4xx/coyote-setup.c
arch/arm/mach-ixp4xx/dsmg600-setup.c
arch/arm/mach-ixp4xx/fsg-setup.c
arch/arm/mach-ixp4xx/gateway7001-setup.c
arch/arm/mach-ixp4xx/goramo_mlr.c
arch/arm/mach-ixp4xx/gtwx5715-setup.c
arch/arm/mach-ixp4xx/include/mach/io.h
arch/arm/mach-ixp4xx/include/mach/platform.h
arch/arm/mach-ixp4xx/ixdp425-setup.c
arch/arm/mach-ixp4xx/nas100d-setup.c
arch/arm/mach-ixp4xx/nslu2-setup.c
arch/arm/mach-ixp4xx/omixp-setup.c
arch/arm/mach-ixp4xx/vulcan-setup.c
arch/arm/mach-ixp4xx/wg302v2-setup.c

index a7277ad470a50ffdf8248f1b574b9961dccea0ca..90e42e9982cb1031d9bdc53a0c9b032a3bc6e5ec 100644 (file)
@@ -165,6 +165,7 @@ static void __init avila_init(void)
 MACHINE_START(AVILA, "Gateworks Avila Network Platform")
        /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
@@ -184,6 +185,7 @@ MACHINE_END
 MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")
        /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
index a6329a0a8ec4b3dc0522df2bc130e683cd171f5a..c60e7b86192c90dffd028f4b14bc1dae82a96c31 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <mach/udc.h>
 #include <mach/hardware.h>
+#include <mach/io.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/page.h>
@@ -517,3 +518,35 @@ void ixp4xx_restart(char mode, const char *cmd)
                *IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE;
        }
 }
+
+#ifdef CONFIG_IXP4XX_INDIRECT_PCI
+/*
+ * In the case of using indirect PCI, we simply return the actual PCI
+ * address and our read/write implementation use that to drive the
+ * access registers. If something outside of PCI is ioremap'd, we
+ * fallback to the default.
+ */
+
+static void __iomem *ixp4xx_ioremap_caller(unsigned long addr, size_t size,
+                                          unsigned int mtype, void *caller)
+{
+       if (!is_pci_memory(addr))
+               return __arm_ioremap_caller(addr, size, mtype, caller);
+
+       return (void __iomem *)addr;
+}
+
+static void ixp4xx_iounmap(void __iomem *addr)
+{
+       if (!is_pci_memory((__force u32)addr))
+               __iounmap(addr);
+}
+
+void __init ixp4xx_init_early(void)
+{
+       arch_ioremap_caller = ixp4xx_ioremap_caller;
+       arch_iounmap = ixp4xx_iounmap;
+}
+#else
+void __init ixp4xx_init_early(void) {}
+#endif
index a74f86ce8bcc8252576215455998b79fb7b5d1a6..1b83110028d6d95f1c99e7a4e42e03ee0b987985 100644 (file)
@@ -110,6 +110,7 @@ static void __init coyote_init(void)
 MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
        /* Maintainer: MontaVista Software, Inc. */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
@@ -129,6 +130,7 @@ MACHINE_END
 MACHINE_START(IXDPG425, "Intel IXDPG425")
        /* Maintainer: MontaVista Software, Inc. */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
index 67be177b336aa0ebd04315f31bc659d66c8c65f8..97a0af8f1955da9b83f5be0fca9014ffc6315aa8 100644 (file)
@@ -280,6 +280,7 @@ MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
        /* Maintainer: www.nslu2-linux.org */
        .atag_offset    = 0x100,
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &dsmg600_timer,
        .init_machine   = dsmg600_init,
index 6d5818285af8efd970d363aff1cee67003d7d281..9175a25a7511723d5a4de4f2d1d4a21b21f74a86 100644 (file)
@@ -270,6 +270,7 @@ static void __init fsg_init(void)
 MACHINE_START(FSG, "Freecom FSG-3")
        /* Maintainer: www.nslu2-linux.org */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
index 7ecf9b28f1c0a3d0d8c2f288e94cf2a18bf6ee14..033c7175895393f82524be3d04d77327858804e8 100644 (file)
@@ -97,6 +97,7 @@ static void __init gateway7001_init(void)
 MACHINE_START(GATEWAY7001, "Gateway 7001 AP")
        /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
index c0e3d69a8aeccf23e7372693c01284b9d43e6917..0dda8f6d78055d1bbe469375d629cb7bb0e6462f 100644 (file)
@@ -497,6 +497,7 @@ subsys_initcall(gmlr_pci_init);
 MACHINE_START(GORAMO_MLR, "MultiLink")
        /* Maintainer: Krzysztof Halasa */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
index a23f8939145836b280a8fbd53d35b4dce0f45ad1..18ebc6be7969cf5f42ea17e4a531bc6ac2c5d43b 100644 (file)
@@ -165,6 +165,7 @@ static void __init gtwx5715_init(void)
 MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)")
        /* Maintainer: George Joseph */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
index ffb9d6afb89f4dfd789ec03a6ccaabf6b4dea61d..6a520768e5edd08f7c9c0cf766d1948b3088aea4 100644 (file)
@@ -57,24 +57,6 @@ static inline int is_pci_memory(u32 addr)
        return (addr >= PCIBIOS_MIN_MEM) && (addr <= 0x4FFFFFFF);
 }
 
-static inline void __iomem * __indirect_ioremap(unsigned long addr, size_t size,
-                                               unsigned int mtype)
-{
-       if (!is_pci_memory(addr))
-               return __arm_ioremap(addr, size, mtype);
-
-       return (void __iomem *)addr;
-}
-
-static inline void __indirect_iounmap(void __iomem *addr)
-{
-       if (!is_pci_memory((__force u32)addr))
-               __iounmap(addr);
-}
-
-#define __arch_ioremap                 __indirect_ioremap
-#define __arch_iounmap                 __indirect_iounmap
-
 #define writeb(v, p)                   __indirect_writeb(v, p)
 #define writew(v, p)                   __indirect_writew(v, p)
 #define writel(v, p)                   __indirect_writel(v, p)
index df9250bbf13d90c1b198338ae61be5366b0041c8..b66bedc64de175154f660d47bbd3ab34700cea34 100644 (file)
@@ -121,6 +121,7 @@ extern unsigned long ixp4xx_timer_freq;
  * Functions used by platform-level setup code
  */
 extern void ixp4xx_map_io(void);
+extern void ixp4xx_init_early(void);
 extern void ixp4xx_init_irq(void);
 extern void ixp4xx_sys_init(void);
 extern void ixp4xx_timer_init(void);
index 8a38b39999f836b5ffb7c3f430ce8f489eb7b8a5..3d742aee177304250d78aa775d69475364a94866 100644 (file)
@@ -254,6 +254,7 @@ static void __init ixdp425_init(void)
 MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
        /* Maintainer: MontaVista Software, Inc. */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
@@ -269,6 +270,7 @@ MACHINE_END
 MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")
        /* Maintainer: MontaVista Software, Inc. */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
@@ -283,6 +285,7 @@ MACHINE_END
 MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
        /* Maintainer: MontaVista Software, Inc. */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
@@ -297,6 +300,7 @@ MACHINE_END
 MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform")
        /* Maintainer: MontaVista Software, Inc. */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
index 1010eb7b0083c6a0f33a63fe373d9567c9ea5b7a..33cb0955b6bffa840b2ae727e7ea76753803aa4b 100644 (file)
@@ -315,6 +315,7 @@ MACHINE_START(NAS100D, "Iomega NAS 100d")
        /* Maintainer: www.nslu2-linux.org */
        .atag_offset    = 0x100,
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .init_machine   = nas100d_init,
index aa355c360d5720e4665999f4acfa11e9495d2467..e2903faaebb35f4ffc4ddfcb0c08f53046e05033 100644 (file)
@@ -301,6 +301,7 @@ MACHINE_START(NSLU2, "Linksys NSLU2")
        /* Maintainer: www.nslu2-linux.org */
        .atag_offset    = 0x100,
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &nslu2_timer,
        .init_machine   = nslu2_init,
index 0940869fcfdd33f487c629806b65862433a2c5c4..158ddb79821da36168bb9c00a1e711bf5c17286a 100644 (file)
@@ -243,6 +243,7 @@ static void __init omixp_init(void)
 MACHINE_START(DEVIXP, "Omicron DEVIXP")
        .atag_offset    = 0x100,
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .init_machine   = omixp_init,
@@ -254,6 +255,7 @@ MACHINE_END
 MACHINE_START(MICCPT, "Omicron MICCPT")
        .atag_offset    = 0x100,
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .init_machine   = omixp_init,
@@ -268,6 +270,7 @@ MACHINE_END
 MACHINE_START(MIC256, "Omicron MIC256")
        .atag_offset    = 0x100,
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .init_machine   = omixp_init,
index 9dec20683291f4eb3c4ee4874b6046bd70788c38..2798f435aaf4fbf3f24eb56fca8851e3decfc985 100644 (file)
@@ -237,6 +237,7 @@ static void __init vulcan_init(void)
 MACHINE_START(ARCOM_VULCAN, "Arcom/Eurotech Vulcan")
        /* Maintainer: Marc Zyngier <maz@misterjones.org> */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,
index 5ac0f0a0fd8cea97f30046de24fffcebb190a784..a785175b115bf146f1e96ef13d41f0408897e514 100644 (file)
@@ -98,6 +98,7 @@ static void __init wg302v2_init(void)
 MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2")
        /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
        .map_io         = ixp4xx_map_io,
+       .init_early     = ixp4xx_init_early,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
        .atag_offset    = 0x100,