summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig75
-rw-r--r--common/board_f.c264
-rw-r--r--common/board_r.c36
-rw-r--r--common/env_common.c2
-rw-r--r--common/env_flags.c1
-rw-r--r--common/env_mmc.c15
-rw-r--r--common/fdt_support.c10
-rw-r--r--common/image-fdt.c1
-rw-r--r--common/spl/Kconfig2
-rw-r--r--common/spl/spl.c8
-rw-r--r--common/spl/spl_net.c34
-rw-r--r--common/xyzModem.c115
12 files changed, 169 insertions, 394 deletions
diff --git a/common/Kconfig b/common/Kconfig
index 8f73c8f757..1879aefaf8 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -90,7 +90,7 @@ config BOOTSTAGE_STASH_ADDR
config BOOTSTAGE_STASH_SIZE
hex "Size of boot timing stash region"
- default 4096
+ default 0x1000
help
This should be large enough to hold the bootstage stash. A value of
4096 (4KiB) is normally plenty.
@@ -158,6 +158,75 @@ config SPI_BOOT
endmenu
+menu "Environment"
+
+if ARCH_SUNXI
+
+choice
+ prompt "Environment Device"
+ default ENV_IS_IN_MMC if ARCH_SUNXI
+
+config ENV_IS_IN_MMC
+ bool "Environment in an MMC device"
+ depends on CMD_MMC
+ help
+ Define this if you have an MMC device which you want to use for the
+ environment.
+
+config ENV_IS_IN_NAND
+ bool "Environment in a NAND device"
+ depends on CMD_NAND
+ help
+ Define this if you have a NAND device which you want to use for the
+ environment.
+
+config ENV_IS_IN_UBI
+ bool "Environment in a UBI volume"
+ depends on CMD_UBI
+ depends on CMD_MTDPARTS
+ help
+ Define this if you have a UBI volume which you want to use for the
+ environment.
+
+config ENV_IS_NOWHERE
+ bool "Environment is not stored"
+ help
+ Define this if you don't want to or can't have an environment stored
+ on a storage medium
+
+endchoice
+
+config ENV_OFFSET
+ hex "Environment Offset"
+ depends on !ENV_IS_IN_UBI
+ depends on !ENV_IS_NOWHERE
+ default 0x88000 if ARCH_SUNXI
+ help
+ Offset from the start of the device (or partition)
+
+config ENV_SIZE
+ hex "Environment Size"
+ depends on !ENV_IS_NOWHERE
+ default 0x20000 if ARCH_SUNXI
+ help
+ Size of the environment storage area
+
+config ENV_UBI_PART
+ string "UBI partition name"
+ depends on ENV_IS_IN_UBI
+ help
+ MTD partition containing the UBI device
+
+config ENV_UBI_VOLUME
+ string "UBI volume name"
+ depends on ENV_IS_IN_UBI
+ help
+ Name of the volume that you want to store the environment in.
+
+endif
+
+endmenu
+
config BOOTDELAY
int "delay in seconds before automatically booting"
default 2
@@ -379,7 +448,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 +456,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 7d1ede0404..d9431ee79a 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))
@@ -166,11 +137,6 @@ static int display_text_info(void)
text_base, bss_start, bss_end);
#endif
-#ifdef CONFIG_USE_IRQ
- debug("IRQ Stack: %08lx\n", IRQ_STACK_START);
- debug("FIQ Stack: %08lx\n", FIQ_STACK_START);
-#endif
-
return 0;
}
@@ -180,25 +146,6 @@ static int announce_dram_init(void)
return 0;
}
-#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;
-}
-#endif
-
static int show_dram_config(void)
{
unsigned long long size;
@@ -227,12 +174,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 +222,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 +243,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 +301,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 +336,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 +358,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 +375,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 +383,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 +428,6 @@ static int reserve_uboot(void)
return 0;
}
-#ifndef CONFIG_SPL_BUILD
/* reserve memory for malloc() area */
static int reserve_malloc(void)
{
@@ -538,7 +449,6 @@ static int reserve_board(void)
}
return 0;
}
-#endif
static int setup_machine(void)
{
@@ -668,30 +578,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 +588,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
@@ -751,6 +629,13 @@ static int setup_reloc(void)
return 0;
}
+#ifdef CONFIG_OF_BOARD_FIXUP
+static int fix_fdt(void)
+{
+ return board_fix_fdt((void *)gd->fdt_blob);
+}
+#endif
+
/* ARM calls relocate_code from its crt0.S */
#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
!CONFIG_IS_ENABLED(X86_64)
@@ -831,9 +716,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,
@@ -843,8 +725,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 */
@@ -854,51 +736,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)
@@ -919,15 +772,7 @@ static const init_fnc_t init_sequence_f[] = {
init_func_spi,
#endif
announce_dram_init,
- /* TODO: unify all these dram functions? */
-#if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_NDS32) || \
- defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) || \
- defined(CONFIG_SH)
dram_init, /* configure available RAM banks */
-#endif
-#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K)
- init_func_ram,
-#endif
#ifdef CONFIG_POST
post_init_f,
#endif
@@ -954,51 +799,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)
@@ -1012,6 +833,9 @@ static const init_fnc_t init_sequence_f[] = {
#ifdef CONFIG_SYS_EXTBDINFO
setup_board_extra,
#endif
+#ifdef CONFIG_OF_BOARD_FIXUP
+ fix_fdt,
+#endif
INIT_FUNC_WATCHDOG_RESET
reloc_fdt,
setup_reloc,
diff --git a/common/board_r.c b/common/board_r.c
index 5c9e6987b9..d69a33c4a3 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)
@@ -426,6 +417,7 @@ static int initr_nand(void)
{
puts("NAND: ");
nand_init();
+ printf("%lu MiB\n", nand_size() / 1024);
return 0;
}
#endif
@@ -597,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)
{
@@ -822,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
@@ -894,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,
@@ -939,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,
};
diff --git a/common/env_common.c b/common/env_common.c
index 7fb62e8b45..6845f8d8d5 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -140,7 +140,7 @@ int set_default_vars(int nvars, char * const vars[])
}
#ifdef CONFIG_ENV_AES
-#include <aes.h>
+#include <uboot_aes.h>
/**
* env_aes_cbc_get_key() - Get AES-128-CBC key for the environment
*
diff --git a/common/env_flags.c b/common/env_flags.c
index 921d3770ea..3c50620cb3 100644
--- a/common/env_flags.c
+++ b/common/env_flags.c
@@ -11,6 +11,7 @@
#ifdef USE_HOSTCC /* Eliminate "ANSI does not permit..." warnings */
#include <stdint.h>
#include <stdio.h>
+#include "fw_env_private.h"
#include "fw_env.h"
#include <env_attr.h>
#include <env_flags.h>
diff --git a/common/env_mmc.c b/common/env_mmc.c
index 16f6a17514..a5d14d448c 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -82,10 +82,6 @@ static int mmc_set_env_part(struct mmc *mmc)
int dev = mmc_get_env_dev();
int ret = 0;
-#ifdef CONFIG_SPL_BUILD
- dev = 0;
-#endif
-
env_mmc_orig_hwpart = mmc_get_blk_desc(mmc)->hwpart;
ret = blk_select_hwpart_devnum(IF_TYPE_MMC, dev, part);
if (ret)
@@ -116,9 +112,6 @@ static void fini_mmc_for_env(struct mmc *mmc)
#ifdef CONFIG_SYS_MMC_ENV_PART
int dev = mmc_get_env_dev();
-#ifdef CONFIG_SPL_BUILD
- dev = 0;
-#endif
blk_select_hwpart_devnum(IF_TYPE_MMC, dev, env_mmc_orig_hwpart);
#endif
}
@@ -223,10 +216,6 @@ void env_relocate_spec(void)
ALLOC_CACHE_ALIGN_BUFFER(env_t, tmp_env1, 1);
ALLOC_CACHE_ALIGN_BUFFER(env_t, tmp_env2, 1);
-#ifdef CONFIG_SPL_BUILD
- dev = 0;
-#endif
-
mmc = find_mmc_device(dev);
errmsg = init_mmc_for_env(mmc);
@@ -306,10 +295,6 @@ void env_relocate_spec(void)
int dev = mmc_get_env_dev();
const char *errmsg;
-#ifdef CONFIG_SPL_BUILD
- dev = 0;
-#endif
-
mmc = find_mmc_device(dev);
errmsg = init_mmc_for_env(mmc);
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 55d4d6f6d4..c6a76b7ad2 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -482,7 +482,6 @@ void fdt_fixup_ethernet(void *fdt)
/* Cycle through all aliases */
for (prop = 0; ; prop++) {
const char *name;
- int len = strlen("ethernet");
/* FDT might have been edited, recompute the offset */
offset = fdt_first_property_offset(fdt,
@@ -495,8 +494,13 @@ void fdt_fixup_ethernet(void *fdt)
break;
path = fdt_getprop_by_offset(fdt, offset, &name, NULL);
- if (!strncmp(name, "ethernet", len)) {
- i = trailing_strtol(name);
+ if (!strncmp(name, "ethernet", 8)) {
+ /* Treat plain "ethernet" same as "ethernet0". */
+ if (!strcmp(name, "ethernet"))
+ i = 0;
+ else
+ i = trailing_strtol(name);
+
if (i != -1) {
if (i == 0)
strcpy(mac, "ethaddr");
diff --git a/common/image-fdt.c b/common/image-fdt.c
index e7540be8d6..7468b902b8 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -494,7 +494,6 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
goto err;
}
}
- fdt_fixup_ethernet(blob);
/* Delete the old LMB reservation */
if (lmb)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 6752b5c65c..ea6fbb60ad 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -371,7 +371,7 @@ config SPL_LIBGENERIC_SUPPORT
config SPL_MMC_SUPPORT
bool "Support MMC"
- depends on SPL
+ depends on SPL && GENERIC_MMC
help
Enable support for MMC (Multimedia Card) within SPL. This enables
the MMC protocol implementation and allows any enabled drivers to
diff --git a/common/spl/spl.c b/common/spl/spl.c
index d98b9fcb9a..a3e73b87bc 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -85,6 +85,9 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
{
spl_image->size = CONFIG_SYS_MONITOR_LEN;
spl_image->entry_point = CONFIG_SYS_UBOOT_START;
+#ifdef CONFIG_CPU_V7M
+ spl_image->entry_point |= 0x1;
+#endif
spl_image->load_addr = CONFIG_SYS_TEXT_BASE;
spl_image->os = IH_OS_U_BOOT;
spl_image->name = "U-Boot";
@@ -227,10 +230,11 @@ int spl_early_init(void)
int spl_init(void)
{
int ret;
+ bool setup_malloc = !(IS_ENABLED(CONFIG_SPL_STACK_R) &&
+ IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIMPLE));
if (!(gd->flags & GD_FLG_SPL_EARLY_INIT)) {
- ret = spl_common_init(
- !IS_ENABLED(CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN));
+ ret = spl_common_init(setup_malloc);
if (ret)
return ret;
}
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index 0fba0172ea..85fe508b17 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -11,19 +11,29 @@
#include <errno.h>
#include <spl.h>
#include <net.h>
+#include <libfdt.h>
DECLARE_GLOBAL_DATA_PTR;
#if defined(CONFIG_SPL_ETH_SUPPORT) || defined(CONFIG_SPL_USBETH_SUPPORT)
+static ulong spl_net_load_read(struct spl_load_info *load, ulong sector,
+ ulong count, void *buf)
+{
+ debug("%s: sector %lx, count %lx, buf %lx\n",
+ __func__, sector, count, (ulong)buf);
+ memcpy(buf, (void *)(load_addr + sector), count);
+ return count;
+}
+
static int spl_net_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
+ struct image_header *header = (struct image_header *)load_addr;
int rv;
env_init();
env_relocate();
setenv("autoload", "yes");
- load_addr = CONFIG_SYS_TEXT_BASE - sizeof(struct image_header);
rv = eth_initialize();
if (rv == 0) {
printf("No Ethernet devices found\n");
@@ -36,8 +46,26 @@ static int spl_net_load_image(struct spl_image_info *spl_image,
printf("Problem booting with BOOTP\n");
return rv;
}
- return spl_parse_image_header(spl_image,
- (struct image_header *)load_addr);
+
+ if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+ image_get_magic(header) == FDT_MAGIC) {
+ struct spl_load_info load;
+
+ debug("Found FIT\n");
+ load.bl_len = 1;
+ load.read = spl_net_load_read;
+ rv = spl_load_simple_fit(spl_image, &load, 0, header);
+ } else {
+ debug("Legacy image\n");
+
+ rv = spl_parse_image_header(spl_image, header);
+ if (rv)
+ return rv;
+
+ memcpy((void *)spl_image->load_addr, header, spl_image->size);
+ }
+
+ return rv;
}
#endif
diff --git a/common/xyzModem.c b/common/xyzModem.c
index e0d87dbfec..a0c5dfeece 100644
--- a/common/xyzModem.c
+++ b/common/xyzModem.c
@@ -39,25 +39,17 @@
#define CAN 0x18
#define EOF 0x1A /* ^Z for DOS officionados */
-#define USE_YMODEM_LENGTH
-
/* Data & state local to the protocol */
static struct
{
-#ifdef REDBOOT
- hal_virtual_comm_table_t *__chan;
-#else
int *__chan;
-#endif
unsigned char pkt[1024], *bufp;
unsigned char blk, cblk, crc1, crc2;
unsigned char next_blk; /* Expected block */
int len, mode, total_retries;
int total_SOH, total_STX, total_CAN;
bool crc_mode, at_eof, tx_ack;
-#ifdef USE_YMODEM_LENGTH
unsigned long file_length, read_length;
-#endif
} xyz;
#define xyzModem_CHAR_TIMEOUT 2000 /* 2 seconds */
@@ -66,7 +58,6 @@ static struct
#define xyzModem_CAN_COUNT 3 /* Wait for 3 CAN before quitting */
-#ifndef REDBOOT /*SB */
typedef int cyg_int32;
static int
CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c)
@@ -156,17 +147,7 @@ parse_num (char *s, unsigned long *val, char **es, char *delim)
if (_is_hex (c) && ((digit = _from_hex (c)) < radix))
{
/* Valid digit */
-#ifdef CYGPKG_HAL_MIPS
- /* FIXME: tx49 compiler generates 0x2539018 for MUL which */
- /* isn't any good. */
- if (16 == radix)
- result = result << 4;
- else
- result = 10 * result;
- result += digit;
-#else
result = (result * radix) + digit;
-#endif
}
else
{
@@ -190,54 +171,15 @@ parse_num (char *s, unsigned long *val, char **es, char *delim)
return true;
}
-#endif
-#define USE_SPRINTF
#ifdef DEBUG
-#ifndef USE_SPRINTF
-/*
- * Note: this debug setup only works if the target platform has two serial ports
- * available so that the other one (currently only port 1) can be used for debug
- * messages.
- */
-static int
-zm_dprintf (char *fmt, ...)
-{
- int cur_console;
- va_list args;
-
- va_start (args, fmt);
-#ifdef REDBOOT
- cur_console =
- CYGACC_CALL_IF_SET_CONSOLE_COMM
- (CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
- CYGACC_CALL_IF_SET_CONSOLE_COMM (1);
-#endif
- diag_vprintf (fmt, args);
-#ifdef REDBOOT
- CYGACC_CALL_IF_SET_CONSOLE_COMM (cur_console);
-#endif
-}
-
-static void
-zm_flush (void)
-{
-}
-
-#else
/*
* Note: this debug setup works by storing the strings in a fixed buffer
*/
-#define FINAL
-#ifdef FINAL
-static char *zm_out = (char *) 0x00380000;
-static char *zm_out_start = (char *) 0x00380000;
-#else
-static char zm_buf[8192];
-static char *zm_out = zm_buf;
-static char *zm_out_start = zm_buf;
+static char zm_debug_buf[8192];
+static char *zm_out = zm_debug_buf;
+static char *zm_out_start = zm_debug_buf;
-#endif
static int
zm_dprintf (char *fmt, ...)
{
@@ -253,23 +195,13 @@ zm_dprintf (char *fmt, ...)
static void
zm_flush (void)
{
-#ifdef REDBOOT
- char *p = zm_out_start;
- while (*p)
- mon_write_char (*p++);
-#endif
zm_out = zm_out_start;
}
-#endif
static void
zm_dump_buf (void *buf, int len)
{
-#ifdef REDBOOT
- diag_vdump_buf_with_offset (zm_dprintf, buf, len, 0);
-#else
-#endif
}
static unsigned char zm_buf[2048];
@@ -476,9 +408,6 @@ xyzModem_get_hdr (void)
int
xyzModem_stream_open (connection_info_t * info, int *err)
{
-#ifdef REDBOOT
- int console_chan;
-#endif
int stat = 0;
int retries = xyzModem_MAX_RETRIES;
int crc_retries = xyzModem_MAX_RETRIES_WITH_CRC;
@@ -492,29 +421,9 @@ xyzModem_stream_open (connection_info_t * info, int *err)
}
#endif
-#ifdef REDBOOT
- /* Set up the I/O channel. Note: this allows for using a different port in the future */
- console_chan =
- CYGACC_CALL_IF_SET_CONSOLE_COMM
- (CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
- if (info->chan >= 0)
- {
- CYGACC_CALL_IF_SET_CONSOLE_COMM (info->chan);
- }
- else
- {
- CYGACC_CALL_IF_SET_CONSOLE_COMM (console_chan);
- }
- xyz.__chan = CYGACC_CALL_IF_CONSOLE_PROCS ();
-
- CYGACC_CALL_IF_SET_CONSOLE_COMM (console_chan);
- CYGACC_COMM_IF_CONTROL (*xyz.__chan, __COMMCTL_SET_TIMEOUT,
- xyzModem_CHAR_TIMEOUT);
-#else
/* TODO: CHECK ! */
int dummy = 0;
xyz.__chan = &dummy;
-#endif
xyz.len = 0;
xyz.crc_mode = true;
xyz.at_eof = false;
@@ -524,10 +433,8 @@ xyzModem_stream_open (connection_info_t * info, int *err)
xyz.total_SOH = 0;
xyz.total_STX = 0;
xyz.total_CAN = 0;
-#ifdef USE_YMODEM_LENGTH
xyz.read_length = 0;
xyz.file_length = 0;
-#endif
CYGACC_COMM_IF_PUTC (*xyz.__chan, (xyz.crc_mode ? 'C' : NAK));
@@ -546,12 +453,10 @@ xyzModem_stream_open (connection_info_t * info, int *err)
/* Y-modem file information header */
if (xyz.blk == 0)
{
-#ifdef USE_YMODEM_LENGTH
/* skip filename */
while (*xyz.bufp++);
/* get the length */
parse_num ((char *) xyz.bufp, &xyz.file_length, NULL, " ");
-#endif
/* The rest of the file name data block quietly discarded */
xyz.tx_ack = true;
}
@@ -604,13 +509,8 @@ xyzModem_stream_read (char *buf, int size, int *err)
("ACK block %d (%d)\n", xyz.blk, __LINE__));
xyz.next_blk = (xyz.next_blk + 1) & 0xFF;
-#if defined(xyzModem_zmodem) || defined(USE_YMODEM_LENGTH)
if (xyz.mode == xyzModem_xmodem || xyz.file_length == 0)
{
-#else
- if (1)
- {
-#endif
/* Data blocks can be padded with ^Z (EOF) characters */
/* This code tries to detect and remove them */
if ((xyz.bufp[xyz.len - 1] == EOF) &&
@@ -625,7 +525,6 @@ xyzModem_stream_read (char *buf, int size, int *err)
}
}
-#ifdef USE_YMODEM_LENGTH
/*
* See if accumulated length exceeds that of the file.
* If so, reduce size (i.e., cut out pad bytes)
@@ -640,7 +539,6 @@ xyzModem_stream_read (char *buf, int size, int *err)
xyz.len -= (xyz.read_length - xyz.file_length);
}
}
-#endif
break;
}
else if (xyz.blk == ((xyz.next_blk - 1) & 0xFF))
@@ -809,10 +707,3 @@ xyzModem_error (int err)
/*
* RedBoot interface
*/
-#if 0 /* SB */
-GETC_IO_FUNCS (xyzModem_io, xyzModem_stream_open, xyzModem_stream_close,
- xyzModem_stream_terminate, xyzModem_stream_read,
- xyzModem_error);
-RedBoot_load (xmodem, xyzModem_io, false, false, xyzModem_xmodem);
-RedBoot_load (ymodem, xyzModem_io, false, false, xyzModem_ymodem);
-#endif