[ARM] 5573/1: ep93xx: ensure typesafe io
authorHartley Sweeten <hartleys@visionengravers.com>
Fri, 26 Jun 2009 20:36:36 +0000 (21:36 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 27 Jun 2009 09:41:12 +0000 (10:41 +0100)
ARM: ep93xx: ensure typesafe io

For the ep93xx platform, all EP93XX_*_BASE defines are based
on virtual addresses.  Ensure that all these defines are
properly typesafe for the __raw_{read/write}* macros.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Ryan Mallon <ryan@bluewatersys.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
arch/arm/mach-ep93xx/include/mach/io.h

index 967c079180dbc8b3e7b453296a20c699baa4065c..49b256b3ddfc222b7d7d299cd5d66ffd0d7d93f0 100644 (file)
 #define EP93XX_AHB_VIRT_BASE           0xfef00000
 #define EP93XX_AHB_SIZE                        0x00100000
 
+#define EP93XX_AHB_IOMEM(x)            IOMEM(EP93XX_AHB_VIRT_BASE + (x))
+
 #define EP93XX_APB_PHYS_BASE           0x80800000
 #define EP93XX_APB_VIRT_BASE           0xfed00000
 #define EP93XX_APB_SIZE                        0x00200000
 
+#define EP93XX_APB_IOMEM(x)            IOMEM(EP93XX_APB_VIRT_BASE + (x))
+
 
 /* AHB peripherals */
-#define EP93XX_DMA_BASE                        ((void __iomem *)               \
-                                        (EP93XX_AHB_VIRT_BASE + 0x00000000))
+#define EP93XX_DMA_BASE                        EP93XX_AHB_IOMEM(0x00000000)
 
-#define EP93XX_ETHERNET_BASE           (EP93XX_AHB_VIRT_BASE + 0x00010000)
 #define EP93XX_ETHERNET_PHYS_BASE      (EP93XX_AHB_PHYS_BASE + 0x00010000)
+#define EP93XX_ETHERNET_BASE           EP93XX_AHB_IOMEM(0x00010000)
 
-#define EP93XX_USB_BASE                        (EP93XX_AHB_VIRT_BASE + 0x00020000)
 #define EP93XX_USB_PHYS_BASE           (EP93XX_AHB_PHYS_BASE + 0x00020000)
+#define EP93XX_USB_BASE                        EP93XX_AHB_IOMEM(0x00020000)
 
-#define EP93XX_RASTER_BASE             (EP93XX_AHB_VIRT_BASE + 0x00030000)
+#define EP93XX_RASTER_BASE             EP93XX_AHB_IOMEM(0x00030000)
 
-#define EP93XX_GRAPHICS_ACCEL_BASE     (EP93XX_AHB_VIRT_BASE + 0x00040000)
+#define EP93XX_GRAPHICS_ACCEL_BASE     EP93XX_AHB_IOMEM(0x00040000)
 
-#define EP93XX_SDRAM_CONTROLLER_BASE   (EP93XX_AHB_VIRT_BASE + 0x00060000)
+#define EP93XX_SDRAM_CONTROLLER_BASE   EP93XX_AHB_IOMEM(0x00060000)
 
-#define EP93XX_PCMCIA_CONTROLLER_BASE  (EP93XX_AHB_VIRT_BASE + 0x00080000)
+#define EP93XX_PCMCIA_CONTROLLER_BASE  EP93XX_AHB_IOMEM(0x00080000)
 
-#define EP93XX_BOOT_ROM_BASE           (EP93XX_AHB_VIRT_BASE + 0x00090000)
+#define EP93XX_BOOT_ROM_BASE           EP93XX_AHB_IOMEM(0x00090000)
 
-#define EP93XX_IDE_BASE                        (EP93XX_AHB_VIRT_BASE + 0x000a0000)
+#define EP93XX_IDE_BASE                        EP93XX_AHB_IOMEM(0x000a0000)
 
-#define EP93XX_VIC1_BASE               (EP93XX_AHB_VIRT_BASE + 0x000b0000)
+#define EP93XX_VIC1_BASE               EP93XX_AHB_IOMEM(0x000b0000)
 
-#define EP93XX_VIC2_BASE               (EP93XX_AHB_VIRT_BASE + 0x000c0000)
+#define EP93XX_VIC2_BASE               EP93XX_AHB_IOMEM(0x000c0000)
 
 
 /* APB peripherals */
-#define EP93XX_TIMER_BASE              (EP93XX_APB_VIRT_BASE + 0x00010000)
+#define EP93XX_TIMER_BASE              EP93XX_APB_IOMEM(0x00010000)
 #define EP93XX_TIMER_REG(x)            (EP93XX_TIMER_BASE + (x))
 #define EP93XX_TIMER1_LOAD             EP93XX_TIMER_REG(0x00)
 #define EP93XX_TIMER1_VALUE            EP93XX_TIMER_REG(0x04)
 #define EP93XX_TIMER3_CONTROL          EP93XX_TIMER_REG(0x88)
 #define EP93XX_TIMER3_CLEAR            EP93XX_TIMER_REG(0x8c)
 
-#define EP93XX_I2S_BASE                        (EP93XX_APB_VIRT_BASE + 0x00020000)
+#define EP93XX_I2S_BASE                        EP93XX_APB_IOMEM(0x00020000)
 
-#define EP93XX_SECURITY_BASE           (EP93XX_APB_VIRT_BASE + 0x00030000)
+#define EP93XX_SECURITY_BASE           EP93XX_APB_IOMEM(0x00030000)
 
