ARM: create a common IOMEM definition
authorRob Herring <rob.herring@calxeda.com>
Sat, 10 Mar 2012 16:30:31 +0000 (10:30 -0600)
committerRob Herring <rob.herring@calxeda.com>
Wed, 14 Mar 2012 02:22:09 +0000 (21:22 -0500)
Several platforms create IOMEM defines for casting to 'void __iomem *',
and other platforms are incorrectly using __io() macro for the same
purpose. This creates a common definition and removes all the platform
specific versions. Rather than try to make linux/io.h and asm/io.h
assembly safe, the assembly version of IOMEM is moved into
asm/assembler.h.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ryan Mallon <rmallon@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: David Brown <davidb@codeaurora.org>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Paul Walmsley <paul@pwsan.com>
Acked-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Rajeev Kumar <rajeev-dlh.kumar@st.com>
Cc: Colin Cross <ccross@android.com>
Cc: Olof Johansson <olof@lixom.net>
Cc: Stephen Warren <swarren@nvidia.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
25 files changed:
arch/arm/include/asm/assembler.h
arch/arm/include/asm/io.h
arch/arm/kernel/debug.S
arch/arm/kernel/entry-armv.S
arch/arm/mach-davinci/include/mach/hardware.h
arch/arm/mach-davinci/include/mach/uncompress.h
arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
arch/arm/mach-mmp/include/mach/addr-map.h
arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
arch/arm/mach-msm/include/mach/msm_iomap.h
arch/arm/mach-mxs/include/mach/hardware.h
arch/arm/mach-omap1/ams-delta-fiq-handler.S
arch/arm/mach-omap1/iomap.h
arch/arm/mach-omap2/clock3xxx_data.c
arch/arm/mach-omap2/clock44xx_data.c
arch/arm/mach-omap2/iomap.h
arch/arm/mach-rpc/include/mach/hardware.h
arch/arm/mach-spear3xx/clock.c
arch/arm/mach-spear6xx/clock.c
arch/arm/mach-tegra/include/mach/iomap.h
arch/arm/mach-u300/include/mach/u300-regs.h
arch/arm/plat-mxc/include/mach/hardware.h
arch/arm/plat-omap/include/plat/hardware.h
arch/arm/plat-omap/include/plat/usb.h
arch/arm/plat-spear/include/plat/hardware.h

index 62f8095..88374dd 100644 (file)
@@ -23,6 +23,8 @@
 #include <asm/ptrace.h>
 #include <asm/domain.h>
 
+#define IOMEM(x)       (x)
+
 /*
  * Endian independent macros for shifting bytes within registers.
  */
index 11d2072..35d9140 100644 (file)
@@ -102,6 +102,8 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
        return (void __iomem *)addr;
 }
 
+#define IOMEM(x)       ((void __force __iomem *)(x))
+
 /* IO barriers */
 #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
 #define __iormb()              rmb()
index 204e216..501cdbf 100644 (file)
@@ -10,6 +10,7 @@
  *  32-bit debugging code
  */
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
                .text
 
index 22f0ed3..395f627 100644 (file)
@@ -15,6 +15,7 @@
  *  that causes it to save wrong values...  Be aware!
  */
 
+#include <asm/assembler.h>
 #include <asm/memory.h>
 #include <asm/glue-df.h>
 #include <asm/glue-pf.h>
index 414e0b9..0be260b 100644 (file)
 #define __IO_ADDRESS(x)                        ((x) + IO_OFFSET)
 #define IO_ADDRESS(pa)                 IOMEM(__IO_ADDRESS(pa))
 
-#ifdef __ASSEMBLER__
-#define IOMEM(x)                       x
-#else
-#define IOMEM(x)                       ((void __force __iomem *)(x))
-#endif
-
 #endif /* __ASM_ARCH_HARDWARE_H */
index 9dc7cf9..da2fb2c 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <mach/serial.h>
 
+#define IOMEM(x)       ((void __force __iomem *)(x))
+
 u32 *uart;
 
 /* PORT_16C550A, in polled non-fifo mode */
index e711d0e..c4a7b84 100644 (file)
@@ -6,15 +6,6 @@
 #define __ASM_ARCH_EP93XX_REGS_H
 
 /*
- * A typesafe __io() variation for variable initialisers
- */
-#ifdef __ASSEMBLER__
-#define IOMEM(p)                p
-#else
-#define IOMEM(p)                ((void __iomem __force *)(p))
-#endif
-
-/*
  * EP93xx Physical Memory Map:
  *
  * The ASDO pin is sampled at system reset to select a synchronous or
index 3e404ac..b1ece08 100644 (file)
 #ifndef __ASM_MACH_ADDR_MAP_H
 #define __ASM_MACH_ADDR_MAP_H
 
-#ifndef __ASSEMBLER__
-#define IOMEM(x)       ((void __iomem *)(x))
-#else
-#define IOMEM(x)       (x)
-#endif
-
 /* APB - Application Subsystem Peripheral Bus
  *
  * NOTE: the DMA controller registers are actually on the AXI fabric #1
index 152b3b7..6c4046c 100644 (file)
  *
  */
 
