blob: d12e8bd6c27cec8ec7193d60a4c0d2de629d1722 [file] [log] [blame]
wdenk2d5b5612003-10-14 19:43:55 +00001/*
2 * (C) Copyright 2002
3 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
4 * Marius Groeger <mgroeger@sysgo.de>
5 *
6 * (C) Copyright 2002
7 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
8 * Alex Zuepke <azu@sysgo.de>
9 *
10 * See file CREDITS for list of people who contributed to this
11 * project.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License as
15 * published by the Free Software Foundation; either version 2 of
16 * the License, or (at your option) any later version.
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 <command.h>
35#include <asm/arch/ixp425.h>
36
37int cpu_init (void)
38{
39 /*
40 * setup up stack if necessary
41 */
42/*
43
44 FIXME: the stack is _below_ the uboot code!!
45
46#ifdef CONFIG_USE_IRQ
47 IRQ_STACK_START = _armboot_end +
48 CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
49 FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
50 _armboot_real_end = FIQ_STACK_START + 4;
51#else
52 _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
53#endif
54*/
55 pci_init();
56 return 0;
57}
58
59int cleanup_before_linux (void)
60{
61 /*
62 * this function is called just before we call linux
63 * it prepares the processor for linux
64 *
65 * just disable everything that can disturb booting linux
66 */
67
68 unsigned long i;
69
70 disable_interrupts ();
71
72 /* turn off I-cache */
73 asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
74 i &= ~0x1000;
75 asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
76
77 /* flush I-cache */
78 asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
79
80 return (0);
81}
82
83int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
84{
85 extern void reset_cpu (ulong addr);
86
87 printf ("reseting ...\n");
88
89 udelay (50000); /* wait 50 ms */
90 disable_interrupts ();
91 reset_cpu (0);
92
93 /*NOTREACHED*/
94 return (0);
95}
96
97/* taken from blob */
98void icache_enable (void)
99{
100 register u32 i;
101
102 /* read control register */
103 asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
104
105 /* set i-cache */
106 i |= 0x1000;
107
108 /* write back to control register */
109 asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
110}
111
112void icache_disable (void)
113{
114 register u32 i;
115
116 /* read control register */
117 asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
118
119 /* clear i-cache */
120 i &= ~0x1000;
121
122 /* write back to control register */
123 asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
124
125 /* flush i-cache */
126 asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
127}
128
129int icache_status (void)
130{
131 register u32 i;
132
133 /* read control register */
134 asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
135
136 /* return bit */
137 return (i & 0x1000);
138}
139
140/* we will never enable dcache, because we have to setup MMU first */
141void dcache_enable (void)
142{
143 return;
144}
145
146void dcache_disable (void)
147{
148 return;
149}
150
151int dcache_status (void)
152{
153 return 0; /* always off */
154}
155
156/* FIXME */
157void pci_init(void)
158{
159 return;
160}