-#define EP93XX_GPIO_BASE               (EP93XX_APB_VIRT_BASE + 0x00040000)
+#define EP93XX_GPIO_BASE               EP93XX_APB_IOMEM(0x00040000)
 #define EP93XX_GPIO_REG(x)             (EP93XX_GPIO_BASE + (x))
 #define EP93XX_GPIO_F_INT_TYPE1                EP93XX_GPIO_REG(0x4c)
 #define EP93XX_GPIO_F_INT_TYPE2                EP93XX_GPIO_REG(0x50)
 #define EP93XX_GPIO_B_INT_ENABLE       EP93XX_GPIO_REG(0xb8)
 #define EP93XX_GPIO_B_INT_STATUS       EP93XX_GPIO_REG(0xbc)
 
-#define EP93XX_AAC_BASE                        (EP93XX_APB_VIRT_BASE + 0x00080000)
+#define EP93XX_AAC_BASE                        EP93XX_APB_IOMEM(0x00080000)
 
-#define EP93XX_SPI_BASE                        (EP93XX_APB_VIRT_BASE + 0x000a0000)
+#define EP93XX_SPI_BASE                        EP93XX_APB_IOMEM(0x000a0000)
 
-#define EP93XX_IRDA_BASE               (EP93XX_APB_VIRT_BASE + 0x000b0000)
+#define EP93XX_IRDA_BASE               EP93XX_APB_IOMEM(0x000b0000)
 
-#define EP93XX_UART1_BASE              (EP93XX_APB_VIRT_BASE + 0x000c0000)
 #define EP93XX_UART1_PHYS_BASE         (EP93XX_APB_PHYS_BASE + 0x000c0000)
+#define EP93XX_UART1_BASE              EP93XX_APB_IOMEM(0x000c0000)
 
-#define EP93XX_UART2_BASE              (EP93XX_APB_VIRT_BASE + 0x000d0000)
 #define EP93XX_UART2_PHYS_BASE         (EP93XX_APB_PHYS_BASE + 0x000d0000)
+#define EP93XX_UART2_BASE              EP93XX_APB_IOMEM(0x000d0000)
 
-#define EP93XX_UART3_BASE              (EP93XX_APB_VIRT_BASE + 0x000e0000)
 #define EP93XX_UART3_PHYS_BASE         (EP93XX_APB_PHYS_BASE + 0x000e0000)
+#define EP93XX_UART3_BASE              EP93XX_APB_IOMEM(0x000e0000)
 
-#define EP93XX_KEY_MATRIX_BASE         (EP93XX_APB_VIRT_BASE + 0x000f0000)
+#define EP93XX_KEY_MATRIX_BASE         EP93XX_APB_IOMEM(0x000f0000)
 
-#define EP93XX_ADC_BASE                        (EP93XX_APB_VIRT_BASE + 0x00100000)
-#define EP93XX_TOUCHSCREEN_BASE                (EP93XX_APB_VIRT_BASE + 0x00100000)
+#define EP93XX_ADC_BASE                        EP93XX_APB_IOMEM(0x00100000)
+#define EP93XX_TOUCHSCREEN_BASE                EP93XX_APB_IOMEM(0x00100000)
 
-#define EP93XX_PWM_BASE                        (EP93XX_APB_VIRT_BASE + 0x00110000)
+#define EP93XX_PWM_BASE                        EP93XX_APB_IOMEM(0x00110000)
 
-#define EP93XX_RTC_BASE                        (EP93XX_APB_VIRT_BASE + 0x00120000)
 #define EP93XX_RTC_PHYS_BASE           (EP93XX_APB_PHYS_BASE + 0x00120000)
+#define EP93XX_RTC_BASE                        EP93XX_APB_IOMEM(0x00120000)
 
-#define EP93XX_SYSCON_BASE             (EP93XX_APB_VIRT_BASE + 0x00130000)
+#define EP93XX_SYSCON_BASE             EP93XX_APB_IOMEM(0x00130000)
 #define EP93XX_SYSCON_REG(x)           (EP93XX_SYSCON_BASE + (x))
 #define EP93XX_SYSCON_POWER_STATE      EP93XX_SYSCON_REG(0x00)
 #define EP93XX_SYSCON_PWRCNT           EP93XX_SYSCON_REG(0x04)
 #define EP93XX_SYSCON_DEVICE_CONFIG_U1EN               (1<<18)
 #define EP93XX_SYSCON_SWLOCK           EP93XX_SYSCON_REG(0xc0)
 
-#define EP93XX_WATCHDOG_BASE           (EP93XX_APB_VIRT_BASE + 0x00140000)
+#define EP93XX_WATCHDOG_BASE           EP93XX_APB_IOMEM(0x00140000)
 
 
 #endif
index fd5f081cc8b7263e01cf40c3e8473f19a3763998..cebcc1c53d63e712948269731682227c7cc9c085 100644 (file)
@@ -1,8 +1,21 @@
 /*
  * arch/arm/mach-ep93xx/include/mach/io.h
  */
+#ifndef __ASM_MACH_IO_H
+#define __ASM_MACH_IO_H
 
 #define IO_SPACE_LIMIT         0xffffffff
 
-#define __io(p)                __typesafe_io(p)
-#define __mem_pci(p)   (p)
+#define __io(p)                        __typesafe_io(p)
+#define __mem_pci(p)           (p)
+
+/*
+ * A typesafe __io() variation for variable initialisers
+ */
+#ifdef __ASSEMBLER__
+#define IOMEM(p)               p
+#else
+#define IOMEM(p)               ((void __iomem __force *)(p))
+#endif
+
+#endif /* __ASM_MACH_IO_H */
This page took 0.036808 seconds and 5 git commands to generate.