diff options
author | Stefano Babic <sbabic@denx.de> | 2013-02-23 10:13:40 +0100 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2013-02-23 10:13:40 +0100 |
commit | 9cd9b34dc7f247fd0fce08ab688bf8197f1bfdbc (patch) | |
tree | 89561497322fff78d3d2e4a8e736f18ab4e0ddfb /common | |
parent | bec0160e9f5adab1d451ded3a95b0114b14e1970 (diff) | |
parent | a5627914daad144727655a72bd3c8a8958fbcdcf (diff) | |
download | u-boot-imx-9cd9b34dc7f247fd0fce08ab688bf8197f1bfdbc.zip u-boot-imx-9cd9b34dc7f247fd0fce08ab688bf8197f1bfdbc.tar.gz u-boot-imx-9cd9b34dc7f247fd0fce08ab688bf8197f1bfdbc.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-arm
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_bdinfo.c | 33 | ||||
-rw-r--r-- | common/cmd_bootm.c | 4 | ||||
-rw-r--r-- | common/cmd_fdt.c | 1 | ||||
-rw-r--r-- | common/cmd_immap.c | 2 | ||||
-rw-r--r-- | common/cmd_time.c | 33 | ||||
-rw-r--r-- | common/command.c | 6 | ||||
-rw-r--r-- | common/env_mmc.c | 4 | ||||
-rw-r--r-- | common/fdt_support.c | 87 | ||||
-rw-r--r-- | common/hush.c | 2 | ||||
-rw-r--r-- | common/image.c | 1 | ||||
-rw-r--r-- | common/main.c | 12 | ||||
-rw-r--r-- | common/spl/spl.c | 5 | ||||
-rw-r--r-- | common/stdio.c | 2 |
13 files changed, 98 insertions, 94 deletions
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index 48cdd16..85279d5 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -51,6 +51,25 @@ static void print_eth(int idx) } __maybe_unused +static void print_eths(void) +{ + struct eth_device *dev; + int i = 0; + + do { + dev = eth_get_dev_by_index(i); + if (dev) { + printf("eth%dname = %s\n", i, dev->name); + print_eth(i); + i++; + } + } while (dev); + + printf("current eth = %s\n", eth_get_name()); + printf("ip_addr = %s\n", getenv("ipaddr")); +} + +__maybe_unused static void print_lnum(const char *name, unsigned long long value) { printf("%-12s= 0x%.8llX\n", name, value); @@ -195,10 +214,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) print_num("sram size ", (ulong)bd->bi_sramsize); #endif #if defined(CONFIG_CMD_NET) - print_eth(0); - printf("ip_addr = %s\n", getenv("ipaddr")); + print_eths(); #endif - printf("baudrate = %u bps\n", (ulong)bd->bi_baudrate); + printf("baudrate = %u bps\n", bd->bi_baudrate); return 0; } @@ -366,18 +384,19 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #if defined(CONFIG_CMD_NET) - print_eth(0); - printf("ip_addr = %s\n", getenv("ipaddr")); + print_eths(); #endif printf("baudrate = %u bps\n", bd->bi_baudrate); #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) - print_num("TLB addr", gd->tlb_addr); + print_num("TLB addr", gd->arch.tlb_addr); #endif print_num("relocaddr", gd->relocaddr); print_num("reloc off", gd->reloc_off); print_num("irq_sp", gd->irq_sp); /* irq stack pointer */ print_num("sp start ", gd->start_addr_sp); +#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) print_num("FB base ", gd->fb_base); +#endif /* * TODO: Currently only support for davinci SOC's is added. * Remove this check once all the board implement this. @@ -463,7 +482,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) print_eth(0); printf("ip_addr = %s\n", getenv("ipaddr")); #endif +#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) print_num("FB base ", gd->fb_base); +#endif return 0; } diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 1b8a8c1..f0338ba 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -47,7 +47,6 @@ #endif #if defined(CONFIG_OF_LIBFDT) -#include <fdt.h> #include <libfdt.h> #include <fdt_support.h> #endif @@ -498,7 +497,8 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc, return CMD_RET_USAGE; } - if (images.state >= state) { + if (images.state < 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_fdt.c b/common/cmd_fdt.c index 9e2de34..6eec947 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -29,7 +29,6 @@ #include <linux/ctype.h> #include <linux/types.h> #include <asm/global_data.h> -#include <fdt.h> #include <libfdt.h> #include <fdt_support.h> diff --git a/common/cmd_immap.c b/common/cmd_immap.c index 1f59c1e..fdf9489 100644 --- a/common/cmd_immap.c +++ b/common/cmd_immap.c @@ -453,7 +453,7 @@ static void prbrg (int n, uint val) #if defined(CONFIG_8xx) ulong clock = gd->cpu_clk; #elif defined(CONFIG_8260) - ulong clock = gd->brg_clk; + ulong clock = gd->arch.brg_clk; #endif printf ("BRG%d:", n); diff --git a/common/cmd_time.c b/common/cmd_time.c index 6dbdbbf..9808cd6 100644 --- a/common/cmd_time.c +++ b/common/cmd_time.c @@ -22,36 +22,6 @@ #include <common.h> #include <command.h> -/* - * TODO(clchiou): This function actually minics the bottom-half of the - * run_command() function. Since this function has ARM-dependent timer - * codes, we cannot merge it with the run_command() for now. - */ -static int run_command_and_time_it(int flag, int argc, char * const argv[], - ulong *cycles) -{ - cmd_tbl_t *cmdtp = find_cmd(argv[0]); - int retval = 0; - - if (!cmdtp) { - printf("%s: command not found\n", argv[0]); - return 1; - } - if (argc > cmdtp->maxargs) - return CMD_RET_USAGE; - - /* - * TODO(clchiou): get_timer_masked() is only defined in certain ARM - * boards. We could use the new timer API that Graeme is proposing - * so that this piece of code would be arch-independent. - */ - *cycles = get_timer_masked(); - retval = cmdtp->cmd(cmdtp, flag, argc, argv); - *cycles = get_timer_masked() - *cycles; - - return retval; -} - static void report_time(ulong cycles) { ulong minutes, seconds, milliseconds; @@ -75,11 +45,12 @@ static int do_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong cycles = 0; int retval = 0; + int repeatable; if (argc == 1) return CMD_RET_USAGE; - retval = run_command_and_time_it(0, argc - 1, argv + 1, &cycles); + retval = cmd_process(0, argc - 1, argv + 1, &repeatable, &cycles); report_time(cycles); return retval; diff --git a/common/command.c b/common/command.c index 50c8429..305a236 100644 --- a/common/command.c +++ b/common/command.c @@ -513,7 +513,7 @@ static int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } enum command_ret_t cmd_process(int flag, int argc, char * const argv[], - int *repeatable) + int *repeatable, ulong *ticks) { enum command_ret_t rc = CMD_RET_SUCCESS; cmd_tbl_t *cmdtp; @@ -543,7 +543,11 @@ enum command_ret_t cmd_process(int flag, int argc, char * const argv[], /* If OK so far, then do the command */ if (!rc) { + if (ticks) + *ticks = get_timer(0); rc = cmd_call(cmdtp, flag, argc, argv); + if (ticks) + *ticks = get_timer(*ticks); *repeatable &= cmdtp->repeatable; } if (rc == CMD_RET_USAGE) diff --git a/common/env_mmc.c b/common/env_mmc.c index ce21671..02bd5ae 100644 --- a/common/env_mmc.c +++ b/common/env_mmc.c @@ -46,13 +46,11 @@ DECLARE_GLOBAL_DATA_PTR; #define CONFIG_ENV_OFFSET 0 #endif -static int __mmc_get_env_addr(struct mmc *mmc, u32 *env_addr) +__weak int mmc_get_env_addr(struct mmc *mmc, u32 *env_addr) { *env_addr = CONFIG_ENV_OFFSET; return 0; } -int mmc_get_env_addr(struct mmc *mmc, u32 *env_addr) - __attribute__((weak, alias("__mmc_get_env_addr"))); int env_init(void) { diff --git a/common/fdt_support.c b/common/fdt_support.c index 6b9fa05..812acb4 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -28,7 +28,6 @@ #include <linux/ctype.h> #include <linux/types.h> #include <asm/global_data.h> -#include <fdt.h> #include <libfdt.h> #include <fdt_support.h> #include <exports.h> @@ -52,7 +51,7 @@ DECLARE_GLOBAL_DATA_PTR; u32 fdt_getprop_u32_default(const void *fdt, const char *path, const char *prop, const u32 dflt) { - const u32 *val; + const fdt32_t *val; int off; off = fdt_path_offset(fdt, path); @@ -86,7 +85,7 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, if (nodeoff < 0) return nodeoff; - if ((!create) && (fdt_get_property(fdt, nodeoff, prop, 0) == NULL)) + if ((!create) && (fdt_get_property(fdt, nodeoff, prop, NULL) == NULL)) return 0; /* create flag not set; so exit quietly */ return fdt_setprop(fdt, nodeoff, prop, val, len); @@ -150,7 +149,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force) { int nodeoffset; int err, j, total; - u32 tmp; + fdt32_t tmp; const char *path; uint64_t addr, size; @@ -189,7 +188,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force) path = fdt_getprop(fdt, nodeoffset, "linux,initrd-start", NULL); if ((path == NULL) || force) { - tmp = __cpu_to_be32(initrd_start); + tmp = cpu_to_fdt32(initrd_start); err = fdt_setprop(fdt, nodeoffset, "linux,initrd-start", &tmp, sizeof(tmp)); if (err < 0) { @@ -198,7 +197,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force) fdt_strerror(err)); return err; } - tmp = __cpu_to_be32(initrd_end); + tmp = cpu_to_fdt32(initrd_end); err = fdt_setprop(fdt, nodeoffset, "linux,initrd-end", &tmp, sizeof(tmp)); if (err < 0) { @@ -301,8 +300,8 @@ void do_fixup_by_path(void *fdt, const char *path, const char *prop, void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop, u32 val, int create) { - val = cpu_to_fdt32(val); - do_fixup_by_path(fdt, path, prop, &val, sizeof(val), create); + fdt32_t tmp = cpu_to_fdt32(val); + do_fixup_by_path(fdt, path, prop, &tmp, sizeof(tmp), create); } void do_fixup_by_prop(void *fdt, @@ -320,7 +319,7 @@ void do_fixup_by_prop(void *fdt, #endif off = fdt_node_offset_by_prop_value(fdt, -1, pname, pval, plen); while (off != -FDT_ERR_NOTFOUND) { - if (create || (fdt_get_property(fdt, off, prop, 0) != NULL)) + if (create || (fdt_get_property(fdt, off, prop, NULL) != NULL)) fdt_setprop(fdt, off, prop, val, len); off = fdt_node_offset_by_prop_value(fdt, off, pname, pval, plen); } @@ -330,8 +329,8 @@ void do_fixup_by_prop_u32(void *fdt, const char *pname, const void *pval, int plen, const char *prop, u32 val, int create) { - val = cpu_to_fdt32(val); - do_fixup_by_prop(fdt, pname, pval, plen, prop, &val, 4, create); + fdt32_t tmp = cpu_to_fdt32(val); + do_fixup_by_prop(fdt, pname, pval, plen, prop, &tmp, 4, create); } void do_fixup_by_compat(void *fdt, const char *compat, @@ -347,7 +346,7 @@ void do_fixup_by_compat(void *fdt, const char *compat, #endif off = fdt_node_offset_by_compatible(fdt, -1, compat); while (off != -FDT_ERR_NOTFOUND) { - if (create || (fdt_get_property(fdt, off, prop, 0) != NULL)) + if (create || (fdt_get_property(fdt, off, prop, NULL) != NULL)) fdt_setprop(fdt, off, prop, val, len); off = fdt_node_offset_by_compatible(fdt, off, compat); } @@ -356,8 +355,8 @@ void do_fixup_by_compat(void *fdt, const char *compat, void do_fixup_by_compat_u32(void *fdt, const char *compat, const char *prop, u32 val, int create) { - val = cpu_to_fdt32(val); - do_fixup_by_compat(fdt, compat, prop, &val, 4, create); + fdt32_t tmp = cpu_to_fdt32(val); + do_fixup_by_compat(fdt, compat, prop, &tmp, 4, create); } /* @@ -367,7 +366,7 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat, */ static int get_cells_len(void *blob, char *nr_cells_name) { - const u32 *cell; + const fdt32_t *cell; cell = fdt_getprop(blob, 0, nr_cells_name, NULL); if (cell && fdt32_to_cpu(*cell) == 2) @@ -388,13 +387,21 @@ static void write_cell(u8 *addr, u64 val, int size) } } +#define MEMORY_BANKS_MAX 4 int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks) { int err, nodeoffset; int addr_cell_len, size_cell_len, len; - u8 tmp[banks * 16]; /* Up to 64-bit address + 64-bit size */ + u8 tmp[MEMORY_BANKS_MAX * 16]; /* Up to 64-bit address + 64-bit size */ int bank; + if (banks > MEMORY_BANKS_MAX) { + printf("%s: num banks %d exceeds hardcoded limit %d." + " Recompile with higher MEMORY_BANKS_MAX?\n", + __FUNCTION__, banks, MEMORY_BANKS_MAX); + return -1; + } + err = fdt_check_header(blob); if (err < 0) { printf("%s: %s\n", __FUNCTION__, fdt_strerror(err)); @@ -903,11 +910,11 @@ void fdt_del_node_and_alias(void *blob, const char *alias) } /* Helper to read a big number; size is in cells (not bytes) */ -static inline u64 of_read_number(const __be32 *cell, int size) +static inline u64 of_read_number(const fdt32_t *cell, int size) { u64 r = 0; while (size--) - r = (r << 32) | be32_to_cpu(*(cell++)); + r = (r << 32) | fdt32_to_cpu(*(cell++)); return r; } @@ -921,7 +928,7 @@ static inline u64 of_read_number(const __be32 *cell, int size) /* Debug utility */ #ifdef DEBUG -static void of_dump_addr(const char *s, const u32 *addr, int na) +static void of_dump_addr(const char *s, const fdt32_t *addr, int na) { printf("%s", s); while(na--) @@ -929,7 +936,7 @@ static void of_dump_addr(const char *s, const u32 *addr, int na) printf("\n"); } #else -static void of_dump_addr(const char *s, const u32 *addr, int na) { } +static void of_dump_addr(const char *s, const fdt32_t *addr, int na) { } #endif /* Callbacks for bus specific translators */ @@ -938,21 +945,21 @@ struct of_bus { const char *addresses; void (*count_cells)(void *blob, int parentoffset, int *addrc, int *sizec); - u64 (*map)(u32 *addr, const u32 *range, + u64 (*map)(fdt32_t *addr, const fdt32_t *range, int na, int ns, int pna); - int (*translate)(u32 *addr, u64 offset, int na); + int (*translate)(fdt32_t *addr, u64 offset, int na); }; /* Default translator (generic bus) */ static void of_bus_default_count_cells(void *blob, int parentoffset, int *addrc, int *sizec) { - const u32 *prop; + const fdt32_t *prop; if (addrc) { prop = fdt_getprop(blob, parentoffset, "#address-cells", NULL); if (prop) - *addrc = be32_to_cpup((u32 *)prop); + *addrc = be32_to_cpup(prop); else *addrc = 2; } @@ -960,13 +967,13 @@ static void of_bus_default_count_cells(void *blob, int parentoffset, if (sizec) { prop = fdt_getprop(blob, parentoffset, "#size-cells", NULL); if (prop) - *sizec = be32_to_cpup((u32 *)prop); + *sizec = be32_to_cpup(prop); else *sizec = 1; } } -static u64 of_bus_default_map(u32 *addr, const u32 *range, +static u64 of_bus_default_map(fdt32_t *addr, const fdt32_t *range, int na, int ns, int pna) { u64 cp, s, da; @@ -983,14 +990,14 @@ static u64 of_bus_default_map(u32 *addr, const u32 *range, return da - cp; } -static int of_bus_default_translate(u32 *addr, u64 offset, int na) +static int of_bus_default_translate(fdt32_t *addr, u64 offset, int na) { u64 a = of_read_number(addr, na); memset(addr, 0, na * 4); a += offset; if (na > 1) - addr[na - 2] = a >> 32; - addr[na - 1] = a & 0xffffffffu; + addr[na - 2] = cpu_to_fdt32(a >> 32); + addr[na - 1] = cpu_to_fdt32(a & 0xffffffffu); return 0; } @@ -1008,10 +1015,10 @@ static struct of_bus of_busses[] = { }; static int of_translate_one(void * blob, int parent, struct of_bus *bus, - struct of_bus *pbus, u32 *addr, + struct of_bus *pbus, fdt32_t *addr, int na, int ns, int pna, const char *rprop) { - const u32 *ranges; + const fdt32_t *ranges; int rlen; int rone; u64 offset = OF_BAD_ADDR; @@ -1028,7 +1035,7 @@ static int of_translate_one(void * blob, int parent, struct of_bus *bus, * to translate addresses that aren't supposed to be translated in * the first place. --BenH. */ - ranges = (u32 *)fdt_getprop(blob, parent, rprop, &rlen); + ranges = fdt_getprop(blob, parent, rprop, &rlen); if (ranges == NULL || rlen == 0) { offset = of_read_number(addr, na); memset(addr, 0, pna * 4); @@ -1070,12 +1077,12 @@ static int of_translate_one(void * blob, int parent, struct of_bus *bus, * that can be mapped to a cpu physical address). This is not really specified * that way, but this is traditionally the way IBM at least do things */ -u64 __of_translate_address(void *blob, int node_offset, const u32 *in_addr, - const char *rprop) +static u64 __of_translate_address(void *blob, int node_offset, const fdt32_t *in_addr, + const char *rprop) { int parent; struct of_bus *bus, *pbus; - u32 addr[OF_MAX_ADDR_CELLS]; + fdt32_t addr[OF_MAX_ADDR_CELLS]; int na, ns, pna, pns; u64 result = OF_BAD_ADDR; @@ -1143,7 +1150,7 @@ u64 __of_translate_address(void *blob, int node_offset, const u32 *in_addr, return result; } -u64 fdt_translate_address(void *blob, int node_offset, const u32 *in_addr) +u64 fdt_translate_address(void *blob, int node_offset, const fdt32_t *in_addr) { return __of_translate_address(blob, node_offset, in_addr, "ranges"); } @@ -1162,7 +1169,7 @@ int fdt_node_offset_by_compat_reg(void *blob, const char *compat, { int len, off = fdt_node_offset_by_compatible(blob, -1, compat); while (off != -FDT_ERR_NOTFOUND) { - u32 *reg = (u32 *)fdt_getprop(blob, off, "reg", &len); + const fdt32_t *reg = fdt_getprop(blob, off, "reg", &len); if (reg) { if (compat_off == fdt_translate_address(blob, off, reg)) return off; @@ -1356,7 +1363,7 @@ err_size: int fdt_verify_alias_address(void *fdt, int anode, const char *alias, u64 addr) { const char *path; - const u32 *reg; + const fdt32_t *reg; int node, len; u64 dt_addr; @@ -1398,11 +1405,11 @@ u64 fdt_get_base_address(void *fdt, int node) { int size; u32 naddr; - const u32 *prop; + const fdt32_t *prop; prop = fdt_getprop(fdt, node, "#address-cells", &size); if (prop && size == 4) - naddr = *prop; + naddr = be32_to_cpup(prop); else naddr = 2; diff --git a/common/hush.c b/common/hush.c index eb6c879..cc81c9c 100644 --- a/common/hush.c +++ b/common/hush.c @@ -1665,7 +1665,7 @@ static int run_pipe_real(struct pipe *pi) } /* Process the command */ return cmd_process(flag, child->argc, child->argv, - &flag_repeat); + &flag_repeat, NULL); #endif } #ifndef __U_BOOT__ diff --git a/common/image.c b/common/image.c index 95498e6..ae1a9d3 100644 --- a/common/image.c +++ b/common/image.c @@ -47,7 +47,6 @@ #include <image.h> #if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT) -#include <fdt.h> #include <libfdt.h> #include <fdt_support.h> #endif diff --git a/common/main.c b/common/main.c index 5d8454e..e2d2e09 100644 --- a/common/main.c +++ b/common/main.c @@ -225,6 +225,7 @@ static inline int abortboot(int bootdelay) { int abort = 0; + unsigned long ts; #ifdef CONFIG_MENUPROMPT printf(CONFIG_MENUPROMPT); @@ -248,11 +249,10 @@ int abortboot(int bootdelay) #endif while ((bootdelay > 0) && (!abort)) { - int i; - --bootdelay; - /* delay 100 * 10ms */ - for (i=0; !abort && i<100; ++i) { + /* delay 1000 ms */ + ts = get_timer(0); + do { if (tstc()) { /* we got a key press */ abort = 1; /* don't auto boot */ bootdelay = 0; /* no more delay */ @@ -264,7 +264,7 @@ int abortboot(int bootdelay) break; } udelay(10000); - } + } while (!abort && get_timer(ts) < 1000); printf("\b\b\b%2d ", bootdelay); } @@ -1452,7 +1452,7 @@ static int builtin_run_command(const char *cmd, int flag) continue; } - if (cmd_process(flag, argc, argv, &repeatable)) + if (cmd_process(flag, argc, argv, &repeatable, NULL)) rc = -1; /* Did the user stop this? */ diff --git a/common/spl/spl.c b/common/spl/spl.c index ff9ba7b..6a5a136 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -221,6 +221,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2) #endif break; #endif +#ifdef CONFIG_SPL_USBETH_SUPPORT + case BOOT_DEVICE_USBETH: + spl_net_load_image("usb_ether"); + break; +#endif default: debug("SPL: Un-supported Boot Device\n"); hang(); diff --git a/common/stdio.c b/common/stdio.c index 97ff9cf..5d5117c 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -207,7 +207,7 @@ int stdio_init (void) /* Initialize the list */ INIT_LIST_HEAD(&(devs.list)); -#ifdef CONFIG_ARM_DCC_MULTI +#ifdef CONFIG_ARM_DCC drv_arm_dcc_init (); #endif #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) |