164 lines
3.8 KiB
C
164 lines
3.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* OMAP cpu type detection
|
|
*
|
|
* Copyright (C) 2004, 2008 Nokia Corporation
|
|
*
|
|
* Copyright (C) 2009-11 Texas Instruments.
|
|
*
|
|
* Written by Tony Lindgren <tony.lindgren@nokia.com>
|
|
*
|
|
* Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
|
|
*/
|
|
|
|
#ifndef __ASM_ARCH_OMAP_CPU_H
|
|
#define __ASM_ARCH_OMAP_CPU_H
|
|
|
|
/*
|
|
* Test if multicore OMAP support is needed
|
|
*/
|
|
#undef MULTI_OMAP1
|
|
#undef OMAP_NAME
|
|
|
|
#ifdef CONFIG_ARCH_OMAP15XX
|
|
# ifdef OMAP_NAME
|
|
# undef MULTI_OMAP1
|
|
# define MULTI_OMAP1
|
|
# else
|
|
# define OMAP_NAME omap1510
|
|
# endif
|
|
#endif
|
|
#ifdef CONFIG_ARCH_OMAP16XX
|
|
# ifdef OMAP_NAME
|
|
# undef MULTI_OMAP1
|
|
# define MULTI_OMAP1
|
|
# else
|
|
# define OMAP_NAME omap16xx
|
|
# endif
|
|
#endif
|
|
|
|
/*
|
|
* omap_rev bits:
|
|
* CPU id bits (0730, 1510, 1710, 2422...) [31:16]
|
|
* CPU revision (See _REV_ defined in cpu.h) [15:08]
|
|
* CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
|
|
*/
|
|
unsigned int omap_rev(void);
|
|
|
|
/*
|
|
* Get the CPU revision for OMAP devices
|
|
*/
|
|
#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
|
|
|
|
/*
|
|
* Macros to group OMAP into cpu classes.
|
|
* These can be used in most places.
|
|
* cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
|
|
* cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
|
|
*/
|
|
#define GET_OMAP_CLASS (omap_rev() & 0xff)
|
|
|
|
#define IS_OMAP_CLASS(class, id) \
|
|
static inline int is_omap ##class (void) \
|
|
{ \
|
|
return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
|
|
}
|
|
|
|
#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
|
|
|
|
#define IS_OMAP_SUBCLASS(subclass, id) \
|
|
static inline int is_omap ##subclass (void) \
|
|
{ \
|
|
return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
|
|
}
|
|
|
|
IS_OMAP_CLASS(15xx, 0x15)
|
|
IS_OMAP_CLASS(16xx, 0x16)
|
|
|
|
#define cpu_is_omap15xx() 0
|
|
#define cpu_is_omap16xx() 0
|
|
|
|
#if defined(MULTI_OMAP1)
|
|
# if defined(CONFIG_ARCH_OMAP15XX)
|
|
# undef cpu_is_omap15xx
|
|
# define cpu_is_omap15xx() is_omap15xx()
|
|
# endif
|
|
# if defined(CONFIG_ARCH_OMAP16XX)
|
|
# undef cpu_is_omap16xx
|
|
# define cpu_is_omap16xx() is_omap16xx()
|
|
# endif
|
|
#else
|
|
# if defined(CONFIG_ARCH_OMAP15XX)
|
|
# undef cpu_is_omap15xx
|
|
# define cpu_is_omap15xx() 1
|
|
# endif
|
|
# if defined(CONFIG_ARCH_OMAP16XX)
|
|
# undef cpu_is_omap16xx
|
|
# define cpu_is_omap16xx() 1
|
|
# endif
|
|
#endif
|
|
|
|
/*
|
|
* Macros to detect individual cpu types.
|
|
* These are only rarely needed.
|
|
* cpu_is_omap310(): True for OMAP310
|
|
* cpu_is_omap1510(): True for OMAP1510
|
|
* cpu_is_omap1610(): True for OMAP1610
|
|
* cpu_is_omap1611(): True for OMAP1611
|
|
* cpu_is_omap5912(): True for OMAP5912
|
|
* cpu_is_omap1621(): True for OMAP1621
|
|
* cpu_is_omap1710(): True for OMAP1710
|
|
*/
|
|
#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
|
|
|
|
#define IS_OMAP_TYPE(type, id) \
|
|
static inline int is_omap ##type (void) \
|
|
{ \
|
|
return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
|
|
}
|
|
|
|
IS_OMAP_TYPE(310, 0x0310)
|
|
IS_OMAP_TYPE(1510, 0x1510)
|
|
IS_OMAP_TYPE(1610, 0x1610)
|
|
IS_OMAP_TYPE(1611, 0x1611)
|
|
IS_OMAP_TYPE(5912, 0x1611)
|
|
IS_OMAP_TYPE(1621, 0x1621)
|
|
IS_OMAP_TYPE(1710, 0x1710)
|
|
|
|
#define cpu_is_omap310() 0
|
|
#define cpu_is_omap1510() 0
|
|
#define cpu_is_omap1610() 0
|
|
#define cpu_is_omap5912() 0
|
|
#define cpu_is_omap1611() 0
|
|
#define cpu_is_omap1621() 0
|
|
#define cpu_is_omap1710() 0
|
|
|
|
#define cpu_class_is_omap1() 1
|
|
|
|
/*
|
|
* Whether we have MULTI_OMAP1 or not, we still need to distinguish
|
|
* between 310 vs. 1510 and 1611B/5912 vs. 1710.
|
|
*/
|
|
|
|
#if defined(CONFIG_ARCH_OMAP15XX)
|
|
# undef cpu_is_omap310
|
|
# undef cpu_is_omap1510
|
|
# define cpu_is_omap310() is_omap310()
|
|
# define cpu_is_omap1510() is_omap1510()
|
|
#endif
|
|
|
|
#if defined(CONFIG_ARCH_OMAP16XX)
|
|
# undef cpu_is_omap1610
|
|
# undef cpu_is_omap1611
|
|
# undef cpu_is_omap5912
|
|
# undef cpu_is_omap1621
|
|
# undef cpu_is_omap1710
|
|
# define cpu_is_omap1610() is_omap1610()
|
|
# define cpu_is_omap1611() is_omap1611()
|
|
# define cpu_is_omap5912() is_omap5912()
|
|
# define cpu_is_omap1621() is_omap1621()
|
|
# define cpu_is_omap1710() is_omap1710()
|
|
#endif
|
|
|
|
#endif
|