summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig4
-rw-r--r--common/board_f.c236
-rw-r--r--common/board_r.c35
3 files changed, 39 insertions, 236 deletions
diff --git a/common/Kconfig b/common/Kconfig
index 8f73c8f..1e0c627 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -379,7 +379,7 @@ config BOARD_LATE_INIT
config DISPLAY_CPUINFO
bool "Display information about the CPU during start up"
- default y if ARM || BLACKFIN || NIOS2 || X86 || XTENSA || MPC5xxx
+ default y if ARM || NIOS2 || X86 || XTENSA || MPC5xxx
help
Display information about the CPU that U-Boot is running on
when U-Boot starts up. The function print_cpuinfo() is called
@@ -387,7 +387,7 @@ config DISPLAY_CPUINFO
config DISPLAY_BOARDINFO
bool "Display information about the board during start up"
- default y if ARM || M68K || MIPS || PPC || SPARC || XTENSA
+ default y if ARM || M68K || MIPS || PPC || XTENSA
help
Display information about the board that U-Boot is running on
when U-Boot starts up. The board function checkboard() is called
diff --git a/common/board_f.c b/common/board_f.c
index bb24a63..224fbed 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -11,58 +11,33 @@
*/
#include <common.h>
-#include <linux/compiler.h>
-#include <version.h>
#include <console.h>
#include <environment.h>
#include <dm.h>
#include <fdtdec.h>
#include <fs.h>
-#if defined(CONFIG_CMD_IDE)
-#include <ide.h>
-#endif
#include <i2c.h>
#include <initcall.h>
+#include <init_helpers.h>
#include <logbuff.h>
#include <malloc.h>
#include <mapmem.h>
-
-/* TODO: Can we move these into arch/ headers? */
-#ifdef CONFIG_8xx
-#include <mpc8xx.h>
-#endif
-#ifdef CONFIG_5xx
-#include <mpc5xx.h>
-#endif
-#ifdef CONFIG_MPC5xxx
-#include <mpc5xxx.h>
-#endif
-#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
-#include <asm/mp.h>
-#endif
-
#include <os.h>
#include <post.h>
+#include <relocate.h>
#include <spi.h>
#include <status_led.h>
#include <timer.h>
#include <trace.h>
#include <video.h>
#include <watchdog.h>
-#include <linux/errno.h>
+#if defined(CONFIG_MP) && defined(CONFIG_PPC)
+#include <asm/mp.h>
+#endif
#include <asm/io.h>
#include <asm/sections.h>
-#if defined(CONFIG_X86) || defined(CONFIG_ARC)
-#include <asm/init_helpers.h>
-#endif
-#if defined(CONFIG_X86) || defined(CONFIG_ARC) || defined(CONFIG_XTENSA)
-#include <asm/relocate.h>
-#endif
-#ifdef CONFIG_SANDBOX
-#include <asm/state.h>
-#endif
#include <dm/root.h>
-#include <linux/compiler.h>
+#include <linux/errno.h>
/*
* Pointer to initial global data area
@@ -109,15 +84,11 @@ __weak void blue_led_off(void) {}
* a structure...
*/
-/*
- * Could the CONFIG_SPL_BUILD infection become a flag in gd?
- */
-
#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
static int init_func_watchdog_init(void)
{
-# if defined(CONFIG_HW_WATCHDOG) && (defined(CONFIG_BLACKFIN) || \
- defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
+# if defined(CONFIG_HW_WATCHDOG) && \
+ (defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) || \
defined(CONFIG_DESIGNWARE_WATCHDOG) || \
defined(CONFIG_IMX_WATCHDOG))
@@ -183,19 +154,7 @@ static int announce_dram_init(void)
#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K)
static int init_func_ram(void)
{
-#ifdef CONFIG_BOARD_TYPES
- int board_type = gd->board_type;
-#else
- int board_type = 0; /* use dummy arg */
-#endif
-
- gd->ram_size = initdram(board_type);
-
- if (gd->ram_size > 0)
- return 0;
-
- puts("*** failed ***\n");
- return 1;
+ return initdram();
}
#endif
@@ -227,12 +186,14 @@ static int show_dram_config(void)
return 0;
}
-__weak void dram_init_banksize(void)
+__weak int dram_init_banksize(void)
{
#if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE)
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
gd->bd->bi_dram[0].size = get_effective_memsize();
#endif
+
+ return 0;
}
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
@@ -273,8 +234,7 @@ static int setup_mon_len(void)
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;
-#elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2) || \
- defined(CONFIG_XTENSA)
+#elif defined(CONFIG_NIOS2) || defined(CONFIG_XTENSA)
gd->mon_len = CONFIG_SYS_MONITOR_LEN;
#elif defined(CONFIG_NDS32) || defined(CONFIG_SH)
gd->mon_len = (ulong)(&__bss_end) - (ulong)(&_start);
@@ -295,18 +255,6 @@ __weak int mach_cpu_init(void)
return 0;
}
-#ifdef CONFIG_SANDBOX
-static int setup_ram_buf(void)
-{
- struct sandbox_state *state = state_get_current();
-
- gd->arch.ram_buf = state->ram_buf;
- gd->ram_size = state->ram_size;
-
- return 0;
-}
-#endif
-
/* Get the top of usable RAM */
__weak ulong board_get_usable_ram_top(ulong total_size)
{
@@ -365,27 +313,16 @@ static int setup_dest_addr(void)
return 0;
}
-#if defined(CONFIG_SPARC)
-static int reserve_prom(void)
-{
- /* defined in arch/sparc/cpu/leon?/prom.c */
- extern void *__prom_start_reloc;
- int size = 8192; /* page table = 2k, prom = 6k */
- gd->relocaddr -= size;
- __prom_start_reloc = map_sysmem(gd->relocaddr + 2048, size - 2048);
- debug("Reserving %dk for PROM and page table at %08lx\n", size,
- gd->relocaddr);
- return 0;
-}
-#endif
-
-#if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
+#if defined(CONFIG_LOGBUFFER)
static int reserve_logbuffer(void)
{
+#ifndef CONFIG_ALT_LB_ADDR
/* reserve kernel log buffer */
gd->relocaddr -= LOGBUFF_RESERVE;
debug("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN,
gd->relocaddr);
+#endif
+
return 0;
}
#endif
@@ -411,10 +348,10 @@ static int reserve_round_4k(void)
return 0;
}
-#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) && \
- defined(CONFIG_ARM)
+#ifdef CONFIG_ARM
static int reserve_mmu(void)
{
+#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
/* reserve TLB table */
gd->arch.tlb_size = PGTABLE_SIZE;
gd->relocaddr -= gd->arch.tlb_size;
@@ -433,14 +370,15 @@ static int reserve_mmu(void)
*/
gd->arch.tlb_allocated = gd->arch.tlb_addr;
#endif
+#endif
return 0;
}
#endif
-#ifdef CONFIG_DM_VIDEO
static int reserve_video(void)
{
+#ifdef CONFIG_DM_VIDEO
ulong addr;
int ret;
@@ -449,14 +387,7 @@ static int reserve_video(void)
if (ret)
return ret;
gd->relocaddr = addr;
-
- return 0;
-}
-#else
-
-# ifdef CONFIG_LCD
-static int reserve_lcd(void)
-{
+#elif defined(CONFIG_LCD)
# ifdef CONFIG_FB_ADDR
gd->fb_base = CONFIG_FB_ADDR;
# else
@@ -464,24 +395,17 @@ static int reserve_lcd(void)
gd->relocaddr = lcd_setmem(gd->relocaddr);
gd->fb_base = gd->relocaddr;
# endif /* CONFIG_FB_ADDR */
-
- return 0;
-}
-# endif /* CONFIG_LCD */
-
-# if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+#elif defined(CONFIG_VIDEO) && \
+ (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
- !defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)
-static int reserve_legacy_video(void)
-{
+ !defined(CONFIG_M68K)
/* reserve memory for video display (always full pages) */
gd->relocaddr = video_setmem(gd->relocaddr);
gd->fb_base = gd->relocaddr;
+#endif
return 0;
}
-# endif
-#endif /* !CONFIG_DM_VIDEO */
static int reserve_trace(void)
{
@@ -516,7 +440,6 @@ static int reserve_uboot(void)
return 0;
}
-#ifndef CONFIG_SPL_BUILD
/* reserve memory for malloc() area */
static int reserve_malloc(void)
{
@@ -538,7 +461,6 @@ static int reserve_board(void)
}
return 0;
}
-#endif
static int setup_machine(void)
{
@@ -668,30 +590,6 @@ static int setup_board_part2(void)
}
#endif
-#ifdef CONFIG_SYS_EXTBDINFO
-static int setup_board_extra(void)
-{
- bd_t *bd = gd->bd;
-
- 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));
-
- bd->bi_procfreq = gd->cpu_clk; /* Processor Speed, In Hz */
- bd->bi_plb_busfreq = gd->bus_clk;
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
- defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
- defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
- bd->bi_pci_busfreq = get_PCI_freq();
- bd->bi_opbfreq = get_OPB_freq();
-#elif defined(CONFIG_XILINX_405)
- bd->bi_pci_busfreq = get_PCI_freq();
-#endif
-
- return 0;
-}
-#endif
-
#ifdef CONFIG_POST
static int init_post(void)
{
@@ -702,14 +600,6 @@ static int init_post(void)
}
#endif
-static int setup_dram_config(void)
-{
- /* Ram is board specific, so move it to board code ... */
- dram_init_banksize();
-
- return 0;
-}
-
static int reloc_fdt(void)
{
#ifndef CONFIG_OF_EMBED
@@ -838,9 +728,6 @@ __weak int arch_cpu_init_dm(void)
}
static const init_fnc_t init_sequence_f[] = {
-#ifdef CONFIG_SANDBOX
- setup_ram_buf,
-#endif
setup_mon_len,
#ifdef CONFIG_OF_CONTROL
fdtdec_setup,
@@ -850,8 +737,8 @@ static const init_fnc_t init_sequence_f[] = {
#endif
initf_malloc,
initf_console_record,
-#if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
- x86_fsp_init,
+#if defined(CONFIG_HAVE_FSP)
+ arch_fsp_init,
#endif
arch_cpu_init, /* basic arch cpu dependent setup */
mach_cpu_init, /* SoC/machine dependent CPU setup */
@@ -861,51 +748,22 @@ static const init_fnc_t init_sequence_f[] = {
#if defined(CONFIG_BOARD_EARLY_INIT_F)
board_early_init_f,
#endif
- /* TODO: can any of this go into arch_cpu_init()? */
-#if defined(CONFIG_PPC) && !defined(CONFIG_8xx_CPUCLK_DEFAULT)
+#if defined(CONFIG_PPC) || defined(CONFIG_SYS_FSL_CLK) || defined(CONFIG_M68K)
+ /* get CPU and bus clocks according to the environment variable */
get_clocks, /* get CPU and bus clocks (etc.) */
-#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \
- && !defined(CONFIG_TQM885D)
- adjust_sdram_tbs_8xx,
#endif
- /* TODO: can we rename this to timer_init()? */
- init_timebase,
-#endif
-#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
- defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32) || \
- defined(CONFIG_SH) || defined(CONFIG_SPARC)
timer_init, /* initialize timer */
-#endif
#if defined(CONFIG_BOARD_POSTCLK_INIT)
board_postclk_init,
#endif
-#if defined(CONFIG_SYS_FSL_CLK) || defined(CONFIG_M68K)
- get_clocks,
-#endif
env_init, /* initialize environment */
-#if defined(CONFIG_8xx_CPUCLK_DEFAULT)
- /* get CPU and bus clocks according to the environment variable */
- get_clocks_866,
- /* adjust sdram refresh rate according to the new clock */
- sdram_adjust_866,
- init_timebase,
-#endif
init_baud_rate, /* initialze baudrate settings */
serial_init, /* serial communications setup */
console_init_f, /* stage 1 init of console */
-#ifdef CONFIG_SANDBOX
- sandbox_early_getopt_check,
-#endif
display_options, /* say that we are here */
display_text_info, /* show debugging info if required */
-#if defined(CONFIG_MPC8260)
- prt_8260_rsr,
- prt_8260_clks,
-#endif /* CONFIG_MPC8260 */
-#if defined(CONFIG_MPC83xx)
- prt_83xx_rsr,
-#endif
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH) || \
+ defined(CONFIG_X86)
checkcpu,
#endif
#if defined(CONFIG_DISPLAY_CPUINFO)
@@ -961,51 +819,27 @@ static const init_fnc_t init_sequence_f[] = {
* - board info struct
*/
setup_dest_addr,
-#if defined(CONFIG_BLACKFIN) || defined(CONFIG_XTENSA)
- /* Blackfin u-boot monitor should be on top of the ram */
- reserve_uboot,
-#endif
-#if defined(CONFIG_SPARC)
- reserve_prom,
-#endif
-#if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
+#if defined(CONFIG_LOGBUFFER)
reserve_logbuffer,
#endif
#ifdef CONFIG_PRAM
reserve_pram,
#endif
reserve_round_4k,
-#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) && \
- defined(CONFIG_ARM)
+#ifdef CONFIG_ARM
reserve_mmu,
#endif
-#ifdef CONFIG_DM_VIDEO
reserve_video,
-#else
-# ifdef CONFIG_LCD
- reserve_lcd,
-# endif
- /* TODO: Why the dependency on CONFIG_8xx? */
-# if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
- !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
- !defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)
- reserve_legacy_video,
-# endif
-#endif /* CONFIG_DM_VIDEO */
reserve_trace,
-#if !defined(CONFIG_BLACKFIN) && !defined(CONFIG_XTENSA)
reserve_uboot,
-#endif
-#ifndef CONFIG_SPL_BUILD
reserve_malloc,
reserve_board,
-#endif
setup_machine,
reserve_global_data,
reserve_fdt,
reserve_arch,
reserve_stacks,
- setup_dram_config,
+ dram_init_banksize,
show_dram_config,
#if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \
defined(CONFIG_SH)
diff --git a/common/board_r.c b/common/board_r.c
index 3344913..d69a33c 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -27,6 +27,7 @@
#include <ide.h>
#endif
#include <initcall.h>
+#include <init_helpers.h>
#ifdef CONFIG_PS2KBD
#include <keyboard.h>
#endif
@@ -49,16 +50,10 @@
#include <timer.h>
#include <trace.h>
#include <watchdog.h>
-#ifdef CONFIG_CMD_AMBAPP
-#include <ambapp.h>
-#endif
#ifdef CONFIG_ADDR_MAP
#include <asm/mmu.h>
#endif
#include <asm/sections.h>
-#ifdef CONFIG_X86
-#include <asm/init_helpers.h>
-#endif
#include <dm/root.h>
#include <linux/compiler.h>
#include <linux/err.h>
@@ -69,10 +64,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#if defined(CONFIG_SPARC)
-extern int prom_init(void);
-#endif
-
ulong monitor_flash_len;
__weak int board_flash_wp_on(void)
@@ -598,18 +589,6 @@ static int initr_status_led(void)
}
#endif
-#if defined(CONFIG_CMD_AMBAPP) && defined(CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP)
-extern int do_ambapp_print(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-
-static int initr_ambapp_print(void)
-{
- puts("AMBA:\n");
- do_ambapp_print(NULL, 0, 0, NULL);
-
- return 0;
-}
-#endif
-
#if defined(CONFIG_SCSI) && !defined(CONFIG_DM_SCSI)
static int initr_scsi(void)
{
@@ -823,8 +802,7 @@ static init_fnc_t init_sequence_r[] = {
initr_flash,
#endif
INIT_FUNC_WATCHDOG_RESET
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86) || \
- defined(CONFIG_SPARC)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86)
/* initialize higher level parts of CPU like time base and timers */
cpu_init_r,
#endif
@@ -895,12 +873,6 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_BOARD_LATE_INIT
board_late_init,
#endif
-#if defined(CONFIG_CMD_AMBAPP)
- ambapp_init_reloc,
-#if defined(CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP)
- initr_ambapp_print,
-#endif
-#endif
#if defined(CONFIG_SCSI) && !defined(CONFIG_DM_SCSI)
INIT_FUNC_WATCHDOG_RESET
initr_scsi,
@@ -940,9 +912,6 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_PS2KBD
initr_kbd,
#endif
-#if defined(CONFIG_SPARC)
- prom_init,
-#endif
run_main_loop,
};