summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig9
-rw-r--r--common/Makefile1
-rw-r--r--common/bootm.c2
-rw-r--r--common/env_common.c1
-rw-r--r--common/env_ubi.c21
-rw-r--r--common/image-fit.c30
-rw-r--r--common/init/board_init.c5
-rw-r--r--common/scsi.c2
-rw-r--r--common/spl/spl.c5
-rw-r--r--common/spl/spl_ext.c5
-rw-r--r--common/spl/spl_fit.c2
-rw-r--r--common/splash_source.c59
-rw-r--r--common/usb.c2
13 files changed, 118 insertions, 26 deletions
diff --git a/common/Kconfig b/common/Kconfig
index 067545d..e691145 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -97,6 +97,15 @@ config BOOTSTAGE_STASH_SIZE
endmenu
+config BOOTDELAY
+ int "delay in seconds before automatically booting"
+ default 2
+ help
+ Delay before automatically running bootcmd;
+ set to -1 to disable autoboot.
+ set to -2 to autoboot with no delay and not check for abort
+ (even when CONFIG_ZERO_BOOTDELAY_CHECK is defined).
+
config CONSOLE_RECORD
bool "Console recording"
help
diff --git a/common/Makefile b/common/Makefile
index 1557a04..97c59fe 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -93,6 +93,7 @@ obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
endif # !CONFIG_SPL_BUILD
ifdef CONFIG_SPL_BUILD
+obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o
obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o
diff --git a/common/bootm.c b/common/bootm.c
index 4941414..2431019 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -445,7 +445,7 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
return err;
}
- flush_cache(load, *load_end - load);
+ flush_cache(load, ALIGN(*load_end - load, ARCH_DMA_MINALIGN));
debug(" kernel loaded at 0x%08lx, end = 0x%08lx\n", load, *load_end);
bootstage_mark(BOOTSTAGE_ID_KERNEL_LOADED);
diff --git a/common/env_common.c b/common/env_common.c
index af59c72..13db7dc 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -123,6 +123,7 @@ void set_default_env(const char *s)
error("Environment import failed: errno = %d\n", errno);
gd->flags |= GD_FLG_ENV_READY;
+ gd->flags |= GD_FLG_ENV_DEFAULT;
}
diff --git a/common/env_ubi.c b/common/env_ubi.c
index e611199..0ac2f65 100644
--- a/common/env_ubi.c
+++ b/common/env_ubi.c
@@ -115,6 +115,17 @@ void env_relocate_spec(void)
int crc1_ok = 0, crc2_ok = 0;
env_t *ep, *tmp_env1, *tmp_env2;
+ /*
+ * In case we have restarted u-boot there is a chance that buffer
+ * contains old environment (from the previous boot).
+ * If UBI volume is zero size, ubi_volume_read() doesn't modify the
+ * buffer.
+ * We need to clear buffer manually here, so the invalid CRC will
+ * cause setting default environment as expected.
+ */
+ memset(env1_buf, 0x0, CONFIG_ENV_SIZE);
+ memset(env2_buf, 0x0, CONFIG_ENV_SIZE);
+
tmp_env1 = (env_t *)env1_buf;
tmp_env2 = (env_t *)env2_buf;
@@ -174,6 +185,16 @@ void env_relocate_spec(void)
{
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
+ /*
+ * In case we have restarted u-boot there is a chance that buffer
+ * contains old environment (from the previous boot).
+ * If UBI volume is zero size, ubi_volume_read() doesn't modify the
+ * buffer.
+ * We need to clear buffer manually here, so the invalid CRC will
+ * cause setting default environment as expected.
+ */
+ memset(buf, 0x0, CONFIG_ENV_SIZE);
+
if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
diff --git a/common/image-fit.c b/common/image-fit.c
index 9873957..6f920da 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -147,7 +147,7 @@ int fit_get_subimage_count(const void *fit, int images_noffset)
* @p: pointer to prefix string
*
* fit_print_contents() formats a multi line FIT image contents description.
- * The routine prints out FIT image properties (root node level) follwed by
+ * The routine prints out FIT image properties (root node level) followed by
* the details of each component image.
*
* returns:
@@ -249,7 +249,7 @@ void fit_print_contents(const void *fit)
* @p: pointer to prefix string
* @type: Type of information to print ("hash" or "sign")
*
- * fit_image_print_data() lists properies for the processed hash node
+ * fit_image_print_data() lists properties for the processed hash node
*
* This function avoid using puts() since it prints a newline on the host
* but does not in U-Boot.
@@ -314,7 +314,7 @@ static void fit_image_print_data(const void *fit, int noffset, const char *p,
* @noffset: offset of the hash or signature node
* @p: pointer to prefix string
*
- * This lists properies for the processed hash node
+ * This lists properties for the processed hash node
*
* returns:
* no returned results
@@ -344,7 +344,7 @@ static void fit_image_print_verification_data(const void *fit, int noffset,
* @image_noffset: offset of the component image node
* @p: pointer to prefix string
*
- * fit_image_print() lists all mandatory properies for the processed component
+ * fit_image_print() lists all mandatory properties for the processed component
* image. If present, hash nodes are printed out as well. Load
* address for images of type firmware is also printed out. Since the load
* address is not mandatory for firmware images, it will be output as
@@ -459,10 +459,10 @@ void fit_image_print(const void *fit, int image_noffset, const char *p)
* fit_get_desc - get node description property
* @fit: pointer to the FIT format image header
* @noffset: node offset
- * @desc: double pointer to the char, will hold pointer to the descrption
+ * @desc: double pointer to the char, will hold pointer to the description
*
* fit_get_desc() reads description property from a given node, if
- * description is found pointer to it is returened in third call argument.
+ * description is found pointer to it is returned in third call argument.
*
* returns:
* 0, on success
@@ -487,8 +487,8 @@ int fit_get_desc(const void *fit, int noffset, char **desc)
* @noffset: node offset
* @timestamp: pointer to the time_t, will hold read timestamp
*
- * fit_get_timestamp() reads timestamp poperty from given node, if timestamp
- * is found and has a correct size its value is retured in third call
+ * fit_get_timestamp() reads timestamp property from given node, if timestamp
+ * is found and has a correct size its value is returned in third call
* argument.
*
* returns:
@@ -520,7 +520,7 @@ int fit_get_timestamp(const void *fit, int noffset, time_t *timestamp)
* @fit: pointer to the FIT format image header
* @image_uname: component image node unit name
*
- * fit_image_get_node() finds a component image (withing the '/images'
+ * fit_image_get_node() finds a component image (within the '/images'
* node) of a provided unit name. If image is found its node offset is
* returned to the caller.
*
@@ -989,7 +989,7 @@ static int fit_image_check_hash(const void *fit, int noffset, const void *data,
}
/**
- * fit_image_verify - verify data intergity
+ * fit_image_verify - verify data integrity
* @fit: pointer to the FIT format image header
* @image_noffset: component image node offset
*
@@ -1073,7 +1073,7 @@ error:
}
/**
- * fit_all_image_verify - verify data intergity for all images
+ * fit_all_image_verify - verify data integrity for all images
* @fit: pointer to the FIT format image header
*
* fit_all_image_verify() goes over all images in the FIT and
@@ -1380,8 +1380,8 @@ int fit_conf_find_compat(const void *fit, const void *fdt)
* @fit: pointer to the FIT format image header
* @conf_uname: configuration node unit name
*
- * fit_conf_get_node() finds a configuration (withing the '/configurations'
- * parant node) of a provided unit name. If configuration is found its node
+ * fit_conf_get_node() finds a configuration (within the '/configurations'
+ * parent node) of a provided unit name. If configuration is found its node
* offset is returned to the caller.
*
* When NULL is provided in second argument fit_conf_get_node() will search
@@ -1447,7 +1447,7 @@ int fit_conf_get_prop_node(const void *fit, int noffset,
* @noffset: offset of the configuration node
* @p: pointer to prefix string
*
- * fit_conf_print() lists all mandatory properies for the processed
+ * fit_conf_print() lists all mandatory properties for the processed
* configuration node.
*
* returns:
@@ -1558,7 +1558,7 @@ static const char *fit_get_image_type_property(int type)
{
/*
* This is sort-of available in the uimage_type[] table in image.c
- * but we don't have access to the sohrt name, and "fdt" is different
+ * but we don't have access to the short name, and "fdt" is different
* anyway. So let's just keep it here.
*/
switch (type) {
diff --git a/common/init/board_init.c b/common/init/board_init.c
index d17bb29..ef01a9a 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -146,3 +146,8 @@ void board_init_f_init_reserve(ulong base)
base += CONFIG_SYS_MALLOC_F_LEN;
#endif
}
+
+/*
+ * Board-specific Platform code can reimplement show_boot_progress () if needed
+ */
+__weak void show_boot_progress(int val) {}
diff --git a/common/scsi.c b/common/scsi.c
index 8ac28dd..dbbf404 100644
--- a/common/scsi.c
+++ b/common/scsi.c
@@ -584,7 +584,7 @@ U_BOOT_DRIVER(scsi_blk) = {
};
#else
U_BOOT_LEGACY_BLK(scsi) = {
- .if_typename = "sata",
+ .if_typename = "scsi",
.if_type = IF_TYPE_SCSI,
.max_devs = CONFIG_SYS_SCSI_MAX_DEVICE,
.desc = scsi_dev_desc,
diff --git a/common/spl/spl.c b/common/spl/spl.c
index c8dfc14..840910a 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -36,6 +36,11 @@ struct spl_image_info spl_image;
static bd_t bdata __attribute__ ((section(".data")));
/*
+ * Board-specific Platform code can reimplement show_boot_progress () if needed
+ */
+__weak void show_boot_progress(int val) {}
+
+/*
* Default function to determine if u-boot or the OS should
* be started. This implementation always returns 1.
*
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index ade5496..a85dc85 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -50,7 +50,7 @@ int spl_load_image_ext(struct blk_desc *block_dev,
err = spl_parse_image_header(header);
if (err < 0) {
- puts("spl: ext4fs_read failed\n");
+ puts("spl: ext: failed to parse image header\n");
goto end;
}
@@ -88,8 +88,7 @@ int spl_load_image_ext_os(struct blk_desc *block_dev, int partition)
#endif
return -1;
}
-
-#if defined(CONFIG_SPL_ENV_SUPPORT) && defined(CONFIG_SPL_OS_BOOT)
+#if defined(CONFIG_SPL_ENV_SUPPORT)
file = getenv("falcon_args_file");
if (file) {
err = ext4fs_open(file, &filelen);
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index c9eb020..9874708 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -77,7 +77,7 @@ static int spl_fit_select_fdt(const void *fdt, int images, int *fdt_offsetp)
for (node = fdt_first_subnode(fdt, conf);
node >= 0;
node = fdt_next_subnode(fdt, node)) {
- name = fdt_getprop(fdt, node, "name", &len);
+ name = fdt_getprop(fdt, node, "description", &len);
printf(" %s\n", name);
}
#endif
diff --git a/common/splash_source.c b/common/splash_source.c
index f86a78a..914f12f 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -120,6 +120,12 @@ static int splash_select_fs_dev(struct splash_location *location)
case SPLASH_STORAGE_SATA:
res = fs_set_blk_dev("sata", location->devpart, FS_TYPE_ANY);
break;
+ case SPLASH_STORAGE_NAND:
+ if (location->ubivol != NULL)
+ res = fs_set_blk_dev("ubi", NULL, FS_TYPE_UBIFS);
+ else
+ res = -ENODEV;
+ break;
default:
printf("Error: unsupported location storage.\n");
return -ENODEV;
@@ -163,6 +169,41 @@ static inline int splash_init_sata(void)
}
#endif
+#ifdef CONFIG_CMD_UBIFS
+static int splash_mount_ubifs(struct splash_location *location)
+{
+ int res;
+ char cmd[32];
+
+ sprintf(cmd, "ubi part %s", location->mtdpart);
+ res = run_command(cmd, 0);
+ if (res)
+ return res;
+
+ sprintf(cmd, "ubifsmount %s", location->ubivol);
+ res = run_command(cmd, 0);
+
+ return res;
+}
+
+static inline int splash_umount_ubifs(void)
+{
+ return run_command("ubifsumount", 0);
+}
+#else
+static inline int splash_mount_ubifs(struct splash_location *location)
+{
+ printf("Cannot load splash image: no UBIFS support\n");
+ return -ENOSYS;
+}
+
+static inline int splash_umount_ubifs(void)
+{
+ printf("Cannot unmount UBIFS: no UBIFS support\n");
+ return -ENOSYS;
+}
+#endif
+
#define SPLASH_SOURCE_DEFAULT_FILE_NAME "splash.bmp"
static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr)
@@ -181,26 +222,36 @@ static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr)
if (location->storage == SPLASH_STORAGE_SATA)
res = splash_init_sata();
+ if (location->ubivol != NULL)
+ res = splash_mount_ubifs(location);
+
if (res)
return res;
res = splash_select_fs_dev(location);
if (res)
- return res;
+ goto out;
res = fs_size(splash_file, &bmp_size);
if (res) {
printf("Error (%d): cannot determine file size\n", res);
- return res;
+ goto out;
}
if (bmp_load_addr + bmp_size >= gd->start_addr_sp) {
printf("Error: splashimage address too high. Data overwrites U-Boot and/or placed beyond DRAM boundaries.\n");
- return -EFAULT;
+ res = -EFAULT;
+ goto out;
}
splash_select_fs_dev(location);
- return fs_read(splash_file, bmp_load_addr, 0, 0, NULL);
+ res = fs_read(splash_file, bmp_load_addr, 0, 0, NULL);
+
+out:
+ if (location->ubivol != NULL)
+ splash_umount_ubifs();
+
+ return res;
}
/**
diff --git a/common/usb.c b/common/usb.c
index 8d9efe5..b3ba487 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1182,7 +1182,7 @@ int usb_new_device(struct usb_device *dev)
* with the device. So a get_descriptor will fail before any
* of that is done for XHCI unlike EHCI.
*/
-#ifdef CONFIG_USB_XHCI
+#ifdef CONFIG_USB_XHCI_HCD
do_read = false;
#endif
err = usb_setup_device(dev, do_read, dev->parent);