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 0x01c40028
21 u8 variant
; /* JTAG ID bits 31:28 */
22 u16 part_no
; /* JTAG ID bits 27:12 */
23 u32 manufacturer
; /* JTAG ID bits 11:1 */
24 u32 type
; /* Cpu id bits [31:8], cpu class bits [7:0] */
27 /* Register values to detect the DaVinci version */
28 static struct davinci_id davinci_ids
[] __initdata
= {
33 .manufacturer
= 0x017,
39 * Get Device Part No. from JTAG ID register
41 static u16 __init
davinci_get_part_no(void)
45 dev_id
= davinci_readl(JTAG_ID_BASE
);
47 part_no
= ((dev_id
>> 12) & 0xffff);
53 * Get Device Revision from JTAG ID register
55 static u8 __init
davinci_get_variant(void)
59 variant
= davinci_readl(JTAG_ID_BASE
);
61 variant
= (variant
>> 28) & 0xf;
66 void __init
davinci_check_revision(void)
72 part_no
= davinci_get_part_no();
73 variant
= davinci_get_variant();
75 /* First check only the major version in a safe way */
76 for (i
= 0; i
< ARRAY_SIZE(davinci_ids
); i
++) {
77 if (part_no
== (davinci_ids
[i
].part_no
)) {
78 system_rev
= davinci_ids
[i
].type
;
83 /* Check if we can find the dev revision */
84 for (i
= 0; i
< ARRAY_SIZE(davinci_ids
); i
++) {
85 if (part_no
== davinci_ids
[i
].part_no
&&
86 variant
== davinci_ids
[i
].variant
) {
87 system_rev
= davinci_ids
[i
].type
;
92 printk("DaVinci DM%04x variant 0x%x\n", system_rev
>> 16, variant
);