2002-11-18 00:14:45 +00:00
|
|
|
|
/*
|
|
|
|
|
* (C) Copyright 2002
|
2009-10-10 10:42:21 +00:00
|
|
|
|
* Daniel Engstr<EFBFBD>m, Omicron Ceti AB, daniel@omicron.se
|
2003-06-27 21:31:46 +00:00
|
|
|
|
*
|
2002-11-18 00:14:45 +00:00
|
|
|
|
* (C) Copyright 2002
|
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
2003-06-27 21:31:46 +00:00
|
|
|
|
*
|
2002-11-18 00:14:45 +00:00
|
|
|
|
* (C) Copyright 2002
|
|
|
|
|
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
|
|
|
|
* Marius Groeger <mgroeger@sysgo.de>
|
|
|
|
|
*
|
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
|
* project.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
|
#include <watchdog.h>
|
|
|
|
|
#include <command.h>
|
2009-05-16 10:14:54 +00:00
|
|
|
|
#include <stdio_dev.h>
|
2008-11-03 15:30:59 +00:00
|
|
|
|
#include <timestamp.h>
|
2002-11-18 00:14:45 +00:00
|
|
|
|
#include <version.h>
|
|
|
|
|
#include <malloc.h>
|
|
|
|
|
#include <net.h>
|
|
|
|
|
#include <ide.h>
|
2003-05-31 18:35:21 +00:00
|
|
|
|
#include <asm/u-boot-i386.h>
|
2009-11-24 09:04:21 +00:00
|
|
|
|
#include <elf.h>
|
2002-11-18 00:14:45 +00:00
|
|
|
|
|
2009-10-10 10:42:21 +00:00
|
|
|
|
#ifdef CONFIG_BITBANGMII
|
|
|
|
|
#include <miiphy.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-03-31 16:32:53 +00:00
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
2009-11-24 09:04:21 +00:00
|
|
|
|
/* Exports from the Linker Script */
|
|
|
|
|
extern ulong _i386boot_text_start;
|
|
|
|
|
extern ulong _i386boot_rel_dyn_start;
|
|
|
|
|
extern ulong _i386boot_rel_dyn_end;
|
|
|
|
|
extern ulong _i386boot_bss_start;
|
|
|
|
|
extern ulong _i386boot_bss_size;
|
2010-04-23 14:05:44 +00:00
|
|
|
|
|
|
|
|
|
void ram_bootstrap (void *, ulong);
|
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
const char version_string[] =
|
2008-11-03 15:30:59 +00:00
|
|
|
|
U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")";
|
2002-11-18 00:14:45 +00:00
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
|
* Init Utilities *
|
|
|
|
|
************************************************************************
|
|
|
|
|
* Some of this code should be moved into the core functions,
|
|
|
|
|
* or dropped completely,
|
|
|
|
|
* but let's get it working (again) first...
|
|
|
|
|
*/
|
|
|
|
|
static int init_baudrate (void)
|
|
|
|
|
{
|
2003-05-31 18:35:21 +00:00
|
|
|
|
char tmp[64]; /* long enough for environment variables */
|
|
|
|
|
int i = getenv_r("baudrate", tmp, 64);
|
2002-11-18 00:14:45 +00:00
|
|
|
|
|
2003-05-31 18:35:21 +00:00
|
|
|
|
gd->baudrate = (i != 0)
|
2002-11-18 00:14:45 +00:00
|
|
|
|
? (int) simple_strtoul (tmp, NULL, 10)
|
|
|
|
|
: CONFIG_BAUDRATE;
|
|
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int display_banner (void)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
printf ("\n\n%s\n\n", version_string);
|
2009-11-24 09:04:21 +00:00
|
|
|
|
/*
|
2002-11-18 00:14:45 +00:00
|
|
|
|
printf ("U-Boot code: %08lX -> %08lX data: %08lX -> %08lX\n"
|
|
|
|
|
" BSS: %08lX -> %08lX stack: %08lX -> %08lX\n",
|
|
|
|
|
i386boot_start, i386boot_romdata_start-1,
|
|
|
|
|
i386boot_romdata_dest, i386boot_romdata_dest+i386boot_romdata_size-1,
|
|
|
|
|
i386boot_bss_start, i386boot_bss_start+i386boot_bss_size-1,
|
2003-06-27 21:31:46 +00:00
|
|
|
|
i386boot_bss_start+i386boot_bss_size,
|
2008-10-16 13:01:15 +00:00
|
|
|
|
i386boot_bss_start+i386boot_bss_size+CONFIG_SYS_STACK_SIZE-1);
|
2003-06-27 21:31:46 +00:00
|
|
|
|
|
2009-11-24 09:04:21 +00:00
|
|
|
|
*/
|
2002-11-18 00:14:45 +00:00
|
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* WARNING: this code looks "cleaner" than the PowerPC version, but
|
|
|
|
|
* has the disadvantage that you either get nothing, or everything.
|
|
|
|
|
* On PowerPC, you might see "DRAM: " before the system hangs - which
|
|
|
|
|
* gives a simple yet clear indication which part of the
|
|
|
|
|
* initialization if failing.
|
|
|
|
|
*/
|
|
|
|
|
static int display_dram_config (void)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
puts ("DRAM Configuration:\n");
|
|
|
|
|
|
|
|
|
|
for (i=0; i<CONFIG_NR_DRAM_BANKS; i++) {
|
|
|
|
|
printf ("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
|
|
|
|
|
print_size (gd->bd->bi_dram[i].size, "\n");
|
|
|
|
|
}
|
2003-06-27 21:31:46 +00:00
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void display_flash_config (ulong size)
|
|
|
|
|
{
|
|
|
|
|
puts ("Flash: ");
|
|
|
|
|
print_size (size, "\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Breath some life into the board...
|
|
|
|
|
*
|
|
|
|
|
* Initialize an SMC for serial comms, and carry out some hardware
|
|
|
|
|
* tests.
|
|
|
|
|
*
|
|
|
|
|
* The first part of initialization is running from Flash memory;
|
|
|
|
|
* its main purpose is to initialize the RAM so that we
|
|
|
|
|
* can relocate the monitor code to RAM.
|
|
|
|
|
*/
|
|
|
|
|
|
2009-11-24 09:04:21 +00:00
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
/*
|
|
|
|
|
* All attempts to come up with a "common" initialization sequence
|
|
|
|
|
* that works for all boards and architectures failed: some of the
|
|
|
|
|
* requirements are just _too_ different. To get rid of the resulting
|
|
|
|
|
* mess of board dependend #ifdef'ed code we now make the whole
|
|
|
|
|
* initialization sequence configurable to the user.
|
|
|
|
|
*
|
|
|
|
|
* The requirements for any new initalization function is simple: it
|
|
|
|
|
* receives a pointer to the "global data" structure as it's only
|
|
|
|
|
* argument, and returns an integer return code, where 0 means
|
|
|
|
|
* "continue" and != 0 means "fatal error, hang the system".
|
|
|
|
|
*/
|
|
|
|
|
typedef int (init_fnc_t) (void);
|
|
|
|
|
|
|
|
|
|
init_fnc_t *init_sequence[] = {
|
2009-11-24 09:04:21 +00:00
|
|
|
|
serial_init,
|
|
|
|
|
cpu_init_r, /* basic cpu dependent setup */
|
|
|
|
|
board_early_init_r, /* basic board dependent setup */
|
2002-11-18 00:14:45 +00:00
|
|
|
|
dram_init, /* configure available RAM banks */
|
|
|
|
|
interrupt_init, /* set up exceptions */
|
2003-06-27 21:31:46 +00:00
|
|
|
|
timer_init,
|
2002-11-18 00:14:45 +00:00
|
|
|
|
env_init, /* initialize environment */
|
|
|
|
|
init_baudrate, /* initialze baudrate settings */
|
|
|
|
|
serial_init, /* serial communications setup */
|
|
|
|
|
display_banner,
|
|
|
|
|
display_dram_config,
|
|
|
|
|
|
|
|
|
|
NULL,
|
|
|
|
|
};
|
|
|
|
|
|
2010-04-23 14:05:44 +00:00
|
|
|
|
static gd_t gd_data;
|
2008-09-06 21:08:42 +00:00
|
|
|
|
gd_t *gd;
|
2002-11-18 00:14:45 +00:00
|
|
|
|
|
2009-11-24 09:04:21 +00:00
|
|
|
|
/*
|
|
|
|
|
* Load U-Boot into RAM, initialize BSS, perform relocation adjustments
|
|
|
|
|
*/
|
|
|
|
|
void board_init_f (ulong stack_limit)
|
|
|
|
|
{
|
|
|
|
|
void *text_start = &_i386boot_text_start;
|
|
|
|
|
void *u_boot_cmd_end = &__u_boot_cmd_end;
|
|
|
|
|
Elf32_Rel *rel_dyn_start = (Elf32_Rel *)&_i386boot_rel_dyn_start;
|
|
|
|
|
Elf32_Rel *rel_dyn_end = (Elf32_Rel *)&_i386boot_rel_dyn_end;
|
|
|
|
|
void *bss_start = &_i386boot_bss_start;
|
2010-04-23 14:05:44 +00:00
|
|
|
|
ulong bss_size = (ulong)&_i386boot_bss_size;
|
2009-11-24 09:04:21 +00:00
|
|
|
|
|
2010-04-23 14:05:44 +00:00
|
|
|
|
ulong uboot_size;
|
|
|
|
|
void *dest_addr;
|
2009-11-24 09:04:21 +00:00
|
|
|
|
ulong rel_offset;
|
|
|
|
|
Elf32_Rel *re;
|
|
|
|
|
|
2010-04-23 14:05:44 +00:00
|
|
|
|
void (*start_func)(void *, ulong);
|
2009-11-24 09:04:21 +00:00
|
|
|
|
|
2010-04-23 14:05:44 +00:00
|
|
|
|
uboot_size = (ulong)u_boot_cmd_end - (ulong)text_start;
|
|
|
|
|
dest_addr = (void *)stack_limit - (uboot_size + (ulong)bss_size);
|
|
|
|
|
rel_offset = text_start - dest_addr;
|
2009-11-24 09:04:21 +00:00
|
|
|
|
start_func = ram_bootstrap - rel_offset;
|
|
|
|
|
|
|
|
|
|
/* First stage CPU initialization */
|
|
|
|
|
if (cpu_init_f() != 0)
|
|
|
|
|
hang();
|
|
|
|
|
|
|
|
|
|
/* First stage Board initialization */
|
|
|
|
|
if (board_early_init_f() != 0)
|
|
|
|
|
hang();
|
|
|
|
|
|
|
|
|
|
/* Copy U-Boot into RAM */
|
2010-04-23 14:05:44 +00:00
|
|
|
|
memcpy(dest_addr, text_start, uboot_size);
|
2009-11-24 09:04:21 +00:00
|
|
|
|
|
|
|
|
|
/* Clear BSS */
|
2010-04-23 14:05:44 +00:00
|
|
|
|
memset(bss_start - rel_offset, 0, bss_size);
|
2009-11-24 09:04:21 +00:00
|
|
|
|
|
|
|
|
|
/* Perform relocation adjustments */
|
|
|
|
|
for (re = rel_dyn_start; re < rel_dyn_end; re++)
|
|
|
|
|
{
|
|
|
|
|
if (re->r_offset >= TEXT_BASE)
|
|
|
|
|
if (*(ulong *)re->r_offset >= TEXT_BASE)
|
|
|
|
|
*(ulong *)(re->r_offset - rel_offset) -= (Elf32_Addr)rel_offset;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-23 14:05:44 +00:00
|
|
|
|
/* Enter the relocated U-Boot! */
|
|
|
|
|
start_func(dest_addr, rel_offset);
|
|
|
|
|
/* NOTREACHED - board_init_f() does not return */
|
2009-11-24 09:04:21 +00:00
|
|
|
|
while(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2010-04-23 14:05:44 +00:00
|
|
|
|
* We cannot initialize gd_data in board_init_f() because we would be
|
|
|
|
|
* attempting to write to flash (I have even tried using manual relocation
|
|
|
|
|
* adjustments on pointers but it just won't work) and board_init_r() does
|
|
|
|
|
* not have enough arguments to allow us to pass the relocation offset
|
|
|
|
|
* straight up. This bootstrap function (which runs in RAM) is used to
|
|
|
|
|
* setup gd_data in order to pass the relocation offset to the rest of
|
|
|
|
|
* U-Boot.
|
|
|
|
|
*
|
|
|
|
|
* TODO: The compiler optimization barrier is intended to stop GCC from
|
|
|
|
|
* optimizing this function into board_init_f(). It seems to work without
|
|
|
|
|
* it, but I've left it in to be sure. I think also that the barrier in
|
|
|
|
|
* board_init_r() is no longer needed, but left it in 'just in case'
|
2009-11-24 09:04:21 +00:00
|
|
|
|
*/
|
2010-04-23 14:05:44 +00:00
|
|
|
|
void ram_bootstrap (void *dest_addr, ulong rel_offset)
|
2009-11-24 09:04:21 +00:00
|
|
|
|
{
|
|
|
|
|
/* compiler optimization barrier needed for GCC >= 3.4 */
|
|
|
|
|
__asm__ __volatile__("": : :"memory");
|
|
|
|
|
|
2010-04-23 14:05:44 +00:00
|
|
|
|
/* tell others: relocation done */
|
|
|
|
|
gd_data.reloc_off = rel_offset;
|
|
|
|
|
gd_data.flags |= GD_FLG_RELOC;
|
|
|
|
|
|
|
|
|
|
board_init_r(&gd_data, (ulong)dest_addr);
|
2009-11-24 09:04:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-04-23 14:05:44 +00:00
|
|
|
|
void board_init_r(gd_t *id, ulong dest_addr)
|
2002-11-18 00:14:45 +00:00
|
|
|
|
{
|
|
|
|
|
char *s;
|
|
|
|
|
int i;
|
|
|
|
|
ulong size;
|
|
|
|
|
static bd_t bd_data;
|
|
|
|
|
init_fnc_t **init_fnc_ptr;
|
2003-06-27 21:31:46 +00:00
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
show_boot_progress(0x21);
|
|
|
|
|
|
2009-11-24 09:04:21 +00:00
|
|
|
|
gd = id;
|
2004-07-01 20:28:03 +00:00
|
|
|
|
/* compiler optimization barrier needed for GCC >= 3.4 */
|
|
|
|
|
__asm__ __volatile__("": : :"memory");
|
2003-06-27 21:31:46 +00:00
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
gd->bd = &bd_data;
|
|
|
|
|
memset (gd->bd, 0, sizeof (bd_t));
|
|
|
|
|
show_boot_progress(0x22);
|
|
|
|
|
|
2003-05-31 18:35:21 +00:00
|
|
|
|
gd->baudrate = CONFIG_BAUDRATE;
|
2003-06-27 21:31:46 +00:00
|
|
|
|
|
2010-04-23 14:05:44 +00:00
|
|
|
|
mem_malloc_init((((ulong)dest_addr - CONFIG_SYS_MALLOC_LEN)+3)&~3,
|
2009-11-24 09:04:21 +00:00
|
|
|
|
CONFIG_SYS_MALLOC_LEN);
|
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
for (init_fnc_ptr = init_sequence, i=0; *init_fnc_ptr; ++init_fnc_ptr, i++) {
|
|
|
|
|
show_boot_progress(0xa130|i);
|
|
|
|
|
|
|
|
|
|
if ((*init_fnc_ptr)() != 0) {
|
|
|
|
|
hang ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
show_boot_progress(0x23);
|
|
|
|
|
|
|
|
|
|
/* configure available FLASH banks */
|
|
|
|
|
size = flash_init();
|
|
|
|
|
display_flash_config(size);
|
|
|
|
|
show_boot_progress(0x24);
|
|
|
|
|
|
|
|
|
|
show_boot_progress(0x25);
|
|
|
|
|
|
|
|
|
|
/* initialize environment */
|
|
|
|
|
env_relocate ();
|
|
|
|
|
show_boot_progress(0x26);
|
|
|
|
|
|
|
|
|
|
|
2010-04-23 14:05:36 +00:00
|
|
|
|
#ifdef CONFIG_CMD_NET
|
2002-11-18 00:14:45 +00:00
|
|
|
|
/* IP Address */
|
|
|
|
|
bd_data.bi_ip_addr = getenv_IPaddr ("ipaddr");
|
2010-04-23 14:05:36 +00:00
|
|
|
|
#endif
|
2002-11-18 00:14:45 +00:00
|
|
|
|
|
|
|
|
|
#if defined(CONFIG_PCI)
|
|
|
|
|
/*
|
|
|
|
|
* Do pci configuration
|
|
|
|
|
*/
|
|
|
|
|
pci_init();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
show_boot_progress(0x27);
|
|
|
|
|
|
|
|
|
|
|
2009-05-16 10:14:54 +00:00
|
|
|
|
stdio_init ();
|
2002-11-18 00:14:45 +00:00
|
|
|
|
|
2003-07-24 23:38:38 +00:00
|
|
|
|
jumptable_init ();
|
2003-06-27 21:31:46 +00:00
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
/* Initialize the console (after the relocation and devices init) */
|
|
|
|
|
console_init_r();
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_MISC_INIT_R
|
|
|
|
|
/* miscellaneous platform dependent initialisations */
|
|
|
|
|
misc_init_r();
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-07-09 23:05:38 +00:00
|
|
|
|
#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE)
|
2002-11-18 00:14:45 +00:00
|
|
|
|
WATCHDOG_RESET();
|
|
|
|
|
puts ("PCMCIA:");
|
|
|
|
|
pcmcia_init();
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-07-09 23:05:38 +00:00
|
|
|
|
#if defined(CONFIG_CMD_KGDB)
|
2002-11-18 00:14:45 +00:00
|
|
|
|
WATCHDOG_RESET();
|
|
|
|
|
puts("KGDB: ");
|
|
|
|
|
kgdb_init();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* enable exceptions */
|
2003-05-31 18:35:21 +00:00
|
|
|
|
enable_interrupts();
|
2002-11-18 00:14:45 +00:00
|
|
|
|
show_boot_progress(0x28);
|
|
|
|
|
|
|
|
|
|
/* Must happen after interrupts are initialized since
|
|
|
|
|
* an irq handler gets installed
|
|
|
|
|
*/
|
2004-03-14 22:25:36 +00:00
|
|
|
|
#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
|
2002-11-18 00:14:45 +00:00
|
|
|
|
serial_buffered_init();
|
|
|
|
|
#endif
|
2003-06-27 21:31:46 +00:00
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
#ifdef CONFIG_STATUS_LED
|
|
|
|
|
status_led_set (STATUS_LED_BOOT, STATUS_LED_BLINKING);
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-05-31 18:35:21 +00:00
|
|
|
|
udelay(20);
|
2002-11-18 00:14:45 +00:00
|
|
|
|
|
|
|
|
|
set_timer (0);
|
|
|
|
|
|
|
|
|
|
/* Initialize from environment */
|
|
|
|
|
if ((s = getenv ("loadaddr")) != NULL) {
|
|
|
|
|
load_addr = simple_strtoul (s, NULL, 16);
|
|
|
|
|
}
|
2007-07-09 23:05:38 +00:00
|
|
|
|
#if defined(CONFIG_CMD_NET)
|
2002-11-18 00:14:45 +00:00
|
|
|
|
if ((s = getenv ("bootfile")) != NULL) {
|
|
|
|
|
copy_filename (BootFile, s, sizeof (BootFile));
|
|
|
|
|
}
|
2007-07-10 16:19:50 +00:00
|
|
|
|
#endif
|
2002-11-18 00:14:45 +00:00
|
|
|
|
|
|
|
|
|
WATCHDOG_RESET();
|
|
|
|
|
|
2007-07-09 23:05:38 +00:00
|
|
|
|
#if defined(CONFIG_CMD_IDE)
|
2002-11-18 00:14:45 +00:00
|
|
|
|
WATCHDOG_RESET();
|
|
|
|
|
puts("IDE: ");
|
|
|
|
|
ide_init();
|
2007-07-10 16:19:50 +00:00
|
|
|
|
#endif
|
2002-11-18 00:14:45 +00:00
|
|
|
|
|
2007-07-09 23:05:38 +00:00
|
|
|
|
#if defined(CONFIG_CMD_SCSI)
|
2002-11-18 00:14:45 +00:00
|
|
|
|
WATCHDOG_RESET();
|
|
|
|
|
puts("SCSI: ");
|
|
|
|
|
scsi_init();
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-07-09 23:05:38 +00:00
|
|
|
|
#if defined(CONFIG_CMD_DOC)
|
2002-11-18 00:14:45 +00:00
|
|
|
|
WATCHDOG_RESET();
|
2003-05-31 18:35:21 +00:00
|
|
|
|
puts("DOC: ");
|
2002-11-18 00:14:45 +00:00
|
|
|
|
doc_init();
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-10-10 10:42:21 +00:00
|
|
|
|
#ifdef CONFIG_BITBANGMII
|
|
|
|
|
bb_miiphy_init();
|
|
|
|
|
#endif
|
2007-07-09 23:05:38 +00:00
|
|
|
|
#if defined(CONFIG_CMD_NET)
|
2005-10-28 20:30:33 +00:00
|
|
|
|
#if defined(CONFIG_NET_MULTI)
|
2002-11-18 00:14:45 +00:00
|
|
|
|
WATCHDOG_RESET();
|
|
|
|
|
puts("Net: ");
|
2005-10-28 20:30:33 +00:00
|
|
|
|
#endif
|
2002-11-18 00:14:45 +00:00
|
|
|
|
eth_initialize(gd->bd);
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-07-09 23:05:38 +00:00
|
|
|
|
#if ( defined(CONFIG_CMD_NET)) && (0)
|
2005-10-28 20:30:33 +00:00
|
|
|
|
WATCHDOG_RESET();
|
|
|
|
|
# ifdef DEBUG
|
|
|
|
|
puts ("Reset Ethernet PHY\n");
|
|
|
|
|
# endif
|
|
|
|
|
reset_phy();
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
#ifdef CONFIG_LAST_STAGE_INIT
|
|
|
|
|
WATCHDOG_RESET();
|
|
|
|
|
/*
|
|
|
|
|
* Some parts can be only initialized if all others (like
|
|
|
|
|
* Interrupts) are up and running (i.e. the PC-style ISA
|
|
|
|
|
* keyboard).
|
|
|
|
|
*/
|
|
|
|
|
last_stage_init();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_POST
|
|
|
|
|
post_run (NULL, POST_RAM | post_bootmode_get(0));
|
|
|
|
|
#endif
|
2003-06-27 21:31:46 +00:00
|
|
|
|
|
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
show_boot_progress(0x29);
|
2003-06-27 21:31:46 +00:00
|
|
|
|
|
2002-11-18 00:14:45 +00:00
|
|
|
|
/* main_loop() can return to retry autoboot, if so just run it again. */
|
|
|
|
|
for (;;) {
|
2003-05-31 18:35:21 +00:00
|
|
|
|
main_loop();
|
2002-11-18 00:14:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* NOTREACHED - no way out of command loop except booting */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void hang (void)
|
|
|
|
|
{
|
|
|
|
|
puts ("### ERROR ### Please RESET the board ###\n");
|
|
|
|
|
for (;;);
|
|
|
|
|
}
|
2008-04-13 23:42:19 +00:00
|
|
|
|
|
|
|
|
|
unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
/*
|
2010-04-23 14:05:39 +00:00
|
|
|
|
* x86 does not use a dedicated register to pass the pointer
|
|
|
|
|
* to the global_data
|
2008-04-13 23:42:19 +00:00
|
|
|
|
*/
|
2010-04-23 14:05:39 +00:00
|
|
|
|
argv[-1] = (char *)gd;
|
|
|
|
|
|
2008-09-06 21:08:42 +00:00
|
|
|
|
return (entry) (argc, argv);
|
2008-04-13 23:42:19 +00:00
|
|
|
|
}
|