|  | @@ -0,0 +1,96 @@
 | 
	
		
			
				|  |  | +/*
 | 
	
		
			
				|  |  | + * linux/arch/arm/mach-omap2/id.c
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + * OMAP2 CPU identification code
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + * Copyright (C) 2005 Nokia Corporation
 | 
	
		
			
				|  |  | + * Written by Tony Lindgren <tony@atomide.com>
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + * Copyright (C) 2009-11 Texas Instruments
 | 
	
		
			
				|  |  | + * Added OMAP4 support - 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 version 2 as
 | 
	
		
			
				|  |  | + * published by the Free Software Foundation.
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include <linux/module.h>
 | 
	
		
			
				|  |  | +#include <linux/kernel.h>
 | 
	
		
			
				|  |  | +#include <linux/init.h>
 | 
	
		
			
				|  |  | +#include <linux/io.h>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include <asm/cputype.h>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include "common.h"
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include "id.h"
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include "soc.h"
 | 
	
		
			
				|  |  | +#include "control.h"
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define OMAP4_SILICON_TYPE_STANDARD		0x01
 | 
	
		
			
				|  |  | +#define OMAP4_SILICON_TYPE_PERFORMANCE		0x02
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static unsigned int omap_revision;
 | 
	
		
			
				|  |  | +static const char *cpu_rev;
 | 
	
		
			
				|  |  | +u32 omap_features;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +unsigned int omap_rev(void)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	return omap_revision;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +EXPORT_SYMBOL(omap_rev);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +int omap_type(void)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	u32 val = 0;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	if (cpu_is_omap24xx()) {
 | 
	
		
			
				|  |  | +		val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
 | 
	
		
			
				|  |  | +	} else if (soc_is_am33xx()) {
 | 
	
		
			
				|  |  | +		val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
 | 
	
		
			
				|  |  | +	} else if (cpu_is_omap34xx()) {
 | 
	
		
			
				|  |  | +		val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
 | 
	
		
			
				|  |  | +	} else if (cpu_is_omap44xx()) {
 | 
	
		
			
				|  |  | +		val = omap_ctrl_readl(OMAP4_CTRL_MODULE_CORE_STATUS);
 | 
	
		
			
				|  |  | +	} else if (soc_is_omap54xx()) {
 | 
	
		
			
				|  |  | +		val = omap_ctrl_readl(OMAP5XXX_CONTROL_STATUS);
 | 
	
		
			
				|  |  | +		val &= OMAP5_DEVICETYPE_MASK;
 | 
	
		
			
				|  |  | +		val >>= 6;
 | 
	
		
			
				|  |  | +		goto out;
 | 
	
		
			
				|  |  | +	} else {
 | 
	
		
			
				|  |  | +		pr_err("Cannot detect omap type!\n");
 | 
	
		
			
				|  |  | +		goto out;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	val &= OMAP2_DEVICETYPE_MASK;
 | 
	
		
			
				|  |  | +	val >>= 8;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +out:
 | 
	
		
			
				|  |  | +	return val;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +EXPORT_SYMBOL(omap_type);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/*----------------------------------------------------------------------------*/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define OMAP_TAP_IDCODE		0x0204
 | 
	
		
			
				|  |  | +#define OMAP_TAP_DIE_ID_0	0x0218
 | 
	
		
			
				|  |  | +#define OMAP_TAP_DIE_ID_1	0x021C
 | 
	
		
			
				|  |  | +#define OMAP_TAP_DIE_ID_2	0x0220
 | 
	
		
			
				|  |  | +#define OMAP_TAP_DIE_ID_3	0x0224
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define OMAP_TAP_DIE_ID_44XX_0	0x0200
 | 
	
		
			
				|  |  | +#define OMAP_TAP_DIE_ID_44XX_1	0x0208
 | 
	
		
			
				|  |  | +#define OMAP_TAP_DIE_ID_44XX_2	0x020c
 | 
	
		
			
				|  |  | +#define OMAP_TAP_DIE_ID_44XX_3	0x0210
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define read_tap_reg(reg)	__raw_readl(tap_base  + (reg))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +struct omap_id {
 | 
	
		
			
				|  |  | +	u16	hawkeye;	/* Silicon type (Hawkeye id) */
 | 
	
		
			
				|  |  | +	u8	dev;		/* Device type from production_id reg */
 | 
	
		
			
				|  |  | +	u32	type;		/* Combined type id copied to omap_revision */
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* Register values to detect the OMAP version */
 |