3 * Julius Baxter, julius@opencores.org
5 * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
6 * Scott McNutt <smcnutt@psyent.com>
8 * (C) Copyright 2000-2002
9 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
12 * See file CREDITS for list of people who contributed to this
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 #include <stdio_dev.h>
37 #ifdef CONFIG_STATUS_LED
38 #include <status_led.h>
40 #ifdef CONFIG_CMD_NAND
41 #include <nand.h> /* cannot even include nand.h if it isnt configured */
44 #include <timestamp.h>
47 DECLARE_GLOBAL_DATA_PTR;
50 * All attempts to come up with a "common" initialization sequence
51 * that works for all boards and architectures failed: some of the
52 * requirements are just _too_ different. To get rid of the resulting
53 * mess of board dependend #ifdef'ed code we now make the whole
54 * initialization sequence configurable to the user.
56 * The requirements for any new initalization function is simple: it
57 * receives a pointer to the "global data" structure as it's only
58 * argument, and returns an integer return code, where 0 means
59 * "continue" and != 0 means "fatal error, hang the system".
62 extern int cache_init(void);
65 * Initialization sequence
67 static int (* const init_sequence[])(void) = {
69 timer_init, /* initialize timer */
79 /***********************************************************************/
85 gd = (gd_t *)CONFIG_SYS_GBL_DATA_ADDR;
87 memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
89 gd->bd = (bd_t *)(gd+1); /* At end of global data */
90 gd->baudrate = CONFIG_BAUDRATE;
91 gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
94 bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
95 bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
96 #ifndef CONFIG_SYS_NO_FLASH
97 bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
99 #if defined(CONFIG_SYS_SRAM_BASE) && defined(CONFIG_SYS_SRAM_SIZE)
100 bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;
101 bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;
103 bd->bi_baudrate = CONFIG_BAUDRATE;
105 for (i = 0; i < ARRAY_SIZE(init_sequence); i++) {
107 if (init_sequence[i]())
113 /* The Malloc area is immediately below the monitor copy in RAM */
114 mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
116 #ifndef CONFIG_SYS_NO_FLASH
118 bd->bi_flashsize = flash_init();
121 #ifdef CONFIG_CMD_NAND
126 #ifdef CONFIG_GENERIC_MMC
142 #if defined(CONFIG_BOARD_LATE_INIT)
146 #if defined(CONFIG_CMD_NET)