summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/board_f.c18
-rw-r--r--common/cmd_mem.c34
-rw-r--r--common/cmd_nand.c27
-rw-r--r--common/env_sf.c6
4 files changed, 41 insertions, 44 deletions
diff --git a/common/board_f.c b/common/board_f.c
index 55ede07..cb956b8 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -47,7 +47,7 @@
#include <asm/errno.h>
#include <asm/io.h>
#include <asm/sections.h>
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) || defined(CONFIG_ARC)
#include <asm/init_helpers.h>
#include <asm/relocate.h>
#endif
@@ -494,7 +494,7 @@ static int reserve_trace(void)
#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
- !defined(CONFIG_BLACKFIN)
+ !defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)
static int reserve_video(void)
{
/* reserve memory for video display (always full pages) */
@@ -761,7 +761,7 @@ static int jump_to_copy(void)
* similarly for all archs. When we do generic relocation, hopefully
* we can make all archs enable the dcache prior to relocation.
*/
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) || defined(CONFIG_ARC)
/*
* SDRAM and console are now initialised. The final stack can now
* be setup in SDRAM. Code execution will continue in Flash, but
@@ -968,7 +968,7 @@ static init_fnc_t init_sequence_f[] = {
/* 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_BLACKFIN) && !defined(CONFIG_M68K)
reserve_video,
#endif
#if !defined(CONFIG_BLACKFIN) && !defined(CONFIG_NIOS2)
@@ -997,7 +997,7 @@ static init_fnc_t init_sequence_f[] = {
INIT_FUNC_WATCHDOG_RESET
reloc_fdt,
setup_reloc,
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) || defined(CONFIG_ARC)
copy_uboot_to_ram,
clear_bss,
do_elf_reloc_fixups,
@@ -1041,7 +1041,7 @@ void board_init_f(ulong boot_flags)
#endif
}
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) || defined(CONFIG_ARC)
/*
* For now this code is only used on x86.
*
@@ -1080,7 +1080,9 @@ void board_init_f_r(void)
/* NOTREACHED - board_init_r() does not return */
hang();
}
-#else
+#endif /* CONFIG_X86 */
+
+#ifndef CONFIG_X86
ulong board_init_f_mem(ulong top)
{
/* Leave space for the stack we are running with now */
@@ -1098,4 +1100,4 @@ ulong board_init_f_mem(ulong top)
return top;
}
-#endif /* CONFIG_X86 */
+#endif /* !CONFIG_X86 */
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index bcb3ee3..3f85c1a 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -999,10 +999,10 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
{
ulong start, end;
vu_long *buf, *dummy;
- int iteration_limit;
+ ulong iteration_limit = 0;
int ret;
ulong errs = 0; /* number of errors, or -1 if interrupted */
- ulong pattern;
+ ulong pattern = 0;
int iteration;
#if defined(CONFIG_SYS_ALT_MEMTEST)
const int alt_test = 1;
@@ -1010,25 +1010,29 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
const int alt_test = 0;
#endif
+ start = CONFIG_SYS_MEMTEST_START;
+ end = CONFIG_SYS_MEMTEST_END;
+
if (argc > 1)
- start = simple_strtoul(argv[1], NULL, 16);
- else
- start = CONFIG_SYS_MEMTEST_START;
+ if (strict_strtoul(argv[1], 16, &start) < 0)
+ return CMD_RET_USAGE;
if (argc > 2)
- end = simple_strtoul(argv[2], NULL, 16);
- else
- end = CONFIG_SYS_MEMTEST_END;
+ if (strict_strtoul(argv[2], 16, &end) < 0)
+ return CMD_RET_USAGE;
if (argc > 3)
- pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
- else
- pattern = 0;
+ if (strict_strtoul(argv[3], 16, &pattern) < 0)
+ return CMD_RET_USAGE;
if (argc > 4)
- iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16);
- else
- iteration_limit = 0;
+ if (strict_strtoul(argv[4], 16, &iteration_limit) < 0)
+ return CMD_RET_USAGE;
+
+ if (end < start) {
+ printf("Refusing to do empty test\n");
+ return -1;
+ }
printf("Testing %08x ... %08x:\n", (uint)start, (uint)end);
debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__,
@@ -1079,7 +1083,7 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
ret = errs != 0;
}
- return ret; /* not reached */
+ return ret;
}
#endif /* CONFIG_CMD_MEMTEST */
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 7f962dc..17fa7ea 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -419,10 +419,13 @@ static int raw_access(nand_info_t *nand, ulong addr, loff_t off, ulong count,
.mode = MTD_OPS_RAW
};
- if (read)
+ if (read) {
ret = mtd_read_oob(nand, off, &ops);
- else
+ } else {
ret = mtd_write_oob(nand, off, &ops);
+ if (!ret)
+ ret = nand_verify_page_oob(nand, &ops, off);
+ }
if (ret) {
printf("%s: error at offset %llx, ret %d\n",
@@ -690,7 +693,8 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
else
ret = nand_write_skip_bad(nand, off, &rwsize,
NULL, maxsize,
- (u_char *)addr, 0);
+ (u_char *)addr,
+ WITH_WR_VERIFY);
#ifdef CONFIG_CMD_NAND_TRIMFFS
} else if (!strcmp(s, ".trimffs")) {
if (read) {
@@ -699,17 +703,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
ret = nand_write_skip_bad(nand, off, &rwsize, NULL,
maxsize, (u_char *)addr,
- WITH_DROP_FFS);
-#endif
-#ifdef CONFIG_CMD_NAND_YAFFS
- } else if (!strcmp(s, ".yaffs")) {
- if (read) {
- printf("Unknown nand command suffix '%s'.\n", s);
- return 1;
- }
- ret = nand_write_skip_bad(nand, off, &rwsize, NULL,
- maxsize, (u_char *)addr,
- WITH_YAFFS_OOB);
+ WITH_DROP_FFS | WITH_WR_VERIFY);
#endif
} else if (!strcmp(s, ".oob")) {
/* out-of-band data */
@@ -853,11 +847,6 @@ static char nand_help_text[] =
" 'addr', skipping bad blocks and dropping any pages at the end\n"
" of eraseblocks that contain only 0xFF\n"
#endif
-#ifdef CONFIG_CMD_NAND_YAFFS
- "nand write.yaffs - addr off|partition size\n"
- " write 'size' bytes starting at offset 'off' with yaffs format\n"
- " from memory address 'addr', skipping bad blocks.\n"
-#endif
"nand erase[.spread] [clean] off size - erase 'size' bytes "
"from offset 'off'\n"
" With '.spread', erase enough for given file size, otherwise,\n"
diff --git a/common/env_sf.c b/common/env_sf.c
index 5e3729c..e928f57 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -188,15 +188,17 @@ void env_relocate_spec(void)
tmp_env2->flags == ACTIVE_FLAG) {
gd->env_valid = 2;
} else if (tmp_env1->flags == tmp_env2->flags) {
- gd->env_valid = 2;
+ gd->env_valid = 1;
} else if (tmp_env1->flags == 0xFF) {
+ gd->env_valid = 1;
+ } else if (tmp_env2->flags == 0xFF) {
gd->env_valid = 2;
} else {
/*
* this differs from code in env_flash.c, but I think a sane
* default path is desirable.
*/
- gd->env_valid = 2;
+ gd->env_valid = 1;
}
if (gd->env_valid == 1)