提交 f5d7a13b 编写于 作者: U Uwe Kleine-König

ARM: imx: refactor the io mapping macro

This makes it more assembler friendly and allows it to be used in situation
that need an unsigned long and not a pointer.  Also the naming is
clearer.  IOMEM is introduced without IMX_ prefix as it is used this way
in more than one ARM subarch and it might become globally available
soon.
Signed-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
上级 9651b7db
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
#include "devices-imx31.h" #include "devices-imx31.h"
#include "devices.h" #include "devices.h"
#define KZM_ARM11_IO_ADDRESS(x) ( \ #define KZM_ARM11_IO_ADDRESS(x) (IOMEM( \
IMX_IO_ADDRESS(x, MX31_CS4) ?: \ IMX_IO_P2V_MODULE(x, MX31_CS4) ?: \
IMX_IO_ADDRESS(x, MX31_CS5) ?: \ IMX_IO_P2V_MODULE(x, MX31_CS5)) ?: \
MX31_IO_ADDRESS(x)) MX31_IO_ADDRESS(x))
/* /*
......
...@@ -22,10 +22,15 @@ ...@@ -22,10 +22,15 @@
#include <asm/sizes.h> #include <asm/sizes.h>
#define IMX_IO_ADDRESS(addr, module) \ #ifdef __ASSEMBLER__
((void __force __iomem *) \ #define IOMEM(addr) (addr)
(((unsigned long)((addr) - (module ## _BASE_ADDR)) < module ## _SIZE) ?\ #else
(addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0)) #define IOMEM(addr) ((void __force __iomem *)(addr))
#endif
#define IMX_IO_P2V_MODULE(addr, module) \
(((addr) - module ## _BASE_ADDR) < module ## _SIZE ? \
(addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0)
#ifdef CONFIG_ARCH_MX5 #ifdef CONFIG_ARCH_MX5
#include <mach/mx51.h> #include <mach/mx51.h>
......
...@@ -73,8 +73,9 @@ ...@@ -73,8 +73,9 @@
#define MX1_CSI_BASE_ADDR (0x24000 + MX1_IO_BASE_ADDR) #define MX1_CSI_BASE_ADDR (0x24000 + MX1_IO_BASE_ADDR)
/* macro to get at IO space when running virtually */ /* macro to get at IO space when running virtually */
#define MX1_IO_ADDRESS(x) ( \ #define MX1_IO_P2V(x) ( \
IMX_IO_ADDRESS(x, MX1_IO)) IMX_IO_P2V_MODULE(x, MX1_IO))
#define MX1_IO_ADDRESS(x) IOMEM(MX1_IO_P2V(x))
/* fixed interrput numbers */ /* fixed interrput numbers */
#define MX1_INT_SOFTINT 0 #define MX1_INT_SOFTINT 0
......
...@@ -92,10 +92,11 @@ ...@@ -92,10 +92,11 @@
#define MX21_IRAM_BASE_ADDR 0xffffe800 /* internal ram */ #define MX21_IRAM_BASE_ADDR 0xffffe800 /* internal ram */
#define MX21_IO_ADDRESS(x) ( \ #define MX21_IO_P2V(x) ( \
IMX_IO_ADDRESS(x, MX21_AIPI) ?: \ IMX_IO_P2V_MODULE(x, MX21_AIPI) ?: \
IMX_IO_ADDRESS(x, MX21_SAHB1) ?: \ IMX_IO_P2V_MODULE(x, MX21_SAHB1) ?: \
IMX_IO_ADDRESS(x, MX21_X_MEMC)) IMX_IO_P2V_MODULE(x, MX21_X_MEMC))
#define MX21_IO_ADDRESS(x) IOMEM(MX21_IO_P2V(x))
/* fixed interrupt numbers */ /* fixed interrupt numbers */
#define MX21_INT_CSPI3 6 #define MX21_INT_CSPI3 6
......
...@@ -28,10 +28,11 @@ ...@@ -28,10 +28,11 @@
#define MX25_GPIO3_BASE_ADDR_VIRT (MX25_AIPS2_BASE_ADDR_VIRT + 0xa4000) #define MX25_GPIO3_BASE_ADDR_VIRT (MX25_AIPS2_BASE_ADDR_VIRT + 0xa4000)
#define MX25_GPIO4_BASE_ADDR_VIRT (MX25_AIPS2_BASE_ADDR_VIRT + 0x9c000) #define MX25_GPIO4_BASE_ADDR_VIRT (MX25_AIPS2_BASE_ADDR_VIRT + 0x9c000)
#define MX25_IO_ADDRESS(x) ( \ #define MX25_IO_P2V(x) ( \
IMX_IO_ADDRESS(x, MX25_AIPS1) ?: \ IMX_IO_P2V_MODULE(x, MX25_AIPS1) ?: \
IMX_IO_ADDRESS(x, MX25_AIPS2) ?: \ IMX_IO_P2V_MODULE(x, MX25_AIPS2) ?: \
IMX_IO_ADDRESS(x, MX25_AVIC)) IMX_IO_P2V_MODULE(x, MX25_AVIC))
#define MX25_IO_ADDRESS(x) IOMEM(MX25_IO_P2V(x))
#define MX25_AIPS1_IO_ADDRESS(x) \ #define MX25_AIPS1_IO_ADDRESS(x) \
(((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT) (((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT)
......
...@@ -123,10 +123,11 @@ ...@@ -123,10 +123,11 @@
/* IRAM */ /* IRAM */
#define MX27_IRAM_BASE_ADDR 0xffff4c00 /* internal ram */ #define MX27_IRAM_BASE_ADDR 0xffff4c00 /* internal ram */
#define MX27_IO_ADDRESS(x) ( \ #define MX27_IO_P2V(x) ( \
IMX_IO_ADDRESS(x, MX27_AIPI) ?: \ IMX_IO_P2V_MODULE(x, MX27_AIPI) ?: \
IMX_IO_ADDRESS(x, MX27_SAHB1) ?: \ IMX_IO_P2V_MODULE(x, MX27_SAHB1) ?: \
IMX_IO_ADDRESS(x, MX27_X_MEMC)) IMX_IO_P2V_MODULE(x, MX27_X_MEMC))
#define MX27_IO_ADDRESS(x) IOMEM(MX27_IO_P2V(x))
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__
static inline void mx27_setup_weimcs(size_t cs, static inline void mx27_setup_weimcs(size_t cs,
......
...@@ -121,12 +121,13 @@ ...@@ -121,12 +121,13 @@
#define MX31_PCMCIA_MEM_BASE_ADDR 0xbc000000 #define MX31_PCMCIA_MEM_BASE_ADDR 0xbc000000
#define MX31_IO_ADDRESS(x) ( \ #define MX31_IO_P2V(x) ( \
IMX_IO_ADDRESS(x, MX31_AIPS1) ?: \ IMX_IO_P2V_MODULE(x, MX31_AIPS1) ?: \
IMX_IO_ADDRESS(x, MX31_AIPS2) ?: \ IMX_IO_P2V_MODULE(x, MX31_AIPS2) ?: \
IMX_IO_ADDRESS(x, MX31_AVIC) ?: \ IMX_IO_P2V_MODULE(x, MX31_AVIC) ?: \
IMX_IO_ADDRESS(x, MX31_X_MEMC) ?: \ IMX_IO_P2V_MODULE(x, MX31_X_MEMC) ?: \
IMX_IO_ADDRESS(x, MX31_SPBA0)) IMX_IO_P2V_MODULE(x, MX31_SPBA0))
#define MX31_IO_ADDRESS(x) IOMEM(MX31_IO_P2V(x))
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__
static inline void mx31_setup_weimcs(size_t cs, static inline void mx31_setup_weimcs(size_t cs,
......
...@@ -114,12 +114,13 @@ ...@@ -114,12 +114,13 @@
#define MX35_NFC_BASE_ADDR 0xbb000000 #define MX35_NFC_BASE_ADDR 0xbb000000
#define MX35_PCMCIA_MEM_BASE_ADDR 0xbc000000 #define MX35_PCMCIA_MEM_BASE_ADDR 0xbc000000
#define MX35_IO_ADDRESS(x) ( \ #define MX35_IO_P2V(x) ( \
IMX_IO_ADDRESS(x, MX35_AIPS1) ?: \ IMX_IO_P2V_MODULE(x, MX35_AIPS1) ?: \
IMX_IO_ADDRESS(x, MX35_AIPS2) ?: \ IMX_IO_P2V_MODULE(x, MX35_AIPS2) ?: \
IMX_IO_ADDRESS(x, MX35_AVIC) ?: \ IMX_IO_P2V_MODULE(x, MX35_AVIC) ?: \
IMX_IO_ADDRESS(x, MX35_X_MEMC) ?: \ IMX_IO_P2V_MODULE(x, MX35_X_MEMC) ?: \
IMX_IO_ADDRESS(x, MX35_SPBA0)) IMX_IO_P2V_MODULE(x, MX35_SPBA0))
#define MX35_IO_ADDRESS(x) IOMEM(MX35_IO_P2V(x))
/* /*
* Interrupt numbers * Interrupt numbers
......
...@@ -163,12 +163,13 @@ ...@@ -163,12 +163,13 @@
#define MX51_GPU2D_BASE_ADDR 0xd0000000 #define MX51_GPU2D_BASE_ADDR 0xd0000000
#define MX51_TZIC_BASE_ADDR 0xe0000000 #define MX51_TZIC_BASE_ADDR 0xe0000000
#define MX51_IO_ADDRESS(x) ( \ #define MX51_IO_P2V(x) ( \
IMX_IO_ADDRESS(x, MX51_IRAM) ?: \ IMX_IO_P2V_MODULE(x, MX51_IRAM) ?: \
IMX_IO_ADDRESS(x, MX51_DEBUG) ?: \ IMX_IO_P2V_MODULE(x, MX51_DEBUG) ?: \
IMX_IO_ADDRESS(x, MX51_SPBA0) ?: \ IMX_IO_P2V_MODULE(x, MX51_SPBA0) ?: \
IMX_IO_ADDRESS(x, MX51_AIPS1) ?: \ IMX_IO_P2V_MODULE(x, MX51_AIPS1) ?: \
IMX_IO_ADDRESS(x, MX51_AIPS2)) IMX_IO_P2V_MODULE(x, MX51_AIPS2))
#define MX51_IO_ADDRESS(x) IOMEM(MX51_IO_P2V(x))
/* This is currently used in <mach/debug-macro.S>, but should go away */ /* This is currently used in <mach/debug-macro.S>, but should go away */
#define MX51_AIPS1_IO_ADDRESS(x) \ #define MX51_AIPS1_IO_ADDRESS(x) \
......
...@@ -187,15 +187,16 @@ ...@@ -187,15 +187,16 @@
* it returns 0. * it returns 0.
*/ */
#define MXC91231_IO_ADDRESS(x) ( \ #define MXC91231_IO_P2V(x) ( \
IMX_IO_ADDRESS(x, MXC91231_L2CC) ?: \ IMX_IO_P2V_MODULE(x, MXC91231_L2CC) ?: \
IMX_IO_ADDRESS(x, MXC91231_X_MEMC) ?: \ IMX_IO_P2V_MODULE(x, MXC91231_X_MEMC) ?: \
IMX_IO_ADDRESS(x, MXC91231_ROMP) ?: \ IMX_IO_P2V_MODULE(x, MXC91231_ROMP) ?: \
IMX_IO_ADDRESS(x, MXC91231_AVIC) ?: \ IMX_IO_P2V_MODULE(x, MXC91231_AVIC) ?: \
IMX_IO_ADDRESS(x, MXC91231_AIPS1) ?: \ IMX_IO_P2V_MODULE(x, MXC91231_AIPS1) ?: \
IMX_IO_ADDRESS(x, MXC91231_SPBA0) ?: \ IMX_IO_P2V_MODULE(x, MXC91231_SPBA0) ?: \
IMX_IO_ADDRESS(x, MXC91231_SPBA1) ?: \ IMX_IO_P2V_MODULE(x, MXC91231_SPBA1) ?: \
IMX_IO_ADDRESS(x, MXC91231_AIPS2)) IMX_IO_P2V_MODULE(x, MXC91231_AIPS2))
#define MXC91231_IO_ADDRESS(x) IOMEM(MXC91231_IO_P2V(x))
/* /*
* Interrupt numbers * Interrupt numbers
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册