2 * Davinci CPU identification code
4 * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com>
6 * Derived from OMAP1 CPU identification code.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
18 #define JTAG_ID_BASE IO_ADDRESS(0x01c40028)
20 static unsigned int davinci_revision;
23 u8 variant; /* JTAG ID bits 31:28 */
24 u16 part_no; /* JTAG ID bits 27:12 */
25 u32 manufacturer; /* JTAG ID bits 11:1 */
26 u32 type; /* Cpu id bits [31:8], cpu class bits [7:0] */
29 /* Register values to detect the DaVinci version */
30 static struct davinci_id davinci_ids[] __initdata = {
35 .manufacturer = 0x017,
42 .manufacturer = 0x017,
49 .manufacturer = 0x00f,
55 * Get Device Part No. from JTAG ID register
57 static u16 __init davinci_get_part_no(void)
61 dev_id = __raw_readl(JTAG_ID_BASE);
63 part_no = ((dev_id >> 12) & 0xffff);
69 * Get Device Revision from JTAG ID register
71 static u8 __init davinci_get_variant(void)
75 variant = __raw_readl(JTAG_ID_BASE);
77 variant = (variant >> 28) & 0xf;
82 unsigned int davinci_rev(void)
84 return davinci_revision >> 16;
86 EXPORT_SYMBOL(davinci_rev);
88 void __init davinci_check_revision(void)
94 part_no = davinci_get_part_no();
95 variant = davinci_get_variant();
97 /* First check only the major version in a safe way */
98 for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) {
99 if (part_no == (davinci_ids[i].part_no)) {
100 davinci_revision = davinci_ids[i].type;
105 /* Check if we can find the dev revision */
106 for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) {
107 if (part_no == davinci_ids[i].part_no &&
108 variant == davinci_ids[i].variant) {
109 davinci_revision = davinci_ids[i].type;
114 printk(KERN_INFO "DaVinci DM%04x variant 0x%x\n",
115 davinci_rev(), variant);