[ARM] pxa: introduce cpu_is_pxaXXX macros
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Tue, 15 May 2007 09:26:49 +0000 (10:26 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 12 Jul 2007 13:28:04 +0000 (14:28 +0100)
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/generic.c
include/asm-arm/arch-pxa/hardware.h

index 64b08b744f9f3fd12bcd06169e949b09881b39b8..147b7c40d9f9fe2411cc76c572cee2f5227a8023 100644 (file)
@@ -448,16 +448,14 @@ static struct platform_device *devices[] __initdata = {
 
 static int __init pxa_init(void)
 {
-       int cpuid, ret;
+       int ret;
 
        ret = platform_add_devices(devices, ARRAY_SIZE(devices));
        if (ret)
                return ret;
 
        /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
-       cpuid = read_cpuid(CPUID_ID);
-       if (((cpuid >> 4) & 0xfff) == 0x2d0 ||
-           ((cpuid >> 4) & 0xfff) == 0x290)
+       if (cpu_is_pxa25x())
                ret = platform_device_register(&hwuart_device);
 
        return ret;
index e2bdc2fbede1efdd52e1a393601edb3c2f5f4e91..386121746417093c90d6807bda3cc90d3d2c7e91 100644 (file)
 
 #ifndef __ASSEMBLY__
 
+#define __cpu_is_pxa21x(id)                            \
+       ({                                              \
+               unsigned int _id = (id) >> 4 & 0xf3f;   \
+               _id == 0x212;                           \
+       })
+
+#define __cpu_is_pxa25x(id)                            \
+       ({                                              \
+               unsigned int _id = (id) >> 4 & 0xfff;   \
+               _id == 0x2d0 || _id == 0x290;           \
+       })
+
+#define __cpu_is_pxa27x(id)                            \
+       ({                                              \
+               unsigned int _id = (id) >> 4 & 0xfff;   \
+               _id == 0x411;                           \
+       })
+
+#define cpu_is_pxa21x()                                        \
+       ({                                              \
+               unsigned int id = read_cpuid(CPUID_ID); \
+               __cpu_is_pxa21x(id);                    \
+       })
+
+#define cpu_is_pxa25x()                                        \
+       ({                                              \
+               unsigned int id = read_cpuid(CPUID_ID); \
+               __cpu_is_pxa25x(id);                    \
+       })
+
+#define cpu_is_pxa27x()                                        \
+       ({                                              \
+               unsigned int id = read_cpuid(CPUID_ID); \
+               __cpu_is_pxa27x(id);                    \
+       })
+
 /*
  * Handy routine to set GPIO alternate functions
  */