mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
[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: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
c0a5f85523
commit
198016e1b1
7 changed files with 80 additions and 16 deletions
|
@ -1077,6 +1077,8 @@ int __init mx31_clocks_init(unsigned long fref)
|
|||
u32 reg;
|
||||
struct clk **clkp;
|
||||
|
||||
mxc_set_cpu_type(MXC_CPU_MX31);
|
||||
|
||||
ckih_rate = fref;
|
||||
|
||||
for (clkp = mxc_clks; clkp < mxc_clks + ARRAY_SIZE(mxc_clks); clkp++)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
# 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_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o
|
||||
|
|
11
arch/arm/plat-mxc/cpu.c
Normal file
11
arch/arm/plat-mxc/cpu.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
#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);
|
|||
extern int mx31_clocks_init(unsigned long fref);
|
||||
extern int mxc_register_gpios(void);
|
||||
extern int mxc_register_device(struct platform_device *pdev, void *data);
|
||||
extern void mxc_set_cpu_type(unsigned int type);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,9 +54,6 @@
|
|||
|
||||
#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!) */
|
||||
#define ARCH_NR_GPIOS (6*32 + 16)
|
||||
|
||||
|
|
|
@ -120,9 +120,6 @@ extern int mx27_revision(void);
|
|||
|
||||
/* 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!) */
|
||||
#define ARCH_NR_GPIOS (192 + 16)
|
||||
|
||||
|
|
|
@ -24,21 +24,74 @@
|
|||
#error "Do not include directly."
|
||||
#endif
|
||||
|
||||
/* clean up all things that are not used */
|
||||
#ifndef CONFIG_ARCH_MX3
|
||||
# define cpu_is_mx31() (0)
|
||||
#define MXC_CPU_MX1 1
|
||||
#define MXC_CPU_MX21 21
|
||||
#define MXC_CPU_MX27 27
|
||||
#define MXC_CPU_MX31 31
|
||||
#define MXC_CPU_MX35 35
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
extern unsigned int __mxc_cpu_type;
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MACH_MX21
|
||||
# define cpu_is_mx21() (0)
|
||||
#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
|
||||
|
||||
#ifndef CONFIG_MACH_MX27
|
||||
# define cpu_is_mx27() (0)
|
||||
#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)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MACH_MX21
|
||||
# define cpu_is_mx21() (0)
|
||||
#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)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_MX31
|
||||
# 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
|
||||
|
||||
#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2)
|
||||
|
@ -47,4 +100,7 @@
|
|||
#define CSCR_A(n) (IO_ADDRESS(WEIM_BASE_ADDR) + n * 0x10 + 0x8)
|
||||
#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__ */
|
||||
|
|
Loading…
Reference in a new issue