blob: ce275e5f3c713cf5ee4d8d7ca2ea5a0d463ec1fa [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>
Ben Warrencc940742008-09-05 01:55:22 -040035#include <netdev.h>
wdenk2d5b5612003-10-14 19:43:55 +000036#include <asm/arch/ixp425.h>
Jean-Christophe PLAGNIOL-VILLARD677e62f2009-04-05 13:02:43 +020037#include <asm/system.h>
wdenk2d5b5612003-10-14 19:43:55 +000038
Wolfgang Denkba94a1b2006-05-30 15:56:48 +020039ulong loops_per_jiffy;
40
Jean-Christophe PLAGNIOL-VILLARDb3acb6c2009-04-05 13:06:31 +020041static void cache_flush(void);
42
Wolfgang Denkba94a1b2006-05-30 15:56:48 +020043#if defined(CONFIG_DISPLAY_CPUINFO)
44int print_cpuinfo (void)
45{
46 unsigned long id;
47 int speed = 0;
48
49 asm ("mrc p15, 0, %0, c0, c0, 0":"=r" (id));
50
51 puts("CPU: Intel IXP425 at ");
52 switch ((id & 0x000003f0) >> 4) {
53 case 0x1c:
54 loops_per_jiffy = 887467;
55 speed = 533;
56 break;
57
58 case 0x1d:
59 loops_per_jiffy = 666016;
60 speed = 400;
61 break;
62
63 case 0x1f:
64 loops_per_jiffy = 442901;
65 speed = 266;
66 break;
67 }
68
69 if (speed)
70 printf("%d MHz\n", speed);
71 else
72 puts("unknown revision\n");
73
74 return 0;
75}
76#endif /* CONFIG_DISPLAY_CPUINFO */
77
wdenk2d5b5612003-10-14 19:43:55 +000078int cleanup_before_linux (void)
79{
80 /*
81 * this function is called just before we call linux
82 * it prepares the processor for linux
83 *
84 * just disable everything that can disturb booting linux
85 */
86
wdenk2d5b5612003-10-14 19:43:55 +000087 disable_interrupts ();
88
89 /* turn off I-cache */
Jean-Christophe PLAGNIOL-VILLARDb3acb6c2009-04-05 13:06:31 +020090 icache_disable();
91 dcache_disable();
wdenk2d5b5612003-10-14 19:43:55 +000092
93 /* flush I-cache */
Jean-Christophe PLAGNIOL-VILLARDb3acb6c2009-04-05 13:06:31 +020094 cache_flush();
wdenk2d5b5612003-10-14 19:43:55 +000095
Jean-Christophe PLAGNIOL-VILLARDb3acb6c2009-04-05 13:06:31 +020096 return 0;
wdenk2d5b5612003-10-14 19:43:55 +000097}
98
Jean-Christophe PLAGNIOL-VILLARDb3acb6c2009-04-05 13:06:31 +020099/* flush I/D-cache */
100static void cache_flush (void)
wdenk2d5b5612003-10-14 19:43:55 +0000101{
Jean-Christophe PLAGNIOL-VILLARDb3acb6c2009-04-05 13:06:31 +0200102 unsigned long i = 0;
wdenk2d5b5612003-10-14 19:43:55 +0000103
Jean-Christophe PLAGNIOL-VILLARDb3acb6c2009-04-05 13:06:31 +0200104 asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
wdenk2d5b5612003-10-14 19:43:55 +0000105}
106
107/* FIXME */
wdenka1191902005-01-09 17:12:27 +0000108/*
wdenk2d5b5612003-10-14 19:43:55 +0000109void pci_init(void)
110{
111 return;
112}
wdenka1191902005-01-09 17:12:27 +0000113*/
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200114
115#ifdef CONFIG_BOOTCOUNT_LIMIT
116
117void bootcount_store (ulong a)
118{
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200119 volatile ulong *save_addr = (volatile ulong *)(CONFIG_SYS_BOOTCOUNT_ADDR);
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200120
121 save_addr[0] = a;
122 save_addr[1] = BOOTCOUNT_MAGIC;
123}
124
125ulong bootcount_load (void)
126{
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200127 volatile ulong *save_addr = (volatile ulong *)(CONFIG_SYS_BOOTCOUNT_ADDR);
Wolfgang Denkba94a1b2006-05-30 15:56:48 +0200128
129 if (save_addr[1] != BOOTCOUNT_MAGIC)
130 return 0;
131 else
132 return save_addr[0];
133}
134
135#endif /* CONFIG_BOOTCOUNT_LIMIT */
Ben Warrencc940742008-09-05 01:55:22 -0400136
137int cpu_eth_init(bd_t *bis)
138{
139#ifdef CONFIG_IXP4XX_NPE
140 npe_initialize(bis);
141#endif
142 return 0;
143}