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,
36 #include <asm/arch/mem.h>
38 const char version_string
[] =
39 "Texas Instruments X-Loader 1.4.2 (" __DATE__
" - " __TIME__
")";
44 printf("\n\n%s\n", version_string
);
49 static int init_func_i2c (void)
52 i2c_init (CFG_I2C_SPEED
, CFG_I2C_SLAVE
);
57 typedef int (init_fnc_t
) (void);
59 init_fnc_t
*init_sequence
[] = {
60 cpu_init
, /* basic cpu dependent setup */
61 board_init
, /* basic board dependent setup */
63 serial_init
, /* serial communications setup */
66 nand_init
, /* board specific nand init */
73 void start_armboot (void)
75 init_fnc_t
**init_fnc_ptr
;
78 block_dev_desc_t
*dev_desc
= NULL
;
80 for (init_fnc_ptr
= init_sequence
; *init_fnc_ptr
; ++init_fnc_ptr
) {
81 if ((*init_fnc_ptr
)() != 0) {
88 buf
= (uchar
*) CFG_LOADADDR
;
93 size
= file_fat_read("u-boot.bin", buf
, 0);
96 printf("Loading u-boot.bin from mmc\n");
103 if (buf
== (uchar
*)CFG_LOADADDR
) {
104 /* if no u-boot on mmc, try onenand or nand, depending upon sysboot */
105 if (get_mem_type() == GPMC_ONENAND
){
107 printf("Loading u-boot.bin from onenand\n");
109 for (i
= ONENAND_START_BLOCK
; i
< ONENAND_END_BLOCK
; i
++){
110 if (!onenand_read_block(buf
, i
))
111 buf
+= ONENAND_BLOCK_SIZE
;
113 } else if (get_mem_type() == GPMC_NAND
){
115 printf("Loading u-boot.bin from nand\n");
117 for (i
= NAND_UBOOT_START
; i
< NAND_UBOOT_END
; i
+= NAND_BLOCK_SIZE
){
118 if (!nand_read_block(buf
, i
))
119 buf
+= NAND_BLOCK_SIZE
; /* advance buf ptr */
125 if (buf
== (uchar
*)CFG_LOADADDR
)
128 /* go run U-Boot and never return */
129 ((init_fnc_t
*)CFG_LOADADDR
)();
131 /* should never come here */
136 /* call board specific hang function */
139 /* if board_hang() returns, hange here */
141 printf("X-Loader hangs\n");