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 * SPDX-License-Identifier: GPL-2.0+
17 #include <stdio_dev.h>
22 #ifdef CONFIG_STATUS_LED
23 #include <status_led.h>
25 #ifdef CONFIG_CMD_NAND
26 #include <nand.h> /* cannot even include nand.h if it isnt configured */
29 #include <timestamp.h>
32 DECLARE_GLOBAL_DATA_PTR;
35 * All attempts to come up with a "common" initialization sequence
36 * that works for all boards and architectures failed: some of the
37 * requirements are just _too_ different. To get rid of the resulting
38 * mess of board dependend #ifdef'ed code we now make the whole
39 * initialization sequence configurable to the user.
41 * The requirements for any new initalization function is simple: it
42 * receives a pointer to the "global data" structure as it's only
43 * argument, and returns an integer return code, where 0 means
44 * "continue" and != 0 means "fatal error, hang the system".
47 extern int cache_init(void);
50 * Initialization sequence
52 static int (* const init_sequence[])(void) = {
54 timer_init, /* initialize timer */
64 /***********************************************************************/
70 gd = (gd_t *)CONFIG_SYS_GBL_DATA_ADDR;
72 memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
74 gd->bd = (bd_t *)(gd+1); /* At end of global data */
75 gd->baudrate = CONFIG_BAUDRATE;
76 gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
79 bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
80 bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
81 #ifndef CONFIG_SYS_NO_FLASH
82 bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
84 #if defined(CONFIG_SYS_SRAM_BASE) && defined(CONFIG_SYS_SRAM_SIZE)
85 bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;
86 bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;
89 for (i = 0; i < ARRAY_SIZE(init_sequence); i++) {
91 if (init_sequence[i]())
97 /* The Malloc area is immediately below the monitor copy in RAM */
98 mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
100 #ifndef CONFIG_SYS_NO_FLASH
102 bd->bi_flashsize = flash_init();
105 #ifdef CONFIG_CMD_NAND
110 #ifdef CONFIG_GENERIC_MMC
126 #if defined(CONFIG_BOARD_LATE_INIT)
130 #if defined(CONFIG_CMD_NET)