Commit c177aa98 authored by Rob Herring's avatar Rob Herring

ARM: imx: convert to common runtime ioremap hook

Convert i.MX platforms to use the common run-time ioremap hook instead of
the imx specific hook.

Also, move addr_in_module out of io.h.
Signed-off-by: default avatarRob Herring <rob.herring@calxeda.com>
Cc: Sascha Hauer <kernel@pengutronix.de>
parent 4fe7ef3a
...@@ -59,8 +59,8 @@ static void imx3_idle(void) ...@@ -59,8 +59,8 @@ static void imx3_idle(void)
: "=r" (reg)); : "=r" (reg));
} }
static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size, static void __iomem *imx3_ioremap_caller(unsigned long phys_addr, size_t size,
unsigned int mtype) unsigned int mtype, void *caller)
{ {
if (mtype == MT_DEVICE) { if (mtype == MT_DEVICE) {
/* /*
...@@ -73,7 +73,7 @@ static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size, ...@@ -73,7 +73,7 @@ static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size,
mtype = MT_DEVICE_NONSHARED; mtype = MT_DEVICE_NONSHARED;
} }
return __arm_ioremap(phys_addr, size, mtype); return __arm_ioremap_caller(phys_addr, size, mtype, caller);
} }
void imx3_init_l2x0(void) void imx3_init_l2x0(void)
...@@ -132,7 +132,7 @@ void __init imx31_init_early(void) ...@@ -132,7 +132,7 @@ void __init imx31_init_early(void)
{ {
mxc_set_cpu_type(MXC_CPU_MX31); mxc_set_cpu_type(MXC_CPU_MX31);
mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
imx_ioremap = imx3_ioremap; arch_ioremap_caller = imx3_ioremap_caller;
arm_pm_idle = imx3_idle; arm_pm_idle = imx3_idle;
} }
...@@ -196,7 +196,7 @@ void __init imx35_init_early(void) ...@@ -196,7 +196,7 @@ void __init imx35_init_early(void)
mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR)); mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR));
mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR)); mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR));
arm_pm_idle = imx3_idle; arm_pm_idle = imx3_idle;
imx_ioremap = imx3_ioremap; arch_ioremap_caller = imx3_ioremap_caller;
} }
void __init mx35_init_irq(void) void __init mx35_init_irq(void)
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#define IOMEM(addr) ((void __force __iomem *)(addr)) #define IOMEM(addr) ((void __force __iomem *)(addr))
#endif #endif
#define addr_in_module(addr, mod) \
((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE)
#define IMX_IO_P2V_MODULE(addr, module) \ #define IMX_IO_P2V_MODULE(addr, module) \
(((addr) - module ## _BASE_ADDR) < module ## _SIZE ? \ (((addr) - module ## _BASE_ADDR) < module ## _SIZE ? \
(addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0) (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0)
......
...@@ -14,23 +14,6 @@ ...@@ -14,23 +14,6 @@
/* Allow IO space to be anywhere in the memory */ /* Allow IO space to be anywhere in the memory */
#define IO_SPACE_LIMIT 0xffffffff #define IO_SPACE_LIMIT 0xffffffff
#define __arch_ioremap __imx_ioremap
#define __arch_iounmap __iounmap
#define addr_in_module(addr, mod) \
((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE)
extern void __iomem *(*imx_ioremap)(unsigned long, size_t, unsigned int);
static inline void __iomem *
__imx_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
{
if (imx_ioremap != NULL)
return imx_ioremap(phys_addr, size, mtype);
else
return __arm_ioremap(phys_addr, size, mtype);
}
/* io address mapping macro */ /* io address mapping macro */
#define __io(a) __typesafe_io(a) #define __io(a) __typesafe_io(a)
......
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