From 04ad40d5c8bca196aa4a5dfe945a007e21f1b149 Mon Sep 17 00:00:00 2001 From: Steve Sakoman Date: Fri, 1 Aug 2008 20:32:13 -0700 Subject: [PATCH] board.c: implement generalized mmc boot for all boards, clean up boot messages TODO: remove individual mmc_boot routines from board files --- lib/board.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/board.c b/lib/board.c index 171cdaf..11b8500 100644 --- a/lib/board.c +++ b/lib/board.c @@ -31,6 +31,8 @@ */ #include +#include +#include #include #ifdef CFG_PRINTF @@ -57,8 +59,9 @@ init_fnc_t *init_sequence[] = { void start_armboot (void) { init_fnc_t **init_fnc_ptr; - int i; + int i, size; uchar *buf; + block_dev_desc_t *dev_desc = NULL; for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { if ((*init_fnc_ptr)() != 0) { @@ -70,14 +73,24 @@ void start_armboot (void) #ifdef CONFIG_MMC /* first try mmc */ - buf += mmc_boot(buf); + if (mmc_init(1)) { + dev_desc = mmc_get_dev(0); + fat_register_device(dev_desc, 1); + size = file_fat_read("u-boot.bin", buf, 0); + if (size > 0) { +#ifdef CFG_PRINTF + printf("Booting from mmc\n"); +#endif + buf += size; + } + } #endif if (buf == (uchar *)CFG_LOADADDR) { - /* if no u-boot on mmc, try onenand and nand */ + /* if no u-boot on mmc, try onenand or nand, depending upon sysboot */ if (get_mem_type() == GPMC_ONENAND){ #ifdef CFG_PRINTF - printf("Booting from onenand . . .\n"); + printf("Booting from onenand\n"); #endif for (i = ONENAND_START_BLOCK; i < ONENAND_END_BLOCK; i++){ if (!onenand_read_block(buf, i)) @@ -87,7 +100,7 @@ void start_armboot (void) if (get_mem_type() == GPMC_NAND){ #ifdef CFG_PRINTF - printf("Booting from nand . . .\n"); + printf("Booting from nand\n"); #endif for (i = NAND_UBOOT_START; i < NAND_UBOOT_END; i+= NAND_BLOCK_SIZE){ if (!nand_read_block(buf, i)) @@ -101,7 +114,6 @@ void start_armboot (void) hang(); /* go run U-Boot and never return */ - printf("Starting OS Bootloader...\n"); ((init_fnc_t *)CFG_LOADADDR)(); /* should never come here */ @@ -113,6 +125,8 @@ void hang (void) board_hang(); /* if board_hang() returns, hange here */ +#ifdef CFG_PRINTF printf("X-Loader hangs\n"); +#endif for (;;); } -- 2.39.5