diff options
| -rw-r--r-- | arch/arm/mach-davinci/id.c | 29 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/include/mach/cputype.h | 49 |
2 files changed, 75 insertions, 3 deletions
diff --git a/arch/arm/mach-davinci/id.c b/arch/arm/mach-davinci/id.c index bf067d604918..379f2baf66d6 100644 --- a/arch/arm/mach-davinci/id.c +++ b/arch/arm/mach-davinci/id.c | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | 17 | ||
| 18 | #define JTAG_ID_BASE 0x01c40028 | 18 | #define JTAG_ID_BASE 0x01c40028 |
| 19 | 19 | ||
| 20 | static unsigned int davinci_revision; | ||
| 21 | |||
| 20 | struct davinci_id { | 22 | struct davinci_id { |
| 21 | u8 variant; /* JTAG ID bits 31:28 */ | 23 | u8 variant; /* JTAG ID bits 31:28 */ |
| 22 | u16 part_no; /* JTAG ID bits 27:12 */ | 24 | u16 part_no; /* JTAG ID bits 27:12 */ |
| @@ -33,6 +35,20 @@ static struct davinci_id davinci_ids[] __initdata = { | |||
| 33 | .manufacturer = 0x017, | 35 | .manufacturer = 0x017, |
| 34 | .type = 0x64460000, | 36 | .type = 0x64460000, |
| 35 | }, | 37 | }, |
| 38 | { | ||
| 39 | /* DM646X */ | ||
| 40 | .part_no = 0xb770, | ||
| 41 | .variant = 0x0, | ||
| 42 | .manufacturer = 0x017, | ||
| 43 | .type = 0x64670000, | ||
| 44 | }, | ||
| 45 | { | ||
| 46 | /* DM355 */ | ||
| 47 | .part_no = 0xb73b, | ||
| 48 | .variant = 0x0, | ||
| 49 | .manufacturer = 0x00f, | ||
| 50 | .type = 0x03550000, | ||
| 51 | }, | ||
| 36 | }; | 52 | }; |
| 37 | 53 | ||
| 38 | /* | 54 | /* |
| @@ -63,6 +79,12 @@ static u8 __init davinci_get_variant(void) | |||
| 63 | return variant; | 79 | return variant; |
| 64 | } | 80 | } |
| 65 | 81 | ||
| 82 | unsigned int davinci_rev(void) | ||
| 83 | { | ||
| 84 | return davinci_revision >> 16; | ||
| 85 | } | ||
| 86 | EXPORT_SYMBOL(davinci_rev); | ||
| 87 | |||
| 66 | void __init davinci_check_revision(void) | 88 | void __init davinci_check_revision(void) |
| 67 | { | 89 | { |
| 68 | int i; | 90 | int i; |
| @@ -75,7 +97,7 @@ void __init davinci_check_revision(void) | |||
| 75 | /* First check only the major version in a safe way */ | 97 | /* First check only the major version in a safe way */ |
| 76 | for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) { | 98 | for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) { |
| 77 | if (part_no == (davinci_ids[i].part_no)) { | 99 | if (part_no == (davinci_ids[i].part_no)) { |
| 78 | system_rev = davinci_ids[i].type; | 100 | davinci_revision = davinci_ids[i].type; |
| 79 | break; | 101 | break; |
| 80 | } | 102 | } |
| 81 | } | 103 | } |
| @@ -84,10 +106,11 @@ void __init davinci_check_revision(void) | |||
| 84 | for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) { | 106 | for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) { |
| 85 | if (part_no == davinci_ids[i].part_no && | 107 | if (part_no == davinci_ids[i].part_no && |
| 86 | variant == davinci_ids[i].variant) { | 108 | variant == davinci_ids[i].variant) { |
| 87 | system_rev = davinci_ids[i].type; | 109 | davinci_revision = davinci_ids[i].type; |
| 88 | break; | 110 | break; |
| 89 | } | 111 | } |
| 90 | } | 112 | } |
| 91 | 113 | ||
| 92 | printk("DaVinci DM%04x variant 0x%x\n", system_rev >> 16, variant); | 114 | printk(KERN_INFO "DaVinci DM%04x variant 0x%x\n", |
| 115 | davinci_rev(), variant); | ||
| 93 | } | 116 | } |
diff --git a/arch/arm/mach-davinci/include/mach/cputype.h b/arch/arm/mach-davinci/include/mach/cputype.h new file mode 100644 index 000000000000..27cfb1b3a662 --- /dev/null +++ b/arch/arm/mach-davinci/include/mach/cputype.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* | ||
| 2 | * DaVinci CPU type detection | ||
| 3 | * | ||
| 4 | * Author: Kevin Hilman, Deep Root Systems, LLC | ||
| 5 | * | ||
| 6 | * Defines the cpu_is_*() macros for runtime detection of DaVinci | ||
| 7 | * device type. In addtion, if support for a given device is not | ||
| 8 | * compiled in to the kernel, the macros return 0 so that | ||
| 9 | * resulting code can be optimized out. | ||
| 10 | * | ||
| 11 | * 2009 (c) Deep Root Systems, LLC. This file is licensed under | ||
| 12 | * the terms of the GNU General Public License version 2. This program | ||
| 13 | * is licensed "as is" without any warranty of any kind, whether express | ||
| 14 | * or implied. | ||
| 15 | */ | ||
| 16 | #ifndef _ASM_ARCH_CPU_H | ||
| 17 | #define _ASM_ARCH_CPU_H | ||
| 18 | |||
| 19 | extern unsigned int davinci_rev(void); | ||
| 20 | |||
| 21 | #define IS_DAVINCI_CPU(type, id) \ | ||
| 22 | static inline int is_davinci_dm ##type(void) \ | ||
| 23 | { \ | ||
| 24 | return (davinci_rev() == (id)) ? 1 : 0; \ | ||
| 25 | } | ||
| 26 | |||
| 27 | IS_DAVINCI_CPU(644x, 0x6446) | ||
| 28 | IS_DAVINCI_CPU(646x, 0x6467) | ||
| 29 | IS_DAVINCI_CPU(355, 0x355) | ||
| 30 | |||
| 31 | #ifdef CONFIG_ARCH_DAVINCI_DM644x | ||
| 32 | #define cpu_is_davinci_dm644x() is_davinci_dm644x() | ||
| 33 | #else | ||
| 34 | #define cpu_is_davinci_dm644x() 0 | ||
| 35 | #endif | ||
| 36 | |||
| 37 | #ifdef CONFIG_ARCH_DAVINCI_DM646x | ||
| 38 | #define cpu_is_davinci_dm646x() is_davinci_dm646x() | ||
| 39 | #else | ||
| 40 | #define cpu_is_davinci_dm646x() 0 | ||
| 41 | #endif | ||
| 42 | |||
| 43 | #ifdef CONFIG_ARCH_DAVINCI_DM355 | ||
| 44 | #define cpu_is_davinci_dm355() is_davinci_dm355() | ||
| 45 | #else | ||
| 46 | #define cpu_is_davinci_dm355() 0 | ||
| 47 | #endif | ||
| 48 | |||
| 49 | #endif | ||
