Commit ccc35fb9 authored by Komal Shah's avatar Komal Shah Committed by Kevin Hilman

ARM: DaVinci: Add DaVinci CPU identification code.

- Patch adds DaVinci CPU identification based on DEVICE_ID
  register.
Signed-off-by: default avatarKomal Shah <komal_shah802003@yahoo.com>
parent 4683fa27
......@@ -5,8 +5,8 @@
# Common objects
obj-y := time.o irq.o dma.o clock.o serial.o io.o \
devices.o gpio.o
obj-y := time.o irq.o dma.o clock.o serial.o io.o \
devices.o gpio.o id.o
# Board specific
obj-$(CONFIG_MACH_DAVINCI_EVM) += board-evm.o i2c-emac.o
......
/*
* linux/arch/arm/mach-davinci/id.c
*
* Davinci CPU identification code
*
* Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com>
*
* Derived from OMAP1 CPU identification code.
*
* 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 <asm/io.h>
#define DAVINCI_DEV_ID 0x01c40028
struct davinci_id {
u16 jtag_id; /* Device Part No. (Unique JTAG id)*/
u8 dev_rev; /* Processor revision */
u32 mfg_jtag_id; /* Manufacturer JTAP id */
u32 type; /* Cpu id bits [31:08], cpu class bits [07:00] */
};
/* Register values to detect the DaVinci version */
static struct davinci_id davinci_ids[] __initdata = {
{ .jtag_id = 0xb700, .dev_rev = 0x2, .mfg_jtag_id = 0x017, .type = 0x64430000},
};
/*
* Get Device Part No. from DEV_ID.
*/
static u16 __init davinci_get_jtag_id(void)
{
u32 dev_id, jtag_id;
dev_id = davinci_readl(DAVINCI_DEV_ID);
jtag_id = ((dev_id >> 12) & 0xffff);
return jtag_id;
}
/*
* Get Device Revision from DEV_ID.
*/
static u8 __init davinci_get_dev_rev(void)
{
u32 dev_rev;
dev_rev = davinci_readl(DAVINCI_DEV_ID);
dev_rev = (dev_rev >> 28) & 0xf;
return dev_rev;
}
void __init davinci_check_revision(void)
{
int i;
u16 jtag_id;
u8 dev_rev;
jtag_id = davinci_get_jtag_id();
dev_rev = davinci_get_dev_rev();
#ifdef DEBUG
printk("JTAG_ID: 0x%04x DEV_REV: %i\n", jtag_id, dev_rev);
#endif
/* First check only the major version in a safe way */
for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) {
if (jtag_id == (davinci_ids[i].jtag_id)) {
system_rev = davinci_ids[i].type;
break;
}
}
/* Check if we can find the dev revision */
for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) {
if (jtag_id == davinci_ids[i].jtag_id &&
dev_rev == davinci_ids[i].dev_rev) {
system_rev = davinci_ids[i].type;
break;
}
}
printk("DM%04x\n", system_rev >> 16);
}
......@@ -14,12 +14,15 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/tlb.h>
#include <asm/io.h>
#include <asm/mach/map.h>
#include <asm/arch/memory.h>
extern int davinci_clk_init(void);
extern void davinci_check_revision(void);
/*
* The machine specific code may provide the extra mapping besides the
* default mapping provided here.
......@@ -42,6 +45,18 @@ static struct map_desc davinci_io_desc[] __initdata = {
void __init davinci_map_common_io(void)
{
iotable_init(davinci_io_desc, ARRAY_SIZE(davinci_io_desc));
/* Normally devicemaps_init() would flush caches and tlb after
* mdesc->map_io(), but we must also do it here because of the CPU
* revision check below.
*/
local_flush_tlb_all();
flush_cache_all();
/* We want to check CPU revision early for cpu_is_omapxxxx() macros.
* IO space mapping must be initialized before we can do that.
*/
davinci_check_revision();
}
void __init davinci_init_common_hw(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment