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.41sms\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
;
76 if (buf
== (uchar
*)CFG_LOADADDR
) {
77 /* if no u-boot on mmc, try onenand and nand */
78 if (get_mem_type() == GPMC_ONENAND
){
80 printf("Booting from onenand . . .\n");
82 for (i
= ONENAND_START_BLOCK
; i
< ONENAND_END_BLOCK
; i
++){
83 if (!onenand_read_block(buf
, i
))
84 buf
+= ONENAND_BLOCK_SIZE
;
88 if (get_mem_type() == GPMC_NAND
){
90 printf("Booting from nand . . .\n");
92 for (i
= NAND_UBOOT_START
; i
< NAND_UBOOT_END
; i
+= NAND_BLOCK_SIZE
){
93 if (!nand_read_block(buf
, i
))
94 buf
+= NAND_BLOCK_SIZE
; /* advance buf ptr */
100 if (buf
== (uchar
*)CFG_LOADADDR
)
103 /* go run U-Boot and never return */
104 printf("Starting OS Bootloader...\n");
105 ((init_fnc_t
*)CFG_LOADADDR
)();
107 /* should never come here */
112 /* call board specific hang function */
115 /* if board_hang() returns, hange here */
116 printf("X-Loader hangs\n");