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 addition, 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 #include <mach/common.h>
20 
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
33 #define	DAVINCI_CPU_ID_DM365		0x03650000
34 #define	DAVINCI_CPU_ID_DA830		0x08300000
35 #define	DAVINCI_CPU_ID_DA850		0x08500000
36 #define	DAVINCI_CPU_ID_TNETV107X	0x0b8a0000
37 
38 #define IS_DAVINCI_CPU(type, id)					\
39 static inline int is_davinci_ ##type(void)				\
40 {									\
41 	return (davinci_soc_info.cpu_id == (id));			\
42 }
43 
44 IS_DAVINCI_CPU(dm644x, DAVINCI_CPU_ID_DM6446)
45 IS_DAVINCI_CPU(dm646x, DAVINCI_CPU_ID_DM6467)
46 IS_DAVINCI_CPU(dm355, DAVINCI_CPU_ID_DM355)
47 IS_DAVINCI_CPU(dm365, DAVINCI_CPU_ID_DM365)
48 IS_DAVINCI_CPU(da830, DAVINCI_CPU_ID_DA830)
49 IS_DAVINCI_CPU(da850, DAVINCI_CPU_ID_DA850)
50 IS_DAVINCI_CPU(tnetv107x, DAVINCI_CPU_ID_TNETV107X)
51 
52 #ifdef CONFIG_ARCH_DAVINCI_DM644x
53 #define cpu_is_davinci_dm644x() is_davinci_dm644x()
54 #else
55 #define cpu_is_davinci_dm644x() 0
56 #endif
57 
58 #ifdef CONFIG_ARCH_DAVINCI_DM646x
59 #define cpu_is_davinci_dm646x() is_davinci_dm646x()
60 #else
61 #define cpu_is_davinci_dm646x() 0
62 #endif
63 
64 #ifdef CONFIG_ARCH_DAVINCI_DM355
65 #define cpu_is_davinci_dm355() is_davinci_dm355()
66 #else
67 #define cpu_is_davinci_dm355() 0
68 #endif
69 
70 #ifdef CONFIG_ARCH_DAVINCI_DM365
71 #define cpu_is_davinci_dm365() is_davinci_dm365()
72 #else
73 #define cpu_is_davinci_dm365() 0
74 #endif
75 
76 #ifdef CONFIG_ARCH_DAVINCI_DA830
77 #define cpu_is_davinci_da830() is_davinci_da830()
78 #else
79 #define cpu_is_davinci_da830() 0
80 #endif
81 
82 #ifdef CONFIG_ARCH_DAVINCI_DA850
83 #define cpu_is_davinci_da850() is_davinci_da850()
84 #else
85 #define cpu_is_davinci_da850() 0
86 #endif
87 
88 #ifdef CONFIG_ARCH_DAVINCI_TNETV107X
89 #define cpu_is_davinci_tnetv107x() is_davinci_tnetv107x()
90 #else
91 #define cpu_is_davinci_tnetv107x() 0
92 #endif
93 
94 #endif
95