Merge branch 'for_rmk' of git://git.mnementh.co.uk/linux-2.6-im into devel
[linux-2.6] / arch / arm / mach-ixp4xx / include / mach / cpu.h
1 /*
2  * arch/arm/mach-ixp4xx/include/mach/cpu.h
3  *
4  * IXP4XX cpu type detection
5  *
6  * Copyright (C) 2007 MontaVista Software, Inc.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  *
12  */
13
14 #ifndef __ASM_ARCH_CPU_H__
15 #define __ASM_ARCH_CPU_H__
16
17 #include <asm/cputype.h>
18
19 /* Processor id value in CP15 Register 0 */
20 #define IXP425_PROCESSOR_ID_VALUE       0x690541c0
21 #define IXP435_PROCESSOR_ID_VALUE       0x69054040
22 #define IXP465_PROCESSOR_ID_VALUE       0x69054200
23 #define IXP4XX_PROCESSOR_ID_MASK        0xfffffff0
24
25 #define cpu_is_ixp42x() ((read_cpuid_id() & IXP4XX_PROCESSOR_ID_MASK) == \
26                           IXP425_PROCESSOR_ID_VALUE)
27 #define cpu_is_ixp43x() ((read_cpuid_id() & IXP4XX_PROCESSOR_ID_MASK) == \
28                           IXP435_PROCESSOR_ID_VALUE)
29 #define cpu_is_ixp46x() ((read_cpuid_id() & IXP4XX_PROCESSOR_ID_MASK) == \
30                           IXP465_PROCESSOR_ID_VALUE)
31
32 static inline u32 ixp4xx_read_feature_bits(void)
33 {
34         unsigned int val = ~*IXP4XX_EXP_CFG2;
35         val &= ~IXP4XX_FEATURE_RESERVED;
36         if (!cpu_is_ixp46x())
37                 val &= ~IXP4XX_FEATURE_IXP46X_ONLY;
38
39         return val;
40 }
41
42 static inline void ixp4xx_write_feature_bits(u32 value)
43 {
44         *IXP4XX_EXP_CFG2 = ~value;
45 }
46
47 #endif  /* _ASM_ARCH_CPU_H */