Kevin Hilman | e653034 | 2009-03-20 17:37:21 -0700 | [diff] [blame] | 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 | |
Mark A. Greer | b9ab127 | 2009-04-15 12:39:09 -0700 | [diff] [blame] | 19 | #include <mach/common.h> |
Kevin Hilman | e653034 | 2009-03-20 17:37:21 -0700 | [diff] [blame] | 20 | |
Mark A. Greer | b9ab127 | 2009-04-15 12:39:09 -0700 | [diff] [blame] | 21 | struct davinci_id { |
| 22 | u8 variant; /* JTAG ID bits 31:28 */ |
| 23 | u16 part_no; /* JTAG ID bits 27:12 */ |
| 24 | u16 manufacturer; /* JTAG ID bits 11:1 */ |
| 25 | u32 cpu_id; |
| 26 | char *name; |
| 27 | }; |
| 28 | |
| 29 | /* Can use lower 16 bits of cpu id for a variant when required */ |
| 30 | #define DAVINCI_CPU_ID_DM6446 0x64460000 |
| 31 | #define DAVINCI_CPU_ID_DM6467 0x64670000 |
| 32 | #define DAVINCI_CPU_ID_DM355 0x03550000 |
Sandeep Paulraj | fb8fcb8 | 2009-06-11 09:41:05 -0400 | [diff] [blame] | 33 | #define DAVINCI_CPU_ID_DM365 0x03650000 |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame^] | 34 | #define DAVINCI_CPU_ID_DA830 0x08300000 |
Mark A. Greer | b9ab127 | 2009-04-15 12:39:09 -0700 | [diff] [blame] | 35 | |
| 36 | #define IS_DAVINCI_CPU(type, id) \ |
| 37 | static inline int is_davinci_ ##type(void) \ |
| 38 | { \ |
| 39 | return (davinci_soc_info.cpu_id == (id)); \ |
Kevin Hilman | e653034 | 2009-03-20 17:37:21 -0700 | [diff] [blame] | 40 | } |
| 41 | |
Mark A. Greer | b9ab127 | 2009-04-15 12:39:09 -0700 | [diff] [blame] | 42 | IS_DAVINCI_CPU(dm644x, DAVINCI_CPU_ID_DM6446) |
| 43 | IS_DAVINCI_CPU(dm646x, DAVINCI_CPU_ID_DM6467) |
| 44 | IS_DAVINCI_CPU(dm355, DAVINCI_CPU_ID_DM355) |
Sandeep Paulraj | fb8fcb8 | 2009-06-11 09:41:05 -0400 | [diff] [blame] | 45 | IS_DAVINCI_CPU(dm365, DAVINCI_CPU_ID_DM365) |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame^] | 46 | IS_DAVINCI_CPU(da830, DAVINCI_CPU_ID_DA830) |
Kevin Hilman | e653034 | 2009-03-20 17:37:21 -0700 | [diff] [blame] | 47 | |
| 48 | #ifdef CONFIG_ARCH_DAVINCI_DM644x |
| 49 | #define cpu_is_davinci_dm644x() is_davinci_dm644x() |
| 50 | #else |
| 51 | #define cpu_is_davinci_dm644x() 0 |
| 52 | #endif |
| 53 | |
| 54 | #ifdef CONFIG_ARCH_DAVINCI_DM646x |
| 55 | #define cpu_is_davinci_dm646x() is_davinci_dm646x() |
| 56 | #else |
| 57 | #define cpu_is_davinci_dm646x() 0 |
| 58 | #endif |
| 59 | |
| 60 | #ifdef CONFIG_ARCH_DAVINCI_DM355 |
| 61 | #define cpu_is_davinci_dm355() is_davinci_dm355() |
| 62 | #else |
| 63 | #define cpu_is_davinci_dm355() 0 |
| 64 | #endif |
| 65 | |
Sandeep Paulraj | fb8fcb8 | 2009-06-11 09:41:05 -0400 | [diff] [blame] | 66 | #ifdef CONFIG_ARCH_DAVINCI_DM365 |
| 67 | #define cpu_is_davinci_dm365() is_davinci_dm365() |
| 68 | #else |
| 69 | #define cpu_is_davinci_dm365() 0 |
| 70 | #endif |
| 71 | |
Mark A. Greer | 55c79a4 | 2009-06-03 18:36:54 -0700 | [diff] [blame^] | 72 | #ifdef CONFIG_ARCH_DAVINCI_DA830 |
| 73 | #define cpu_is_davinci_da830() is_davinci_da830() |
| 74 | #else |
| 75 | #define cpu_is_davinci_da830() 0 |
| 76 | #endif |
| 77 | |
Kevin Hilman | e653034 | 2009-03-20 17:37:21 -0700 | [diff] [blame] | 78 | #endif |