2 * Copyright (C) 2005 Texas Instruments.
5 * Jian Zhang, Texas Instruments, jzhang@ti.com.
8 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
11 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
12 * Marius Groeger <mgroeger@sysgo.de>
14 * See file CREDITS for list of people who contributed to this
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License as
19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 #include <asm/arch/mem.h>
39 printf("\n\nTexas Instruments X-Loader 1.41\n");
44 typedef int (init_fnc_t) (void);
46 init_fnc_t *init_sequence[] = {
47 cpu_init, /* basic cpu dependent setup */
48 board_init, /* basic board dependent setup */
50 serial_init, /* serial communications setup */
53 nand_init, /* board specific nand init */
57 void start_armboot (void)
59 init_fnc_t **init_fnc_ptr;
63 for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
64 if ((*init_fnc_ptr)() != 0) {
69 buf = (uchar*) CFG_LOADADDR;
71 if ((get_mem_type() == MMC_ONENAND) || (get_mem_type() == MMC_NAND)){
75 if (get_mem_type() == GPMC_ONENAND){
76 for (i = ONENAND_START_BLOCK; i < ONENAND_END_BLOCK; i++){
77 if (!onenand_read_block(buf, i))
78 buf += ONENAND_BLOCK_SIZE;
82 if (get_mem_type() == GPMC_NAND){
83 for (i = NAND_UBOOT_START; i < NAND_UBOOT_END; i+= NAND_BLOCK_SIZE){
84 if (!nand_read_block(buf, i))
85 buf += NAND_BLOCK_SIZE; /* advance buf ptr */
91 if (buf == (uchar *)CFG_LOADADDR)
94 /* go run U-Boot and never return */
95 printf("Starting OS Bootloader...\n");
96 ((init_fnc_t *)CFG_LOADADDR)();
98 /* should never come here */
103 /* call board specific hang function */
106 /* if board_hang() returns, hange here */
107 printf("X-Loader hangs\n");