-#ifdef __ASSEMBLY__
-#define IOMEM(x)       x
-#else
-#define IOMEM(x)       ((void __force __iomem *)(x))
-#endif
-
 #define MSM_VIC_BASE          IOMEM(0xE0000000)
 #define MSM_VIC_PHYS          0xC0000000
 #define MSM_VIC_SIZE          SZ_4K
index 90682f4..00afdfb 100644 (file)
  *
  */
 
-#ifdef __ASSEMBLY__
-#define IOMEM(x)       x
-#else
-#define IOMEM(x)       ((void __force __iomem *)(x))
-#endif
-
 #if defined(CONFIG_ARCH_MSM7X30)
 #include "msm_iomap-7x30.h"
 #elif defined(CONFIG_ARCH_QSD8X50)
index 53e89a0..4c0e8a6 100644 (file)
 #ifndef __MACH_MXS_HARDWARE_H__
 #define __MACH_MXS_HARDWARE_H__
 
-#ifdef __ASSEMBLER__
-#define IOMEM(addr)    (addr)
-#else
-#define IOMEM(addr)    ((void __force __iomem *)(addr))
-#endif
-
 #endif /* __MACH_MXS_HARDWARE_H__ */
index 399c4c4..a051cb8 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 #include <plat/board-ams-delta.h>
 
index d681757..330c471 100644 (file)
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifdef __ASSEMBLER__
-#define IOMEM(x)               (x)
-#else
-#define IOMEM(x)               ((void __force __iomem *)(x))
-#endif
-
 #define OMAP1_IO_OFFSET                0x01000000      /* Virtual IO = 0xfefb0000 */
 #define OMAP1_IO_ADDRESS(pa)   IOMEM((pa) - OMAP1_IO_OFFSET)
 
index 981b9f9..480fb8f 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/clk.h>
 #include <linux/list.h>
+#include <linux/io.h>
 
 #include <plat/hardware.h>
 #include <plat/clkdev_omap.h>
index 79b98f2..c03c110 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/clk.h>
+#include <linux/io.h>
 
 #include <plat/hardware.h>
 #include <plat/clkdev_omap.h>
index e6f9581..0812b15 100644 (file)
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifdef __ASSEMBLER__
-#define IOMEM(x)               (x)
-#else
-#define IOMEM(x)               ((void __force __iomem *)(x))
-#endif
-
 #define OMAP2_L3_IO_OFFSET     0x90000000
 #define OMAP2_L3_IO_ADDRESS(pa)        IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */
 
index 050d63c..257166b 100644 (file)
 
 #include <mach/memory.h>
 
-#ifndef __ASSEMBLY__
-#define IOMEM(x) ((void __iomem *)(unsigned long)(x))
-#else
-#define IOMEM(x) x
-#endif /* __ASSEMBLY__ */
-
 /*
  * What hardware must be present
  */
index f67860c..6c4841f 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <asm/mach-types.h>
 #include <plat/clock.h>
index ac70e0d..9281cf8 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <plat/clock.h>
 #include <mach/misc_regs.h>
index 082b4d1..c05b311 100644 (file)
  *
  */
 
-#ifdef __ASSEMBLY__
-#define IOMEM(x)       (x)
-#else
-#define IOMEM(x)       ((void __force __iomem *)(x))
-#endif
-
 #define IO_IRAM_PHYS   0x40000000
 #define IO_IRAM_VIRT   IOMEM(0xFE400000)
 #define IO_IRAM_SIZE   SZ_256K
index 035fdc9..7b7cba9 100644 (file)
  * the defines are used for setting up the I/O memory mapping.
  */
 
-#ifdef __ASSEMBLER__
-#define IOMEM(a) (a)
-#else
-#define IOMEM(a) (void __iomem *) a
-#endif
-
 /* NAND Flash CS0 */
 #define U300_NAND_CS0_PHYS_BASE                0x80000000
 
index ca06a68..0630513 100644 (file)
 
 #include <asm/sizes.h>
 
-#ifdef __ASSEMBLER__
-#define IOMEM(addr)    (addr)
-#else
-#define IOMEM(addr)    ((void __force __iomem *)(addr))
-#endif
-
 #define addr_in_module(addr, mod) \
        ((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE)
 
index 537b05a..e897978 100644 (file)
 #endif
 #include <plat/serial.h>
 
-#ifdef __ASSEMBLER__
-#define IOMEM(x)               (x)
-#else
-#define IOMEM(x)               ((void __force __iomem *)(x))
-#endif
-
 /*
  * ---------------------------------------------------------------------------
  * Common definitions for all OMAP processors
index d0fc9f4..762eeb0 100644 (file)
@@ -112,7 +112,6 @@ extern int omap4430_phy_suspend(struct device *dev, int suspend);
  */
 
 #define OMAP2_L4_IO_OFFSET     0xb2000000
-#define IOMEM(x)               ((void __force __iomem *)(x))
 #define OMAP2_L4_IO_ADDRESS(pa)        IOMEM((pa) + OMAP2_L4_IO_OFFSET)
 
 static inline u8 omap_readb(u32 pa)
index 66d6772..70187d7 100644 (file)
 #ifndef __PLAT_HARDWARE_H
 #define __PLAT_HARDWARE_H
 
-#ifndef __ASSEMBLY__
-#define IOMEM(x)       ((void __iomem __force *)(x))
-#else
-#define IOMEM(x)       (x)
-#endif
-
 #endif /* __PLAT_HARDWARE_H */