summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2015-03-02 09:42:53 +0100
committerStefano Babic <sbabic@denx.de>2015-03-02 09:42:53 +0100
commitb9cb64825b5e6efeb715abd8b48d9b12f98973e9 (patch)
treed70d73a986308dee88474572006f5c60b10749be /common
parent4579dc37c3cce36d9521c26c6e82881393ec769e (diff)
parent1606b34aa50804227806971dbb6b82ea0bf81f55 (diff)
downloadu-boot-imx-b9cb64825b5e6efeb715abd8b48d9b12f98973e9.zip
u-boot-imx-b9cb64825b5e6efeb715abd8b48d9b12f98973e9.tar.gz
u-boot-imx-b9cb64825b5e6efeb715abd8b48d9b12f98973e9.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig24
-rw-r--r--common/board_f.c64
-rw-r--r--common/board_r.c28
-rw-r--r--common/bootm.c2
-rw-r--r--common/cmd_bdinfo.c4
-rw-r--r--common/cmd_blob.c18
-rw-r--r--common/cmd_demo.c4
-rw-r--r--common/cmd_fdt.c10
-rw-r--r--common/cmd_i2c.c75
-rw-r--r--common/cmd_mmc.c8
-rw-r--r--common/hash.c10
-rw-r--r--common/image-fdt.c2
-rw-r--r--common/image-fit.c4
-rw-r--r--common/image-sig.c16
-rw-r--r--common/malloc_simple.c2
-rw-r--r--common/spl/spl.c5
-rw-r--r--common/spl/spl_nor.c2
17 files changed, 177 insertions, 101 deletions
diff --git a/common/Kconfig b/common/Kconfig
index fd84fa0..f82bc88 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1,5 +1,4 @@
menu "Command line interface"
- depends on !SPL_BUILD
config HUSH_PARSER
bool "Use hush shell"
@@ -153,6 +152,29 @@ endmenu
menu "Device access commands"
+config CMD_DM
+ bool "dm - Access to driver model information"
+ depends on DM
+ default y
+ help
+ Provides access to driver model data structures and information,
+ such as a list of devices, list of uclasses and the state of each
+ device (e.g. activated). This is not required for operation, but
+ can be useful to see the state of driver model for debugging or
+ interest.
+
+config CMD_DEMO
+ bool "demo - Demonstration commands for driver model"
+ depends on DM
+ help
+ Provides a 'demo' command which can be used to play around with
+ driver model. To use this properly you will need to enable one or
+ both of the demo devices (DM_DEMO_SHAPE and DM_DEMO_SIMPLE).
+ Otherwise you will always get an empty list of devices. The demo
+ devices are defined in the sandbox device tree, so the easiest
+ option is to use sandbox and pass the -d point to sandbox's
+ u-boot.dtb file.
+
config CMD_LOADB
bool "loadb"
help
diff --git a/common/board_f.c b/common/board_f.c
index bdad36b..4d8b8a6 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -573,48 +573,22 @@ static int reserve_fdt(void)
return 0;
}
-static int reserve_stacks(void)
+int arch_reserve_stacks(void)
{
-#ifdef CONFIG_SPL_BUILD
-# ifdef CONFIG_ARM
- gd->start_addr_sp -= 128; /* leave 32 words for abort-stack */
- gd->irq_sp = gd->start_addr_sp;
-# endif
-#else
-# ifdef CONFIG_PPC
- ulong *s;
-# endif
+ return 0;
+}
- /* setup stack pointer for exceptions */
+static int reserve_stacks(void)
+{
+ /* make stack pointer 16-byte aligned */
gd->start_addr_sp -= 16;
gd->start_addr_sp &= ~0xf;
- gd->irq_sp = gd->start_addr_sp;
/*
- * Handle architecture-specific things here
- * TODO(sjg@chromium.org): Perhaps create arch_reserve_stack()
- * to handle this and put in arch/xxx/lib/stack.c
+ * let the architecture specific code tailor gd->start_addr_sp and
+ * gd->irq_sp
*/
-# if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
-# ifdef CONFIG_USE_IRQ
- gd->start_addr_sp -= (CONFIG_STACKSIZE_IRQ + CONFIG_STACKSIZE_FIQ);
- debug("Reserving %zu Bytes for IRQ stack at: %08lx\n",
- CONFIG_STACKSIZE_IRQ + CONFIG_STACKSIZE_FIQ, gd->start_addr_sp);
-
- /* 8-byte alignment for ARM ABI compliance */
- gd->start_addr_sp &= ~0x07;
-# endif
- /* leave 3 words for abort-stack, plus 1 for alignment */
- gd->start_addr_sp -= 16;
-# elif defined(CONFIG_PPC)
- /* Clear initial stack frame */
- s = (ulong *) gd->start_addr_sp;
- *s = 0; /* Terminate back chain */
- *++s = 0; /* NULL return address */
-# endif /* Architecture specific code */
-
- return 0;
-#endif
+ return arch_reserve_stacks();
}
static int display_new_sp(void)
@@ -909,7 +883,7 @@ static init_fnc_t init_sequence_f[] = {
#endif
announce_dram_init,
/* TODO: unify all these dram functions? */
-#if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
+#if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32)
dram_init, /* configure available RAM banks */
#endif
#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
@@ -1075,4 +1049,22 @@ void board_init_f_r(void)
/* NOTREACHED - board_init_r() does not return */
hang();
}
+#else
+ulong board_init_f_mem(ulong top)
+{
+ /* Leave space for the stack we are running with now */
+ top -= 0x40;
+
+ top -= sizeof(struct global_data);
+ top = ALIGN(top, 16);
+ gd = (struct global_data *)top;
+ memset((void *)gd, '\0', sizeof(*gd));
+
+#ifdef CONFIG_SYS_MALLOC_F_LEN
+ top -= CONFIG_SYS_MALLOC_F_LEN;
+ gd->malloc_base = top;
+#endif
+
+ return top;
+}
#endif /* CONFIG_X86 */
diff --git a/common/board_r.c b/common/board_r.c
index 907b33c..4fcd4f6 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -55,6 +55,9 @@
#include <dm/root.h>
#include <linux/compiler.h>
#include <linux/err.h>
+#ifdef CONFIG_AVR32
+#include <asm/arch/mmu.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -459,6 +462,18 @@ static int initr_env(void)
return 0;
}
+#ifdef CONFIG_SYS_BOOTPARAMS_LEN
+static int initr_malloc_bootparams(void)
+{
+ gd->bd->bi_boot_params = (ulong)malloc(CONFIG_SYS_BOOTPARAMS_LEN);
+ if (!gd->bd->bi_boot_params) {
+ puts("WARNING: Cannot allocate space for boot parameters\n");
+ return -ENOMEM;
+ }
+ return 0;
+}
+#endif
+
#ifdef CONFIG_SC3
/* TODO: with new initcalls, move this into the driver */
extern void sc3_read_eeprom(void);
@@ -486,7 +501,7 @@ static int initr_api(void)
#endif
/* enable exceptions */
-#ifdef CONFIG_ARM
+#if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
static int initr_enable_interrupts(void)
{
enable_interrupts();
@@ -775,6 +790,9 @@ init_fnc_t init_sequence_r[] = {
initr_dataflash,
#endif
initr_env,
+#ifdef CONFIG_SYS_BOOTPARAMS_LEN
+ initr_malloc_bootparams,
+#endif
INIT_FUNC_WATCHDOG_RESET
initr_secondary_cpu,
#ifdef CONFIG_SC3
@@ -810,10 +828,10 @@ init_fnc_t init_sequence_r[] = {
initr_kgdb,
#endif
interrupt_init,
-#if defined(CONFIG_ARM)
+#if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
initr_enable_interrupts,
#endif
-#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
+#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32)
timer_init, /* initialize timer */
#endif
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
@@ -878,6 +896,10 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
int i;
#endif
+#ifdef CONFIG_AVR32
+ mmu_init_r(dest_addr);
+#endif
+
#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
gd = new_gd;
#endif
diff --git a/common/bootm.c b/common/bootm.c
index e2dc164..34f60bb 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -233,7 +233,7 @@ static int bootm_find_fdt(int flag, int argc, char * const argv[])
return 1;
}
- set_working_fdt_addr(images.ft_addr);
+ set_working_fdt_addr((ulong)images.ft_addr);
return 0;
}
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index e9eab23..aa81da2 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -345,8 +345,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
bd_t *bd = gd->bd;
print_num("boot_params", (ulong)bd->bi_boot_params);
- print_num("memstart", (ulong)bd->bi_memstart);
- print_lnum("memsize", (u64)bd->bi_memsize);
+ print_num("memstart", (ulong)bd->bi_dram[0].start);
+ print_lnum("memsize", (u64)bd->bi_dram[0].size);
print_num("flashstart", (ulong)bd->bi_flashstart);
print_num("flashsize", (ulong)bd->bi_flashsize);
print_num("flashoffset", (ulong)bd->bi_flashoffset);
diff --git a/common/cmd_blob.c b/common/cmd_blob.c
index 82ecaf0..d3f22a1 100644
--- a/common/cmd_blob.c
+++ b/common/cmd_blob.c
@@ -90,17 +90,19 @@ static char blob_help_text[] =
"enc src dst len km - Encapsulate and create blob of data\n"
" $len bytes long at address $src and\n"
" store the result at address $dst.\n"
- " $km is the 16 byte key modifier\n"
- " is also required for generation/use as\n"
- " key for cryptographic operation. Key\n"
- " modifier should be 16 byte long.\n"
+ " $km is the address where the key\n"
+ " modifier is stored.\n"
+ " The modifier is required for generation\n"
+ " /use as key for cryptographic operation.\n"
+ " Key modifier should be 16 byte long.\n"
"blob dec src dst len km - Decapsulate the blob of data at address\n"
" $src and store result of $len byte at\n"
" addr $dst.\n"
- " $km is the 16 byte key modifier\n"
- " is also required for generation/use as\n"
- " key for cryptographic operation. Key\n"
- " modifier should be 16 byte long.\n";
+ " $km is the address where the key\n"
+ " modifier is stored.\n"
+ " The modifier is required for generation\n"
+ " /use as key for cryptographic operation.\n"
+ " Key modifier should be 16 byte long.\n";
U_BOOT_CMD(
blob, 6, 1, do_blob,
diff --git a/common/cmd_demo.c b/common/cmd_demo.c
index bcb34d9..8a10bdf 100644
--- a/common/cmd_demo.c
+++ b/common/cmd_demo.c
@@ -97,7 +97,9 @@ static int do_demo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ARRAY_SIZE(demo_commands));
argc -= 2;
argv += 2;
- if (!demo_cmd || argc > demo_cmd->maxargs)
+
+ if ((!demo_cmd || argc > demo_cmd->maxargs) ||
+ ((demo_cmd->name[0] != 'l') && (argc < 1)))
return CMD_RET_USAGE;
if (argc) {
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index dc59fab..48b3e70 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -38,13 +38,13 @@ static int is_printable_string(const void *data, int len);
*/
struct fdt_header *working_fdt;
-void set_working_fdt_addr(void *addr)
+void set_working_fdt_addr(ulong addr)
{
void *buf;
- buf = map_sysmem((ulong)addr, 0);
+ buf = map_sysmem(addr, 0);
working_fdt = buf;
- setenv_addr("fdtaddr", addr);
+ setenv_ulong("fdtaddr", addr);
}
/*
@@ -111,7 +111,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (!blob || !fdt_valid(&blob))
return 1;
printf("The address of the fdt is %#08lx\n",
- control ? (ulong)blob :
+ control ? (ulong)map_to_sysmem(blob) :
getenv_hex("fdtaddr", 0));
return 0;
}
@@ -123,7 +123,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (control)
gd->fdt_blob = blob;
else
- set_working_fdt_addr((void *)blob);
+ set_working_fdt_addr(addr);
if (argc >= 2) {
int len;
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 7c3ad00..ad38cbf 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -342,9 +342,10 @@ static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
int ret;
#ifdef CONFIG_DM_I2C
struct udevice *dev;
+ struct dm_i2c_chip *i2c_chip;
#endif
- if (argc != 5)
+ if ((argc < 5) || (argc > 6))
return cmd_usage(cmdtp);
/*
@@ -367,7 +368,7 @@ static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
return cmd_usage(cmdtp);
/*
- * Length is the number of objects, not number of bytes.
+ * Length is the number of bytes.
*/
length = simple_strtoul(argv[4], NULL, 16);
@@ -377,22 +378,47 @@ static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
ret = i2c_set_chip_offset_len(dev, alen);
if (ret)
return i2c_report_err(ret, I2C_ERR_WRITE);
+ i2c_chip = dev_get_parent_platdata(dev);
+ if (!i2c_chip)
+ return i2c_report_err(ret, I2C_ERR_WRITE);
#endif
- while (length-- > 0) {
+ if (argc == 6 && !strcmp(argv[5], "-s")) {
+ /*
+ * Write all bytes in a single I2C transaction. If the target
+ * device is an EEPROM, it is your responsibility to not cross
+ * a page boundary. No write delay upon completion, take this
+ * into account if linking commands.
+ */
#ifdef CONFIG_DM_I2C
- ret = dm_i2c_write(dev, devaddr++, memaddr++, 1);
+ i2c_chip->flags &= ~DM_I2C_CHIP_WR_ADDRESS;
+ ret = dm_i2c_write(dev, devaddr, memaddr, length);
#else
- ret = i2c_write(chip, devaddr++, alen, memaddr++, 1);
+ ret = i2c_write(chip, devaddr, alen, memaddr, length);
#endif
if (ret)
return i2c_report_err(ret, I2C_ERR_WRITE);
+ } else {
+ /*
+ * Repeated addressing - perform <length> separate
+ * write transactions of one byte each
+ */
+ while (length-- > 0) {
+#ifdef CONFIG_DM_I2C
+ i2c_chip->flags |= DM_I2C_CHIP_WR_ADDRESS;
+ ret = dm_i2c_write(dev, devaddr++, memaddr++, 1);
+#else
+ ret = i2c_write(chip, devaddr++, alen, memaddr++, 1);
+#endif
+ if (ret)
+ return i2c_report_err(ret, I2C_ERR_WRITE);
/*
* No write delay with FRAM devices.
*/
#if !defined(CONFIG_SYS_I2C_FRAM)
- udelay(11000);
+ udelay(11000);
#endif
+ }
}
return 0;
}
@@ -518,7 +544,7 @@ static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
ret = i2c_read(chip, addr, alen, linebuf, linebytes);
#endif
if (ret)
- i2c_report_err(ret, I2C_ERR_READ);
+ return i2c_report_err(ret, I2C_ERR_READ);
else {
printf("%04x:", addr);
cp = linebuf;
@@ -616,7 +642,7 @@ static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
ret = i2c_write(chip, addr++, alen, &byte, 1);
#endif
if (ret)
- i2c_report_err(ret, I2C_ERR_WRITE);
+ return i2c_report_err(ret, I2C_ERR_WRITE);
/*
* Wait for the write to complete. The write can take
* up to 10mSec (we allow a little more time).
@@ -798,16 +824,15 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
ret = i2c_read(chip, addr, alen, (uchar *)&data, size);
#endif
if (ret)
- i2c_report_err(ret, I2C_ERR_READ);
- else {
- data = cpu_to_be32(data);
- if (size == 1)
- printf(" %02lx", (data >> 24) & 0x000000FF);
- else if (size == 2)
- printf(" %04lx", (data >> 16) & 0x0000FFFF);
- else
- printf(" %08lx", data);
- }
+ return i2c_report_err(ret, I2C_ERR_READ);
+
+ data = cpu_to_be32(data);
+ if (size == 1)
+ printf(" %02lx", (data >> 24) & 0x000000FF);
+ else if (size == 2)
+ printf(" %04lx", (data >> 16) & 0x0000FFFF);
+ else
+ printf(" %08lx", data);
nbytes = cli_readline(" ? ");
if (nbytes == 0) {
@@ -848,7 +873,8 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
(uchar *)&data, size);
#endif
if (ret)
- i2c_report_err(ret, I2C_ERR_WRITE);
+ return i2c_report_err(ret,
+ I2C_ERR_WRITE);
#ifdef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
#endif
@@ -1730,7 +1756,7 @@ static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const
#endif
if (argc == 1) {
#ifdef CONFIG_DM_I2C
- speed = i2c_get_bus_speed(bus);
+ speed = dm_i2c_get_bus_speed(bus);
#else
speed = i2c_get_bus_speed();
#endif
@@ -1740,7 +1766,7 @@ static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const
speed = simple_strtoul(argv[1], NULL, 10);
printf("Setting bus speed to %d Hz\n", speed);
#ifdef CONFIG_DM_I2C
- ret = i2c_set_bus_speed(bus, speed);
+ ret = dm_i2c_set_bus_speed(bus, speed);
#else
ret = i2c_set_bus_speed(speed);
#endif
@@ -1827,7 +1853,7 @@ static cmd_tbl_t cmd_i2c_sub[] = {
U_BOOT_CMD_MKENT(nm, 2, 1, do_i2c_nm, "", ""),
U_BOOT_CMD_MKENT(probe, 0, 1, do_i2c_probe, "", ""),
U_BOOT_CMD_MKENT(read, 5, 1, do_i2c_read, "", ""),
- U_BOOT_CMD_MKENT(write, 5, 0, do_i2c_write, "", ""),
+ U_BOOT_CMD_MKENT(write, 6, 0, do_i2c_write, "", ""),
#ifdef CONFIG_DM_I2C
U_BOOT_CMD_MKENT(flags, 2, 1, do_i2c_flags, "", ""),
#endif
@@ -1894,7 +1920,8 @@ static char i2c_help_text[] =
"i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)\n"
"i2c probe [address] - test for and show device(s) on the I2C bus\n"
"i2c read chip address[.0, .1, .2] length memaddress - read to memory\n"
- "i2c write memaddress chip address[.0, .1, .2] length - write memory to i2c\n"
+ "i2c write memaddress chip address[.0, .1, .2] length [-s] - write memory\n"
+ " to I2C; the -s option selects bulk write in a single transaction\n"
#ifdef CONFIG_DM_I2C
"i2c flags chip [flags] - set or get chip flags\n"
#endif
@@ -1906,7 +1933,7 @@ static char i2c_help_text[] =
#endif
U_BOOT_CMD(
- i2c, 6, 1, do_i2c,
+ i2c, 7, 1, do_i2c,
"I2C sub-system",
i2c_help_text
);
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 4e28c9d..1335e3d 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -85,8 +85,12 @@ static void print_mmcinfo(struct mmc *mmc)
printf("Tran Speed: %d\n", mmc->tran_speed);
printf("Rd Block Len: %d\n", mmc->read_bl_len);
- printf("%s version %d.%d\n", IS_SD(mmc) ? "SD" : "MMC",
- (mmc->version >> 8) & 0xf, mmc->version & 0xff);
+ printf("%s version %d.%d", IS_SD(mmc) ? "SD" : "MMC",
+ EXTRACT_SDMMC_MAJOR_VERSION(mmc->version),
+ EXTRACT_SDMMC_MINOR_VERSION(mmc->version));
+ if (EXTRACT_SDMMC_CHANGE_VERSION(mmc->version) != 0)
+ printf(".%d", EXTRACT_SDMMC_CHANGE_VERSION(mmc->version));
+ printf("\n");
printf("High Capacity: %s\n", mmc->high_capacity ? "Yes" : "No");
puts("Capacity: ");
diff --git a/common/hash.c b/common/hash.c
index d154d02..9e9f84b 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -127,11 +127,21 @@ static struct hash_algo hash_algo[] = {
SHA1_SUM_LEN,
hw_sha1,
CHUNKSZ_SHA1,
+#ifdef CONFIG_SHA_PROG_HW_ACCEL
+ hw_sha_init,
+ hw_sha_update,
+ hw_sha_finish,
+#endif
}, {
"sha256",
SHA256_SUM_LEN,
hw_sha256,
CHUNKSZ_SHA256,
+#ifdef CONFIG_SHA_PROG_HW_ACCEL
+ hw_sha_init,
+ hw_sha_update,
+ hw_sha_finish,
+#endif
},
#endif
#ifdef CONFIG_SHA1
diff --git a/common/image-fdt.c b/common/image-fdt.c
index e3f06cd..d9e4728 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -190,7 +190,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
*of_flat_tree = of_start;
*of_size = of_len;
- set_working_fdt_addr(*of_flat_tree);
+ set_working_fdt_addr((ulong)*of_flat_tree);
return 0;
error:
diff --git a/common/image-fit.c b/common/image-fit.c
index b47d110..778d2a1 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1010,9 +1010,7 @@ int fit_image_verify(const void *fit, int image_noffset)
}
/* Process all hash subnodes of the component image node */
- for (noffset = fdt_first_subnode(fit, image_noffset);
- noffset >= 0;
- noffset = fdt_next_subnode(fit, noffset)) {
+ fdt_for_each_subnode(fit, noffset, image_noffset) {
const char *name = fit_get_name(fit, noffset, NULL);
/*
diff --git a/common/image-sig.c b/common/image-sig.c
index 2c9f0cd..eda5e13 100644
--- a/common/image-sig.c
+++ b/common/image-sig.c
@@ -212,9 +212,7 @@ static int fit_image_verify_sig(const void *fit, int image_noffset,
int ret;
/* Process all hash subnodes of the component image node */
- for (noffset = fdt_first_subnode(fit, image_noffset);
- noffset >= 0;
- noffset = fdt_next_subnode(fit, noffset)) {
+ fdt_for_each_subnode(fit, noffset, image_noffset) {
const char *name = fit_get_name(fit, noffset, NULL);
if (!strncmp(name, FIT_SIG_NODENAME,
@@ -262,9 +260,7 @@ int fit_image_verify_required_sigs(const void *fit, int image_noffset,
return 0;
}
- for (noffset = fdt_first_subnode(sig_blob, sig_node);
- noffset >= 0;
- noffset = fdt_next_subnode(sig_blob, noffset)) {
+ fdt_for_each_subnode(sig_blob, noffset, sig_node) {
const char *required;
int ret;
@@ -397,9 +393,7 @@ static int fit_config_verify_sig(const void *fit, int conf_noffset,
int ret;
/* Process all hash subnodes of the component conf node */
- for (noffset = fdt_first_subnode(fit, conf_noffset);
- noffset >= 0;
- noffset = fdt_next_subnode(fit, noffset)) {
+ fdt_for_each_subnode(fit, noffset, conf_noffset) {
const char *name = fit_get_name(fit, noffset, NULL);
if (!strncmp(name, FIT_SIG_NODENAME,
@@ -444,9 +438,7 @@ int fit_config_verify_required_sigs(const void *fit, int conf_noffset,
return 0;
}
- for (noffset = fdt_first_subnode(sig_blob, sig_node);
- noffset >= 0;
- noffset = fdt_next_subnode(sig_blob, noffset)) {
+ fdt_for_each_subnode(sig_blob, noffset, sig_node) {
const char *required;
int ret;
diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index afdacff..64ae036 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -19,7 +19,7 @@ void *malloc_simple(size_t bytes)
new_ptr = gd->malloc_ptr + bytes;
if (new_ptr > gd->malloc_limit)
- panic("Out of pre-reloc memory");
+ return NULL;
ptr = map_sysmem(gd->malloc_base + gd->malloc_ptr, bytes);
gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));
return ptr;
diff --git a/common/spl/spl.c b/common/spl/spl.c
index daaeb50..ded0f30 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -229,6 +229,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
spl_sata_load_image();
break;
#endif
+#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
+ case BOOT_DEVICE_BOARD:
+ spl_board_load_image();
+ break;
+#endif
default:
#if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
puts("SPL: Unsupported Boot Device!\n");
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index 2c0e8e0..c2fee01 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -17,7 +17,7 @@ void spl_nor_load_image(void)
#ifdef CONFIG_SPL_OS_BOOT
if (!spl_start_uboot()) {
- struct image_header *header;
+ const struct image_header *header;
/*
* Load Linux from its location in NOR flash to its defined