mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-19 08:54:48 -04:00
arch/powerpc/lib/board.c: make (mostly) checkpatch-clean
CodingStyle cleanup. Accepted (in this cleanup) checkpatch messages: - externs should be avoided (to be cleaned up later) - no spaces at the start of a line (accepted in multi-line #if's) - Macros with complex values (false reports) - do not use assignment in if condition (accepted in one place, where avoiding it would have required an additional level of nesting, resulting in less readable code) Signed-off-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
parent
9306749752
commit
9b998b0c52
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* (C) Copyright 2000-2010
|
* (C) Copyright 2000-2011
|
||||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||||
*
|
*
|
||||||
* See file CREDITS for list of people who contributed to this
|
* See file CREDITS for list of people who contributed to this
|
||||||
@ -88,7 +88,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
|
#ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
|
||||||
extern int update_flash_size (int flash_size);
|
extern int update_flash_size(int flash_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SC3)
|
#if defined(CONFIG_SC3)
|
||||||
@ -96,7 +96,7 @@ extern void sc3_read_eeprom(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_DOC)
|
#if defined(CONFIG_CMD_DOC)
|
||||||
void doc_init (void);
|
void doc_init(void);
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_HARD_I2C) || \
|
#if defined(CONFIG_HARD_I2C) || \
|
||||||
defined(CONFIG_SOFT_I2C)
|
defined(CONFIG_SOFT_I2C)
|
||||||
@ -130,9 +130,8 @@ ulong monitor_flash_len;
|
|||||||
#include <bedbug/type.h>
|
#include <bedbug/type.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/*
|
||||||
* Utilities *
|
* Utilities
|
||||||
************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -147,16 +146,16 @@ ulong monitor_flash_len;
|
|||||||
* argument, and returns an integer return code, where 0 means
|
* argument, and returns an integer return code, where 0 means
|
||||||
* "continue" and != 0 means "fatal error, hang the system".
|
* "continue" and != 0 means "fatal error, hang the system".
|
||||||
*/
|
*/
|
||||||
typedef int (init_fnc_t) (void);
|
typedef int (init_fnc_t)(void);
|
||||||
|
|
||||||
/************************************************************************
|
/*
|
||||||
* Init Utilities *
|
* Init Utilities
|
||||||
************************************************************************
|
*
|
||||||
* Some of this code should be moved into the core functions,
|
* Some of this code should be moved into the core functions,
|
||||||
* but let's get it working (again) first...
|
* but let's get it working (again) first...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int init_baudrate (void)
|
static int init_baudrate(void)
|
||||||
{
|
{
|
||||||
gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
|
gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
|
||||||
return 0;
|
return 0;
|
||||||
@ -168,7 +167,9 @@ void __board_add_ram_info(int use_default)
|
|||||||
{
|
{
|
||||||
/* please define platform specific board_add_ram_info() */
|
/* please define platform specific board_add_ram_info() */
|
||||||
}
|
}
|
||||||
void board_add_ram_info(int) __attribute__((weak, alias("__board_add_ram_info")));
|
|
||||||
|
void board_add_ram_info(int)
|
||||||
|
__attribute__ ((weak, alias("__board_add_ram_info")));
|
||||||
|
|
||||||
int __board_flash_wp_on(void)
|
int __board_flash_wp_on(void)
|
||||||
{
|
{
|
||||||
@ -179,80 +180,86 @@ int __board_flash_wp_on(void)
|
|||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int board_flash_wp_on(void) __attribute__((weak, alias("__board_flash_wp_on")));
|
|
||||||
|
int board_flash_wp_on(void)
|
||||||
|
__attribute__ ((weak, alias("__board_flash_wp_on")));
|
||||||
|
|
||||||
void __cpu_secondary_init_r(void)
|
void __cpu_secondary_init_r(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void cpu_secondary_init_r(void)
|
|
||||||
__attribute__((weak, alias("__cpu_secondary_init_r")));
|
|
||||||
|
|
||||||
static int init_func_ram (void)
|
void cpu_secondary_init_r(void)
|
||||||
|
__attribute__ ((weak, alias("__cpu_secondary_init_r")));
|
||||||
|
|
||||||
|
static int init_func_ram(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_BOARD_TYPES
|
#ifdef CONFIG_BOARD_TYPES
|
||||||
int board_type = gd->board_type;
|
int board_type = gd->board_type;
|
||||||
#else
|
#else
|
||||||
int board_type = 0; /* use dummy arg */
|
int board_type = 0; /* use dummy arg */
|
||||||
#endif
|
#endif
|
||||||
puts ("DRAM: ");
|
puts("DRAM: ");
|
||||||
|
|
||||||
if ((gd->ram_size = initdram (board_type)) > 0) {
|
gd->ram_size = initdram(board_type);
|
||||||
print_size (gd->ram_size, "");
|
|
||||||
|
if (gd->ram_size > 0) {
|
||||||
|
print_size(gd->ram_size, "");
|
||||||
board_add_ram_info(0);
|
board_add_ram_info(0);
|
||||||
putc('\n');
|
putc('\n');
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
puts (failed);
|
puts(failed);
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
|
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
|
||||||
static int init_func_i2c (void)
|
static int init_func_i2c(void)
|
||||||
{
|
{
|
||||||
puts ("I2C: ");
|
puts("I2C: ");
|
||||||
i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
|
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
|
||||||
puts ("ready\n");
|
puts("ready\n");
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_HARD_SPI)
|
#if defined(CONFIG_HARD_SPI)
|
||||||
static int init_func_spi (void)
|
static int init_func_spi(void)
|
||||||
{
|
{
|
||||||
puts ("SPI: ");
|
puts("SPI: ");
|
||||||
spi_init ();
|
spi_init();
|
||||||
puts ("ready\n");
|
puts("ready\n");
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_WATCHDOG)
|
#if defined(CONFIG_WATCHDOG)
|
||||||
static int init_func_watchdog_init (void)
|
static int init_func_watchdog_init(void)
|
||||||
{
|
{
|
||||||
puts (" Watchdog enabled\n");
|
puts(" Watchdog enabled\n");
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
# define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
|
|
||||||
|
|
||||||
static int init_func_watchdog_reset (void)
|
#define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
|
||||||
|
|
||||||
|
static int init_func_watchdog_reset(void)
|
||||||
{
|
{
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
# define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
|
|
||||||
|
#define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
|
||||||
#else
|
#else
|
||||||
# define INIT_FUNC_WATCHDOG_INIT /* undef */
|
#define INIT_FUNC_WATCHDOG_INIT /* undef */
|
||||||
# define INIT_FUNC_WATCHDOG_RESET /* undef */
|
#define INIT_FUNC_WATCHDOG_RESET /* undef */
|
||||||
#endif /* CONFIG_WATCHDOG */
|
#endif /* CONFIG_WATCHDOG */
|
||||||
|
|
||||||
/************************************************************************
|
/*
|
||||||
* Initialization sequence *
|
* Initialization sequence
|
||||||
************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
init_fnc_t *init_sequence[] = {
|
init_fnc_t *init_sequence[] = {
|
||||||
@ -280,8 +287,10 @@ init_fnc_t *init_sequence[] = {
|
|||||||
#endif
|
#endif
|
||||||
env_init,
|
env_init,
|
||||||
#if defined(CONFIG_8xx_CPUCLK_DEFAULT)
|
#if defined(CONFIG_8xx_CPUCLK_DEFAULT)
|
||||||
get_clocks_866, /* get CPU and bus clocks according to the environment variable */
|
/* get CPU and bus clocks according to the environment variable */
|
||||||
sdram_adjust_866, /* adjust sdram refresh rate according to the new clock */
|
get_clocks_866,
|
||||||
|
/* adjust sdram refresh rate according to the new clock */
|
||||||
|
sdram_adjust_866,
|
||||||
init_timebase,
|
init_timebase,
|
||||||
#endif
|
#endif
|
||||||
init_baudrate,
|
init_baudrate,
|
||||||
@ -317,14 +326,12 @@ init_fnc_t *init_sequence[] = {
|
|||||||
#ifdef CONFIG_POST
|
#ifdef CONFIG_POST
|
||||||
post_init_f,
|
post_init_f,
|
||||||
#endif
|
#endif
|
||||||
INIT_FUNC_WATCHDOG_RESET
|
INIT_FUNC_WATCHDOG_RESET init_func_ram,
|
||||||
init_func_ram,
|
|
||||||
#if defined(CONFIG_SYS_DRAM_TEST)
|
#if defined(CONFIG_SYS_DRAM_TEST)
|
||||||
testdram,
|
testdram,
|
||||||
#endif /* CONFIG_SYS_DRAM_TEST */
|
#endif /* CONFIG_SYS_DRAM_TEST */
|
||||||
INIT_FUNC_WATCHDOG_RESET
|
INIT_FUNC_WATCHDOG_RESET
|
||||||
|
NULL, /* Terminate this list */
|
||||||
NULL, /* Terminate this list */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ulong get_effective_memsize(void)
|
ulong get_effective_memsize(void)
|
||||||
@ -334,12 +341,11 @@ ulong get_effective_memsize(void)
|
|||||||
#else
|
#else
|
||||||
/* limit stack to what we can reasonable map */
|
/* limit stack to what we can reasonable map */
|
||||||
return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
|
return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
|
||||||
CONFIG_MAX_MEM_MAPPED : gd->ram_size);
|
CONFIG_MAX_MEM_MAPPED : gd->ram_size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/*
|
||||||
*
|
|
||||||
* This is the first part of the initialization sequence that is
|
* This is the first part of the initialization sequence that is
|
||||||
* implemented in C, but still running from ROM.
|
* implemented in C, but still running from ROM.
|
||||||
*
|
*
|
||||||
@ -350,8 +356,6 @@ ulong get_effective_memsize(void)
|
|||||||
*
|
*
|
||||||
* Be aware of the restrictions: global data is read-only, BSS is not
|
* Be aware of the restrictions: global data is read-only, BSS is not
|
||||||
* initialized, and stack space is limited to a few kB.
|
* initialized, and stack space is limited to a few kB.
|
||||||
*
|
|
||||||
************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_LOGBUFFER
|
#ifdef CONFIG_LOGBUFFER
|
||||||
@ -361,13 +365,14 @@ unsigned long logbuffer_base(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void board_init_f (ulong bootflag)
|
void board_init_f(ulong bootflag)
|
||||||
{
|
{
|
||||||
bd_t *bd;
|
bd_t *bd;
|
||||||
ulong len, addr, addr_sp;
|
ulong len, addr, addr_sp;
|
||||||
ulong *s;
|
ulong *s;
|
||||||
gd_t *id;
|
gd_t *id;
|
||||||
init_fnc_t **init_fnc_ptr;
|
init_fnc_t **init_fnc_ptr;
|
||||||
|
|
||||||
#ifdef CONFIG_PRAM
|
#ifdef CONFIG_PRAM
|
||||||
ulong reg;
|
ulong reg;
|
||||||
#endif
|
#endif
|
||||||
@ -375,20 +380,18 @@ void board_init_f (ulong bootflag)
|
|||||||
/* Pointer is writable since we allocated a register for it */
|
/* Pointer is writable since we allocated a register for it */
|
||||||
gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
|
gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
|
||||||
/* compiler optimization barrier needed for GCC >= 3.4 */
|
/* compiler optimization barrier needed for GCC >= 3.4 */
|
||||||
__asm__ __volatile__("": : :"memory");
|
__asm__ __volatile__("":::"memory");
|
||||||
|
|
||||||
#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC512X) && \
|
#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC512X) && \
|
||||||
!defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \
|
!defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \
|
||||||
!defined(CONFIG_MPC86xx)
|
!defined(CONFIG_MPC86xx)
|
||||||
/* Clear initial global data */
|
/* Clear initial global data */
|
||||||
memset ((void *) gd, 0, sizeof (gd_t));
|
memset((void *) gd, 0, sizeof(gd_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
|
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr)
|
||||||
if ((*init_fnc_ptr) () != 0) {
|
if ((*init_fnc_ptr) () != 0)
|
||||||
hang ();
|
hang();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_POST
|
#ifdef CONFIG_POST
|
||||||
post_bootmode_init();
|
post_bootmode_init();
|
||||||
@ -432,7 +435,7 @@ void board_init_f (ulong bootflag)
|
|||||||
*/
|
*/
|
||||||
if (addr > determine_mp_bootpg()) {
|
if (addr > determine_mp_bootpg()) {
|
||||||
addr = determine_mp_bootpg();
|
addr = determine_mp_bootpg();
|
||||||
debug ("Reserving MP boot page to %08lx\n", addr);
|
debug("Reserving MP boot page to %08lx\n", addr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -440,7 +443,8 @@ void board_init_f (ulong bootflag)
|
|||||||
#ifndef CONFIG_ALT_LB_ADDR
|
#ifndef CONFIG_ALT_LB_ADDR
|
||||||
/* reserve kernel log buffer */
|
/* reserve kernel log buffer */
|
||||||
addr -= (LOGBUFF_RESERVE);
|
addr -= (LOGBUFF_RESERVE);
|
||||||
debug ("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, addr);
|
debug("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN,
|
||||||
|
addr);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -449,27 +453,27 @@ void board_init_f (ulong bootflag)
|
|||||||
* reserve protected RAM
|
* reserve protected RAM
|
||||||
*/
|
*/
|
||||||
reg = getenv_ulong("pram", 10, CONFIG_PRAM);
|
reg = getenv_ulong("pram", 10, CONFIG_PRAM);
|
||||||
addr -= (reg << 10); /* size is in kB */
|
addr -= (reg << 10); /* size is in kB */
|
||||||
debug("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
|
debug("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
|
||||||
#endif /* CONFIG_PRAM */
|
#endif /* CONFIG_PRAM */
|
||||||
|
|
||||||
/* round down to next 4 kB limit */
|
/* round down to next 4 kB limit */
|
||||||
addr &= ~(4096 - 1);
|
addr &= ~(4096 - 1);
|
||||||
debug ("Top of RAM usable for U-Boot at: %08lx\n", addr);
|
debug("Top of RAM usable for U-Boot at: %08lx\n", addr);
|
||||||
|
|
||||||
#ifdef CONFIG_LCD
|
#ifdef CONFIG_LCD
|
||||||
#ifdef CONFIG_FB_ADDR
|
#ifdef CONFIG_FB_ADDR
|
||||||
gd->fb_base = CONFIG_FB_ADDR;
|
gd->fb_base = CONFIG_FB_ADDR;
|
||||||
#else
|
#else
|
||||||
/* reserve memory for LCD display (always full pages) */
|
/* reserve memory for LCD display (always full pages) */
|
||||||
addr = lcd_setmem (addr);
|
addr = lcd_setmem(addr);
|
||||||
gd->fb_base = addr;
|
gd->fb_base = addr;
|
||||||
#endif /* CONFIG_FB_ADDR */
|
#endif /* CONFIG_FB_ADDR */
|
||||||
#endif /* CONFIG_LCD */
|
#endif /* CONFIG_LCD */
|
||||||
|
|
||||||
#if defined(CONFIG_VIDEO) && defined(CONFIG_8xx)
|
#if defined(CONFIG_VIDEO) && defined(CONFIG_8xx)
|
||||||
/* reserve memory for video display (always full pages) */
|
/* reserve memory for video display (always full pages) */
|
||||||
addr = video_setmem (addr);
|
addr = video_setmem(addr);
|
||||||
gd->fb_base = addr;
|
gd->fb_base = addr;
|
||||||
#endif /* CONFIG_VIDEO */
|
#endif /* CONFIG_VIDEO */
|
||||||
|
|
||||||
@ -484,29 +488,29 @@ void board_init_f (ulong bootflag)
|
|||||||
addr &= ~(65536 - 1);
|
addr &= ~(65536 - 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
debug ("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
|
debug("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* reserve memory for malloc() arena
|
* reserve memory for malloc() arena
|
||||||
*/
|
*/
|
||||||
addr_sp = addr - TOTAL_MALLOC_LEN;
|
addr_sp = addr - TOTAL_MALLOC_LEN;
|
||||||
debug ("Reserving %dk for malloc() at: %08lx\n",
|
debug("Reserving %dk for malloc() at: %08lx\n",
|
||||||
TOTAL_MALLOC_LEN >> 10, addr_sp);
|
TOTAL_MALLOC_LEN >> 10, addr_sp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (permanently) allocate a Board Info struct
|
* (permanently) allocate a Board Info struct
|
||||||
* and a permanent copy of the "global" data
|
* and a permanent copy of the "global" data
|
||||||
*/
|
*/
|
||||||
addr_sp -= sizeof (bd_t);
|
addr_sp -= sizeof(bd_t);
|
||||||
bd = (bd_t *) addr_sp;
|
bd = (bd_t *) addr_sp;
|
||||||
memset(bd, 0, sizeof(bd_t));
|
memset(bd, 0, sizeof(bd_t));
|
||||||
gd->bd = bd;
|
gd->bd = bd;
|
||||||
debug ("Reserving %zu Bytes for Board Info at: %08lx\n",
|
debug("Reserving %zu Bytes for Board Info at: %08lx\n",
|
||||||
sizeof (bd_t), addr_sp);
|
sizeof(bd_t), addr_sp);
|
||||||
addr_sp -= sizeof (gd_t);
|
addr_sp -= sizeof(gd_t);
|
||||||
id = (gd_t *) addr_sp;
|
id = (gd_t *) addr_sp;
|
||||||
debug ("Reserving %zu Bytes for Global Data at: %08lx\n",
|
debug("Reserving %zu Bytes for Global Data at: %08lx\n",
|
||||||
sizeof (gd_t), addr_sp);
|
sizeof(gd_t), addr_sp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finally, we set up a new (bigger) stack.
|
* Finally, we set up a new (bigger) stack.
|
||||||
@ -516,22 +520,22 @@ void board_init_f (ulong bootflag)
|
|||||||
*/
|
*/
|
||||||
addr_sp -= 16;
|
addr_sp -= 16;
|
||||||
addr_sp &= ~0xF;
|
addr_sp &= ~0xF;
|
||||||
s = (ulong *)addr_sp;
|
s = (ulong *) addr_sp;
|
||||||
*s-- = 0;
|
*s-- = 0;
|
||||||
*s-- = 0;
|
*s-- = 0;
|
||||||
addr_sp = (ulong)s;
|
addr_sp = (ulong) s;
|
||||||
debug ("Stack Pointer at: %08lx\n", addr_sp);
|
debug("Stack Pointer at: %08lx\n", addr_sp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save local variables to board info struct
|
* Save local variables to board info struct
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of DRAM memory */
|
bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of memory */
|
||||||
bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */
|
bd->bi_memsize = gd->ram_size; /* size in bytes */
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_SRAM_BASE
|
#ifdef CONFIG_SYS_SRAM_BASE
|
||||||
bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM memory */
|
bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */
|
||||||
bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM memory */
|
bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \
|
#if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \
|
||||||
@ -546,33 +550,34 @@ void board_init_f (ulong bootflag)
|
|||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_MPC8220)
|
#if defined(CONFIG_MPC8220)
|
||||||
bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */
|
bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */
|
||||||
bd->bi_inpfreq = gd->inp_clk;
|
bd->bi_inpfreq = gd->inp_clk;
|
||||||
bd->bi_pcifreq = gd->pci_clk;
|
bd->bi_pcifreq = gd->pci_clk;
|
||||||
bd->bi_vcofreq = gd->vco_clk;
|
bd->bi_vcofreq = gd->vco_clk;
|
||||||
bd->bi_pevfreq = gd->pev_clk;
|
bd->bi_pevfreq = gd->pev_clk;
|
||||||
bd->bi_flbfreq = gd->flb_clk;
|
bd->bi_flbfreq = gd->flb_clk;
|
||||||
|
|
||||||
/* store bootparam to sram (backward compatible), here? */
|
/* store bootparam to sram (backward compatible), here? */
|
||||||
{
|
{
|
||||||
u32 *sram = (u32 *)CONFIG_SYS_SRAM_BASE;
|
u32 *sram = (u32 *) CONFIG_SYS_SRAM_BASE;
|
||||||
|
|
||||||
*sram++ = gd->ram_size;
|
*sram++ = gd->ram_size;
|
||||||
*sram++ = gd->bus_clk;
|
*sram++ = gd->bus_clk;
|
||||||
*sram++ = gd->inp_clk;
|
*sram++ = gd->inp_clk;
|
||||||
*sram++ = gd->cpu_clk;
|
*sram++ = gd->cpu_clk;
|
||||||
*sram++ = gd->vco_clk;
|
*sram++ = gd->vco_clk;
|
||||||
*sram++ = gd->flb_clk;
|
*sram++ = gd->flb_clk;
|
||||||
*sram++ = 0xb8c3ba11; /* boot signature */
|
*sram++ = 0xb8c3ba11; /* boot signature */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */
|
bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */
|
||||||
bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
|
bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
|
||||||
#if defined(CONFIG_CPM2)
|
#if defined(CONFIG_CPM2)
|
||||||
bd->bi_cpmfreq = gd->cpm_clk;
|
bd->bi_cpmfreq = gd->cpm_clk;
|
||||||
bd->bi_brgfreq = gd->brg_clk;
|
bd->bi_brgfreq = gd->brg_clk;
|
||||||
bd->bi_sccfreq = gd->scc_clk;
|
bd->bi_sccfreq = gd->scc_clk;
|
||||||
bd->bi_vco = gd->vco_out;
|
bd->bi_vco = gd->vco_out;
|
||||||
#endif /* CONFIG_CPM2 */
|
#endif /* CONFIG_CPM2 */
|
||||||
#if defined(CONFIG_MPC512X)
|
#if defined(CONFIG_MPC512X)
|
||||||
bd->bi_ipsfreq = gd->ips_clk;
|
bd->bi_ipsfreq = gd->ips_clk;
|
||||||
@ -584,47 +589,46 @@ void board_init_f (ulong bootflag)
|
|||||||
bd->bi_baudrate = gd->baudrate; /* Console Baudrate */
|
bd->bi_baudrate = gd->baudrate; /* Console Baudrate */
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_EXTBDINFO
|
#ifdef CONFIG_SYS_EXTBDINFO
|
||||||
strncpy ((char *)bd->bi_s_version, "1.2", sizeof (bd->bi_s_version));
|
strncpy((char *) bd->bi_s_version, "1.2", sizeof(bd->bi_s_version));
|
||||||
strncpy ((char *)bd->bi_r_version, U_BOOT_VERSION, sizeof (bd->bi_r_version));
|
strncpy((char *) bd->bi_r_version, U_BOOT_VERSION,
|
||||||
|
sizeof(bd->bi_r_version));
|
||||||
|
|
||||||
bd->bi_procfreq = gd->cpu_clk; /* Processor Speed, In Hz */
|
bd->bi_procfreq = gd->cpu_clk; /* Processor Speed, In Hz */
|
||||||
bd->bi_plb_busfreq = gd->bus_clk;
|
bd->bi_plb_busfreq = gd->bus_clk;
|
||||||
#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
|
#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
|
||||||
defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
|
defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
|
||||||
defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
|
defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
|
||||||
bd->bi_pci_busfreq = get_PCI_freq ();
|
bd->bi_pci_busfreq = get_PCI_freq();
|
||||||
bd->bi_opbfreq = get_OPB_freq ();
|
bd->bi_opbfreq = get_OPB_freq();
|
||||||
#elif defined(CONFIG_XILINX_405)
|
#elif defined(CONFIG_XILINX_405)
|
||||||
bd->bi_pci_busfreq = get_PCI_freq ();
|
bd->bi_pci_busfreq = get_PCI_freq();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
debug ("New Stack Pointer is: %08lx\n", addr_sp);
|
debug("New Stack Pointer is: %08lx\n", addr_sp);
|
||||||
|
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
|
|
||||||
gd->relocaddr = addr; /* Record relocation address, useful for debug */
|
gd->relocaddr = addr; /* Store relocation addr, useful for debug */
|
||||||
|
|
||||||
memcpy (id, (void *)gd, sizeof (gd_t));
|
memcpy(id, (void *) gd, sizeof(gd_t));
|
||||||
|
|
||||||
relocate_code (addr_sp, id, addr);
|
relocate_code(addr_sp, id, addr);
|
||||||
|
|
||||||
/* NOTREACHED - relocate_code() does not return */
|
/* NOTREACHED - relocate_code() does not return */
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/*
|
||||||
*
|
|
||||||
* This is the next part if the initialization sequence: we are now
|
* This is the next part if the initialization sequence: we are now
|
||||||
* running from RAM and have a "normal" C environment, i. e. global
|
* running from RAM and have a "normal" C environment, i. e. global
|
||||||
* data can be written, BSS has been cleared, the stack size in not
|
* data can be written, BSS has been cleared, the stack size in not
|
||||||
* that critical any more, etc.
|
* that critical any more, etc.
|
||||||
*
|
|
||||||
************************************************************************
|
|
||||||
*/
|
*/
|
||||||
void board_init_r (gd_t *id, ulong dest_addr)
|
void board_init_r(gd_t *id, ulong dest_addr)
|
||||||
{
|
{
|
||||||
bd_t *bd;
|
bd_t *bd;
|
||||||
ulong malloc_start;
|
ulong malloc_start;
|
||||||
|
|
||||||
#if defined(CONFIG_SYS_FLASH_CHECKSUM) || defined(CONFIG_CMD_NET)
|
#if defined(CONFIG_SYS_FLASH_CHECKSUM) || defined(CONFIG_CMD_NET)
|
||||||
char *s;
|
char *s;
|
||||||
#endif
|
#endif
|
||||||
@ -663,38 +667,38 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
|||||||
serial_initialize();
|
serial_initialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
|
debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
|
||||||
|
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup trap handlers
|
* Setup trap handlers
|
||||||
*/
|
*/
|
||||||
trap_init (dest_addr);
|
trap_init(dest_addr);
|
||||||
|
|
||||||
#ifdef CONFIG_ADDR_MAP
|
#ifdef CONFIG_ADDR_MAP
|
||||||
init_addr_map();
|
init_addr_map();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_BOARD_EARLY_INIT_R)
|
#if defined(CONFIG_BOARD_EARLY_INIT_R)
|
||||||
board_early_init_r ();
|
board_early_init_r();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
monitor_flash_len = (ulong)&__init_end - dest_addr;
|
monitor_flash_len = (ulong)&__init_end - dest_addr;
|
||||||
|
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
|
|
||||||
#ifdef CONFIG_LOGBUFFER
|
#ifdef CONFIG_LOGBUFFER
|
||||||
logbuff_init_ptrs ();
|
logbuff_init_ptrs();
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_POST
|
#ifdef CONFIG_POST
|
||||||
post_output_backlog ();
|
post_output_backlog();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WATCHDOG_RESET();
|
WATCHDOG_RESET();
|
||||||
|
|
||||||
#if defined(CONFIG_SYS_DELAYED_ICACHE)
|
#if defined(CONFIG_SYS_DELAYED_ICACHE)
|
||||||
icache_enable (); /* it's time to enable the instruction cache */
|
icache_enable(); /* it's time to enable the instruction cache */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
|
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
|
||||||
@ -706,85 +710,89 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
|||||||
* Do early PCI configuration _before_ the flash gets initialised,
|
* Do early PCI configuration _before_ the flash gets initialised,
|
||||||
* because PCU ressources are crucial for flash access on some boards.
|
* because PCU ressources are crucial for flash access on some boards.
|
||||||
*/
|
*/
|
||||||
pci_init ();
|
pci_init();
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_WINBOND_83C553)
|
#if defined(CONFIG_WINBOND_83C553)
|
||||||
/*
|
/*
|
||||||
* Initialise the ISA bridge
|
* Initialise the ISA bridge
|
||||||
*/
|
*/
|
||||||
initialise_w83c553f ();
|
initialise_w83c553f();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
asm ("sync ; isync");
|
asm("sync ; isync");
|
||||||
|
|
||||||
mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN);
|
mem_malloc_init(malloc_start, TOTAL_MALLOC_LEN);
|
||||||
|
|
||||||
#if !defined(CONFIG_SYS_NO_FLASH)
|
#if !defined(CONFIG_SYS_NO_FLASH)
|
||||||
puts ("Flash: ");
|
puts("Flash: ");
|
||||||
|
|
||||||
if (board_flash_wp_on()) {
|
if (board_flash_wp_on()) {
|
||||||
printf("Uninitialized - Write Protect On\n");
|
printf("Uninitialized - Write Protect On\n");
|
||||||
/* Since WP is on, we can't find real size. Set to 0 */
|
/* Since WP is on, we can't find real size. Set to 0 */
|
||||||
flash_size = 0;
|
flash_size = 0;
|
||||||
} else if ((flash_size = flash_init ()) > 0) {
|
} else if ((flash_size = flash_init()) > 0) {
|
||||||
# ifdef CONFIG_SYS_FLASH_CHECKSUM
|
#ifdef CONFIG_SYS_FLASH_CHECKSUM
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
print_size (flash_size, "");
|
print_size(flash_size, "");
|
||||||
/*
|
/*
|
||||||
* Compute and print flash CRC if flashchecksum is set to 'y'
|
* Compute and print flash CRC if flashchecksum is set to 'y'
|
||||||
*
|
*
|
||||||
* NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
|
* NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
|
||||||
*/
|
*/
|
||||||
s = getenv ("flashchecksum");
|
s = getenv("flashchecksum");
|
||||||
if (s && (*s == 'y')) {
|
if (s && (*s == 'y')) {
|
||||||
printf (" CRC: %08X",
|
printf(" CRC: %08X",
|
||||||
crc32 (0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, flash_size)
|
crc32(0,
|
||||||
);
|
(const unsigned char *)
|
||||||
|
CONFIG_SYS_FLASH_BASE, flash_size)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
putc ('\n');
|
putc('\n');
|
||||||
# else /* !CONFIG_SYS_FLASH_CHECKSUM */
|
#else /* !CONFIG_SYS_FLASH_CHECKSUM */
|
||||||
print_size (flash_size, "\n");
|
print_size(flash_size, "\n");
|
||||||
# endif /* CONFIG_SYS_FLASH_CHECKSUM */
|
#endif /* CONFIG_SYS_FLASH_CHECKSUM */
|
||||||
} else {
|
} else {
|
||||||
puts (failed);
|
puts(failed);
|
||||||
hang ();
|
hang();
|
||||||
}
|
}
|
||||||
|
|
||||||
bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; /* update start of FLASH memory */
|
/* update start of FLASH memory */
|
||||||
bd->bi_flashsize = flash_size; /* size of FLASH memory (final value) */
|
bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
|
||||||
|
/* size of FLASH memory (final value) */
|
||||||
|
bd->bi_flashsize = flash_size;
|
||||||
|
|
||||||
#if defined(CONFIG_SYS_UPDATE_FLASH_SIZE)
|
#if defined(CONFIG_SYS_UPDATE_FLASH_SIZE)
|
||||||
/* Make a update of the Memctrl. */
|
/* Make a update of the Memctrl. */
|
||||||
update_flash_size (flash_size);
|
update_flash_size(flash_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
# if defined(CONFIG_OXC) || defined(CONFIG_RMU)
|
#if defined(CONFIG_OXC) || defined(CONFIG_RMU)
|
||||||
/* flash mapped at end of memory map */
|
/* flash mapped at end of memory map */
|
||||||
bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size;
|
bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size;
|
||||||
# elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
|
#elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
|
||||||
bd->bi_flashoffset = monitor_flash_len; /* reserved area for startup monitor */
|
bd->bi_flashoffset = monitor_flash_len; /* reserved area for monitor */
|
||||||
# endif
|
#endif
|
||||||
#endif /* !CONFIG_SYS_NO_FLASH */
|
#endif /* !CONFIG_SYS_NO_FLASH */
|
||||||
|
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
|
|
||||||
/* initialize higher level parts of CPU like time base and timers */
|
/* initialize higher level parts of CPU like time base and timers */
|
||||||
cpu_init_r ();
|
cpu_init_r();
|
||||||
|
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
|
|
||||||
#ifdef CONFIG_SPI
|
#ifdef CONFIG_SPI
|
||||||
# if !defined(CONFIG_ENV_IS_IN_EEPROM)
|
#if !defined(CONFIG_ENV_IS_IN_EEPROM)
|
||||||
spi_init_f ();
|
spi_init_f();
|
||||||
# endif
|
#endif
|
||||||
spi_init_r ();
|
spi_init_r();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_NAND)
|
#if defined(CONFIG_CMD_NAND)
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
puts ("NAND: ");
|
puts("NAND: ");
|
||||||
nand_init(); /* go init the NAND */
|
nand_init(); /* go init the NAND */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -794,13 +802,13 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
|||||||
* Thus It is required that operations like pin multiplexer
|
* Thus It is required that operations like pin multiplexer
|
||||||
* be put in board_init.
|
* be put in board_init.
|
||||||
*/
|
*/
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
puts ("MMC: ");
|
puts("MMC: ");
|
||||||
mmc_initialize (bd);
|
mmc_initialize(bd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* relocate environment function pointers etc. */
|
/* relocate environment function pointers etc. */
|
||||||
env_relocate ();
|
env_relocate();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* after non-volatile devices & environment is setup and cpu code have
|
* after non-volatile devices & environment is setup and cpu code have
|
||||||
@ -826,21 +834,22 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
|||||||
* "i2cfast" into account
|
* "i2cfast" into account
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char *s = getenv ("i2cfast");
|
char *s = getenv("i2cfast");
|
||||||
|
|
||||||
if (s && ((*s == 'y') || (*s == 'Y'))) {
|
if (s && ((*s == 'y') || (*s == 'Y'))) {
|
||||||
bd->bi_iic_fast[0] = 1;
|
bd->bi_iic_fast[0] = 1;
|
||||||
bd->bi_iic_fast[1] = 1;
|
bd->bi_iic_fast[1] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_I2CFAST */
|
#endif /* CONFIG_I2CFAST */
|
||||||
#endif /* CONFIG_405GP, CONFIG_405EP */
|
#endif /* CONFIG_405GP, CONFIG_405EP */
|
||||||
#endif /* CONFIG_SYS_EXTBDINFO */
|
#endif /* CONFIG_SYS_EXTBDINFO */
|
||||||
|
|
||||||
#if defined(CONFIG_SC3)
|
#if defined(CONFIG_SC3)
|
||||||
sc3_read_eeprom();
|
sc3_read_eeprom();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (CONFIG_ID_EEPROM) || defined (CONFIG_SYS_I2C_MAC_OFFSET)
|
#if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET)
|
||||||
mac_read_from_eeprom();
|
mac_read_from_eeprom();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -872,60 +881,60 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
|||||||
#endif /* CONFIG_CMD_NET */
|
#endif /* CONFIG_CMD_NET */
|
||||||
|
|
||||||
/* IP Address */
|
/* IP Address */
|
||||||
bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
|
bd->bi_ip_addr = getenv_IPaddr("ipaddr");
|
||||||
|
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
|
|
||||||
#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
|
#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
|
||||||
/*
|
/*
|
||||||
* Do pci configuration
|
* Do pci configuration
|
||||||
*/
|
*/
|
||||||
pci_init ();
|
pci_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** leave this here (after malloc(), environment and PCI are working) **/
|
/** leave this here (after malloc(), environment and PCI are working) **/
|
||||||
/* Initialize stdio devices */
|
/* Initialize stdio devices */
|
||||||
stdio_init ();
|
stdio_init();
|
||||||
|
|
||||||
/* Initialize the jump table for applications */
|
/* Initialize the jump table for applications */
|
||||||
jumptable_init ();
|
jumptable_init();
|
||||||
|
|
||||||
#if defined(CONFIG_API)
|
#if defined(CONFIG_API)
|
||||||
/* Initialize API */
|
/* Initialize API */
|
||||||
api_init ();
|
api_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize the console (after the relocation and devices init) */
|
/* Initialize the console (after the relocation and devices init) */
|
||||||
console_init_r ();
|
console_init_r();
|
||||||
|
|
||||||
#if defined(CONFIG_MISC_INIT_R)
|
#if defined(CONFIG_MISC_INIT_R)
|
||||||
/* miscellaneous platform dependent initialisations */
|
/* miscellaneous platform dependent initialisations */
|
||||||
misc_init_r ();
|
misc_init_r();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_HERMES
|
#ifdef CONFIG_HERMES
|
||||||
if (bd->bi_ethspeed != 0xFFFF)
|
if (bd->bi_ethspeed != 0xFFFF)
|
||||||
hermes_start_lxt980 ((int) bd->bi_ethspeed);
|
hermes_start_lxt980((int) bd->bi_ethspeed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_KGDB)
|
#if defined(CONFIG_CMD_KGDB)
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
puts ("KGDB: ");
|
puts("KGDB: ");
|
||||||
kgdb_init ();
|
kgdb_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
debug ("U-Boot relocated to %08lx\n", dest_addr);
|
debug("U-Boot relocated to %08lx\n", dest_addr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable Interrupts
|
* Enable Interrupts
|
||||||
*/
|
*/
|
||||||
interrupt_init ();
|
interrupt_init();
|
||||||
|
|
||||||
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
|
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
|
||||||
status_led_set (STATUS_LED_BOOT, STATUS_LED_BLINKING);
|
status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
udelay (20);
|
udelay(20);
|
||||||
|
|
||||||
/* Initialize from environment */
|
/* Initialize from environment */
|
||||||
load_addr = getenv_ulong("loadaddr", 16, load_addr);
|
load_addr = getenv_ulong("loadaddr", 16, load_addr);
|
||||||
@ -938,74 +947,74 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_SCSI)
|
#if defined(CONFIG_CMD_SCSI)
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
puts ("SCSI: ");
|
puts("SCSI: ");
|
||||||
scsi_init ();
|
scsi_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_DOC)
|
#if defined(CONFIG_CMD_DOC)
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
puts ("DOC: ");
|
puts("DOC: ");
|
||||||
doc_init ();
|
doc_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_BITBANGMII
|
#ifdef CONFIG_BITBANGMII
|
||||||
bb_miiphy_init();
|
bb_miiphy_init();
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_CMD_NET)
|
#if defined(CONFIG_CMD_NET)
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
puts ("Net: ");
|
puts("Net: ");
|
||||||
eth_initialize (bd);
|
eth_initialize(bd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
|
#if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
debug ("Reset Ethernet PHY\n");
|
debug("Reset Ethernet PHY\n");
|
||||||
reset_phy ();
|
reset_phy();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_POST
|
#ifdef CONFIG_POST
|
||||||
post_run (NULL, POST_RAM | post_bootmode_get(0));
|
post_run(NULL, POST_RAM | post_bootmode_get(0));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_PCMCIA) \
|
#if defined(CONFIG_CMD_PCMCIA) \
|
||||||
&& !defined(CONFIG_CMD_IDE)
|
&& !defined(CONFIG_CMD_IDE)
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
puts ("PCMCIA:");
|
puts("PCMCIA:");
|
||||||
pcmcia_init ();
|
pcmcia_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_IDE)
|
#if defined(CONFIG_CMD_IDE)
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
# ifdef CONFIG_IDE_8xx_PCCARD
|
#ifdef CONFIG_IDE_8xx_PCCARD
|
||||||
puts ("PCMCIA:");
|
puts("PCMCIA:");
|
||||||
# else
|
#else
|
||||||
puts ("IDE: ");
|
puts("IDE: ");
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_START_IDE)
|
#if defined(CONFIG_START_IDE)
|
||||||
if (board_start_ide())
|
if (board_start_ide())
|
||||||
ide_init ();
|
ide_init();
|
||||||
#else
|
#else
|
||||||
ide_init ();
|
ide_init();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_LAST_STAGE_INIT
|
#ifdef CONFIG_LAST_STAGE_INIT
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
/*
|
/*
|
||||||
* Some parts can be only initialized if all others (like
|
* Some parts can be only initialized if all others (like
|
||||||
* Interrupts) are up and running (i.e. the PC-style ISA
|
* Interrupts) are up and running (i.e. the PC-style ISA
|
||||||
* keyboard).
|
* keyboard).
|
||||||
*/
|
*/
|
||||||
last_stage_init ();
|
last_stage_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_BEDBUG)
|
#if defined(CONFIG_CMD_BEDBUG)
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
bedbug_init ();
|
bedbug_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
|
#if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
|
||||||
@ -1023,46 +1032,49 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
|||||||
#ifdef CONFIG_LOGBUFFER
|
#ifdef CONFIG_LOGBUFFER
|
||||||
#ifndef CONFIG_ALT_LB_ADDR
|
#ifndef CONFIG_ALT_LB_ADDR
|
||||||
/* Also take the logbuffer into account (pram is in kB) */
|
/* Also take the logbuffer into account (pram is in kB) */
|
||||||
pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024;
|
pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
|
sprintf((char *) memsz, "%ldk",
|
||||||
setenv ("mem", (char *)memsz);
|
(bd->bi_memsize / 1024) - pram);
|
||||||
|
setenv("mem", (char *) memsz);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_PS2KBD
|
#ifdef CONFIG_PS2KBD
|
||||||
puts ("PS/2: ");
|
puts("PS/2: ");
|
||||||
kbd_init();
|
kbd_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MODEM_SUPPORT
|
#ifdef CONFIG_MODEM_SUPPORT
|
||||||
{
|
{
|
||||||
extern int do_mdm_init;
|
extern int do_mdm_init;
|
||||||
do_mdm_init = gd->do_mdm_init;
|
|
||||||
}
|
do_mdm_init = gd->do_mdm_init;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialization complete - start the monitor */
|
/* Initialization complete - start the monitor */
|
||||||
|
|
||||||
/* main_loop() can return to retry autoboot, if so just run it again. */
|
/* main_loop() can return to retry autoboot, if so just run it again. */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
WATCHDOG_RESET ();
|
WATCHDOG_RESET();
|
||||||
main_loop ();
|
main_loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTREACHED - no way out of command loop except booting */
|
/* NOTREACHED - no way out of command loop except booting */
|
||||||
}
|
}
|
||||||
|
|
||||||
void hang (void)
|
void hang(void)
|
||||||
{
|
{
|
||||||
puts ("### ERROR ### Please RESET the board ###\n");
|
puts("### ERROR ### Please RESET the board ###\n");
|
||||||
show_boot_progress(-30);
|
show_boot_progress(-30);
|
||||||
for (;;);
|
for (;;)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0 /* We could use plain global data, but the resulting code is bigger */
|
#if 0 /* We could use plain global data, but the resulting code is bigger */
|
||||||
/*
|
/*
|
||||||
* Pointer to initial global data area
|
* Pointer to initial global data area
|
||||||
*
|
*
|
||||||
@ -1070,7 +1082,8 @@ void hang (void)
|
|||||||
*/
|
*/
|
||||||
#undef XTRN_DECLARE_GLOBAL_DATA_PTR
|
#undef XTRN_DECLARE_GLOBAL_DATA_PTR
|
||||||
#define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */
|
#define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */
|
||||||
DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
|
DECLARE_GLOBAL_DATA_PTR =
|
||||||
#endif /* 0 */
|
(gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user