| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 | /* * 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> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */#include "omap24xx.h"#include "omap34xx.h"#include "omap44xx.h"#include "ti81xx.h"#include "am33xx.h"#include "omap54xx.h"#ifndef __ASSEMBLY__#include <linux/bitops.h>/* * Test if multicore OMAP support is needed */#undef MULTI_OMAP2#undef OMAP_NAME#ifdef CONFIG_SOC_OMAP2420# ifdef OMAP_NAME#  undef  MULTI_OMAP2#  define MULTI_OMAP2# else#  define OMAP_NAME omap2420# endif#endif#ifdef CONFIG_SOC_OMAP2430# ifdef OMAP_NAME#  undef  MULTI_OMAP2#  define MULTI_OMAP2# else#  define OMAP_NAME omap2430# endif#endif#ifdef CONFIG_ARCH_OMAP3# ifdef OMAP_NAME#  undef  MULTI_OMAP2#  define MULTI_OMAP2# else#  define OMAP_NAME omap3# endif#endif#ifdef CONFIG_ARCH_OMAP4# ifdef OMAP_NAME#  undef  MULTI_OMAP2#  define MULTI_OMAP2# else#  define OMAP_NAME omap4# endif#endif#ifdef CONFIG_SOC_OMAP5# ifdef OMAP_NAME#  undef  MULTI_OMAP2#  define MULTI_OMAP2# else#  define OMAP_NAME omap5# endif#endif#ifdef CONFIG_SOC_AM33XX# ifdef OMAP_NAME#  undef  MULTI_OMAP2#  define MULTI_OMAP2# else#  define OMAP_NAME am33xx# endif#endif/* * Omap device type i.e. EMU/HS/TST/GP/BAD */#define OMAP2_DEVICE_TYPE_TEST		0#define OMAP2_DEVICE_TYPE_EMU		1#define OMAP2_DEVICE_TYPE_SEC		2#define OMAP2_DEVICE_TYPE_GP		3#define OMAP2_DEVICE_TYPE_BAD		4int omap_type(void);/* * 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_omap24xx():	True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 * cpu_is_omap242x():	True for OMAP2420, OMAP2422, OMAP2423 * cpu_is_omap243x():	True for OMAP2430 * cpu_is_omap343x():	True for OMAP3430 * cpu_is_omap443x():	True for OMAP4430 * cpu_is_omap446x():	True for OMAP4460 * cpu_is_omap447x():	True for OMAP4470 * soc_is_omap543x():	True for OMAP5430, OMAP5432 */#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_AM_CLASS	((omap_rev() >> 24) & 0xff)#define IS_AM_CLASS(class, id)				\static inline int is_am ##class (void)			\{							\	return (GET_AM_CLASS == (id)) ? 1 : 0;		\}#define GET_TI_CLASS	((omap_rev() >> 24) & 0xff)#define IS_TI_CLASS(class, id)			\static inline int is_ti ##class (void)		\{							\	return (GET_TI_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;	\}#define IS_TI_SUBCLASS(subclass, id)			\static inline int is_ti ##subclass (void)		\{							\	return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0;	\}#define IS_AM_SUBCLASS(subclass, id)			\static inline int is_am ##subclass (void)		\{							\	return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0;	\}IS_OMAP_CLASS(24xx, 0x24)IS_OMAP_CLASS(34xx, 0x34)IS_OMAP_CLASS(44xx, 0x44)IS_AM_CLASS(35xx, 0x35)IS_OMAP_CLASS(54xx, 0x54)IS_AM_CLASS(33xx, 0x33)IS_TI_CLASS(81xx, 0x81)IS_OMAP_SUBCLASS(242x, 0x242)IS_OMAP_SUBCLASS(243x, 0x243)IS_OMAP_SUBCLASS(343x, 0x343)IS_OMAP_SUBCLASS(363x, 0x363)IS_OMAP_SUBCLASS(443x, 0x443)IS_OMAP_SUBCLASS(446x, 0x446)IS_OMAP_SUBCLASS(447x, 0x447)IS_OMAP_SUBCLASS(543x, 0x543)IS_TI_SUBCLASS(816x, 0x816)IS_TI_SUBCLASS(814x, 0x814)IS_AM_SUBCLASS(335x, 0x335)#define cpu_is_omap24xx()		0#define cpu_is_omap242x()		0#define cpu_is_omap243x()		0#define cpu_is_omap34xx()		0#define cpu_is_omap343x()		0#define cpu_is_ti81xx()			0#define cpu_is_ti816x()			0#define cpu_is_ti814x()			0#define soc_is_am35xx()			0#define soc_is_am33xx()			0#define soc_is_am335x()			0#define cpu_is_omap44xx()		0#define cpu_is_omap443x()		0#define cpu_is_omap446x()		0#define cpu_is_omap447x()		0#define soc_is_omap54xx()		0#define soc_is_omap543x()		0#if defined(MULTI_OMAP2)# if defined(CONFIG_ARCH_OMAP2)#  undef  cpu_is_omap24xx#  define cpu_is_omap24xx()		is_omap24xx()# endif# if defined (CONFIG_SOC_OMAP2420)#  undef  cpu_is_omap242x#  define cpu_is_omap242x()		is_omap242x()# endif# if defined (CONFIG_SOC_OMAP2430)#  undef  cpu_is_omap243x#  define cpu_is_omap243x()		is_omap243x()# endif# if defined(CONFIG_ARCH_OMAP3)#  undef  cpu_is_omap34xx#  undef  cpu_is_omap343x#  define cpu_is_omap34xx()		is_omap34xx()#  define cpu_is_omap343x()		is_omap343x()# endif#else# if defined(CONFIG_ARCH_OMAP2)#  undef  cpu_is_omap24xx#  define cpu_is_omap24xx()		1# endif# if defined(CONFIG_SOC_OMAP2420)#  undef  cpu_is_omap242x#  define cpu_is_omap242x()		1# endif# if defined(CONFIG_SOC_OMAP2430)#  undef  cpu_is_omap243x#  define cpu_is_omap243x()		1# endif# if defined(CONFIG_ARCH_OMAP3)#  undef  cpu_is_omap34xx#  define cpu_is_omap34xx()		1# endif# if defined(CONFIG_SOC_OMAP3430)#  undef  cpu_is_omap343x#  define cpu_is_omap343x()		1# endif#endif/* * Macros to detect individual cpu types. * These are only rarely needed. * cpu_is_omap2420():	True for OMAP2420 * cpu_is_omap2422():	True for OMAP2422 * cpu_is_omap2423():	True for OMAP2423
 |