Skip to content

Commit

Permalink
ARM: create a common IOMEM definition
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Russell King <[email protected]>
Cc: Sekhar Nori <[email protected]>
Cc: Kevin Hilman <[email protected]>
Acked-by: H Hartley Sweeten <[email protected]>
Cc: Ryan Mallon <[email protected]>
Cc: Eric Miao <[email protected]>
Cc: Haojian Zhuang <[email protected]>
Acked-by: David Brown <[email protected]>
Cc: Daniel Walker <[email protected]>
Cc: Bryan Huntsman <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Acked-by: Tony Lindgren <[email protected]>
Acked-by: Paul Walmsley <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
Cc: Rajeev Kumar <[email protected]>
Cc: Colin Cross <[email protected]>
Cc: Olof Johansson <[email protected]>
Cc: Stephen Warren <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
  • Loading branch information
Rob Herring committed Mar 14, 2012
1 parent 6f71e92 commit 6f6f6a7
Show file tree
Hide file tree
Showing 25 changed files with 13 additions and 88 deletions.
2 changes: 2 additions & 0 deletions arch/arm/include/asm/assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <asm/ptrace.h>
#include <asm/domain.h>

#define IOMEM(x) (x)

/*
* Endian independent macros for shifting bytes within registers.
*/
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions arch/arm/kernel/debug.S
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* 32-bit debugging code
*/
#include <linux/linkage.h>
#include <asm/assembler.h>

.text

Expand Down
1 change: 1 addition & 0 deletions arch/arm/kernel/entry-armv.S
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-davinci/include/mach/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,4 @@
#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 */
2 changes: 2 additions & 0 deletions arch/arm/mach-davinci/include/mach/uncompress.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#include <mach/serial.h>

#define IOMEM(x) ((void __force __iomem *)(x))

u32 *uart;

/* PORT_16C550A, in polled non-fifo mode */
Expand Down
9 changes: 0 additions & 9 deletions arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
#ifndef __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:
*
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-mmp/include/mach/addr-map.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
#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
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_PHYS 0xC0000000
#define MSM_VIC_SIZE SZ_4K
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-msm/include/mach/msm_iomap.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@
*
*/

#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)
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-mxs/include/mach/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,4 @@
#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__ */
1 change: 1 addition & 0 deletions arch/arm/mach-omap1/ams-delta-fiq-handler.S
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

#include <linux/linkage.h>
#include <asm/assembler.h>

#include <plat/board-ams-delta.h>

Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-omap1/iomap.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
* 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)

Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-omap2/clock3xxx_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-omap2/clock44xx_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-omap2/iomap.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
* 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 */

Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-rpc/include/mach/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@

#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
*/
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-spear3xx/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-spear6xx/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-tegra/include/mach/iomap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_VIRT IOMEM(0xFE400000)
#define IO_IRAM_SIZE SZ_256K
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-u300/include/mach/u300-regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
* 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

Expand Down
6 changes: 0 additions & 6 deletions arch/arm/plat-mxc/include/mach/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@

#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)

Expand Down
6 changes: 0 additions & 6 deletions arch/arm/plat-omap/include/plat/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@
#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
Expand Down
1 change: 0 additions & 1 deletion arch/arm/plat-omap/include/plat/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/plat-spear/include/plat/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,4 @@
#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 */

0 comments on commit 6f6f6a7

Please sign in to comment.