summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig3
-rw-r--r--common/board_f.c32
-rw-r--r--common/board_r.c14
-rw-r--r--common/cmd_blob.c18
-rw-r--r--common/cmd_bootm.c3
-rw-r--r--common/cmd_eeprom.c6
-rw-r--r--common/cmd_elf.c4
-rw-r--r--common/cmd_fastboot.c6
-rw-r--r--common/cmd_gpt.c52
-rw-r--r--common/cmd_usb_mass_storage.c2
-rw-r--r--common/cmd_yaffs2.c26
-rw-r--r--common/dlmalloc.c10
-rw-r--r--common/fb_mmc.c60
-rw-r--r--common/hash.c10
-rw-r--r--common/lcd_console.c39
-rw-r--r--common/spl/spl.c35
16 files changed, 258 insertions, 62 deletions
diff --git a/common/Kconfig b/common/Kconfig
index 2ca002de27..e662774304 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"
@@ -134,7 +133,7 @@ config LOOPW
Infinite write loop on address range
config CMD_MEMTEST
- bool "crc32"
+ bool "memtest"
help
Simple RAM read/write test.
diff --git a/common/board_f.c b/common/board_f.c
index 62fdaebb54..731b539eaa 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -174,7 +174,7 @@ static int announce_dram_init(void)
return 0;
}
-#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
+#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K)
static int init_func_ram(void)
{
#ifdef CONFIG_BOARD_TYPES
@@ -610,7 +610,7 @@ static int display_new_sp(void)
return 0;
}
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
static int setup_board_part1(void)
{
bd_t *bd = gd->bd;
@@ -631,7 +631,7 @@ static int setup_board_part1(void)
defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
bd->bi_immr_base = CONFIG_SYS_IMMR; /* base of IMMR register */
#endif
-#if defined(CONFIG_MPC5xxx)
+#if defined(CONFIG_MPC5xxx) || defined(CONFIG_M68K)
bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */
#endif
#if defined(CONFIG_MPC83xx)
@@ -660,6 +660,14 @@ static int setup_board_part2(void)
bd->bi_ipbfreq = gd->arch.ipb_clk;
bd->bi_pcifreq = gd->pci_clk;
#endif /* CONFIG_MPC5xxx */
+#if defined(CONFIG_M68K) && defined(CONFIG_PCI)
+ bd->bi_pcifreq = gd->pci_clk;
+#endif
+#if defined(CONFIG_EXTRA_CLOCK)
+ bd->bi_inpfreq = gd->arch.inp_clk; /* input Freq in Hz */
+ bd->bi_vcofreq = gd->arch.vco_clk; /* vco Freq in Hz */
+ bd->bi_flbfreq = gd->arch.flb_clk; /* flexbus Freq in Hz */
+#endif
return 0;
}
@@ -721,6 +729,13 @@ static int setup_reloc(void)
{
#ifdef CONFIG_SYS_TEXT_BASE
gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
+#ifdef CONFIG_M68K
+ /*
+ * On all ColdFire arch cpu, monitor code starts always
+ * just after the default vector table location, so at 0x400
+ */
+ gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
+#endif
#endif
memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
@@ -846,6 +861,9 @@ static init_fnc_t init_sequence_f[] = {
#ifdef CONFIG_FSL_ESDHC
get_clocks,
#endif
+#ifdef 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 */
@@ -872,7 +890,7 @@ static init_fnc_t init_sequence_f[] = {
#if defined(CONFIG_MPC83xx)
prt_83xx_rsr,
#endif
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
checkcpu,
#endif
print_cpuinfo, /* display cpu info (and speed) */
@@ -898,7 +916,7 @@ static init_fnc_t init_sequence_f[] = {
#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)
+#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K)
init_func_ram,
#endif
#ifdef CONFIG_POST
@@ -966,7 +984,7 @@ static init_fnc_t init_sequence_f[] = {
reserve_stacks,
setup_dram_config,
show_dram_config,
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
setup_board_part1,
INIT_FUNC_WATCHDOG_RESET
setup_board_part2,
@@ -1056,7 +1074,7 @@ void board_init_f_r(void)
* Transfer execution from Flash to RAM by calculating the address
* of the in-RAM copy of board_init_r() and calling it
*/
- (board_init_r + gd->reloc_off)(gd, gd->relocaddr);
+ (board_init_r + gd->reloc_off)((gd_t *)gd, gd->relocaddr);
/* NOTREACHED - board_init_r() does not return */
hang();
diff --git a/common/board_r.c b/common/board_r.c
index 4fcd4f6a70..0335f6bde6 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -167,14 +167,17 @@ static int initr_serial(void)
return 0;
}
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
static int initr_trap(void)
{
/*
* Setup trap handlers
*/
+#if defined(CONFIG_PPC)
trap_init(gd->relocaddr);
-
+#else
+ trap_init(CONFIG_SYS_SDRAM_BASE);
+#endif
return 0;
}
#endif
@@ -729,7 +732,7 @@ init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_NEEDS_MANUAL_RELOC
initr_manual_reloc_cmdtable,
#endif
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
initr_trap,
#endif
#ifdef CONFIG_ADDR_MAP
@@ -767,7 +770,7 @@ init_fnc_t init_sequence_r[] = {
initr_flash,
#endif
INIT_FUNC_WATCHDOG_RESET
-#if defined(CONFIG_PPC)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
/* initialize higher level parts of CPU like time base and timers */
cpu_init_r,
#endif
@@ -831,7 +834,8 @@ init_fnc_t init_sequence_r[] = {
#if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
initr_enable_interrupts,
#endif
-#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32)
+#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) \
+ || defined(CONFIG_M68K)
timer_init, /* initialize timer */
#endif
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
diff --git a/common/cmd_blob.c b/common/cmd_blob.c
index 82ecaf09e5..d3f22a1afc 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_bootm.c b/common/cmd_bootm.c
index 48199bfff3..4f77f22f94 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -78,7 +78,8 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
- if (state != BOOTM_STATE_START && images.state >= state) {
+ if (((state & BOOTM_STATE_START) != BOOTM_STATE_START) &&
+ images.state >= state) {
printf("Trying to execute a command out of order\n");
return CMD_RET_USAGE;
}
diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index 29f0f1f784..e9904cd698 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -161,6 +161,9 @@ int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt
#if defined(CONFIG_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
spi_read (addr, alen, buffer, len);
#else
+#if defined(CONFIG_SYS_I2C_EEPROM_BUS)
+ i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS);
+#endif
if (i2c_read(addr[0], offset, alen - 1, buffer, len))
rcode = 1;
#endif
@@ -339,6 +342,9 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
/* Write is enabled ... now write eeprom value.
*/
#endif
+#if defined(CONFIG_SYS_I2C_EEPROM_BUS)
+ i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS);
+#endif
if (i2c_write(addr[0], offset, alen - 1, buffer, len))
rcode = 1;
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index 58b61c2640..c745371506 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -95,6 +95,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
unsigned long addr; /* Address of the ELF image */
unsigned long rc; /* Return value from user code */
char *sload, *saddr;
+ const char *ep = getenv("autostart");
/* -------------------------------------------------- */
int rcode = 0;
@@ -123,6 +124,9 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
else
addr = load_elf_image_shdr(addr);
+ if (ep && !strcmp(ep, "no"))
+ return rcode;
+
printf("## Starting application at 0x%08lx ...\n", addr);
/*
diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index b72f4f310d..346ab80454 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -20,6 +20,12 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (ret)
return ret;
+ if (!g_dnl_board_usb_cable_connected()) {
+ puts("\rUSB cable not detected.\n" \
+ "Command exit.\n");
+ return CMD_RET_FAILURE;
+ }
+
while (1) {
if (g_dnl_detach())
break;
diff --git a/common/cmd_gpt.c b/common/cmd_gpt.c
index e38422d792..c56fe15d3b 100644
--- a/common/cmd_gpt.c
+++ b/common/cmd_gpt.c
@@ -154,17 +154,24 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
/* extract disk guid */
s = str;
- tok = strsep(&s, ";");
- val = extract_val(tok, "uuid_disk");
+ val = extract_val(str, "uuid_disk");
if (!val) {
+#ifdef CONFIG_RANDOM_UUID
+ *str_disk_guid = malloc(UUID_STR_LEN + 1);
+ gen_rand_uuid_str(*str_disk_guid, UUID_STR_FORMAT_STD);
+#else
free(str);
return -2;
+#endif
+ } else {
+ val = strsep(&val, ";");
+ if (extract_env(val, &p))
+ p = val;
+ *str_disk_guid = strdup(p);
+ free(val);
+ /* Move s to first partition */
+ strsep(&s, ";");
}
- if (extract_env(val, &p))
- p = val;
- *str_disk_guid = strdup(p);
- free(val);
-
if (strlen(s) == 0)
return -3;
@@ -192,20 +199,25 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
/* uuid */
val = extract_val(tok, "uuid");
- if (!val) { /* 'uuid' is mandatory */
- errno = -4;
- goto err;
- }
- if (extract_env(val, &p))
- p = val;
- if (strlen(p) >= sizeof(parts[i].uuid)) {
- printf("Wrong uuid format for partition %d\n", i);
+ if (!val) {
+ /* 'uuid' is optional if random uuid's are enabled */
+#ifdef CONFIG_RANDOM_UUID
+ gen_rand_uuid_str(parts[i].uuid, UUID_STR_FORMAT_STD);
+#else
errno = -4;
goto err;
+#endif
+ } else {
+ if (extract_env(val, &p))
+ p = val;
+ if (strlen(p) >= sizeof(parts[i].uuid)) {
+ printf("Wrong uuid format for partition %d\n", i);
+ errno = -4;
+ goto err;
+ }
+ strcpy((char *)parts[i].uuid, p);
+ free(val);
}
- strcpy((char *)parts[i].uuid, p);
- free(val);
-
/* name */
val = extract_val(tok, "name");
if (!val) { /* name is mandatory */
@@ -281,11 +293,11 @@ static int gpt_default(block_dev_desc_t *blk_dev_desc, const char *str_part)
}
/* save partitions layout to disk */
- gpt_restore(blk_dev_desc, str_disk_guid, partitions, part_count);
+ ret = gpt_restore(blk_dev_desc, str_disk_guid, partitions, part_count);
free(str_disk_guid);
free(partitions);
- return 0;
+ return ret;
}
/**
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 2c879ea083..51c3fffb46 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -159,6 +159,6 @@ exit:
U_BOOT_CMD(ums, 4, 1, do_usb_mass_storage,
"Use the UMS [User Mass Storage]",
- "ums <USB_controller> [<devtype>] <devnum> e.g. ums 0 mmc 0\n"
+ "<USB_controller> [<devtype>] <devnum> e.g. ums 0 mmc 0\n"
" devtype defaults to mmc"
);
diff --git a/common/cmd_yaffs2.c b/common/cmd_yaffs2.c
index d43a9d444c..9244606bda 100644
--- a/common/cmd_yaffs2.c
+++ b/common/cmd_yaffs2.c
@@ -281,46 +281,46 @@ int do_ymv(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
U_BOOT_CMD(ytrace, 2, 0, do_ytrace,
"show/set yaffs trace mask",
- "ytrace [new_mask] show/set yaffs trace mask");
+ "[new_mask] show/set yaffs trace mask");
U_BOOT_CMD(ydevls, 1, 0, do_ydevls,
"list yaffs mount points", "list yaffs mount points");
U_BOOT_CMD(ydevconfig, 5, 0, do_ydevconfig,
"configure yaffs mount point",
- "ydevconfig mtpoint mtd_id start_block end_block configures a yaffs2 mount point");
+ "mtpoint mtd_id start_block end_block configures a yaffs2 mount point");
U_BOOT_CMD(ymount, 2, 0, do_ymount,
- "mount yaffs", "ymount mtpoint mounts a yaffs2 mount point");
+ "mount yaffs", "mtpoint mounts a yaffs2 mount point");
U_BOOT_CMD(yumount, 2, 0, do_yumount,
- "unmount yaffs", "yunmount mtpoint unmounts a yaffs2 mount point");
+ "unmount yaffs", "mtpoint unmounts a yaffs2 mount point");
-U_BOOT_CMD(yls, 3, 0, do_yls, "yaffs ls", "yls [-l] dirname");
+U_BOOT_CMD(yls, 3, 0, do_yls, "yaffs ls", "[-l] dirname");
U_BOOT_CMD(yrd, 2, 0, do_yrd,
- "read file from yaffs", "yrd path read file from yaffs");
+ "read file from yaffs", "path read file from yaffs");
U_BOOT_CMD(ywr, 4, 0, do_ywr,
"write file to yaffs",
- "ywr filename value num_vlues write values to yaffs file");
+ "filename value num_vlues write values to yaffs file");
U_BOOT_CMD(yrdm, 3, 0, do_yrdm,
"read file to memory from yaffs",
- "yrdm filename offset reads yaffs file into memory");
+ "filename offset reads yaffs file into memory");
U_BOOT_CMD(ywrm, 4, 0, do_ywrm,
"write file from memory to yaffs",
- "ywrm filename offset size writes memory to yaffs file");
+ "filename offset size writes memory to yaffs file");
U_BOOT_CMD(ymkdir, 2, 0, do_ymkdir,
- "YAFFS mkdir", "ymkdir dir create a yaffs directory");
+ "YAFFS mkdir", "dir create a yaffs directory");
U_BOOT_CMD(yrmdir, 2, 0, do_yrmdir,
- "YAFFS rmdir", "yrmdir dirname removes a yaffs directory");
+ "YAFFS rmdir", "dirname removes a yaffs directory");
-U_BOOT_CMD(yrm, 2, 0, do_yrm, "YAFFS rm", "yrm path removes a yaffs file");
+U_BOOT_CMD(yrm, 2, 0, do_yrm, "YAFFS rm", "path removes a yaffs file");
U_BOOT_CMD(ymv, 4, 0, do_ymv,
"YAFFS mv",
- "ymv old_path new_path moves/rename files within a yaffs mount point");
+ "old_path new_path moves/rename files within a yaffs mount point");
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index 6453ee9c25..b2ce063c5f 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1535,9 +1535,9 @@ void mem_malloc_init(ulong start, ulong size)
debug("using memory %#lx-%#lx for malloc()\n", mem_malloc_start,
mem_malloc_end);
-
- memset((void *)mem_malloc_start, 0, size);
-
+#ifdef CONFIG_SYS_MALLOC_CLEAR_ON_INIT
+ memset((void *)mem_malloc_start, 0x0, size);
+#endif
malloc_bin_reloc();
}
@@ -2948,10 +2948,12 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
/* check if expand_top called, in which case don't need to clear */
+#ifdef CONFIG_SYS_MALLOC_CLEAR_ON_INIT
#if MORECORE_CLEARS
mchunkptr oldtop = top;
INTERNAL_SIZE_T oldtopsize = chunksize(top);
#endif
+#endif
Void_t* mem = mALLOc (sz);
if ((long)n < 0) return NULL;
@@ -2977,6 +2979,7 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
csz = chunksize(p);
+#ifdef CONFIG_SYS_MALLOC_CLEAR_ON_INIT
#if MORECORE_CLEARS
if (p == oldtop && csz > oldtopsize)
{
@@ -2984,6 +2987,7 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
csz = oldtopsize;
}
#endif
+#endif
MALLOC_ZERO(mem, csz - SIZE_SZ);
return mem;
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index 6ea3938d83..75899e4c28 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -10,6 +10,7 @@
#include <part.h>
#include <aboot.h>
#include <sparse_format.h>
+#include <mmc.h>
#ifndef CONFIG_FASTBOOT_GPT_NAME
#define CONFIG_FASTBOOT_GPT_NAME GPT_ENTRY_NAME
@@ -22,13 +23,13 @@ static char *response_str;
void fastboot_fail(const char *s)
{
- strncpy(response_str, "FAIL", 4);
+ strncpy(response_str, "FAIL\0", 5);
strncat(response_str, s, RESPONSE_LEN - 4 - 1);
}
void fastboot_okay(const char *s)
{
- strncpy(response_str, "OKAY", 4);
+ strncpy(response_str, "OKAY\0", 5);
strncat(response_str, s, RESPONSE_LEN - 4 - 1);
}
@@ -110,3 +111,58 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,
write_raw_image(dev_desc, &info, cmd, download_buffer,
download_bytes);
}
+
+void fb_mmc_erase(const char *cmd, char *response)
+{
+ int ret;
+ block_dev_desc_t *dev_desc;
+ disk_partition_t info;
+ lbaint_t blks, blks_start, blks_size, grp_size;
+ struct mmc *mmc = find_mmc_device(CONFIG_FASTBOOT_FLASH_MMC_DEV);
+
+ if (mmc == NULL) {
+ error("invalid mmc device");
+ fastboot_fail("invalid mmc device");
+ return;
+ }
+
+ /* initialize the response buffer */
+ response_str = response;
+
+ dev_desc = get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
+ if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
+ error("invalid mmc device");
+ fastboot_fail("invalid mmc device");
+ return;
+ }
+
+ ret = get_partition_info_efi_by_name(dev_desc, cmd, &info);
+ if (ret) {
+ error("cannot find partition: '%s'", cmd);
+ fastboot_fail("cannot find partition");
+ return;
+ }
+
+ /* Align blocks to erase group size to avoid erasing other partitions */
+ grp_size = mmc->erase_grp_size;
+ blks_start = (info.start + grp_size - 1) & ~(grp_size - 1);
+ if (info.size >= grp_size)
+ blks_size = (info.size - (blks_start - info.start)) &
+ (~(grp_size - 1));
+ else
+ blks_size = 0;
+
+ printf("Erasing blocks " LBAFU " to " LBAFU " due to alignment\n",
+ blks_start, blks_start + blks_size);
+
+ blks = dev_desc->block_erase(dev_desc->dev, blks_start, blks_size);
+ if (blks != blks_size) {
+ error("failed erasing from device %d", dev_desc->dev);
+ fastboot_fail("failed erasing from device");
+ return;
+ }
+
+ printf("........ erased " LBAFU " bytes from '%s'\n",
+ blks_size * info.blksz, cmd);
+ fastboot_okay("");
+}
diff --git a/common/hash.c b/common/hash.c
index d154d029e9..9e9f84b9fb 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/lcd_console.c b/common/lcd_console.c
index 74c388a0ca..8bf83b90d5 100644
--- a/common/lcd_console.c
+++ b/common/lcd_console.c
@@ -209,3 +209,42 @@ void lcd_printf(const char *fmt, ...)
lcd_puts(buf);
}
+
+static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ unsigned int col, row;
+
+ if (argc != 3)
+ return CMD_RET_USAGE;
+
+ col = simple_strtoul(argv[1], NULL, 10);
+ row = simple_strtoul(argv[2], NULL, 10);
+ lcd_position_cursor(col, row);
+
+ return 0;
+}
+
+static int do_lcd_puts(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ if (argc != 2)
+ return CMD_RET_USAGE;
+
+ lcd_puts(argv[1]);
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ setcurs, 3, 1, do_lcd_setcursor,
+ "set cursor position within screen",
+ " <col> <row> in character"
+);
+
+U_BOOT_CMD(
+ lcdputs, 2, 1, do_lcd_puts,
+ "print string on lcd-framebuffer",
+ " <string>"
+);
+
diff --git a/common/spl/spl.c b/common/spl/spl.c
index ded0f30478..cd75bbc4ce 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -281,3 +281,38 @@ void preloader_console_init(void)
spl_display_print();
#endif
}
+
+/**
+ * spl_relocate_stack_gd() - Relocate stack ready for board_init_r() execution
+ *
+ * Sometimes board_init_f() runs with a stack in SRAM but we want to use SDRAM
+ * for the main board_init_r() execution. This is typically because we need
+ * more stack space for things like the MMC sub-system.
+ *
+ * This function calculates the stack position, copies the global_data into
+ * place and returns the new stack position. The caller is responsible for
+ * setting up the sp register.
+ *
+ * @return new stack location, or 0 to use the same stack
+ */
+ulong spl_relocate_stack_gd(void)
+{
+#ifdef CONFIG_SPL_STACK_R
+ gd_t *new_gd;
+ ulong ptr;
+
+ /* Get stack position: use 8-byte alignment for ABI compliance */
+ ptr = CONFIG_SPL_STACK_R - sizeof(gd_t);
+ ptr &= ~7;
+ new_gd = (gd_t *)ptr;
+ memcpy(new_gd, (void *)gd, sizeof(gd_t));
+ gd = new_gd;
+
+ /* Clear the BSS. */
+ memset(__bss_start, 0, __bss_end - __bss_start);
+
+ return ptr;
+#else
+ return 0;
+#endif
+}