diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Makefile | 3 | ||||
-rw-r--r-- | common/cmd_bootldr.c | 64 | ||||
-rw-r--r-- | common/cmd_bootm.c | 11 | ||||
-rw-r--r-- | common/cmd_cplbinfo.c | 59 | ||||
-rw-r--r-- | common/cmd_fdt.c | 130 | ||||
-rw-r--r-- | common/cmd_log.c | 38 | ||||
-rw-r--r-- | common/cmd_setexpr.c | 70 | ||||
-rw-r--r-- | common/fdt_support.c | 218 | ||||
-rw-r--r-- | common/main.c | 8 |
9 files changed, 383 insertions, 218 deletions
diff --git a/common/Makefile b/common/Makefile index fc842225d52..1c81fcfe4f4 100644 --- a/common/Makefile +++ b/common/Makefile @@ -39,9 +39,11 @@ COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o COBJS-y += image.o COBJS-y += gunzip.o COBJS-y += cmd_boot.o +COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-y += cmd_bootm.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o +COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o COBJS-$(CONFIG_CMD_DATE) += cmd_date.o ifdef CONFIG_4xx COBJS-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o @@ -88,6 +90,7 @@ COBJS-$(CONFIG_CMD_REGINFO) += cmd_reginfo.o COBJS-$(CONFIG_CMD_REISER) += cmd_reiser.o COBJS-y += cmd_sata.o COBJS-$(CONFIG_CMD_SCSI) += cmd_scsi.o +COBJS-$(CONFIG_CMD_SETEXPR) += cmd_setexpr.o COBJS-$(CONFIG_CMD_SPI) += cmd_spi.o COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o diff --git a/common/cmd_bootldr.c b/common/cmd_bootldr.c new file mode 100644 index 00000000000..e6474aab22b --- /dev/null +++ b/common/cmd_bootldr.c @@ -0,0 +1,64 @@ +/* + * U-boot - bootldr.c + * + * Copyright (c) 2005-2008 Analog Devices Inc. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * Licensed under the GPL-2 or later. + */ + +#include <config.h> +#include <common.h> +#include <command.h> + +#include <asm/blackfin.h> +#include <asm/mach-common/bits/bootrom.h> + +/* + * the bootldr command loads an address, checks to see if there + * is a Boot stream that the on-chip BOOTROM can understand, + * and loads it via the BOOTROM Callback. It is possible + * to also add booting from SPI, or TWI, but this function does + * not currently support that. + */ + +int do_bootldr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + void *addr; + uint32_t *data; + + /* Get the address */ + if (argc < 2) + addr = (void *)load_addr; + else + addr = (void *)simple_strtoul(argv[1], NULL, 16); + + /* Check if it is a LDR file */ + data = addr; +#if defined(__ADSPBF54x__) || defined(__ADSPBF52x__) + if ((*data & 0xFF000000) == 0xAD000000 && data[2] == 0x00000000) { +#else + if (*data == 0xFF800060 || *data == 0xFF800040 || *data == 0xFF800020) { +#endif + /* We want to boot from FLASH or SDRAM */ + printf("## Booting ldr image at 0x%p ...\n", addr); + + icache_disable(); + dcache_disable(); + + __asm__( + "jump (%1);" + : + : "q7" (addr), "a" (_BOOTROM_MEMBOOT)); + } else + printf("## No ldr image at address 0x%p\n", addr); + + return 0; +} + +U_BOOT_CMD(bootldr, 2, 0, do_bootldr, + "bootldr - boot ldr image from memory\n", + "[addr]\n" + " - boot ldr image stored in memory\n"); diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 789ee03387e..9e5ce4b38fc 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -427,6 +427,17 @@ static int fit_check_kernel (const void *fit, int os_noffset, int verify) } show_boot_progress (105); +#ifdef CONFIG_LOGBUFFER +#ifndef CONFIG_ALT_LB_ADDR + kbd=gd->bd; + /* Prevent initrd from overwriting logbuffer */ + if (initrd_high < (kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD)) + initrd_high = kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD; + debug ("## Logbuffer at 0x%08lX ", kbd->bi_memsize-LOGBUFF_LEN); +#else + debug ("## Logbuffer at 0x%08lX ", CONFIG_ALT_LB_ADDR); +#endif +#endif if (!fit_image_check_target_arch (fit, os_noffset)) { puts ("Unsupported Architecture\n"); show_boot_progress (-105); diff --git a/common/cmd_cplbinfo.c b/common/cmd_cplbinfo.c new file mode 100644 index 00000000000..b2bbec12ea8 --- /dev/null +++ b/common/cmd_cplbinfo.c @@ -0,0 +1,59 @@ +/* + * cmd_cplbinfo.c - dump the instruction/data cplb tables + * + * Copyright (c) 2007-2008 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#include <common.h> +#include <command.h> +#include <asm/blackfin.h> +#include <asm/cplb.h> +#include <asm/mach-common/bits/mpu.h> + +/* + * Translate the PAGE_SIZE bits into a human string + */ +static const char *cplb_page_size(uint32_t data) +{ + static const char page_size_string_table[][4] = { "1K", "4K", "1M", "4M" }; + return page_size_string_table[(data & PAGE_SIZE_MASK) >> PAGE_SIZE_SHIFT]; +} + +/* + * show a hardware cplb table + */ +static void show_cplb_table(uint32_t *addr, uint32_t *data) +{ + size_t i; + printf(" Address Data Size Valid Locked\n"); + for (i = 1; i <= 16; ++i) { + printf(" %2i 0x%p 0x%05X %s %c %c\n", + i, *addr, *data, + cplb_page_size(*data), + (*data & CPLB_VALID ? 'Y' : 'N'), + (*data & CPLB_LOCK ? 'Y' : 'N')); + ++addr; + ++data; + } +} + +/* + * display current instruction and data cplb tables + */ +int do_cplbinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + printf("%s CPLB table [%08x]:\n", "Instruction", *(uint32_t *)DMEM_CONTROL); + show_cplb_table((uint32_t *)ICPLB_ADDR0, (uint32_t *)ICPLB_DATA0); + + printf("%s CPLB table [%08x]:\n", "Data", *(uint32_t *)IMEM_CONTROL); + show_cplb_table((uint32_t *)DCPLB_ADDR0, (uint32_t *)DCPLB_DATA0); + + return 0; +} + +U_BOOT_CMD(cplbinfo, 1, 0, do_cplbinfo, + "cplbinfo- display current CPLB tables\n", + "\n" + " - display current CPLB tables\n"); diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index 9cd22ee94ae..a52284e2fee 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -260,7 +260,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) /******************************************************************** * Remove a property/node ********************************************************************/ - } else if (argv[1][0] == 'r') { + } else if ((argv[1][0] == 'r') && (argv[1][1] == 'm')) { int nodeoffset; /* node offset from libfdt */ int err; @@ -296,6 +296,111 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return err; } } + + /******************************************************************** + * Display header info + ********************************************************************/ + } else if (argv[1][0] == 'h') { + u32 version = fdt_version(fdt); + printf("magic:\t\t\t0x%x\n", fdt_magic(fdt)); + printf("totalsize:\t\t0x%x (%d)\n", fdt_totalsize(fdt), fdt_totalsize(fdt)); + printf("off_dt_struct:\t\t0x%x\n", fdt_off_dt_struct(fdt)); + printf("off_dt_strings:\t\t0x%x\n", fdt_off_dt_strings(fdt)); + printf("off_mem_rsvmap:\t\t0x%x\n", fdt_off_mem_rsvmap(fdt)); + printf("version:\t\t%d\n", version); + printf("last_comp_version:\t%d\n", fdt_last_comp_version(fdt)); + if (version >= 2) + printf("boot_cpuid_phys:\t0x%x\n", + fdt_boot_cpuid_phys(fdt)); + if (version >= 3) + printf("size_dt_strings:\t0x%x\n", + fdt_size_dt_strings(fdt)); + if (version >= 17) + printf("size_dt_struct:\t\t0x%x\n", + fdt_size_dt_struct(fdt)); + printf("number mem_rsv:\t\t0x%x\n", fdt_num_mem_rsv(fdt)); + printf("\n"); + + /******************************************************************** + * Set boot cpu id + ********************************************************************/ + } else if ((argv[1][0] == 'b') && (argv[1][1] == 'o') && + (argv[1][2] == 'o')) { + unsigned long tmp = simple_strtoul(argv[2], NULL, 16); + fdt_set_boot_cpuid_phys(fdt, tmp); + + /******************************************************************** + * memory command + ********************************************************************/ + } else if ((argv[1][0] == 'm') && (argv[1][1] == 'e')) { + uint64_t addr, size; + int err; +#ifdef CFG_64BIT_STRTOUL + addr = simple_strtoull(argv[2], NULL, 16); + size = simple_strtoull(argv[3], NULL, 16); +#else + addr = simple_strtoul(argv[2], NULL, 16); + size = simple_strtoul(argv[3], NULL, 16); +#endif + err = fdt_fixup_memory(fdt, addr, size); + if (err < 0) + return err; + + /******************************************************************** + * mem reserve commands + ********************************************************************/ + } else if ((argv[1][0] == 'r') && (argv[1][1] == 's')) { + if (argv[2][0] == 'p') { + uint64_t addr, size; + int total = fdt_num_mem_rsv(fdt); + int j, err; + printf("index\t\t start\t\t size\n"); + printf("-------------------------------" + "-----------------\n"); + for (j = 0; j < total; j++) { + err = fdt_get_mem_rsv(fdt, j, &addr, &size); + if (err < 0) { + printf("libfdt fdt_get_mem_rsv(): %s\n", + fdt_strerror(err)); + return err; + } + printf(" %x\t%08x%08x\t%08x%08x\n", j, + (u32)(addr >> 32), + (u32)(addr & 0xffffffff), + (u32)(size >> 32), + (u32)(size & 0xffffffff)); + } + } else if (argv[2][0] == 'a') { + uint64_t addr, size; + int err; +#ifdef CFG_64BIT_STRTOUL + addr = simple_strtoull(argv[3], NULL, 16); + size = simple_strtoull(argv[4], NULL, 16); +#else + addr = simple_strtoul(argv[3], NULL, 16); + size = simple_strtoul(argv[4], NULL, 16); +#endif + err = fdt_add_mem_rsv(fdt, addr, size); + + if (err < 0) { + printf("libfdt fdt_add_mem_rsv(): %s\n", + fdt_strerror(err)); + return err; + } + } else if (argv[2][0] == 'd') { + unsigned long idx = simple_strtoul(argv[3], NULL, 16); + int err = fdt_del_mem_rsv(fdt, idx); + + if (err < 0) { + printf("libfdt fdt_del_mem_rsv(): %s\n", + fdt_strerror(err)); + return err; + } + } else { + /* Unrecognized command */ + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; + } } #ifdef CONFIG_OF_BOARD_SETUP /* Call the board-specific fixup routine */ @@ -305,17 +410,6 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) /* Create a chosen node */ else if (argv[1][0] == 'c') fdt_chosen(fdt, 0, 0, 1); - -#ifdef CONFIG_OF_HAS_UBOOT_ENV - /* Create a u-boot-env node */ - else if (argv[1][0] == 'e') - fdt_env(fdt); -#endif -#ifdef CONFIG_OF_HAS_BD_T - /* Create a bd_t node */ - else if (argv[1][0] == 'b') - fdt_bd_t(fdt); -#endif else { /* Unrecognized command */ printf ("Usage:\n%s\n", cmdtp->usage); @@ -689,13 +783,13 @@ U_BOOT_CMD( "fdt set <path> <prop> [<val>] - Set <property> [to <val>]\n" "fdt mknode <path> <node> - Create a new node after <path>\n" "fdt rm <path> [<prop>] - Delete the node or <property>\n" + "fdt header - Display header info\n" + "fdt bootcpu <id> - Set boot cpuid\n" + "fdt memory <addr> <size> - Add/Update memory node\n" + "fdt rsvmem print - Show current mem reserves\n" + "fdt rsvmem add <addr> <size> - Add a mem reserve\n" + "fdt rsvmem delete <index> - Delete a mem reserves\n" "fdt chosen - Add/update the /chosen branch in the tree\n" -#ifdef CONFIG_OF_HAS_UBOOT_ENV - "fdt env - Add/replace the /u-boot-env branch in the tree\n" -#endif -#ifdef CONFIG_OF_HAS_BD_T - "fdt bd_t - Add/replace the /bd_t branch in the tree\n" -#endif "NOTE: If the path or property you are setting/printing has a '#' character\n" " or spaces, you MUST escape it with a \\ character or quote it with \".\n" ); diff --git a/common/cmd_log.c b/common/cmd_log.c index e593dbedd37..34b36ff1dd8 100644 --- a/common/cmd_log.c +++ b/common/cmd_log.c @@ -59,14 +59,25 @@ static char buf[1024]; static unsigned console_loglevel = 3; static unsigned default_message_loglevel = 4; static unsigned log_version = 1; +#ifdef CONFIG_ALT_LB_ADDR +static volatile logbuff_t *log; +#else static logbuff_t *log; +#endif +static char *lbuf; void logbuff_init_ptrs (void) { unsigned long tag, post_word; char *s; +#ifdef CONFIG_ALT_LB_ADDR + log = (logbuff_t *)CONFIG_ALT_LH_ADDR; + lbuf = (char *)CONFIG_ALT_LB_ADDR; +#else log = (logbuff_t *)(gd->bd->bi_memsize-LOGBUFF_LEN) - 1; + lbuf = log->buf; +#endif /* Set up log version */ if ((s = getenv ("logversion")) != NULL) @@ -101,11 +112,26 @@ void logbuff_init_ptrs (void) void logbuff_reset (void) { +#ifndef CONFIG_ALT_LB_ADDR memset (log, 0, sizeof (logbuff_t)); - if (log_version == 2) +#endif + if (log_version == 2) { log->v2.tag = LOGBUFF_MAGIC; - else +#ifdef CONFIG_ALT_LB_ADDR + log->v2.start = 0; + log->v2.con = 0; + log->v2.end = 0; + log->v2.chars = 0; +#endif + } else { log->v1.tag = LOGBUFF_MAGIC; +#ifdef CONFIG_ALT_LB_ADDR + log->v1.dummy = 0; + log->v1.start = 0; + log->v1.size = 0; + log->v1.chars = 0; +#endif + } } int drv_logbuff_init (void) @@ -188,7 +214,7 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) size = log->v1.size; } for (i=0; i < (size&LOGBUFF_MASK); i++) { - s = (char *)log->buf+((start+i)&LOGBUFF_MASK); + s = lbuf+((start+i)&LOGBUFF_MASK); putc (*s); } return 0; @@ -196,7 +222,7 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) logbuff_reset (); return 0; } else if (strcmp(argv[1],"info") == 0) { - printf ("Logbuffer at %08lx\n", (unsigned long)log->buf); + printf ("Logbuffer at %08lx\n", (unsigned long)lbuf); if (log_version == 2) { printf ("log_start = %08lx\n", log->v2.start); printf ("log_end = %08lx\n", log->v2.end); @@ -257,14 +283,14 @@ static int logbuff_printk(const char *line) line_feed = 0; for (; p < buf_end; p++) { if (log_version == 2) { - log->buf[log->v2.end & LOGBUFF_MASK] = *p; + lbuf[log->v2.end & LOGBUFF_MASK] = *p; log->v2.end++; if (log->v2.end - log->v2.start > LOGBUFF_LEN) log->v2.start++; log->v2.chars++; } else { - log->buf[(log->v1.start + log->v1.size) & + lbuf[(log->v1.start + log->v1.size) & LOGBUFF_MASK] = *p; if (log->v1.size < LOGBUFF_LEN) log->v1.size++; diff --git a/common/cmd_setexpr.c b/common/cmd_setexpr.c new file mode 100644 index 00000000000..2e49b6dd928 --- /dev/null +++ b/common/cmd_setexpr.c @@ -0,0 +1,70 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +/* + * This file provides a shell like 'expr' function to return. + */ + +#include <common.h> +#include <config.h> +#include <command.h> + +int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + ulong a, b; + char buf[16]; + + /* Validate arguments */ + if ((argc != 5) || (strlen(argv[3]) != 1)) { + printf("Usage:\n%s\n", cmdtp->usage); + return 1; + } + + a = simple_strtoul(argv[2], NULL, 16); + b = simple_strtoul(argv[4], NULL, 16); + + switch (argv[3][0]) { + case '|': sprintf(buf, "%lx", (a | b)); break; + case '&': sprintf(buf, "%lx", (a & b)); break; + case '+': sprintf(buf, "%lx", (a + b)); break; + case '^': sprintf(buf, "%lx", (a ^ b)); break; + case '-': sprintf(buf, "%lx", (a - b)); break; + case '*': sprintf(buf, "%lx", (a * b)); break; + case '/': sprintf(buf, "%lx", (a / b)); break; + case '%': sprintf(buf, "%lx", (a % b)); break; + default: + printf("invalid op\n"); + return 1; + } + + setenv(argv[1], buf); + + return 0; +} + +U_BOOT_CMD( + setexpr, 5, 0, do_setexpr, + "setexpr - set environment variable as the result of eval expression\n", + "name value1 <op> value2\n" + " - set environment variable 'name' to the result of the evaluated\n" + " express specified by <op>. <op> can be &, |, ^, +, -, *, /, %\n" +); diff --git a/common/fdt_support.c b/common/fdt_support.c index 69eb6679548..75077442d85 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -40,7 +40,6 @@ DECLARE_GLOBAL_DATA_PTR; */ struct fdt_header *fdt; -/********************************************************************/ /** * fdt_find_and_setprop: Find a node and set it's property @@ -218,198 +217,6 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force) return err; } -/********************************************************************/ - -#ifdef CONFIG_OF_HAS_UBOOT_ENV - -/* Function that returns a character from the environment */ -extern uchar(*env_get_char) (int); - - -int fdt_env(void *fdt) -{ - int nodeoffset; - int err; - int k, nxt; - int i; - static char tmpenv[256]; - - err = fdt_check_header(fdt); - if (err < 0) { - printf("fdt_env: %s\n", fdt_strerror(err)); - return err; - } - - /* - * See if we already have a "u-boot-env" node, delete it if so. - * Then create a new empty node. - */ - nodeoffset = fdt_path_offset (fdt, "/u-boot-env"); - if (nodeoffset >= 0) { - err = fdt_del_node(fdt, nodeoffset); - if (err < 0) { - printf("fdt_env: %s\n", fdt_strerror(err)); - return err; - } - } - /* - * Create a new node "/u-boot-env" (offset 0 is root level) - */ - nodeoffset = fdt_add_subnode(fdt, 0, "u-boot-env"); - if (nodeoffset < 0) { - printf("WARNING: could not create /u-boot-env %s.\n", - fdt_strerror(nodeoffset)); - return nodeoffset; - } - - for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) { - char *s, *lval, *rval; - - /* - * Find the end of the name=definition - */ - for (nxt = i; env_get_char(nxt) != '\0'; ++nxt) - ; - s = tmpenv; - for (k = i; k < nxt && s < &tmpenv[sizeof(tmpenv) - 1]; ++k) - *s++ = env_get_char(k); - *s++ = '\0'; - lval = tmpenv; - /* - * Find the first '=': it separates the name from the value - */ - s = strchr(tmpenv, '='); - if (s != NULL) { - *s++ = '\0'; - rval = s; - } else - continue; - err = fdt_setprop(fdt, nodeoffset, lval, rval, strlen(rval)+1); - if (err < 0) { - printf("WARNING: could not set %s %s.\n", - lval, fdt_strerror(err)); - return err; - } - } - return 0; -} -#endif /* ifdef CONFIG_OF_HAS_UBOOT_ENV */ - -/********************************************************************/ - -#ifdef CONFIG_OF_HAS_BD_T - -#define BDM(x) { .name = #x, .offset = offsetof(bd_t, bi_ ##x ) } - -static const struct { - const char *name; - int offset; -} bd_map[] = { - BDM(memstart), - BDM(memsize), - BDM(flashstart), - BDM(flashsize), - BDM(flashoffset), - BDM(sramstart), - BDM(sramsize), -#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || defined(CONFIG_8260) \ - || defined(CONFIG_E500) - BDM(immr_base), -#endif -#if defined(CONFIG_MPC5xxx) - BDM(mbar_base), -#endif -#if defined(CONFIG_MPC83XX) - BDM(immrbar), -#endif -#if defined(CONFIG_MPC8220) - BDM(mbar_base), - BDM(inpfreq), - BDM(pcifreq), - BDM(pevfreq), - BDM(flbfreq), - BDM(vcofreq), -#endif - BDM(bootflags), - BDM(ip_addr), - BDM(intfreq), - BDM(busfreq), -#ifdef CONFIG_CPM2 - BDM(cpmfreq), - BDM(brgfreq), - BDM(sccfreq), - BDM(vco), -#endif -#if defined(CONFIG_MPC5xxx) - BDM(ipbfreq), - BDM(pcifreq), -#endif - BDM(baudrate), -}; - - -int fdt_bd_t(void *fdt) -{ - bd_t *bd = gd->bd; - int nodeoffset; - int err; - u32 tmp; /* used to set 32 bit integer properties */ - int i; - - err = fdt_check_header(fdt); - if (err < 0) { - printf("fdt_bd_t: %s\n", fdt_strerror(err)); - return err; - } - - /* - * See if we already have a "bd_t" node, delete it if so. - * Then create a new empty node. - */ - nodeoffset = fdt_path_offset (fdt, "/bd_t"); - if (nodeoffset >= 0) { - err = fdt_del_node(fdt, nodeoffset); - if (err < 0) { - printf("fdt_bd_t: %s\n", fdt_strerror(err)); - return err; - } - } - /* - * Create a new node "/bd_t" (offset 0 is root level) - */ - nodeoffset = fdt_add_subnode(fdt, 0, "bd_t"); - if (nodeoffset < 0) { - printf("WARNING: could not create /bd_t %s.\n", - fdt_strerror(nodeoffset)); - printf("fdt_bd_t: %s\n", fdt_strerror(nodeoffset)); - return nodeoffset; - } - /* - * Use the string/pointer structure to create the entries... - */ - for (i = 0; i < sizeof(bd_map)/sizeof(bd_map[0]); i++) { - tmp = cpu_to_be32(getenv("bootargs")); - err = fdt_setprop(fdt, nodeoffset, - bd_map[i].name, &tmp, sizeof(tmp)); - if (err < 0) - printf("WARNING: could not set %s %s.\n", - bd_map[i].name, fdt_strerror(err)); - } - /* - * Add a couple of oddball entries... - */ - err = fdt_setprop(fdt, nodeoffset, "enetaddr", &bd->bi_enetaddr, 6); - if (err < 0) - printf("WARNING: could not set enetaddr %s.\n", - fdt_strerror(err)); - err = fdt_setprop(fdt, nodeoffset, "ethspeed", &bd->bi_ethspeed, 4); - if (err < 0) - printf("WARNING: could not set ethspeed %s.\n", - fdt_strerror(err)); - return 0; -} -#endif /* ifdef CONFIG_OF_HAS_BD_T */ - void do_fixup_by_path(void *fdt, const char *path, const char *prop, const void *val, int len, int create) { @@ -615,3 +422,28 @@ void fdt_fixup_ethernet(void *fdt, bd_t *bd) } } #endif + +#ifdef CONFIG_HAS_FSL_DR_USB +void fdt_fixup_dr_usb(void *blob, bd_t *bd) +{ + char *mode; + const char *compat = "fsl-usb2-dr"; + const char *prop = "dr_mode"; + int node_offset; + int err; + + mode = getenv("usb_dr_mode"); + if (!mode) + return; + + node_offset = fdt_node_offset_by_compatible(blob, 0, compat); + if (node_offset < 0) + printf("WARNING: could not find compatible node %s: %s.\n", + compat, fdt_strerror(node_offset)); + + err = fdt_setprop(blob, node_offset, prop, mode, strlen(mode) + 1); + if (err < 0) + printf("WARNING: could not set %s for %s: %s.\n", + prop, compat, fdt_strerror(err)); +} +#endif /* CONFIG_HAS_FSL_DR_USB */ diff --git a/common/main.c b/common/main.c index 163ba02e62b..21e7afab61f 100644 --- a/common/main.c +++ b/common/main.c @@ -40,7 +40,7 @@ #include <post.h> -#ifdef CONFIG_SILENT_CONSOLE +#if defined(CONFIG_SILENT_CONSOLE) || defined(CONFIG_POST) DECLARE_GLOBAL_DATA_PTR; #endif @@ -369,6 +369,12 @@ void main_loop (void) init_cmd_timeout (); # endif /* CONFIG_BOOT_RETRY_TIME */ +#ifdef CONFIG_POST + if (gd->flags & GD_FLG_POSTFAIL) { + s = getenv("failbootcmd"); + } + else +#endif /* CONFIG_POST */ #ifdef CONFIG_BOOTCOUNT_LIMIT if (bootlimit && (bootcount > bootlimit)) { printf ("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n", |