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+
16 #include <stdio_dev.h>
21 #ifdef CONFIG_STATUS_LED
22 #include <status_led.h>
24 #ifdef CONFIG_CMD_NAND
25 #include <nand.h> /* cannot even include nand.h if it isnt configured */
28 #include <timestamp.h>
31 DECLARE_GLOBAL_DATA_PTR;
34 * All attempts to come up with a "common" initialization sequence
35 * that works for all boards and architectures failed: some of the
36 * requirements are just _too_ different. To get rid of the resulting
37 * mess of board dependend #ifdef'ed code we now make the whole
38 * initialization sequence configurable to the user.
40 * The requirements for any new initalization function is simple: it
41 * receives a pointer to the "global data" structure as it's only
42 * argument, and returns an integer return code, where 0 means
43 * "continue" and != 0 means "fatal error, hang the system".
46 extern int cache_init(void);
49 * Initialization sequence
51 static int (* const init_sequence[])(void) = {
53 timer_init, /* initialize timer */
63 /***********************************************************************/
69 gd = (gd_t *)CONFIG_SYS_GBL_DATA_ADDR;
71 memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
73 gd->bd = (bd_t *)(gd+1); /* At end of global data */
74 gd->baudrate = CONFIG_BAUDRATE;
75 gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
78 bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
79 bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
80 #ifndef CONFIG_SYS_NO_FLASH
81 bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
83 #if defined(CONFIG_SYS_SRAM_BASE) && defined(CONFIG_SYS_SRAM_SIZE)
84 bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;
85 bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;
87 bd->bi_baudrate = CONFIG_BAUDRATE;
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)