2007-07-05 16:01:14 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2002-2006
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*
|
|
|
|
* (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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* To match the U-Boot user interface on ARM platforms to the U-Boot
|
|
|
|
* standard (as on PPC platforms), some messages with debug character
|
|
|
|
* are removed from the default U-Boot build.
|
|
|
|
*
|
|
|
|
* Define DEBUG here if you want additional info as shown below
|
|
|
|
* printed upon startup:
|
|
|
|
*
|
|
|
|
* U-Boot code: 00F00000 -> 00F3C774 BSS: -> 00FC3274
|
|
|
|
* IRQ Stack: 00ebff7c
|
|
|
|
* FIQ Stack: 00ebef7c
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2007-07-05 16:01:24 +00:00
|
|
|
#include <init.h>
|
2007-07-05 16:01:14 +00:00
|
|
|
#include <command.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <version.h>
|
2007-07-05 16:01:29 +00:00
|
|
|
#include <mem_malloc.h>
|
|
|
|
#include <debug_ll.h>
|
2007-07-05 16:01:23 +00:00
|
|
|
|
2007-07-05 16:01:24 +00:00
|
|
|
ulong load_addr = 0; /* Default Load Address */
|
2007-07-05 16:01:14 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
#ifndef CONFIG_IDENT_STRING
|
|
|
|
#define CONFIG_IDENT_STRING ""
|
|
|
|
#endif
|
|
|
|
|
|
|
|
const char version_string[] =
|
|
|
|
U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")"CONFIG_IDENT_STRING;
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* 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 display_banner (void)
|
|
|
|
{
|
|
|
|
printf ("\n\n%s\n\n", version_string);
|
2007-07-05 16:01:29 +00:00
|
|
|
// debug ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n",
|
|
|
|
// _armboot_start, _bss_start, _bss_end);
|
2007-07-05 16:01:14 +00:00
|
|
|
#ifdef CONFIG_USE_IRQ
|
|
|
|
debug ("IRQ Stack: %08lx\n", IRQ_STACK_START);
|
|
|
|
debug ("FIQ Stack: %08lx\n", FIQ_STACK_START);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Breathe some life into the board...
|
|
|
|
*
|
|
|
|
* Initialize a serial port as console, 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 dependent #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".
|
|
|
|
*/
|
|
|
|
|
2007-07-05 16:01:24 +00:00
|
|
|
extern initcall_t __u_boot_initcalls_start[], __u_boot_initcalls_end[];
|
|
|
|
|
2007-07-05 16:01:29 +00:00
|
|
|
void start_uboot (void)
|
2007-07-05 16:01:14 +00:00
|
|
|
{
|
2007-07-05 16:01:24 +00:00
|
|
|
initcall_t *initcall;
|
|
|
|
int result;
|
2007-07-05 16:01:39 +00:00
|
|
|
|
2007-07-05 16:01:14 +00:00
|
|
|
/* compiler optimization barrier needed for GCC >= 3.4 */
|
2007-07-05 16:01:29 +00:00
|
|
|
// __asm__ __volatile__("": : :"memory");
|
2007-07-05 16:01:24 +00:00
|
|
|
|
2007-07-05 16:01:29 +00:00
|
|
|
// serial_init(); /* serial communications setup */
|
2007-07-05 16:01:24 +00:00
|
|
|
for (initcall = __u_boot_initcalls_start; initcall < __u_boot_initcalls_end; initcall++) {
|
2007-07-05 16:01:39 +00:00
|
|
|
// PUTHEX_LL(*initcall);
|
|
|
|
// PUTC('\n');
|
2007-07-05 16:01:24 +00:00
|
|
|
result = (*initcall)();
|
|
|
|
if (result)
|
|
|
|
hang();
|
|
|
|
}
|
|
|
|
|
|
|
|
display_banner();
|
2007-07-05 16:01:14 +00:00
|
|
|
|
|
|
|
/* enable exceptions */
|
|
|
|
enable_interrupts ();
|
|
|
|
|
2007-07-05 16:01:45 +00:00
|
|
|
run_command("mount none ramfs /", 0);
|
|
|
|
run_command("mkdir /dev", 0);
|
|
|
|
run_command("mkdir /env", 0);
|
|
|
|
run_command("mount none devfs /dev", 0);
|
|
|
|
|
2007-07-05 16:01:51 +00:00
|
|
|
run_command("eth0.ip=172.0.0.2", 0);
|
|
|
|
run_command("eth0.mac=80:81:82:83:84:85", 0);
|
|
|
|
run_command("eth0.serverip=172.0.0.1", 0);
|
|
|
|
run_command("eth0.gateway=172.0.0.1", 0);
|
|
|
|
run_command("eth0.netmask=255.255.255.0", 0);
|
2007-07-05 16:01:45 +00:00
|
|
|
|
2007-07-05 16:01:24 +00:00
|
|
|
/* main_loop() can return to retry autoboot, if so just run it again. */
|
2007-07-05 16:01:14 +00:00
|
|
|
for (;;) {
|
|
|
|
main_loop ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NOTREACHED - no way out of command loop except booting */
|
|
|
|
}
|
|
|
|
|
|
|
|
void hang (void)
|
|
|
|
{
|
|
|
|
puts ("### ERROR ### Please RESET the board ###\n");
|
|
|
|
for (;;);
|
|
|
|
}
|