Commit 6f6f6a70 authored by Rob Herring's avatar Rob Herring

ARM: create a common IOMEM definition

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: default avatarRob 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: default avatarH 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: default avatarDavid 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: default avatarTony Lindgren <tony@atomide.com>
Acked-by: default avatarPaul Walmsley <paul@pwsan.com>
Acked-by: default avatarViresh 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: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 6f71e921
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/domain.h> #include <asm/domain.h>
#define IOMEM(x) (x)
/* /*
* Endian independent macros for shifting bytes within registers. * Endian independent macros for shifting bytes within registers.
*/ */
......
...@@ -102,6 +102,8 @@ static inline void __iomem *__typesafe_io(unsigned long addr) ...@@ -102,6 +102,8 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
return (void __iomem *)addr; return (void __iomem *)addr;
} }
#define IOMEM(x) ((void __force __iomem *)(x))
/* IO barriers */ /* IO barriers */
#ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
#define __iormb() rmb() #define __iormb() rmb()
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* 32-bit debugging code * 32-bit debugging code
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/assembler.h>
.text .text
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* that causes it to save wrong values... Be aware! * that causes it to save wrong values... Be aware!
*/ */
#include <asm/assembler.h>
#include <asm/memory.h> #include <asm/memory.h>
#include <asm/glue-df.h> #include <asm/glue-df.h>
#include <asm/glue-pf.h> #include <asm/glue-pf.h>
......
...@@ -32,10 +32,4 @@ ...@@ -32,10 +32,4 @@
#define __IO_ADDRESS(x) ((x) + IO_OFFSET) #define __IO_ADDRESS(x) ((x) + IO_OFFSET)
#define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa)) #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 */ #endif /* __ASM_ARCH_HARDWARE_H */
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include <mach/serial.h> #include <mach/serial.h>
#define IOMEM(x) ((void __force __iomem *)(x))
u32 *uart; u32 *uart;
/* PORT_16C550A, in polled non-fifo mode */ /* PORT_16C550A, in polled non-fifo mode */
......
...@@ -5,15 +5,6 @@ ...@@ -5,15 +5,6 @@
#ifndef __ASM_ARCH_EP93XX_REGS_H #ifndef __ASM_ARCH_EP93XX_REGS_H
#define __ASM_ARCH_EP93XX_REGS_H #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: * EP93xx Physical Memory Map:
* *
......
...@@ -11,12 +11,6 @@ ...@@ -11,12 +11,6 @@
#ifndef __ASM_MACH_ADDR_MAP_H #ifndef __ASM_MACH_ADDR_MAP_H
#define __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 /* APB - Application Subsystem Peripheral Bus
* *
* NOTE: the DMA controller registers are actually on the AXI fabric #1 * NOTE: the DMA controller registers are actually on the AXI fabric #1
......
...@@ -38,12 +38,6 @@ ...@@ -38,12 +38,6 @@
* *
*/ */
#ifdef __ASSEMBLY__
#define IOMEM(x) x
#else
#define IOMEM(x) ((void __force __iomem *)(x))
#endif
#define MSM_VIC_BASE IOMEM(0xE0000000) #define MSM_VIC_BASE IOMEM(0xE0000000)
#define MSM_VIC_PHYS 0xC0000000 #define MSM_VIC_PHYS 0xC0000000
#define MSM_VIC_SIZE SZ_4K #define MSM_VIC_SIZE SZ_4K
......
...@@ -37,12 +37,6 @@ ...@@ -37,12 +37,6 @@
* *
*/ */
#ifdef __ASSEMBLY__
#define IOMEM(x) x
#else
#define IOMEM(x) ((void __force __iomem *)(x))
#endif
#if defined(CONFIG_ARCH_MSM7X30) #if defined(CONFIG_ARCH_MSM7X30)
#include "msm_iomap-7x30.h" #include "msm_iomap-7x30.h"
#elif defined(CONFIG_ARCH_QSD8X50) #elif defined(CONFIG_ARCH_QSD8X50)
......
...@@ -20,10 +20,4 @@ ...@@ -20,10 +20,4 @@
#ifndef __MACH_MXS_HARDWARE_H__ #ifndef __MACH_MXS_HARDWARE_H__
#define __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__ */ #endif /* __MACH_MXS_HARDWARE_H__ */
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/assembler.h>
#include <plat/board-ams-delta.h> #include <plat/board-ams-delta.h>
......
...@@ -22,12 +22,6 @@ ...@@ -22,12 +22,6 @@
* 675 Mass Ave, Cambridge, MA 02139, USA. * 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_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
#define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET) #define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET)
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/io.h>
#include <plat/hardware.h> #include <plat/hardware.h>
#include <plat/clkdev_omap.h> #include <plat/clkdev_omap.h>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h>
#include <plat/hardware.h> #include <plat/hardware.h>
#include <plat/clkdev_omap.h> #include <plat/clkdev_omap.h>
......
...@@ -22,12 +22,6 @@ ...@@ -22,12 +22,6 @@
* 675 Mass Ave, Cambridge, MA 02139, USA. * 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_OFFSET 0x90000000
#define OMAP2_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */ #define OMAP2_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */
......
...@@ -14,12 +14,6 @@ ...@@ -14,12 +14,6 @@
#include <mach/memory.h> #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 * What hardware must be present
*/ */
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <plat/clock.h> #include <plat/clock.h>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <plat/clock.h> #include <plat/clock.h>
#include <mach/misc_regs.h> #include <mach/misc_regs.h>
......
...@@ -281,12 +281,6 @@ ...@@ -281,12 +281,6 @@
* *
*/ */
#ifdef __ASSEMBLY__
#define IOMEM(x) (x)
#else
#define IOMEM(x) ((void __force __iomem *)(x))
#endif
#define IO_IRAM_PHYS 0x40000000 #define IO_IRAM_PHYS 0x40000000
#define IO_IRAM_VIRT IOMEM(0xFE400000) #define IO_IRAM_VIRT IOMEM(0xFE400000)
#define IO_IRAM_SIZE SZ_256K #define IO_IRAM_SIZE SZ_256K
......
...@@ -18,12 +18,6 @@ ...@@ -18,12 +18,6 @@
* the defines are used for setting up the I/O memory mapping. * 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 */ /* NAND Flash CS0 */
#define U300_NAND_CS0_PHYS_BASE 0x80000000 #define U300_NAND_CS0_PHYS_BASE 0x80000000
......
...@@ -22,12 +22,6 @@ ...@@ -22,12 +22,6 @@
#include <asm/sizes.h> #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) \ #define addr_in_module(addr, mod) \
((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE) ((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE)
......
...@@ -43,12 +43,6 @@ ...@@ -43,12 +43,6 @@
#endif #endif
#include <plat/serial.h> #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 * Common definitions for all OMAP processors
......
...@@ -112,7 +112,6 @@ extern int omap4430_phy_suspend(struct device *dev, int suspend); ...@@ -112,7 +112,6 @@ extern int omap4430_phy_suspend(struct device *dev, int suspend);
*/ */
#define OMAP2_L4_IO_OFFSET 0xb2000000 #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) #define OMAP2_L4_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L4_IO_OFFSET)
static inline u8 omap_readb(u32 pa) static inline u8 omap_readb(u32 pa)
......
...@@ -14,10 +14,4 @@ ...@@ -14,10 +14,4 @@
#ifndef __PLAT_HARDWARE_H #ifndef __PLAT_HARDWARE_H
#define __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 */ #endif /* __PLAT_HARDWARE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment