summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2010-11-16 09:55:11 +0900
committerMinkyu Kang <mk7.kang@samsung.com>2010-11-16 09:55:11 +0900
commit1032d97496f6d534bf0030a5779ff1cb38cc9ebf (patch)
tree3713c814a7453024eceb097c67532072950e2f2e /common
parent37a3bda0c9c8a2ffbf7e2a9e121177a3385a0626 (diff)
parent227b72515546fca535dbd3274f6d875d97f494fe (diff)
downloadu-boot-imx-1032d97496f6d534bf0030a5779ff1cb38cc9ebf.zip
u-boot-imx-1032d97496f6d534bf0030a5779ff1cb38cc9ebf.tar.gz
u-boot-imx-1032d97496f6d534bf0030a5779ff1cb38cc9ebf.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-arm
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bdinfo.c4
-rw-r--r--common/cmd_bmp.c2
-rw-r--r--common/cmd_bootm.c2
-rw-r--r--common/cmd_date.c6
-rw-r--r--common/cmd_i2c.c2
-rw-r--r--common/cmd_nvedit.c2
-rw-r--r--common/cmd_onenand.c9
-rw-r--r--common/cmd_pci.c13
-rw-r--r--common/command.c2
-rw-r--r--common/dlmalloc.c2
-rw-r--r--common/env_common.c2
-rw-r--r--common/env_flash.c3
-rw-r--r--common/env_sf.c172
-rw-r--r--common/hush.c4
-rw-r--r--common/hwconfig.c21
-rw-r--r--common/image.c8
-rw-r--r--common/serial.c2
-rw-r--r--common/stdio.c4
-rw-r--r--common/usb_storage.c2
19 files changed, 140 insertions, 122 deletions
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 1326c8f..bba7374 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -192,7 +192,7 @@ int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
printf("CONFIG_SYS_PROM_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
CONFIG_SYS_PROM_SIZE);
printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
- CONFIG_SYS_GBL_DATA_SIZE);
+ GENERATED_GBL_DATA_SIZE);
#if defined(CONFIG_CMD_NET)
print_eth(0);
@@ -343,7 +343,6 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
#endif
printf ("baudrate = %d bps\n", bd->bi_baudrate);
-#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
#if !(defined(CONFIG_SYS_NO_ICACHE) && defined(CONFIG_SYS_NO_DCACHE))
print_num ("TLB addr", gd->tlb_addr);
#endif
@@ -352,7 +351,6 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_num ("irq_sp", gd->irq_sp); /* irq stack pointer */
print_num ("sp start ", gd->start_addr_sp);
print_num ("FB base ", gd->fb_base);
-#endif
return 0;
}
diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index 6fa8a15..f2a48f7 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -137,7 +137,7 @@ static cmd_tbl_t cmd_bmp_sub[] = {
U_BOOT_CMD_MKENT(display, 5, 0, do_bmp_display, "", ""),
};
-#ifndef CONFIG_RELOC_FIXUP_WORKS
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
void bmp_reloc(void) {
fixup_cmdtable(cmd_bmp_sub, ARRAY_SIZE(cmd_bmp_sub));
}
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index ce3c77c..1a024f1 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -590,7 +590,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ulong load_end = 0;
int ret;
boot_os_fn *boot_fn;
-#ifndef CONFIG_RELOC_FIXUP_WORKS
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
static int relocated = 0;
/* relocate boot function table */
diff --git a/common/cmd_date.c b/common/cmd_date.c
index 50b4240..8dbf16d 100644
--- a/common/cmd_date.c
+++ b/common/cmd_date.c
@@ -35,10 +35,10 @@ const char *weekdays[] = {
"Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur",
};
-#ifdef CONFIG_RELOC_FIXUP_WORKS
-#define RELOC(a) a
-#else
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
#define RELOC(a) ((typeof(a))((unsigned long)(a) + gd->reloc_off))
+#else
+#define RELOC(a) a
#endif
int mk_date (char *, struct rtc_time *);
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 0a0cfce..c272b0d 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -1284,7 +1284,7 @@ static cmd_tbl_t cmd_i2c_sub[] = {
U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""),
};
-#ifndef CONFIG_RELOC_FIXUP_WORKS
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
void i2c_reloc(void) {
fixup_cmdtable(cmd_i2c_sub, ARRAY_SIZE(cmd_i2c_sub));
}
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 3d30c32..3fd8abc 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -837,7 +837,7 @@ static cmd_tbl_t cmd_env_sub[] = {
U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 0, do_env_set, "", ""),
};
-#if !defined(CONFIG_RELOC_FIXUP_WORKS)
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
void env_reloc(void)
{
fixup_cmdtable(cmd_env_sub, ARRAY_SIZE(cmd_env_sub));
diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c
index 83d967b..33108f1 100644
--- a/common/cmd_onenand.c
+++ b/common/cmd_onenand.c
@@ -525,10 +525,19 @@ static cmd_tbl_t cmd_onenand_sub[] = {
U_BOOT_CMD_MKENT(markbad, CONFIG_SYS_MAXARGS, 0, do_onenand_markbad, "", ""),
};
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+void onenand_reloc(void) {
+ fixup_cmdtable(cmd_onenand_sub, ARRAY_SIZE(cmd_onenand_sub));
+}
+#endif
+
static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
cmd_tbl_t *c;
+ if (argc < 2)
+ return cmd_usage(cmdtp);
+
mtd = &onenand_mtd;
/* Strip off leading 'onenand' command argument */
diff --git a/common/cmd_pci.c b/common/cmd_pci.c
index 4bde059..ccf5ada 100644
--- a/common/cmd_pci.c
+++ b/common/cmd_pci.c
@@ -497,6 +497,10 @@ int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if ((bdf = get_pci_dev(argv[2])) == -1)
return 1;
break;
+#ifdef CONFIG_CMD_PCI_ENUM
+ case 'e':
+ break;
+#endif
default: /* scan bus */
value = 1; /* short listing */
bdf = 0; /* bus number */
@@ -518,6 +522,11 @@ int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
case 'd': /* display */
return pci_cfg_display(bdf, addr, size, value);
+#ifdef CONFIG_CMD_PCI_ENUM
+ case 'e':
+ pci_init();
+ return 0;
+#endif
case 'n': /* next */
if (argc < 4)
goto usage;
@@ -545,6 +554,10 @@ U_BOOT_CMD(
"list and access PCI Configuration Space",
"[bus] [long]\n"
" - short or long list of PCI devices on bus 'bus'\n"
+#ifdef CONFIG_CMD_PCI_ENUM
+ "pci enum\n"
+ " - re-enumerate PCI buses\n"
+#endif
"pci header b.d.f\n"
" - show header of PCI device 'bus.device.function'\n"
"pci display[.b, .w, .l] b.d.f [address] [# of objects]\n"
diff --git a/common/command.c b/common/command.c
index d47d719..0020eac 100644
--- a/common/command.c
+++ b/common/command.c
@@ -466,7 +466,7 @@ int cmd_get_data_size(char* arg, int default_size)
}
#endif
-#if !defined(CONFIG_RELOC_FIXUP_WORKS)
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
DECLARE_GLOBAL_DATA_PTR;
void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index fce7a76..4871f4b 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1491,7 +1491,7 @@ static mbinptr av_[NAV * 2 + 2] = {
IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127)
};
-#ifndef CONFIG_RELOC_FIXUP_WORKS
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
void malloc_bin_reloc (void)
{
unsigned long *p = (unsigned long *)(&av_[2]);
diff --git a/common/env_common.c b/common/env_common.c
index 5acda4d..a276efc 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -227,7 +227,7 @@ int env_import(const char *buf, int check)
void env_relocate (void)
{
-#if !defined(CONFIG_RELOC_FIXUP_WORKS)
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
extern void env_reloc(void);
env_reloc();
diff --git a/common/env_flash.c b/common/env_flash.c
index 1da78b7..54c0bfe 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -82,9 +82,6 @@ uchar env_get_char_spec(int index)
return (*((uchar *)(gd->env_addr + index)));
}
-#undef debug
-#define debug printf
-
#ifdef CONFIG_ENV_ADDR_REDUND
int env_init(void)
diff --git a/common/env_sf.c b/common/env_sf.c
index fb0c39b..a597b24 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -51,7 +51,7 @@ static ulong env_new_offset = CONFIG_ENV_OFFSET_REDUND;
#define ACTIVE_FLAG 1
#define OBSOLETE_FLAG 0
-#endif /* CONFIG_ENV_ADDR_REDUND */
+#endif /* CONFIG_ENV_OFFSET_REDUND */
DECLARE_GLOBAL_DATA_PTR;
@@ -69,13 +69,6 @@ uchar env_get_char_spec(int index)
}
#if defined(CONFIG_ENV_OFFSET_REDUND)
-void swap_env(void)
-{
- ulong tmp_offset = env_offset;
-
- env_offset = env_new_offset;
- env_new_offset = tmp_offset;
-}
int saveenv(void)
{
@@ -89,8 +82,13 @@ int saveenv(void)
char flag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG;
if (!env_flash) {
- puts("Environment SPI flash not initialized\n");
- return 1;
+ env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS,
+ CONFIG_ENV_SPI_CS,
+ CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
+ if (!env_flash) {
+ set_default_env("!spi_flash_probe() failed");
+ return 1;
+ }
}
res = (char *)&env_new.data;
@@ -102,6 +100,14 @@ int saveenv(void)
env_new.crc = crc32(0, env_new.data, ENV_SIZE);
env_new.flags = ACTIVE_FLAG;
+ if (gd->env_valid == 1) {
+ env_new_offset = CONFIG_ENV_OFFSET_REDUND;
+ env_offset = CONFIG_ENV_OFFSET;
+ } else {
+ env_new_offset = CONFIG_ENV_OFFSET;
+ env_offset = CONFIG_ENV_OFFSET_REDUND;
+ }
+
/* Is the sector larger than the env (i.e. embedded) */
if (CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE) {
saved_size = CONFIG_ENV_SECT_SIZE - CONFIG_ENV_SIZE;
@@ -130,27 +136,9 @@ int saveenv(void)
goto done;
puts("Writing to SPI flash...");
- ret = spi_flash_write(env_flash,
- env_new_offset + offsetof(env_t, data),
- sizeof(env_new.data), env_new.data);
- if (ret)
- goto done;
-
- ret = spi_flash_write(env_flash,
- env_new_offset + offsetof(env_t, crc),
- sizeof(env_new.crc), &env_new.crc);
- if (ret)
- goto done;
- ret = spi_flash_write(env_flash,
- env_offset + offsetof(env_t, flags),
- sizeof(env_new.flags), &flag);
- if (ret)
- goto done;
-
- ret = spi_flash_write(env_flash,
- env_new_offset + offsetof(env_t, flags),
- sizeof(env_new.flags), &new_flag);
+ ret = spi_flash_write(env_flash, env_new_offset,
+ CONFIG_ENV_SIZE, &env_new);
if (ret)
goto done;
@@ -161,11 +149,18 @@ int saveenv(void)
goto done;
}
- swap_env();
+ ret = spi_flash_write(env_flash,
+ env_offset + offsetof(env_t, flags),
+ sizeof(env_new.flags), &flag);
+ if (ret)
+ goto done;
- ret = 0;
puts("done\n");
+ gd->env_valid = (gd->env_valid == 2 ? 1 : 2);
+
+ printf("Valid environment: %d\n", gd->env_valid);
+
done:
if (saved_buffer)
free(saved_buffer);
@@ -178,7 +173,7 @@ void env_relocate_spec(void)
int crc1_ok = 0, crc2_ok = 0;
env_t *tmp_env1 = NULL;
env_t *tmp_env2 = NULL;
- env_t ep;
+ env_t *ep = NULL;
uchar flag1, flag2;
/* current_env is set only in case both areas are valid! */
int current_env = 0;
@@ -219,90 +214,57 @@ void env_relocate_spec(void)
flag2 = tmp_env2->flags;
}
- if (!crc1_ok && !crc2_ok)
- goto err_crc;
- else if (crc1_ok && !crc2_ok) {
+ if (!crc1_ok && !crc2_ok) {
+ free(tmp_env1);
+ free(tmp_env2);
+ set_default_env("!bad CRC");
+ return;
+ } else if (crc1_ok && !crc2_ok) {
gd->env_valid = 1;
ep = tmp_env1;
} else if (!crc1_ok && crc2_ok) {
gd->env_valid = 1;
- ep = tmp_env2;
- swap_env();
} else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) {
gd->env_valid = 1;
- ep = tmp_env1;
} else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) {
- gd->env_valid = 1;
- ep = tmp_env2;
- swap_env();
+ gd->env_valid = 2;
} else if (flag1 == flag2) {
gd->env_valid = 2;
- ep = tmp_env1;
- current_env = 1;
} else if (flag1 == 0xFF) {
gd->env_valid = 2;
- ep = tmp_env1;
- current_env = 1;
} else {
/*
* this differs from code in env_flash.c, but I think a sane
* default path is desirable.
*/
gd->env_valid = 2;
- ep = tmp_env2;
- swap_env();
- current_env = 2;
}
- rc = env_import((char *)ep, 0);
- if (!rc) {
- error("Cannot import environment: errno = %d\n", errno);
- goto out;
- }
+ free(env_ptr);
- if (current_env == 1) {
- if (flag2 != OBSOLETE_FLAG) {
- flag2 = OBSOLETE_FLAG;
- spi_flash_write(env_flash,
- env_new_offset + offsetof(env_t, flags),
- sizeof(env_new.flags), &flag2);
- }
- if (flag1 != ACTIVE_FLAG) {
- flag1 = ACTIVE_FLAG;
- spi_flash_write(env_flash,
- env_offset + offsetof(env_t, flags),
- sizeof(env_new.flags), &flag1);
- }
- } else if (current_env == 2) {
- if (flag1 != OBSOLETE_FLAG) {
- flag1 = OBSOLETE_FLAG;
- spi_flash_write(env_flash,
- env_new_offset + offsetof(env_t, flags),
- sizeof(env_new.flags), &flag1);
- }
- if (flag2 != ACTIVE_FLAG) {
- flag2 = ACTIVE_FLAG;
- spi_flash_write(env_flash,
- env_offset + offsetof(env_t, flags),
- sizeof(env_new.flags), &flag2);
- }
- }
- if (gd->env_valid == 2) {
- puts("*** Warning - some problems detected "
- "reading environment; recovered successfully\n\n");
+ if (gd->env_valid == 1)
+ ep = tmp_env1;
+ else
+ ep = tmp_env2;
+
+ ret = env_import((char *)ep, 0);
+ if (!ret) {
+ error("Cannot import environment: errno = %d\n", errno);
+ set_default_env("env_import failed");
}
- if (tmp_env1)
- free(tmp_env1);
- if (tmp_env2)
- free(tmp_env2);
- return;
err_read:
spi_flash_free(env_flash);
env_flash = NULL;
out:
+ if (tmp_env1)
+ free(tmp_env1);
+ if (tmp_env2)
+ free(tmp_env2);
free(tmp_env1);
free(tmp_env2);
+
+ return;
}
#else
int saveenv(void)
@@ -311,10 +273,18 @@ int saveenv(void)
char *saved_buffer = NULL;
u32 sector = 1;
int ret;
+ env_t env_new;
+ char *res;
+ ssize_t len;
if (!env_flash) {
- puts("Environment SPI flash not initialized\n");
- return 1;
+ env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS,
+ CONFIG_ENV_SPI_CS,
+ CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
+ if (!env_flash) {
+ set_default_env("!spi_flash_probe() failed");
+ return 1;
+ }
}
/* Is the sector larger than the env (i.e. embedded) */
@@ -326,7 +296,8 @@ int saveenv(void)
ret = 1;
goto done;
}
- ret = spi_flash_read(env_flash, saved_offset, saved_size, saved_buffer);
+ ret = spi_flash_read(env_flash, saved_offset,
+ saved_size, saved_buffer);
if (ret)
goto done;
}
@@ -337,18 +308,29 @@ int saveenv(void)
sector++;
}
+ res = (char *)&env_new.data;
+ len = hexport('\0', &res, ENV_SIZE);
+ if (len < 0) {
+ error("Cannot export environment: errno = %d\n", errno);
+ goto done;
+ }
+ env_new.crc = crc32(0, env_new.data, ENV_SIZE);
+
puts("Erasing SPI flash...");
- ret = spi_flash_erase(env_flash, CONFIG_ENV_OFFSET, sector * CONFIG_ENV_SECT_SIZE);
+ ret = spi_flash_erase(env_flash, CONFIG_ENV_OFFSET,
+ sector * CONFIG_ENV_SECT_SIZE);
if (ret)
goto done;
puts("Writing to SPI flash...");
- ret = spi_flash_write(env_flash, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, env_ptr);
+ ret = spi_flash_write(env_flash, CONFIG_ENV_OFFSET,
+ CONFIG_ENV_SIZE, &env_new);
if (ret)
goto done;
if (CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE) {
- ret = spi_flash_write(env_flash, saved_offset, saved_size, saved_buffer);
+ ret = spi_flash_write(env_flash, saved_offset,
+ saved_size, saved_buffer);
if (ret)
goto done;
}
diff --git a/common/hush.c b/common/hush.c
index 4dd9513..2188fd4 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -3268,7 +3268,7 @@ int parse_file_outer(void)
}
#ifdef __U_BOOT__
-#ifndef CONFIG_RELOC_FIXUP_WORKS
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
static void u_boot_hush_reloc(void)
{
unsigned long addr;
@@ -3290,7 +3290,7 @@ int u_boot_hush_start(void)
top_vars->next = 0;
top_vars->flg_export = 0;
top_vars->flg_read_only = 1;
-#ifndef CONFIG_RELOC_FIXUP_WORKS
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
u_boot_hush_reloc();
#endif
}
diff --git a/common/hwconfig.c b/common/hwconfig.c
index 1f9f4a0..3c9759f 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -26,6 +26,8 @@
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif /* HWCONFIG_TEST */
+DECLARE_GLOBAL_DATA_PTR;
+
static const char *hwconfig_parse(const char *opts, size_t maxlen,
const char *opt, char *stopchs, char eqch,
size_t *arglen)
@@ -69,9 +71,26 @@ next:
const char *cpu_hwconfig __attribute__((weak));
const char *board_hwconfig __attribute__((weak));
+#define HWCONFIG_PRE_RELOC_BUF_SIZE 128
+
static const char *__hwconfig(const char *opt, size_t *arglen)
{
- const char *env_hwconfig = getenv("hwconfig");
+ const char *env_hwconfig = NULL;
+ char buf[HWCONFIG_PRE_RELOC_BUF_SIZE];
+
+ if (gd->flags & GD_FLG_ENV_READY) {
+ env_hwconfig = getenv("hwconfig");
+ } else {
+ /*
+ * Use our own on stack based buffer before relocation to allow
+ * accessing longer hwconfig strings that might be in the
+ * environment before we've relocated. This is pretty fragile
+ * on both the use of stack and if the buffer is big enough.
+ * However we will get a warning from getenv_f for the later.
+ */
+ if ((getenv_f("hwconfig", buf, sizeof(buf))) > 0)
+ env_hwconfig = buf;
+ }
if (env_hwconfig)
return hwconfig_parse(env_hwconfig, strlen(env_hwconfig),
diff --git a/common/image.c b/common/image.c
index 89c10b8..42f5b79 100644
--- a/common/image.c
+++ b/common/image.c
@@ -520,7 +520,7 @@ char *get_table_entry_name (table_entry_t *table, char *msg, int id)
{
for (; table->id >= 0; ++table) {
if (table->id == id)
-#if defined(USE_HOSTCC) || defined(CONFIG_RELOC_FIXUP_WORKS)
+#if defined(USE_HOSTCC) || !defined(CONFIG_NEEDS_MANUAL_RELOC)
return table->lname;
#else
return table->lname + gd->reloc_off;
@@ -585,10 +585,10 @@ int get_table_entry_id (table_entry_t *table,
fprintf (stderr, "\n");
#else
for (t = table; t->id >= 0; ++t) {
-#ifdef CONFIG_RELOC_FIXUP_WORKS
- if (t->sname && strcmp(t->sname, name) == 0)
-#else
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
if (t->sname && strcmp(t->sname + gd->reloc_off, name) == 0)
+#else
+ if (t->sname && strcmp(t->sname, name) == 0)
#endif
return (t->id);
}
diff --git a/common/serial.c b/common/serial.c
index c3323ea..051ae4e 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -99,7 +99,7 @@ struct serial_device *default_serial_console(void) __attribute__((weak, alias("_
int serial_register (struct serial_device *dev)
{
-#ifndef CONFIG_RELOC_FIXUP_WORKS
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
dev->init += gd->reloc_off;
dev->setbrg += gd->reloc_off;
dev->getc += gd->reloc_off;
diff --git a/common/stdio.c b/common/stdio.c
index 2501369..ab7c5ab 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -193,7 +193,7 @@ int stdio_deregister(char *devname)
int stdio_init (void)
{
-#if !defined(CONFIG_RELOC_FIXUP_WORKS)
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
/* already relocated for current ARM implementation */
ulong relocation_offset = gd->reloc_off;
int i;
@@ -203,7 +203,7 @@ int stdio_init (void)
stdio_names[i] = (char *) (((ulong) stdio_names[i]) +
relocation_offset);
}
-#endif /* !CONFIG_RELOC_FIXUP_WORKS */
+#endif /* CONFIG_NEEDS_MANUAL_RELOC */
/* Initialize the list */
INIT_LIST_HEAD(&(devs.list));
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 613c4f0..1e6cd6a 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -70,7 +70,7 @@
/* direction table -- this indicates the direction of the data
* transfer for each command code -- a 1 indicates input
*/
-unsigned char us_direction[256/8] = {
+static const unsigned char us_direction[256/8] = {
0x28, 0x81, 0x14, 0x14, 0x20, 0x01, 0x90, 0x77,
0x0C, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01,