Commit 198016e1 authored by Sascha Hauer's avatar Sascha Hauer

[ARM] MXC: add cpu_is_ macros

We had hardcoded cpu_is_ macros for mxc architectures till now. As we
want to run the same kernel on i.MX31 and i.MX35 this patch adds cpu_is_
macros which expand to 0 or 1 if only one architecture is compiled in and
only check for the cpu type if more than one architecture is compiled
in.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent c0a5f855
...@@ -1077,6 +1077,8 @@ int __init mx31_clocks_init(unsigned long fref) ...@@ -1077,6 +1077,8 @@ int __init mx31_clocks_init(unsigned long fref)
u32 reg; u32 reg;
struct clk **clkp; struct clk **clkp;
mxc_set_cpu_type(MXC_CPU_MX31);
ckih_rate = fref; ckih_rate = fref;
for (clkp = mxc_clks; clkp < mxc_clks + ARRAY_SIZE(mxc_clks); clkp++) for (clkp = mxc_clks; clkp < mxc_clks + ARRAY_SIZE(mxc_clks); clkp++)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# Common support # Common support
obj-y := irq.o clock.o gpio.o time.o devices.o obj-y := irq.o clock.o gpio.o time.o devices.o cpu.o
obj-$(CONFIG_ARCH_MX1) += iomux-mx1-mx2.o dma-mx1-mx2.o obj-$(CONFIG_ARCH_MX1) += iomux-mx1-mx2.o dma-mx1-mx2.o
obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o
......
#include <linux/module.h>
unsigned int __mxc_cpu_type;
EXPORT_SYMBOL(__mxc_cpu_type);
void mxc_set_cpu_type(unsigned int type)
{
__mxc_cpu_type = type;
}
...@@ -23,5 +23,6 @@ extern int mx27_clocks_init(unsigned long fref); ...@@ -23,5 +23,6 @@ extern int mx27_clocks_init(unsigned long fref);
extern int mx31_clocks_init(unsigned long fref); extern int mx31_clocks_init(unsigned long fref);
extern int mxc_register_gpios(void); extern int mxc_register_gpios(void);
extern int mxc_register_device(struct platform_device *pdev, void *data); extern int mxc_register_device(struct platform_device *pdev, void *data);
extern void mxc_set_cpu_type(unsigned int type);
#endif #endif
...@@ -54,9 +54,6 @@ ...@@ -54,9 +54,6 @@
#define IRAM_BASE_ADDR 0xFFFFE800 /* internal ram */ #define IRAM_BASE_ADDR 0xFFFFE800 /* internal ram */
/* this is an i.MX21 CPU */
#define cpu_is_mx21() (1)
/* this CPU supports up to 192 GPIOs (don't forget the baseboard!) */ /* this CPU supports up to 192 GPIOs (don't forget the baseboard!) */
#define ARCH_NR_GPIOS (6*32 + 16) #define ARCH_NR_GPIOS (6*32 + 16)
......
...@@ -120,9 +120,6 @@ extern int mx27_revision(void); ...@@ -120,9 +120,6 @@ extern int mx27_revision(void);
/* Mandatory defines used globally */ /* Mandatory defines used globally */
/* this is an i.MX27 CPU */
#define cpu_is_mx27() (1)
/* this CPU supports up to 192 GPIOs (don't forget the baseboard!) */ /* this CPU supports up to 192 GPIOs (don't forget the baseboard!) */
#define ARCH_NR_GPIOS (192 + 16) #define ARCH_NR_GPIOS (192 + 16)
......
...@@ -24,21 +24,74 @@ ...@@ -24,21 +24,74 @@
#error "Do not include directly." #error "Do not include directly."
#endif #endif
/* clean up all things that are not used */ #define MXC_CPU_MX1 1
#ifndef CONFIG_ARCH_MX3 #define MXC_CPU_MX21 21
# define cpu_is_mx31() (0) #define MXC_CPU_MX27 27
#define MXC_CPU_MX31 31
#define MXC_CPU_MX35 35
#ifndef __ASSEMBLY__
extern unsigned int __mxc_cpu_type;
#endif #endif
#ifndef CONFIG_MACH_MX21 #ifdef CONFIG_ARCH_MX1
# ifdef mxc_cpu_type
# undef mxc_cpu_type
# define mxc_cpu_type __mxc_cpu_type
# else
# define mxc_cpu_type MXC_CPU_MX1
# endif
# define cpu_is_mx1() (mxc_cpu_type == MXC_CPU_MX1)
#else
# define cpu_is_mx1() (0)
#endif
#ifdef CONFIG_MACH_MX21
# ifdef mxc_cpu_type
# undef mxc_cpu_type
# define mxc_cpu_type __mxc_cpu_type
# else
# define mxc_cpu_type MXC_CPU_MX21
# endif
# define cpu_is_mx21() (mxc_cpu_type == MXC_CPU_MX21)
#else
# define cpu_is_mx21() (0) # define cpu_is_mx21() (0)
#endif #endif
#ifndef CONFIG_MACH_MX27 #ifdef CONFIG_MACH_MX27
# ifdef mxc_cpu_type
# undef mxc_cpu_type
# define mxc_cpu_type __mxc_cpu_type
# else
# define mxc_cpu_type MXC_CPU_MX27
# endif
# define cpu_is_mx27() (mxc_cpu_type == MXC_CPU_MX27)
#else
# define cpu_is_mx27() (0) # define cpu_is_mx27() (0)
#endif #endif
#ifndef CONFIG_MACH_MX21 #ifdef CONFIG_ARCH_MX31
# define cpu_is_mx21() (0) # ifdef mxc_cpu_type
# undef mxc_cpu_type
# define mxc_cpu_type __mxc_cpu_type
# else
# define mxc_cpu_type MXC_CPU_MX31
# endif
# define cpu_is_mx31() (mxc_cpu_type == MXC_CPU_MX31)
#else
# define cpu_is_mx31() (0)
#endif
#ifdef CONFIG_ARCH_MX35
# ifdef mxc_cpu_type
# undef mxc_cpu_type
# define mxc_cpu_type __mxc_cpu_type
# else
# define mxc_cpu_type MXC_CPU_MX35
# endif
# define cpu_is_mx35() (mxc_cpu_type == MXC_CPU_MX35)
#else
# define cpu_is_mx35() (0)
#endif #endif
#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2) #if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2)
...@@ -47,4 +100,7 @@ ...@@ -47,4 +100,7 @@
#define CSCR_A(n) (IO_ADDRESS(WEIM_BASE_ADDR) + n * 0x10 + 0x8) #define CSCR_A(n) (IO_ADDRESS(WEIM_BASE_ADDR) + n * 0x10 + 0x8)
#endif #endif
#define cpu_is_mx3() (cpu_is_mx31() || cpu_is_mx35())
#define cpu_is_mx2() (cpu_is_mx21() || cpu_is_mx27())
#endif /* __ASM_ARCH_MXC_H__ */ #endif /* __ASM_ARCH_MXC_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