2006-03-12 01:12:27 +00:00
|
|
|
/*
|
|
|
|
* U-boot - board.c First C file to be called contains init routines
|
|
|
|
*
|
2008-02-19 05:54:20 +00:00
|
|
|
* Copyright (c) 2005-2008 Analog Devices Inc.
|
2006-03-12 01:12:27 +00:00
|
|
|
*
|
|
|
|
* (C) Copyright 2000-2004
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*
|
2008-02-19 05:54:20 +00:00
|
|
|
* Licensed under the GPL-2 or later.
|
2006-03-12 01:12:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
2009-05-16 10:14:54 +00:00
|
|
|
#include <stdio_dev.h>
|
2011-04-30 03:23:28 +00:00
|
|
|
#include <serial.h>
|
2006-03-12 01:12:27 +00:00
|
|
|
#include <environment.h>
|
2008-02-19 05:54:20 +00:00
|
|
|
#include <malloc.h>
|
2009-11-20 08:24:43 +00:00
|
|
|
#include <mmc.h>
|
2008-02-19 05:54:20 +00:00
|
|
|
#include <net.h>
|
2008-10-06 07:52:24 +00:00
|
|
|
#include <status_led.h>
|
2008-02-19 05:54:20 +00:00
|
|
|
#include <version.h>
|
2013-12-09 04:56:27 +00:00
|
|
|
#include <watchdog.h>
|
2008-02-19 05:54:20 +00:00
|
|
|
|
2007-03-09 05:38:44 +00:00
|
|
|
#include <asm/cplb.h>
|
2008-02-19 05:54:20 +00:00
|
|
|
#include <asm/mach-common/bits/mpu.h>
|
2009-12-21 21:35:48 +00:00
|
|
|
#include <kgdb.h>
|
2008-02-19 05:54:20 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_CMD_NAND
|
|
|
|
#include <nand.h> /* cannot even include nand.h if it isnt configured */
|
|
|
|
#endif
|
2006-03-12 01:12:27 +00:00
|
|
|
|
2009-10-10 10:42:21 +00:00
|
|
|
#ifdef CONFIG_BITBANGMII
|
|
|
|
#include <miiphy.h>
|
|
|
|
#endif
|
|
|
|
|
2008-03-30 19:46:13 +00:00
|
|
|
#if defined(CONFIG_POST)
|
2007-03-09 05:38:44 +00:00
|
|
|
#include <post.h>
|
|
|
|
int post_flag;
|
|
|
|
#endif
|
2006-03-31 16:32:53 +00:00
|
|
|
|
2012-01-16 21:12:24 +00:00
|
|
|
#if defined(CONFIG_SYS_I2C)
|
|
|
|
#include <i2c.h>
|
|
|
|
#endif
|
|
|
|
|
2007-09-15 18:48:41 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2008-02-19 05:54:20 +00:00
|
|
|
__attribute__((always_inline))
|
|
|
|
static inline void serial_early_puts(const char *s)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_DEBUG_EARLY_SERIAL
|
|
|
|
serial_puts("Early: ");
|
|
|
|
serial_puts(s);
|
2007-03-09 05:38:44 +00:00
|
|
|
#endif
|
2008-02-19 05:54:20 +00:00
|
|
|
}
|
2006-03-12 01:12:27 +00:00
|
|
|
|
|
|
|
static int display_banner(void)
|
|
|
|
{
|
2011-06-30 22:26:39 +00:00
|
|
|
display_options();
|
2010-08-09 21:39:22 +00:00
|
|
|
printf("CPU: ADSP %s "
|
2009-01-06 11:16:19 +00:00
|
|
|
"(Detected Rev: 0.%d) "
|
|
|
|
"(%s boot)\n",
|
2010-08-09 21:39:22 +00:00
|
|
|
gd->bd->bi_cpu,
|
2009-01-06 11:16:19 +00:00
|
|
|
bfin_revid(),
|
|
|
|
get_bfin_boot_mode(CONFIG_BFIN_BOOT_MODE));
|
2008-02-19 05:54:20 +00:00
|
|
|
return 0;
|
2006-03-12 01:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int init_baudrate(void)
|
|
|
|
{
|
2011-10-13 14:43:08 +00:00
|
|
|
gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
|
2013-07-01 05:16:17 +00:00
|
|
|
gd->bd->bi_baudrate = gd->baudrate;
|
2008-02-19 05:54:20 +00:00
|
|
|
return 0;
|
2006-03-12 01:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void display_global_data(void)
|
|
|
|
{
|
|
|
|
bd_t *bd;
|
2010-01-19 20:39:07 +00:00
|
|
|
|
|
|
|
#ifndef CONFIG_DEBUG_EARLY_SERIAL
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
2006-03-12 01:12:27 +00:00
|
|
|
bd = gd->bd;
|
2009-08-24 23:03:18 +00:00
|
|
|
printf(" gd: %p\n", gd);
|
|
|
|
printf(" |-flags: %lx\n", gd->flags);
|
2013-03-05 14:39:59 +00:00
|
|
|
printf(" |-board_type: %lx\n", gd->arch.board_type);
|
2012-10-12 14:21:17 +00:00
|
|
|
printf(" |-baudrate: %u\n", gd->baudrate);
|
2009-08-24 23:03:18 +00:00
|
|
|
printf(" |-have_console: %lx\n", gd->have_console);
|
|
|
|
printf(" |-ram_size: %lx\n", gd->ram_size);
|
|
|
|
printf(" |-env_addr: %lx\n", gd->env_addr);
|
|
|
|
printf(" |-env_valid: %lx\n", gd->env_valid);
|
|
|
|
printf(" |-jt(%p): %p\n", gd->jt, *(gd->jt));
|
|
|
|
printf(" \\-bd: %p\n", gd->bd);
|
2008-02-19 05:54:20 +00:00
|
|
|
printf(" |-bi_baudrate: %x\n", bd->bi_baudrate);
|
2009-08-24 23:03:18 +00:00
|
|
|
printf(" |-bi_boot_params: %lx\n", bd->bi_boot_params);
|
|
|
|
printf(" |-bi_memstart: %lx\n", bd->bi_memstart);
|
|
|
|
printf(" |-bi_memsize: %lx\n", bd->bi_memsize);
|
|
|
|
printf(" |-bi_flashstart: %lx\n", bd->bi_flashstart);
|
|
|
|
printf(" |-bi_flashsize: %lx\n", bd->bi_flashsize);
|
|
|
|
printf(" \\-bi_flashoffset: %lx\n", bd->bi_flashoffset);
|
2008-02-19 05:54:20 +00:00
|
|
|
}
|
2006-03-12 01:12:27 +00:00
|
|
|
|
2008-02-19 05:54:20 +00:00
|
|
|
#define CPLB_PAGE_SIZE (4 * 1024 * 1024)
|
|
|
|
#define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1))
|
2011-10-25 10:07:58 +00:00
|
|
|
#if defined(__ADSPBF60x__)
|
|
|
|
#define CPLB_EX_PAGE_SIZE (16 * 1024 * 1024)
|
|
|
|
#define CPLB_EX_PAGE_MASK (~(CPLB_EX_PAGE_SIZE - 1))
|
|
|
|
#else
|
|
|
|
#define CPLB_EX_PAGE_SIZE CPLB_PAGE_SIZE
|
|
|
|
#define CPLB_EX_PAGE_MASK CPLB_PAGE_MASK
|
|
|
|
#endif
|
2007-03-09 05:38:44 +00:00
|
|
|
void init_cplbtables(void)
|
|
|
|
{
|
2008-02-19 05:54:20 +00:00
|
|
|
volatile uint32_t *ICPLB_ADDR, *ICPLB_DATA;
|
|
|
|
volatile uint32_t *DCPLB_ADDR, *DCPLB_DATA;
|
|
|
|
uint32_t extern_memory;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
void icplb_add(uint32_t addr, uint32_t data)
|
|
|
|
{
|
|
|
|
*(ICPLB_ADDR + i) = addr;
|
|
|
|
*(ICPLB_DATA + i) = data;
|
2007-03-09 05:38:44 +00:00
|
|
|
}
|
2008-02-19 05:54:20 +00:00
|
|
|
void dcplb_add(uint32_t addr, uint32_t data)
|
|
|
|
{
|
|
|
|
*(DCPLB_ADDR + i) = addr;
|
|
|
|
*(DCPLB_DATA + i) = data;
|
2007-03-09 05:38:44 +00:00
|
|
|
}
|
|
|
|
|
2008-02-19 05:54:20 +00:00
|
|
|
/* populate a few common entries ... we'll let
|
|
|
|
* the memory map and cplb exception handler do
|
|
|
|
* the rest of the work.
|
|
|
|
*/
|
|
|
|
i = 0;
|
|
|
|
ICPLB_ADDR = (uint32_t *)ICPLB_ADDR0;
|
|
|
|
ICPLB_DATA = (uint32_t *)ICPLB_DATA0;
|
|
|
|
DCPLB_ADDR = (uint32_t *)DCPLB_ADDR0;
|
|
|
|
DCPLB_DATA = (uint32_t *)DCPLB_DATA0;
|
|
|
|
|
|
|
|
icplb_add(0xFFA00000, L1_IMEMORY);
|
|
|
|
dcplb_add(0xFF800000, L1_DMEMORY);
|
|
|
|
++i;
|
2011-10-25 10:07:58 +00:00
|
|
|
#if defined(__ADSPBF60x__)
|
|
|
|
icplb_add(0x0, 0x0);
|
|
|
|
dcplb_add(CONFIG_SYS_FLASH_BASE, SDRAM_EBIU);
|
|
|
|
++i;
|
|
|
|
#endif
|
2008-02-19 05:54:20 +00:00
|
|
|
|
2009-11-10 00:38:23 +00:00
|
|
|
if (CONFIG_MEM_SIZE) {
|
|
|
|
uint32_t mbase = CONFIG_SYS_MONITOR_BASE;
|
|
|
|
uint32_t mend = mbase + CONFIG_SYS_MONITOR_LEN;
|
|
|
|
mbase &= CPLB_PAGE_MASK;
|
|
|
|
mend &= CPLB_PAGE_MASK;
|
|
|
|
|
|
|
|
icplb_add(mbase, SDRAM_IKERNEL);
|
|
|
|
dcplb_add(mbase, SDRAM_DKERNEL);
|
2008-02-19 05:54:20 +00:00
|
|
|
++i;
|
2009-11-10 00:38:23 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If the monitor crosses a 4 meg boundary, we'll need
|
|
|
|
* to lock two entries for it. We assume it doesn't
|
|
|
|
* cross two 4 meg boundaries ...
|
|
|
|
*/
|
|
|
|
if (mbase != mend) {
|
|
|
|
icplb_add(mend, SDRAM_IKERNEL);
|
|
|
|
dcplb_add(mend, SDRAM_DKERNEL);
|
|
|
|
++i;
|
|
|
|
}
|
2008-02-19 05:54:20 +00:00
|
|
|
}
|
|
|
|
|
2011-10-25 10:07:58 +00:00
|
|
|
#ifndef __ADSPBF60x__
|
2008-02-19 05:54:20 +00:00
|
|
|
icplb_add(0x20000000, SDRAM_INON_CHBL);
|
|
|
|
dcplb_add(0x20000000, SDRAM_EBIU);
|
|
|
|
++i;
|
2011-10-25 10:07:58 +00:00
|
|
|
#endif
|
2008-02-19 05:54:20 +00:00
|
|
|
|
|
|
|
/* Add entries for the rest of external RAM up to the bootrom */
|
|
|
|
extern_memory = 0;
|
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_NULL_PTR
|
|
|
|
icplb_add(extern_memory, (SDRAM_IKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
|
|
|
|
dcplb_add(extern_memory, (SDRAM_DKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
|
|
|
|
++i;
|
|
|
|
icplb_add(extern_memory, SDRAM_IKERNEL);
|
|
|
|
dcplb_add(extern_memory, SDRAM_DKERNEL);
|
|
|
|
extern_memory += CPLB_PAGE_SIZE;
|
|
|
|
++i;
|
|
|
|
#endif
|
|
|
|
|
2011-10-25 10:07:58 +00:00
|
|
|
while (i < 16 && extern_memory <
|
|
|
|
(CONFIG_SYS_MONITOR_BASE & CPLB_EX_PAGE_MASK)) {
|
2008-02-19 05:54:20 +00:00
|
|
|
icplb_add(extern_memory, SDRAM_IGENERIC);
|
|
|
|
dcplb_add(extern_memory, SDRAM_DGENERIC);
|
2011-10-25 10:07:58 +00:00
|
|
|
extern_memory += CPLB_EX_PAGE_SIZE;
|
2008-02-19 05:54:20 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
while (i < 16) {
|
|
|
|
icplb_add(0, 0);
|
|
|
|
dcplb_add(0, 0);
|
|
|
|
++i;
|
|
|
|
}
|
2007-03-09 05:38:44 +00:00
|
|
|
}
|
|
|
|
|
2012-03-01 03:48:10 +00:00
|
|
|
static int global_board_data_init(void)
|
|
|
|
{
|
|
|
|
#ifndef CONFIG_SYS_GBL_DATA_ADDR
|
|
|
|
# define CONFIG_SYS_GBL_DATA_ADDR 0
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_SYS_BD_INFO_ADDR
|
|
|
|
# define CONFIG_SYS_BD_INFO_ADDR 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
bd_t *bd;
|
|
|
|
|
|
|
|
if (CONFIG_SYS_GBL_DATA_ADDR) {
|
|
|
|
gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR);
|
|
|
|
memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
|
|
|
|
} else {
|
|
|
|
static gd_t _bfin_gd;
|
|
|
|
gd = &_bfin_gd;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CONFIG_SYS_BD_INFO_ADDR) {
|
|
|
|
bd = (bd_t *) (CONFIG_SYS_BD_INFO_ADDR);
|
|
|
|
memset(bd, 0, GENERATED_BD_INFO_SIZE);
|
|
|
|
} else {
|
|
|
|
static bd_t _bfin_bd;
|
|
|
|
bd = &_bfin_bd;
|
|
|
|
}
|
|
|
|
gd->bd = bd;
|
|
|
|
|
|
|
|
bd->bi_r_version = version_string;
|
2012-09-23 15:41:24 +00:00
|
|
|
bd->bi_cpu = __stringify(CONFIG_BFIN_CPU);
|
2012-03-01 03:48:10 +00:00
|
|
|
bd->bi_board_name = BFIN_BOARD_NAME;
|
|
|
|
bd->bi_vco = get_vco();
|
|
|
|
bd->bi_cclk = get_cclk();
|
|
|
|
bd->bi_sclk = get_sclk();
|
|
|
|
bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
|
|
|
|
bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-03-12 01:12:27 +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".
|
|
|
|
*/
|
|
|
|
|
2010-02-12 01:19:10 +00:00
|
|
|
extern int watchdog_init(void);
|
2008-02-19 05:54:20 +00:00
|
|
|
extern int exception_init(void);
|
|
|
|
extern int irq_init(void);
|
|
|
|
extern int timer_init(void);
|
|
|
|
|
2006-03-12 01:12:27 +00:00
|
|
|
void board_init_f(ulong bootflag)
|
|
|
|
{
|
2008-10-20 20:15:04 +00:00
|
|
|
char buf[32];
|
2007-03-09 05:38:44 +00:00
|
|
|
|
2008-02-19 05:54:20 +00:00
|
|
|
#ifdef CONFIG_BOARD_EARLY_INIT_F
|
|
|
|
serial_early_puts("Board early init flash\n");
|
|
|
|
board_early_init_f();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
serial_early_puts("Init CPLB tables\n");
|
2007-03-09 05:38:44 +00:00
|
|
|
init_cplbtables();
|
2006-03-12 01:12:27 +00:00
|
|
|
|
2008-02-19 05:54:20 +00:00
|
|
|
serial_early_puts("Exceptions setup\n");
|
|
|
|
exception_init();
|
|
|
|
|
|
|
|
#ifndef CONFIG_ICACHE_OFF
|
|
|
|
serial_early_puts("Turn on ICACHE\n");
|
|
|
|
icache_enable();
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_DCACHE_OFF
|
|
|
|
serial_early_puts("Turn on DCACHE\n");
|
|
|
|
dcache_enable();
|
|
|
|
#endif
|
|
|
|
|
2013-04-07 10:02:37 +00:00
|
|
|
#ifdef CONFIG_HW_WATCHDOG
|
2010-02-12 01:19:10 +00:00
|
|
|
serial_early_puts("Setting up external watchdog\n");
|
2013-04-07 10:02:37 +00:00
|
|
|
hw_watchdog_init();
|
2010-02-12 01:19:10 +00:00
|
|
|
#endif
|
|
|
|
|
2008-10-06 07:57:39 +00:00
|
|
|
#ifdef DEBUG
|
2010-10-26 12:34:52 +00:00
|
|
|
if (GENERATED_GBL_DATA_SIZE < sizeof(*gd))
|
2008-10-06 07:57:39 +00:00
|
|
|
hang();
|
|
|
|
#endif
|
2008-02-19 05:54:20 +00:00
|
|
|
serial_early_puts("Init global data\n");
|
2006-03-12 01:12:27 +00:00
|
|
|
|
2012-03-01 03:48:10 +00:00
|
|
|
global_board_data_init();
|
2008-02-19 05:54:20 +00:00
|
|
|
|
2006-03-12 01:12:27 +00:00
|
|
|
/* Initialize */
|
2008-02-19 05:54:20 +00:00
|
|
|
serial_early_puts("IRQ init\n");
|
2008-03-30 19:46:13 +00:00
|
|
|
irq_init();
|
2008-02-19 05:54:20 +00:00
|
|
|
serial_early_puts("Environment init\n");
|
|
|
|
env_init();
|
|
|
|
serial_early_puts("Baudrate init\n");
|
|
|
|
init_baudrate();
|
|
|
|
serial_early_puts("Serial init\n");
|
|
|
|
serial_init();
|
2011-04-30 03:23:28 +00:00
|
|
|
serial_initialize();
|
2008-02-19 05:54:20 +00:00
|
|
|
serial_early_puts("Console init flash\n");
|
2006-03-12 01:12:27 +00:00
|
|
|
console_init_f();
|
2008-02-19 05:54:20 +00:00
|
|
|
serial_early_puts("End of early debugging\n");
|
|
|
|
display_banner();
|
2007-03-09 05:38:44 +00:00
|
|
|
|
2006-03-12 01:12:27 +00:00
|
|
|
checkboard();
|
|
|
|
timer_init();
|
2008-02-19 05:54:20 +00:00
|
|
|
|
2008-10-20 20:15:04 +00:00
|
|
|
printf("Clock: VCO: %s MHz, ", strmhz(buf, get_vco()));
|
|
|
|
printf("Core: %s MHz, ", strmhz(buf, get_cclk()));
|
2012-08-16 03:56:14 +00:00
|
|
|
#if defined(__ADSPBF60x__)
|
|
|
|
printf("System0: %s MHz, ", strmhz(buf, get_sclk0()));
|
|
|
|
printf("System1: %s MHz, ", strmhz(buf, get_sclk1()));
|
|
|
|
printf("Dclk: %s MHz\n", strmhz(buf, get_dclk()));
|
|
|
|
#else
|
2008-10-20 20:15:04 +00:00
|
|
|
printf("System: %s MHz\n", strmhz(buf, get_sclk()));
|
2012-08-16 03:56:14 +00:00
|
|
|
#endif
|
2008-02-19 05:54:20 +00:00
|
|
|
|
2010-12-20 10:18:55 +00:00
|
|
|
if (CONFIG_MEM_SIZE) {
|
|
|
|
printf("RAM: ");
|
2012-03-01 03:48:10 +00:00
|
|
|
print_size(gd->bd->bi_memsize, "\n");
|
2010-12-20 10:18:55 +00:00
|
|
|
}
|
|
|
|
|
2008-03-30 19:46:13 +00:00
|
|
|
#if defined(CONFIG_POST)
|
2007-03-09 05:38:44 +00:00
|
|
|
post_init_f();
|
|
|
|
post_bootmode_init();
|
|
|
|
post_run(NULL, POST_ROM | post_bootmode_get(0));
|
|
|
|
#endif
|
2008-02-19 05:54:20 +00:00
|
|
|
|
2006-03-12 01:12:27 +00:00
|
|
|
board_init_r((gd_t *) gd, 0x20000010);
|
|
|
|
}
|
|
|
|
|
2009-02-22 21:02:27 +00:00
|
|
|
static void board_net_init_r(bd_t *bd)
|
|
|
|
{
|
2009-10-10 10:42:21 +00:00
|
|
|
#ifdef CONFIG_BITBANGMII
|
|
|
|
bb_miiphy_init();
|
|
|
|
#endif
|
2009-02-22 21:02:27 +00:00
|
|
|
#ifdef CONFIG_CMD_NET
|
|
|
|
printf("Net: ");
|
2012-04-04 18:53:41 +00:00
|
|
|
eth_initialize(bd);
|
2009-02-22 21:02:27 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-03-12 01:12:27 +00:00
|
|
|
void board_init_r(gd_t * id, ulong dest_addr)
|
|
|
|
{
|
|
|
|
bd_t *bd;
|
|
|
|
gd = id;
|
|
|
|
gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
|
|
|
|
bd = gd->bd;
|
|
|
|
|
2008-03-30 19:46:13 +00:00
|
|
|
#if defined(CONFIG_POST)
|
2007-03-09 05:38:44 +00:00
|
|
|
post_output_backlog();
|
|
|
|
#endif
|
|
|
|
|
2009-05-11 13:50:12 +00:00
|
|
|
/* initialize malloc() area */
|
2009-08-22 04:05:20 +00:00
|
|
|
mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
|
2009-05-11 13:50:12 +00:00
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#if !defined(CONFIG_SYS_NO_FLASH)
|
2008-10-06 08:00:07 +00:00
|
|
|
/* Initialize the flash and protect u-boot by default */
|
2008-02-19 05:54:20 +00:00
|
|
|
extern flash_info_t flash_info[];
|
|
|
|
puts("Flash: ");
|
2008-10-06 08:01:26 +00:00
|
|
|
ulong size = flash_init();
|
2008-02-19 05:54:20 +00:00
|
|
|
print_size(size, "\n");
|
2008-10-16 13:01:15 +00:00
|
|
|
flash_protect(FLAG_PROTECT_SET, CONFIG_SYS_FLASH_BASE,
|
2008-10-06 08:00:07 +00:00
|
|
|
CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN - 1,
|
|
|
|
&flash_info[0]);
|
2008-10-16 13:01:15 +00:00
|
|
|
bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
|
2006-03-12 01:12:27 +00:00
|
|
|
bd->bi_flashsize = size;
|
|
|
|
bd->bi_flashoffset = 0;
|
|
|
|
#else
|
|
|
|
bd->bi_flashstart = 0;
|
|
|
|
bd->bi_flashsize = 0;
|
|
|
|
bd->bi_flashoffset = 0;
|
|
|
|
#endif
|
|
|
|
|
2008-10-06 07:55:25 +00:00
|
|
|
#ifdef CONFIG_CMD_NAND
|
|
|
|
puts("NAND: ");
|
|
|
|
nand_init(); /* go init the NAND */
|
|
|
|
#endif
|
|
|
|
|
2009-11-20 08:24:43 +00:00
|
|
|
#ifdef CONFIG_GENERIC_MMC
|
2010-09-29 18:46:42 +00:00
|
|
|
puts("MMC: ");
|
2009-11-20 08:24:43 +00:00
|
|
|
mmc_initialize(bd);
|
|
|
|
#endif
|
|
|
|
|
2012-01-16 21:12:24 +00:00
|
|
|
#if defined(CONFIG_SYS_I2C)
|
|
|
|
i2c_reloc_fixup();
|
|
|
|
#endif
|
2006-03-12 01:12:27 +00:00
|
|
|
/* relocate environment function pointers etc. */
|
|
|
|
env_relocate();
|
|
|
|
|
2009-05-16 10:14:54 +00:00
|
|
|
/* Initialize stdio devices */
|
|
|
|
stdio_init();
|
2006-03-12 01:12:27 +00:00
|
|
|
jumptable_init();
|
|
|
|
|
|
|
|
/* Initialize the console (after the relocation and devices init) */
|
|
|
|
console_init_r();
|
|
|
|
|
2009-12-21 21:35:48 +00:00
|
|
|
#ifdef CONFIG_CMD_KGDB
|
|
|
|
puts("KGDB: ");
|
|
|
|
kgdb_init();
|
|
|
|
#endif
|
|
|
|
|
2008-10-06 07:52:24 +00:00
|
|
|
#ifdef CONFIG_STATUS_LED
|
|
|
|
status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
|
|
|
|
status_led_set(STATUS_LED_CRASH, STATUS_LED_OFF);
|
|
|
|
#endif
|
|
|
|
|
2006-03-12 01:12:27 +00:00
|
|
|
/* Initialize from environment */
|
2011-10-13 14:43:08 +00:00
|
|
|
load_addr = getenv_ulong("loadaddr", 16, load_addr);
|
2007-03-09 05:38:44 +00:00
|
|
|
|
2006-03-12 01:12:27 +00:00
|
|
|
#if defined(CONFIG_MISC_INIT_R)
|
|
|
|
/* miscellaneous platform dependent initialisations */
|
|
|
|
misc_init_r();
|
|
|
|
#endif
|
|
|
|
|
2009-02-22 21:02:27 +00:00
|
|
|
board_net_init_r(bd);
|
2006-03-12 01:12:27 +00:00
|
|
|
|
2007-03-09 05:38:44 +00:00
|
|
|
display_global_data();
|
|
|
|
|
2008-03-30 19:46:13 +00:00
|
|
|
#if defined(CONFIG_POST)
|
2007-03-09 05:38:44 +00:00
|
|
|
if (post_flag)
|
|
|
|
post_run(NULL, POST_RAM | post_bootmode_get(0));
|
2006-03-12 01:12:27 +00:00
|
|
|
#endif
|
|
|
|
|
2010-12-24 18:19:25 +00:00
|
|
|
if (CONFIG_MEM_SIZE && bfin_os_log_check()) {
|
2009-07-09 05:15:05 +00:00
|
|
|
puts("\nLog buffer from operating system:\n");
|
|
|
|
bfin_os_log_dump();
|
|
|
|
puts("\n");
|
|
|
|
}
|
|
|
|
|
2006-03-12 01:12:27 +00:00
|
|
|
/* main_loop() can return to retry autoboot, if so just run it again. */
|
2008-02-19 05:54:20 +00:00
|
|
|
for (;;)
|
2006-03-12 01:12:27 +00:00
|
|
|
main_loop();
|
|
|
|
}
|