xref: /openbmc/linux/arch/arm/mach-davinci/cputype.h (revision c3848db3)
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_DA830		0x08300000
29 #define	DAVINCI_CPU_ID_DA850		0x08500000
30 
31 #define IS_DAVINCI_CPU(type, id)					\
32 static inline int is_davinci_ ##type(void)				\
33 {									\
34 	return (davinci_soc_info.cpu_id == (id));			\
35 }
36 
37 IS_DAVINCI_CPU(da830, DAVINCI_CPU_ID_DA830)
38 IS_DAVINCI_CPU(da850, DAVINCI_CPU_ID_DA850)
39 
40 #ifdef CONFIG_ARCH_DAVINCI_DA830
41 #define cpu_is_davinci_da830() is_davinci_da830()
42 #else
43 #define cpu_is_davinci_da830() 0
44 #endif
45 
46 #ifdef CONFIG_ARCH_DAVINCI_DA850
47 #define cpu_is_davinci_da850() is_davinci_da850()
48 #else
49 #define cpu_is_davinci_da850() 0
50 #endif
51 
52 #endif
53