xref: /freebsd/sys/arm/ti/ti_cpuid.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1e53470feSOleksandr Tymoshenko /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3af3dc4a7SPedro F. Giffuni  *
4e53470feSOleksandr Tymoshenko  * Copyright (c) 2011
5e53470feSOleksandr Tymoshenko  *	Ben Gray <ben.r.gray@gmail.com>.
6e53470feSOleksandr Tymoshenko  * All rights reserved.
7e53470feSOleksandr Tymoshenko  *
8e53470feSOleksandr Tymoshenko  * Redistribution and use in source and binary forms, with or without
9e53470feSOleksandr Tymoshenko  * modification, are permitted provided that the following conditions
10e53470feSOleksandr Tymoshenko  * are met:
11e53470feSOleksandr Tymoshenko  * 1. Redistributions of source code must retain the above copyright
12e53470feSOleksandr Tymoshenko  *    notice, this list of conditions and the following disclaimer.
13e53470feSOleksandr Tymoshenko  * 2. Redistributions in binary form must reproduce the above copyright
14e53470feSOleksandr Tymoshenko  *    notice, this list of conditions and the following disclaimer in the
15e53470feSOleksandr Tymoshenko  *    documentation and/or other materials provided with the distribution.
16e53470feSOleksandr Tymoshenko  *
17e53470feSOleksandr Tymoshenko  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18e53470feSOleksandr Tymoshenko  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19e53470feSOleksandr Tymoshenko  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20e53470feSOleksandr Tymoshenko  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
21e53470feSOleksandr Tymoshenko  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22e53470feSOleksandr Tymoshenko  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23e53470feSOleksandr Tymoshenko  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24e53470feSOleksandr Tymoshenko  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25e53470feSOleksandr Tymoshenko  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26e53470feSOleksandr Tymoshenko  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27e53470feSOleksandr Tymoshenko  * SUCH DAMAGE.
28e53470feSOleksandr Tymoshenko  */
29e53470feSOleksandr Tymoshenko 
30e53470feSOleksandr Tymoshenko #ifndef _TI_CPUID_H_
31e53470feSOleksandr Tymoshenko #define	_TI_CPUID_H_
32e53470feSOleksandr Tymoshenko 
33e53470feSOleksandr Tymoshenko #define	OMAP_MAKEREV(d, a, b, c) \
34e53470feSOleksandr Tymoshenko 	(uint32_t)(((d) << 16) | (((a) & 0xf) << 8) | (((b) & 0xf) << 4) | ((c) & 0xf))
35e53470feSOleksandr Tymoshenko 
36e53470feSOleksandr Tymoshenko #define	OMAP_REV_DEVICE(x)	(((x) >> 16) & 0xffff)
37e53470feSOleksandr Tymoshenko #define	OMAP_REV_MAJOR(x)	(((x) >> 8) & 0xf)
38e53470feSOleksandr Tymoshenko #define	OMAP_REV_MINOR(x)	(((x) >> 4) & 0xf)
39e53470feSOleksandr Tymoshenko #define	OMAP_REV_MINOR_MINOR(x)	(((x) >> 0) & 0xf)
40e53470feSOleksandr Tymoshenko 
41e53470feSOleksandr Tymoshenko #define	OMAP3350_DEV		0x3530
42e53470feSOleksandr Tymoshenko #define	OMAP3350_REV_ES1_0	OMAP_MAKEREV(OMAP3350_DEV, 1, 0, 0)
43e53470feSOleksandr Tymoshenko #define	OMAP3530_REV_ES2_0	OMAP_MAKEREV(OMAP3350_DEV, 2, 0, 0)
44e53470feSOleksandr Tymoshenko #define	OMAP3530_REV_ES2_1	OMAP_MAKEREV(OMAP3350_DEV, 2, 1, 0)
45e53470feSOleksandr Tymoshenko #define	OMAP3530_REV_ES3_0	OMAP_MAKEREV(OMAP3350_DEV, 3, 0, 0)
46e53470feSOleksandr Tymoshenko #define	OMAP3530_REV_ES3_1	OMAP_MAKEREV(OMAP3350_DEV, 3, 1, 0)
47e53470feSOleksandr Tymoshenko #define	OMAP3530_REV_ES3_1_2	OMAP_MAKEREV(OMAP3350_DEV, 3, 1, 2)
48e53470feSOleksandr Tymoshenko 
49e53470feSOleksandr Tymoshenko #define	OMAP4430_DEV		0x4430
50e53470feSOleksandr Tymoshenko #define	OMAP4430_REV_ES1_0	OMAP_MAKEREV(OMAP4430_DEV, 1, 0, 0)
51e53470feSOleksandr Tymoshenko #define	OMAP4430_REV_ES2_0	OMAP_MAKEREV(OMAP4430_DEV, 2, 0, 0)
52e53470feSOleksandr Tymoshenko #define	OMAP4430_REV_ES2_1	OMAP_MAKEREV(OMAP4430_DEV, 2, 1, 0)
53e53470feSOleksandr Tymoshenko #define	OMAP4430_REV_ES2_2	OMAP_MAKEREV(OMAP4430_DEV, 2, 2, 0)
54e53470feSOleksandr Tymoshenko #define	OMAP4430_REV_ES2_3	OMAP_MAKEREV(OMAP4430_DEV, 2, 3, 0)
555c79e1ddSOleksandr Tymoshenko #define	OMAP4430_REV_UNKNOWN	OMAP_MAKEREV(OMAP4430_DEV, 9, 9, 9)
565c79e1ddSOleksandr Tymoshenko 
575c79e1ddSOleksandr Tymoshenko #define	OMAP4460_DEV		0x4460
585c79e1ddSOleksandr Tymoshenko #define	OMAP4460_REV_ES1_0	OMAP_MAKEREV(OMAP4460_DEV, 1, 0, 0)
595c79e1ddSOleksandr Tymoshenko #define	OMAP4460_REV_ES1_1	OMAP_MAKEREV(OMAP4460_DEV, 1, 1, 0)
605c79e1ddSOleksandr Tymoshenko #define	OMAP4460_REV_UNKNOWN	OMAP_MAKEREV(OMAP4460_DEV, 9, 9, 9)
615c79e1ddSOleksandr Tymoshenko 
625c79e1ddSOleksandr Tymoshenko #define	OMAP4470_DEV		0x4470
635c79e1ddSOleksandr Tymoshenko #define	OMAP4470_REV_ES1_0	OMAP_MAKEREV(OMAP4470_DEV, 1, 0, 0)
645c79e1ddSOleksandr Tymoshenko #define	OMAP4470_REV_UNKNOWN	OMAP_MAKEREV(OMAP4470_DEV, 9, 9, 9)
655c79e1ddSOleksandr Tymoshenko 
665c79e1ddSOleksandr Tymoshenko #define	OMAP_UNKNOWN_DEV	OMAP_MAKEREV(0x9999, 9, 9, 9)
67e53470feSOleksandr Tymoshenko 
68e53470feSOleksandr Tymoshenko #define	AM335X_DEVREV(x)	((x) >> 28)
69e53470feSOleksandr Tymoshenko 
7056d8b96cSAndrew Turner #define	CHIP_OMAP_4	0
7156d8b96cSAndrew Turner #define	CHIP_AM335X	1
72e53470feSOleksandr Tymoshenko 
7331a2ddf2SOlivier Houchard extern int _ti_chip;
7431a2ddf2SOlivier Houchard 
ti_chip(void)75e53470feSOleksandr Tymoshenko static __inline int ti_chip(void)
76e53470feSOleksandr Tymoshenko {
77cbfebd9aSOlivier Houchard 	KASSERT(_ti_chip != -1, ("Can't determine TI Chip"));
7831a2ddf2SOlivier Houchard 	return _ti_chip;
79e53470feSOleksandr Tymoshenko }
80e53470feSOleksandr Tymoshenko 
81e53470feSOleksandr Tymoshenko uint32_t ti_revision(void);
82e53470feSOleksandr Tymoshenko 
ti_soc_is_supported(void)8369d14913SOlivier Houchard static __inline bool ti_soc_is_supported(void)
8469d14913SOlivier Houchard {
8569d14913SOlivier Houchard 
8669d14913SOlivier Houchard 	return (_ti_chip != -1);
8769d14913SOlivier Houchard }
8869d14913SOlivier Houchard 
89e53470feSOleksandr Tymoshenko #endif  /* _TI_CPUID_H_ */
90