[U-Boot] [PATCH 19/28] nios2: board init for eth, no flash, nand and mmc
Thomas Chou
thomas at wytron.com.tw
Fri Mar 19 08:43:44 CET 2010
This patch adds various initializations for eth, flash protection,
no flash, nand flash and mmc.
Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
---
lib_nios2/board.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/lib_nios2/board.c b/lib_nios2/board.c
index 41d3297..34d811e 100644
--- a/lib_nios2/board.c
+++ b/lib_nios2/board.c
@@ -38,6 +38,8 @@
DECLARE_GLOBAL_DATA_PTR;
+unsigned long monitor_flash_len = CONFIG_SYS_MONITOR_LEN;
+
/*
* All attempts to come up with a "common" initialization sequence
* that works for all boards and architectures failed: some of the
@@ -78,6 +80,21 @@ init_fnc_t *init_sequence[] = {
};
+static void board_net_init_r(bd_t *bd)
+{
+#ifdef CONFIG_CMD_NET
+ char *s = getenv("bootfile");
+
+ if (s != NULL)
+ copy_filename(BootFile, s, sizeof(BootFile));
+
+ bd->bi_ip_addr = getenv_IPaddr("ipaddr");
+
+ printf("Net: ");
+ eth_initialize(gd->bd);
+#endif
+}
+
/***********************************************************************/
void board_init (void)
{
@@ -100,7 +117,9 @@ void board_init (void)
bd = gd->bd;
bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
+#ifndef CONFIG_SYS_NO_FLASH
bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
+#endif
#if defined(CONFIG_SYS_SRAM_BASE) && defined(CONFIG_SYS_SRAM_SIZE)
bd->bi_sramstart= CONFIG_SYS_SRAM_BASE;
bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;
@@ -119,8 +138,20 @@ void board_init (void)
/* The Malloc area is immediately below the monitor copy in RAM */
mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
+#ifndef CONFIG_SYS_NO_FLASH
WATCHDOG_RESET ();
bd->bi_flashsize = flash_init();
+#endif
+
+#ifdef CONFIG_CMD_NAND
+ puts("NAND: ");
+ nand_init(); /* go init the NAND */
+#endif
+
+#ifdef CONFIG_GENERIC_MMC
+ puts("MMC: ");
+ mmc_initialize(bd);
+#endif
WATCHDOG_RESET ();
env_relocate();
@@ -135,6 +166,8 @@ void board_init (void)
WATCHDOG_RESET ();
interrupt_init ();
+ board_net_init_r(bd);
+
#if defined(CONFIG_BOARD_LATE_INIT)
board_late_init ();
#endif
--
1.6.6.1
More information about the U-Boot
mailing list