xloader: Panda - clean board files style
[pandora-x-loader.git] / cpu / omap4 / cpu.c
1 /*
2  * (C) Copyright 2004-2009 Texas Insturments
3  *
4  * (C) Copyright 2002
5  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
6  * Marius Groeger <mgroeger@sysgo.de>
7  *
8  * (C) Copyright 2002
9  * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
10  *
11  * See file CREDITS for list of people who contributed to this
12  * project.
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * version 2 as published by the Free Software Foundation.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26  * MA 02111-1307 USA
27  */
28
29 /*
30  * CPU specific code
31  */
32
33 #include <common.h>
34 #include <asm/io.h>
35
36 /* See also ARM Ref. Man. */
37 #define C1_MMU          (1<<0)          /* mmu off/on */
38 #define C1_ALIGN        (1<<1)          /* alignment faults off/on */
39 #define C1_DC           (1<<2)          /* dcache off/on */
40 #define C1_WB           (1<<3)          /* merging write buffer on/off */
41 #define C1_BIG_ENDIAN   (1<<7)          /* big endian off/on */
42 #define C1_SYS_PROT     (1<<8)          /* system protection */
43 #define C1_ROM_PROT     (1<<9)          /* ROM protection */
44 #define C1_IC           (1<<12)         /* icache off/on */
45 #define C1_HIGH_VECTORS (1<<13) /* location of vectors: low/high addresses */
46 #define RESERVED_1      (0xf << 3)      /* must be 111b for R/W */
47
48 int cpu_init(void)
49 {
50         return 0;
51 }
52
53 unsigned int cortex_a9_rev(void)
54 {
55
56         unsigned int i;
57
58         /* turn off I/D-cache */
59         asm ("mrc p15, 0, %0, c0, c0, 0" : "=r" (i));
60
61         return i;
62 }
63
64 unsigned int omap_revision(void)
65 {
66         switch (cortex_a9_rev()) {
67
68         case 0x410FC091:
69                 return OMAP4430_ES1_0;
70
71         case 0x411FC092:
72                 switch ((__raw_readl(OMAP44XX_CTRL_ID_CODE) >> 28) & 0xF) {
73                 case 0:
74                 case 1:
75                 case 2:
76                         return OMAP4430_ES2_0;
77                 case 3:
78                         return OMAP4430_ES2_1;
79                 default:
80                         return OMAP4430_ES2_2;
81                 }
82         }
83
84         return OMAP4430_SILICON_ID_INVALID;
85 }