2 * U-boot - cpu.c CPU specific functions
4 * Copyright (c) 2005-2007 Analog Devices Inc.
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
29 #include <asm/blackfin.h>
31 #include <asm/entry.h>
38 extern unsigned int icplb_table
[page_descriptor_table_size
][2];
39 extern unsigned int dcplb_table
[page_descriptor_table_size
][2];
41 int do_reset(cmd_tbl_t
* cmdtp
, int flag
, int argc
, char *argv
[])
43 __asm__
__volatile__("cli r3;" "P0 = %0;" "JUMP (P0);"::"r"(L1_ISRAM
)
49 /* These functions are just used to satisfy the linker */
55 int cleanup_before_linux(void)
60 void icache_enable(void)
62 unsigned int *I0
, *I1
;
65 /* Before enable icache, disable it first */
67 I0
= (unsigned int *)ICPLB_ADDR0
;
68 I1
= (unsigned int *)ICPLB_DATA0
;
70 /* make sure the locked ones go in first */
71 for (i
= 0; i
< page_descriptor_table_size
; i
++) {
72 if (CPLB_LOCK
& icplb_table
[i
][1]) {
73 debug("adding %02i %02i 0x%08x 0x%08x\n", i
, j
,
74 icplb_table
[i
][0], icplb_table
[i
][1]);
75 *I0
++ = icplb_table
[i
][0];
76 *I1
++ = icplb_table
[i
][1];
81 for (i
= 0; i
< page_descriptor_table_size
; i
++) {
82 if (!(CPLB_LOCK
& icplb_table
[i
][1])) {
83 debug("adding %02i %02i 0x%08x 0x%08x\n", i
, j
,
84 icplb_table
[i
][0], icplb_table
[i
][1]);
85 *I0
++ = icplb_table
[i
][0];
86 *I1
++ = icplb_table
[i
][1];
94 /* Fill the rest with invalid entry */
96 for (; j
<= 16; j
++) {
97 debug("filling %i with 0", j
);
106 *(unsigned int *)IMEM_CONTROL
= IMC
| ENICPLB
;
111 void icache_disable(void)
116 *(unsigned int *)IMEM_CONTROL
&= ~(IMC
| ENICPLB
);
121 int icache_status(void)
124 value
= *(unsigned int *)IMEM_CONTROL
;
126 if (value
& (IMC
| ENICPLB
))
132 void dcache_enable(void)
134 unsigned int *I0
, *I1
;
138 /* Before enable dcache, disable it first */
140 I0
= (unsigned int *)DCPLB_ADDR0
;
141 I1
= (unsigned int *)DCPLB_DATA0
;
143 /* make sure the locked ones go in first */
144 for (i
= 0; i
< page_descriptor_table_size
; i
++) {
145 if (CPLB_LOCK
& dcplb_table
[i
][1]) {
146 debug("adding %02i %02i 0x%08x 0x%08x\n", i
, j
,
147 dcplb_table
[i
][0], dcplb_table
[i
][1]);
148 *I0
++ = dcplb_table
[i
][0];
149 *I1
++ = dcplb_table
[i
][1];
152 debug("skip %02i %02i 0x%08x 0x%08x\n", i
, j
,
153 dcplb_table
[i
][0], dcplb_table
[i
][1]);
157 for (i
= 0; i
< page_descriptor_table_size
; i
++) {
158 if (!(CPLB_LOCK
& dcplb_table
[i
][1])) {
159 debug("adding %02i %02i 0x%08x 0x%08x\n", i
, j
,
160 dcplb_table
[i
][0], dcplb_table
[i
][1]);
161 *I0
++ = dcplb_table
[i
][0];
162 *I1
++ = dcplb_table
[i
][1];
170 /* Fill the rest with invalid entry */
172 for (; j
<= 16; j
++) {
173 debug("filling %i with 0", j
);
179 temp
= *(unsigned int *)DMEM_CONTROL
;
182 *(unsigned int *)DMEM_CONTROL
=
183 ACACHE_BCACHE
| ENDCPLB
| PORT_PREF0
| temp
;
188 void dcache_disable(void)
190 unsigned int *I0
, *I1
;
196 *(unsigned int *)DMEM_CONTROL
&=
197 ~(ACACHE_BCACHE
| ENDCPLB
| PORT_PREF0
);
201 /* after disable dcache,
202 * clear it so we don't confuse the next application
204 I0
= (unsigned int *)DCPLB_ADDR0
;
205 I1
= (unsigned int *)DCPLB_DATA0
;
207 for (i
= 0; i
< 16; i
++) {
213 int dcache_status(void)
216 value
= *(unsigned int *)DMEM_CONTROL
;
217 if (value
& (ENDCPLB
))