summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/board_f.c45
-rw-r--r--common/board_r.c3
-rw-r--r--common/bootm.c25
-rw-r--r--common/cli_simple.c4
-rw-r--r--common/cmd_dfu.c3
-rw-r--r--common/cmd_ext4.c16
-rw-r--r--common/cmd_fat.c13
-rw-r--r--common/cmd_fdt.c2
-rw-r--r--common/cmd_fs.c13
-rw-r--r--common/cmd_mtdparts.c1
-rw-r--r--common/cmd_pxe.c46
-rw-r--r--common/cmd_thordown.c6
-rw-r--r--common/cmd_ubi.c28
-rw-r--r--common/cmd_ubifs.c2
-rw-r--r--common/env_fat.c4
-rw-r--r--common/fdt_support.c2
-rw-r--r--common/image-fdt.c2
-rw-r--r--common/image-fit.c2
-rw-r--r--common/image.c61
-rw-r--r--common/lcd.c85
20 files changed, 235 insertions, 128 deletions
diff --git a/common/board_f.c b/common/board_f.c
index e1dbdf3c953..4ece2b6c9fe 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -106,9 +106,14 @@ __weak void blue_led_off(void) {}
* Could the CONFIG_SPL_BUILD infection become a flag in gd?
*/
-#if defined(CONFIG_WATCHDOG)
+#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) || \
+ defined(CONFIG_SH))
+ hw_watchdog_init();
+# endif
puts(" Watchdog enabled\n");
WATCHDOG_RESET();
@@ -146,7 +151,11 @@ static int display_text_info(void)
bss_end = (ulong)&__bss_end;
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",
+#ifdef CONFIG_SYS_TEXT_BASE
CONFIG_SYS_TEXT_BASE, bss_start, bss_end);
+#else
+ CONFIG_SYS_MONITOR_BASE, bss_start, bss_end);
+#endif
#endif
#ifdef CONFIG_MODEM_SUPPORT
@@ -261,6 +270,8 @@ static int setup_mon_len(void)
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
#elif defined(CONFIG_SANDBOX)
gd->mon_len = (ulong)&_end - (ulong)_init;
+#elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2)
+ gd->mon_len = CONFIG_SYS_MONITOR_LEN;
#else
/* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */
gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
@@ -470,8 +481,9 @@ static int reserve_trace(void)
return 0;
}
-#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \
- && !defined(CONFIG_ARM) && !defined(CONFIG_X86)
+#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+ !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
+ !defined(CONFIG_BLACKFIN)
static int reserve_video(void)
{
/* reserve memory for video display (always full pages) */
@@ -516,11 +528,13 @@ static int reserve_malloc(void)
/* (permanently) allocate a Board Info struct */
static int reserve_board(void)
{
- gd->start_addr_sp -= sizeof(bd_t);
- gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t));
- memset(gd->bd, '\0', sizeof(bd_t));
- debug("Reserving %zu Bytes for Board Info at: %08lx\n",
- sizeof(bd_t), gd->start_addr_sp);
+ if (!gd->bd) {
+ gd->start_addr_sp -= sizeof(bd_t);
+ gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t));
+ memset(gd->bd, '\0', sizeof(bd_t));
+ debug("Reserving %zu Bytes for Board Info at: %08lx\n",
+ sizeof(bd_t), gd->start_addr_sp);
+ }
return 0;
}
#endif
@@ -721,7 +735,9 @@ static int reloc_fdt(void)
static int setup_reloc(void)
{
+#ifdef CONFIG_SYS_TEXT_BASE
gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
+#endif
memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
debug("Relocation Offset is: %08lx\n", gd->reloc_off);
@@ -828,7 +844,7 @@ static init_fnc_t init_sequence_f[] = {
/* TODO: can we rename this to timer_init()? */
init_timebase,
#endif
-#if defined(CONFIG_ARM) || defined(CONFIG_MIPS)
+#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_BLACKFIN)
timer_init, /* initialize timer */
#endif
#ifdef CONFIG_SYS_ALLOC_DPRAM
@@ -929,6 +945,10 @@ static init_fnc_t init_sequence_f[] = {
* - board info struct
*/
setup_dest_addr,
+#if defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2)
+ /* Blackfin u-boot monitor should be on top of the ram */
+ reserve_uboot,
+#endif
#if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
reserve_logbuffer,
#endif
@@ -945,11 +965,14 @@ static init_fnc_t init_sequence_f[] = {
#endif
reserve_trace,
/* TODO: Why the dependency on CONFIG_8xx? */
-#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \
- && !defined(CONFIG_ARM) && !defined(CONFIG_X86)
+#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+ !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
+ !defined(CONFIG_BLACKFIN)
reserve_video,
#endif
+#if !defined(CONFIG_BLACKFIN) && !defined(CONFIG_NIOS2)
reserve_uboot,
+#endif
#ifndef CONFIG_SPL_BUILD
reserve_malloc,
reserve_board,
diff --git a/common/board_r.c b/common/board_r.c
index 8e7a3ac74cd..f9647e13583 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -133,7 +133,7 @@ static int initr_reloc_global_data(void)
{
#ifdef __ARM__
monitor_flash_len = _end - __image_copy_start;
-#elif !defined(CONFIG_SANDBOX)
+#elif !defined(CONFIG_SANDBOX) && !defined(CONFIG_NIOS2)
monitor_flash_len = (ulong)&__init_end - gd->relocaddr;
#endif
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
@@ -587,6 +587,7 @@ static int initr_doc(void)
{
puts("DOC: ");
doc_init();
+ return 0;
}
#endif
diff --git a/common/bootm.c b/common/bootm.c
index 7ec2ed8f45c..ff81a271a55 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -725,32 +725,15 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
#endif
ulong img_addr;
const void *buf;
-#if defined(CONFIG_FIT)
const char *fit_uname_config = NULL;
const char *fit_uname_kernel = NULL;
+#if defined(CONFIG_FIT)
int os_noffset;
#endif
- /* find out kernel image address */
- if (argc < 1) {
- img_addr = load_addr;
- debug("* kernel: default image load address = 0x%08lx\n",
- load_addr);
-#if defined(CONFIG_FIT)
- } else if (fit_parse_conf(argv[0], load_addr, &img_addr,
- &fit_uname_config)) {
- debug("* kernel: config '%s' from image at 0x%08lx\n",
- fit_uname_config, img_addr);
- } else if (fit_parse_subimage(argv[0], load_addr, &img_addr,
- &fit_uname_kernel)) {
- debug("* kernel: subimage '%s' from image at 0x%08lx\n",
- fit_uname_kernel, img_addr);
-#endif
- } else {
- img_addr = simple_strtoul(argv[0], NULL, 16);
- debug("* kernel: cmdline image address = 0x%08lx\n",
- img_addr);
- }
+ img_addr = genimg_get_kernel_addr_fit(argc < 1 ? NULL : argv[0],
+ &fit_uname_config,
+ &fit_uname_kernel);
bootstage_mark(BOOTSTAGE_ID_CHECK_MAGIC);
diff --git a/common/cli_simple.c b/common/cli_simple.c
index 353ceeb7349..6c65cc686cb 100644
--- a/common/cli_simple.c
+++ b/common/cli_simple.c
@@ -57,7 +57,7 @@ int cli_simple_parse_line(char *line, char *argv[])
return nargs;
}
-static void process_macros(const char *input, char *output)
+void cli_simple_process_macros(const char *input, char *output)
{
char c, prev;
const char *varname_start = NULL;
@@ -236,7 +236,7 @@ int cli_simple_run_command(const char *cmd, int flag)
debug_parser("token: \"%s\"\n", token);
/* find macros in this token and replace them */
- process_macros(token, finaltoken);
+ cli_simple_process_macros(token, finaltoken);
/* Extract arguments */
argc = cli_simple_parse_line(finaltoken, argv);
diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 433bddd5d2b..2633b30e556 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -24,8 +24,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int ret, i = 0;
- ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
- NULL, 10));
+ ret = dfu_init_env_entities(interface, devstring);
if (ret)
goto done;
diff --git a/common/cmd_ext4.c b/common/cmd_ext4.c
index 68b047ba6ae..ecfc6d3c9bb 100644
--- a/common/cmd_ext4.c
+++ b/common/cmd_ext4.c
@@ -42,6 +42,12 @@
#include <usb.h>
#endif
+int do_ext4_size(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ return do_size(cmdtp, flag, argc, argv, FS_TYPE_EXT);
+}
+
int do_ext4_load(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
{
@@ -113,6 +119,14 @@ U_BOOT_CMD(ext4write, 6, 1, do_ext4_write,
#endif
+U_BOOT_CMD(
+ ext4size, 4, 0, do_ext4_size,
+ "determine a file's size",
+ "<interface> <dev[:part]> <filename>\n"
+ " - Find file 'filename' from 'dev' on 'interface'\n"
+ " and determine its size."
+);
+
U_BOOT_CMD(ext4ls, 4, 1, do_ext4_ls,
"list files in a directory (default /)",
"<interface> <dev[:part]> [directory]\n"
@@ -120,6 +134,6 @@ U_BOOT_CMD(ext4ls, 4, 1, do_ext4_ls,
U_BOOT_CMD(ext4load, 6, 0, do_ext4_load,
"load binary file from a Ext4 filesystem",
- "<interface> <dev[:part]> [addr] [filename] [bytes]\n"
+ "<interface> [<dev[:part]> [addr [filename [bytes [pos]]]]]\n"
" - load binary file 'filename' from 'dev' on 'interface'\n"
" to address 'addr' from ext4 filesystem");
diff --git a/common/cmd_fat.c b/common/cmd_fat.c
index a4780174480..633fbf1d311 100644
--- a/common/cmd_fat.c
+++ b/common/cmd_fat.c
@@ -18,6 +18,19 @@
#include <fat.h>
#include <fs.h>
+int do_fat_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ return do_size(cmdtp, flag, argc, argv, FS_TYPE_FAT);
+}
+
+U_BOOT_CMD(
+ fatsize, 4, 0, do_fat_size,
+ "determine a file's size",
+ "<interface> <dev[:part]> <filename>\n"
+ " - Find file 'filename' from 'dev' on 'interface'\n"
+ " and determine its size."
+);
+
int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
return do_load(cmdtp, flag, argc, argv, FS_TYPE_FAT);
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index e86d992838e..5640ded2968 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -621,7 +621,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
/* resize the fdt */
else if (strncmp(argv[1], "re", 2) == 0) {
- fdt_resize(working_fdt);
+ fdt_shrink_to_minimum(working_fdt);
}
else {
/* Unrecognized command */
diff --git a/common/cmd_fs.c b/common/cmd_fs.c
index 78590d2ef0d..67543407863 100644
--- a/common/cmd_fs.c
+++ b/common/cmd_fs.c
@@ -20,6 +20,19 @@
#include <command.h>
#include <fs.h>
+static int do_size_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ return do_size(cmdtp, flag, argc, argv, FS_TYPE_ANY);
+}
+
+U_BOOT_CMD(
+ size, 4, 0, do_size_wrapper,
+ "determine a file's size",
+ "<interface> <dev[:part]> <filename>\n"
+ " - Find file 'filename' from 'dev' on 'interface'\n"
+ " and determine its size."
+);
+
static int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index 40b6333ebf4..3cb0571df39 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -292,6 +292,7 @@ static int get_mtd_info(u8 type, u8 num, struct mtd_info **mtd)
printf("Device %s not found!\n", mtd_dev);
return 1;
}
+ put_mtd_device(*mtd);
return 0;
}
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index ba48692e864..0ab1e0aaa63 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -1,5 +1,6 @@
/*
* Copyright 2010-2011 Calxeda, Inc.
+ * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -14,6 +15,7 @@
#include <fs.h>
#include "menu.h"
+#include "cli.h"
#define MAX_TFTP_PATH_LEN 127
@@ -577,8 +579,12 @@ static int label_localboot(struct pxe_label *label)
if (!localcmd)
return -ENOENT;
- if (label->append)
- setenv("bootargs", label->append);
+ if (label->append) {
+ char bootargs[CONFIG_SYS_CBSIZE];
+
+ cli_simple_process_macros(label->append, bootargs);
+ setenv("bootargs", bootargs);
+ }
debug("running: %s\n", localcmd);
@@ -606,9 +612,10 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
char initrd_str[22];
char mac_str[29] = "";
char ip_str[68] = "";
- char *bootargs;
int bootm_argc = 3;
int len = 0;
+ ulong kernel_addr;
+ void *buf;
label_print(label);
@@ -651,7 +658,6 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
sprintf(ip_str, " ip=%s:%s:%s:%s",
getenv("ipaddr"), getenv("serverip"),
getenv("gatewayip"), getenv("netmask"));
- len += strlen(ip_str);
}
#ifdef CONFIG_CMD_NET
@@ -661,27 +667,21 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8);
if (err < 0)
mac_str[0] = '\0';
- len += strlen(mac_str);
}
#endif
- if (label->append)
- len += strlen(label->append);
+ if ((label->ipappend & 0x3) || label->append) {
+ char bootargs[CONFIG_SYS_CBSIZE] = "";
+ char finalbootargs[CONFIG_SYS_CBSIZE];
- if (len) {
- bootargs = malloc(len + 1);
- if (!bootargs)
- return 1;
- bootargs[0] = '\0';
if (label->append)
strcpy(bootargs, label->append);
strcat(bootargs, ip_str);
strcat(bootargs, mac_str);
- setenv("bootargs", bootargs);
- printf("append: %s\n", bootargs);
-
- free(bootargs);
+ cli_simple_process_macros(bootargs, finalbootargs);
+ setenv("bootargs", finalbootargs);
+ printf("append: %s\n", finalbootargs);
}
bootm_argv[1] = getenv("kernel_addr_r");
@@ -771,11 +771,15 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
if (bootm_argv[3])
bootm_argc = 4;
- do_bootm(cmdtp, 0, bootm_argc, bootm_argv);
-
+ kernel_addr = genimg_get_kernel_addr(bootm_argv[1]);
+ buf = map_sysmem(kernel_addr, 0);
+ /* Try bootm for legacy and FIT format image */
+ if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID)
+ do_bootm(cmdtp, 0, bootm_argc, bootm_argv);
#ifdef CONFIG_CMD_BOOTZ
- /* Try booting a zImage if do_bootm returns */
- do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
+ /* Try booting a zImage */
+ else
+ do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
#endif
return 1;
}
@@ -1554,6 +1558,8 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
destroy_pxe_menu(cfg);
+ copy_filename(BootFile, "", sizeof(BootFile));
+
return 0;
}
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index 2dd750928e4..8ed1dc6f9e4 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -26,10 +26,9 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
puts("TIZEN \"THOR\" Downloader\n");
- ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
- NULL, 10));
+ ret = dfu_init_env_entities(interface, devstring);
if (ret)
- return ret;
+ goto done;
int controller_index = simple_strtoul(usb_controller, NULL, 0);
ret = board_usb_init(controller_index, USB_INIT_DEVICE);
@@ -57,6 +56,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
exit:
g_dnl_unregister();
+done:
dfu_free_entities();
return ret;
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 3c37c93f100..6c8570377e3 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -19,6 +19,7 @@
#include <onenand_uboot.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
+#include <linux/err.h>
#include <ubi_uboot.h>
#include <asm/errno.h>
#include <jffs2/load_kernel.h>
@@ -50,33 +51,6 @@ int ubifs_is_mounted(void);
void cmd_ubifs_umount(void);
#endif
-static void ubi_dump_vol_info(const struct ubi_volume *vol)
-{
- ubi_msg("volume information dump:");
- ubi_msg("vol_id %d", vol->vol_id);
- ubi_msg("reserved_pebs %d", vol->reserved_pebs);
- ubi_msg("alignment %d", vol->alignment);
- ubi_msg("data_pad %d", vol->data_pad);
- ubi_msg("vol_type %d", vol->vol_type);
- ubi_msg("name_len %d", vol->name_len);
- ubi_msg("usable_leb_size %d", vol->usable_leb_size);
- ubi_msg("used_ebs %d", vol->used_ebs);
- ubi_msg("used_bytes %lld", vol->used_bytes);
- ubi_msg("last_eb_bytes %d", vol->last_eb_bytes);
- ubi_msg("corrupted %d", vol->corrupted);
- ubi_msg("upd_marker %d", vol->upd_marker);
-
- if (vol->name_len <= UBI_VOL_NAME_MAX &&
- strnlen(vol->name, vol->name_len + 1) == vol->name_len) {
- ubi_msg("name %s", vol->name);
- } else {
- ubi_msg("the 1st 5 characters of the name: %c%c%c%c%c",
- vol->name[0], vol->name[1], vol->name[2],
- vol->name[3], vol->name[4]);
- }
- printf("\n");
-}
-
static void display_volume_info(struct ubi_device *ubi)
{
int i;
diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c
index 19c8a43ce4f..8e9a4e5038d 100644
--- a/common/cmd_ubifs.c
+++ b/common/cmd_ubifs.c
@@ -38,7 +38,7 @@ static int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc,
ubifs_initialized = 1;
}
- ret = ubifs_mount(vol_name);
+ ret = uboot_ubifs_mount(vol_name);
if (ret)
return -1;
diff --git a/common/env_fat.c b/common/env_fat.c
index 328c09d45ff..8db0160ceb0 100644
--- a/common/env_fat.c
+++ b/common/env_fat.c
@@ -73,7 +73,7 @@ int saveenv(void)
void env_relocate_spec(void)
{
- char buf[CONFIG_ENV_SIZE];
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
block_dev_desc_t *dev_desc = NULL;
disk_partition_t info;
int dev, part;
@@ -92,7 +92,7 @@ void env_relocate_spec(void)
goto err_env_relocate;
}
- err = file_fat_read(FAT_ENV_FILE, (uchar *)&buf, CONFIG_ENV_SIZE);
+ err = file_fat_read(FAT_ENV_FILE, buf, CONFIG_ENV_SIZE);
if (err == -1) {
printf("\n** Unable to read \"%s\" from %s%d:%d **\n",
FAT_ENV_FILE, FAT_ENV_INTERFACE, dev, part);
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 7927a83b896..784a570a818 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -508,7 +508,7 @@ void fdt_fixup_ethernet(void *fdt)
}
/* Resize the fdt to its actual size + a bit of padding */
-int fdt_resize(void *blob)
+int fdt_shrink_to_minimum(void *blob)
{
int i;
uint64_t addr, size;
diff --git a/common/image-fdt.c b/common/image-fdt.c
index db6e3955627..a2342fa3dfd 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -479,7 +479,7 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
(phys_size_t)fdt_totalsize(blob));
- ret = fdt_resize(blob);
+ ret = fdt_shrink_to_minimum(blob);
if (ret < 0)
return ret;
of_size = ret;
diff --git a/common/image-fit.c b/common/image-fit.c
index c61be651334..255c4cac9ca 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1656,7 +1656,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
bootstage_error(bootstage_id + BOOTSTAGE_SUB_LOAD);
return -EBADF;
}
- } else {
+ } else if (load_op != FIT_LOAD_OPTIONAL_NON_ZERO || load) {
ulong image_start, image_end;
ulong load_end;
void *dst;
diff --git a/common/image.c b/common/image.c
index 11b3cf58e6f..38b56e3deb5 100644
--- a/common/image.c
+++ b/common/image.c
@@ -643,6 +643,64 @@ int genimg_get_comp_id(const char *name)
#ifndef USE_HOSTCC
/**
+ * genimg_get_kernel_addr_fit - get the real kernel address and return 2
+ * FIT strings
+ * @img_addr: a string might contain real image address
+ * @fit_uname_config: double pointer to a char, will hold pointer to a
+ * configuration unit name
+ * @fit_uname_kernel: double pointer to a char, will hold pointer to a subimage
+ * name
+ *
+ * genimg_get_kernel_addr_fit get the real kernel start address from a string
+ * which is normally the first argv of bootm/bootz
+ *
+ * returns:
+ * kernel start address
+ */
+ulong genimg_get_kernel_addr_fit(char * const img_addr,
+ const char **fit_uname_config,
+ const char **fit_uname_kernel)
+{
+ ulong kernel_addr;
+
+ /* find out kernel image address */
+ if (!img_addr) {
+ kernel_addr = load_addr;
+ debug("* kernel: default image load address = 0x%08lx\n",
+ load_addr);
+#if defined(CONFIG_FIT)
+ } else if (fit_parse_conf(img_addr, load_addr, &kernel_addr,
+ fit_uname_config)) {
+ debug("* kernel: config '%s' from image at 0x%08lx\n",
+ *fit_uname_config, kernel_addr);
+ } else if (fit_parse_subimage(img_addr, load_addr, &kernel_addr,
+ fit_uname_kernel)) {
+ debug("* kernel: subimage '%s' from image at 0x%08lx\n",
+ *fit_uname_kernel, kernel_addr);
+#endif
+ } else {
+ kernel_addr = simple_strtoul(img_addr, NULL, 16);
+ debug("* kernel: cmdline image address = 0x%08lx\n",
+ kernel_addr);
+ }
+
+ return kernel_addr;
+}
+
+/**
+ * genimg_get_kernel_addr() is the simple version of
+ * genimg_get_kernel_addr_fit(). It ignores those return FIT strings
+ */
+ulong genimg_get_kernel_addr(char * const img_addr)
+{
+ const char *fit_uname_config = NULL;
+ const char *fit_uname_kernel = NULL;
+
+ return genimg_get_kernel_addr_fit(img_addr, &fit_uname_config,
+ &fit_uname_kernel);
+}
+
+/**
* genimg_get_format - get image format type
* @img_addr: image start address
*
@@ -908,7 +966,8 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
&fit_uname_config, arch,
IH_TYPE_RAMDISK,
BOOTSTAGE_ID_FIT_RD_START,
- FIT_LOAD_IGNORED, &rd_data, &rd_len);
+ FIT_LOAD_OPTIONAL_NON_ZERO,
+ &rd_data, &rd_len);
if (rd_noffset < 0)
return 1;
diff --git a/common/lcd.c b/common/lcd.c
index feb913a7201..217ec9dbd2e 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -100,7 +100,8 @@
#if LCD_BPP == LCD_MONOCHROME
# define COLOR_MASK(c) ((c) | (c) << 1 | (c) << 2 | (c) << 3 | \
(c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
-#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
+#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) || \
+ (LCD_BPP == LCD_COLOR32)
# define COLOR_MASK(c) (c)
#else
# error Unsupported LCD BPP.
@@ -109,14 +110,12 @@
DECLARE_GLOBAL_DATA_PTR;
static void lcd_drawchars(ushort x, ushort y, uchar *str, int count);
-static inline void lcd_puts_xy(ushort x, ushort y, uchar *s);
static inline void lcd_putc_xy(ushort x, ushort y, uchar c);
static int lcd_init(void *lcdbase);
static void *lcd_logo(void);
-static int lcd_getbgcolor(void);
static void lcd_setfgcolor(int color);
static void lcd_setbgcolor(int color);
@@ -177,10 +176,20 @@ static void console_scrollup(void)
CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows);
/* Clear the last rows */
+#if (LCD_BPP != LCD_COLOR32)
memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
COLOR_MASK(lcd_color_bg),
CONSOLE_ROW_SIZE * rows);
-
+#else
+ u32 *ppix = lcd_console_address +
+ CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows;
+ u32 i;
+ for (i = 0;
+ i < (CONSOLE_ROW_SIZE * rows) / NBYTES(panel_info.vl_bpix);
+ i++) {
+ *ppix++ = COLOR_MASK(lcd_color_bg);
+ }
+#endif
lcd_sync();
console_row -= rows;
}
@@ -308,13 +317,15 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
ushort off = x * (1 << LCD_BPP) % 8;
#endif
- dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
+ dest = (uchar *)(lcd_base + y * lcd_line_length + x * NBITS(LCD_BPP)/8);
for (row = 0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
uchar *s = str;
int i;
#if LCD_BPP == LCD_COLOR16
ushort *d = (ushort *)dest;
+#elif LCD_BPP == LCD_COLOR32
+ u32 *d = (u32 *)dest;
#else
uchar *d = dest;
#endif
@@ -347,6 +358,12 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
lcd_color_fg : lcd_color_bg;
bits <<= 1;
}
+#elif LCD_BPP == LCD_COLOR32
+ for (c = 0; c < 8; ++c) {
+ *d++ = (bits & 0x80) ?
+ lcd_color_fg : lcd_color_bg;
+ bits <<= 1;
+ }
#endif
}
#if LCD_BPP == LCD_MONOCHROME
@@ -355,15 +372,6 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
}
}
-/*----------------------------------------------------------------------*/
-
-static inline void lcd_puts_xy(ushort x, ushort y, uchar *s)
-{
- lcd_drawchars(x, y, s, strlen((char *)s));
-}
-
-/*----------------------------------------------------------------------*/
-
static inline void lcd_putc_xy(ushort x, ushort y, uchar c)
{
lcd_drawchars(x, y, &c, 1);
@@ -476,9 +484,19 @@ void lcd_clear(void)
test_pattern();
#else
/* set framebuffer to background color */
+#if (LCD_BPP != LCD_COLOR32)
memset((char *)lcd_base,
- COLOR_MASK(lcd_getbgcolor()),
+ COLOR_MASK(lcd_color_bg),
lcd_line_length * panel_info.vl_row);
+#else
+ u32 *ppix = lcd_base;
+ u32 i;
+ for (i = 0;
+ i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
+ i++) {
+ *ppix++ = COLOR_MASK(lcd_color_bg);
+ }
+#endif
#endif
/* Paint the logo and retrieve LCD base address */
debug("[LCD] Drawing the logo...\n");
@@ -586,20 +604,6 @@ static void lcd_setbgcolor(int color)
lcd_color_bg = color;
}
-/*----------------------------------------------------------------------*/
-
-int lcd_getfgcolor(void)
-{
- return lcd_color_fg;
-}
-
-/*----------------------------------------------------------------------*/
-
-static int lcd_getbgcolor(void)
-{
- return lcd_color_bg;
-}
-
/************************************************************************/
/* ** Chipset depending Bitmap / Logo stuff... */
/************************************************************************/
@@ -938,8 +942,13 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
return 1;
}
- /* We support displaying 8bpp BMPs on 16bpp LCDs */
- if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16)) {
+ /*
+ * We support displaying 8bpp BMPs on 16bpp LCDs
+ * and displaying 24bpp BMPs on 32bpp LCDs
+ * */
+ if (bpix != bmp_bpix &&
+ !(bmp_bpix == 8 && bpix == 16) &&
+ !(bmp_bpix == 24 && bpix == 32)) {
printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
bpix, get_unaligned_le16(&bmp->header.bit_count));
return 1;
@@ -1060,7 +1069,19 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
}
break;
#endif /* CONFIG_BMP_16BPP */
-
+#if defined(CONFIG_BMP_24BMP)
+ case 24:
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; j++) {
+ *(fb++) = *(bmap++);
+ *(fb++) = *(bmap++);
+ *(fb++) = *(bmap++);
+ *(fb++) = 0;
+ }
+ fb -= lcd_line_length + width * (bpix / 8);
+ }
+ break;
+#endif /* CONFIG_BMP_24BMP */
#if defined(CONFIG_BMP_32BPP)
case 32:
for (i = 0; i < height; ++i) {