1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * DaVinci CPU type detection
4  *
5  * Author: Kevin Hilman, Deep Root Systems, LLC
6  *
7  * Defines the cpu_is_*() macros for runtime detection of DaVinci
8  * device type.  In addition, if support for a given device is not
9  * compiled in to the kernel, the macros return 0 so that
10  * resulting code can be optimized out.
11  *
12  * 2009 (c) Deep Root Systems, LLC.
13  */
14 #ifndef _ASM_ARCH_CPU_H
15 #define _ASM_ARCH_CPU_H
16 
17 #include "common.h"
18 
19 struct davinci_id {
20 	u8	variant;	/* JTAG ID bits 31:28 */
21 	u16	part_no;	/* JTAG ID bits 27:12 */
22 	u16	manufacturer;	/* JTAG ID bits 11:1 */
23 	u32	cpu_id;
24 	char	*name;
25 };
26 
27 /* Can use lower 16 bits of cpu id  for a variant when required */
28 #define	DAVINCI_CPU_ID_DM6446		0x64460000
29 #define	DAVINCI_CPU_ID_DM6467		0x64670000
30 #define	DAVINCI_CPU_ID_DM355		0x03550000
31 #define	DAVINCI_CPU_ID_DM365		0x03650000
32 #define	DAVINCI_CPU_ID_DA830		0x08300000
33 #define	DAVINCI_CPU_ID_DA850		0x08500000
34 
35 #define IS_DAVINCI_CPU(type, id)					\
36 static inline int is_davinci_ ##type(void)				\
37 {									\
38 	return (davinci_soc_info.cpu_id == (id));			\
39 }
40 
41 IS_DAVINCI_CPU(dm644x, DAVINCI_CPU_ID_DM6446)
42 IS_DAVINCI_CPU(dm646x, DAVINCI_CPU_ID_DM6467)
43 IS_DAVINCI_CPU(dm355, DAVINCI_CPU_ID_DM355)
44 IS_DAVINCI_CPU(dm365, DAVINCI_CPU_ID_DM365)
45 IS_DAVINCI_CPU(da830, DAVINCI_CPU_ID_DA830)
46 IS_DAVINCI_CPU(da850, DAVINCI_CPU_ID_DA850)
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 
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 
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 
78 #ifdef CONFIG_ARCH_DAVINCI_DA850
79 #define cpu_is_davinci_da850() is_davinci_da850()
80 #else
81 #define cpu_is_davinci_da850() 0
82 #endif
83 
84 #endif
85