diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/fdt.c | 10 | ||||
-rw-r--r-- | cmd/fpga.c | 20 | ||||
-rw-r--r-- | cmd/mem.c | 28 | ||||
-rw-r--r-- | cmd/sata.c | 5 | ||||
-rw-r--r-- | cmd/usb.c | 2 |
5 files changed, 24 insertions, 41 deletions
@@ -58,7 +58,7 @@ static int fdt_value_setenv(const void *nodep, int len, const char *var) else if (len == 4) { char buf[11]; - sprintf(buf, "0x%08X", *(uint32_t *)nodep); + sprintf(buf, "0x%08X", fdt32_to_cpu(*(fdt32_t *)nodep)); setenv(var, buf); } else if (len%4 == 0 && len <= 20) { /* Needed to print things like sha1 hashes. */ @@ -642,6 +642,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) else if (strncmp(argv[1], "ap", 2) == 0) { unsigned long addr; struct fdt_header *blob; + int ret; if (argc != 3) return CMD_RET_USAGE; @@ -654,8 +655,11 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!fdt_valid(&blob)) return CMD_RET_FAILURE; - if (fdt_overlay_apply(working_fdt, blob)) + ret = fdt_overlay_apply(working_fdt, blob); + if (ret) { + printf("fdt_overlay_apply(): %s\n", fdt_strerror(ret)); return CMD_RET_FAILURE; + } } #endif /* resize the fdt */ @@ -764,7 +768,7 @@ static int fdt_parse_prop(char * const *newval, int count, char *data, int *len) cp = newp; tmp = simple_strtoul(cp, &newp, 0); - *(__be32 *)data = __cpu_to_be32(tmp); + *(fdt32_t *)data = cpu_to_fdt32(tmp); data += 4; *len += 4; @@ -18,15 +18,17 @@ static int fpga_get_op(char *opstr); /* Local defines */ -#define FPGA_NONE -1 -#define FPGA_INFO 0 -#define FPGA_LOAD 1 -#define FPGA_LOADB 2 -#define FPGA_DUMP 3 -#define FPGA_LOADMK 4 -#define FPGA_LOADP 5 -#define FPGA_LOADBP 6 -#define FPGA_LOADFS 7 +enum { + FPGA_NONE = -1, + FPGA_INFO, + FPGA_LOAD, + FPGA_LOADB, + FPGA_DUMP, + FPGA_LOADMK, + FPGA_LOADP, + FPGA_LOADBP, + FPGA_LOADFS, +}; /* ------------------------------------------------------------------------- */ /* command form: @@ -372,10 +372,8 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - ulong addr, dest, count, bytes; + ulong addr, dest, count; int size; - const void *src; - void *buf; if (argc != 4) return CMD_RET_USAGE; @@ -465,29 +463,7 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #endif - bytes = size * count; - buf = map_sysmem(dest, bytes); - src = map_sysmem(addr, bytes); - while (count-- > 0) { - if (size == 4) - *((u32 *)buf) = *((u32 *)src); -#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA - else if (size == 8) - *((u64 *)buf) = *((u64 *)src); -#endif - else if (size == 2) - *((u16 *)buf) = *((u16 *)src); - else - *((u8 *)buf) = *((u8 *)src); - src += size; - buf += size; - - /* reset watchdog from time to time */ - if ((count % (64 << 10)) == 0) - WATCHDOG_RESET(); - } - unmap_sysmem(buf); - unmap_sysmem(src); + memcpy((void *)dest, (void *)addr, count * size); return 0; } @@ -28,14 +28,15 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (sata_curr_device != -1) sata_stop(); - return sata_initialize(); + return (sata_initialize() < 0) ? + CMD_RET_FAILURE : CMD_RET_SUCCESS; } /* If the user has not yet run `sata init`, do it now */ if (sata_curr_device == -1) { rc = sata_initialize(); if (rc == -1) - return rc; + return CMD_RET_FAILURE; sata_curr_device = rc; } @@ -571,11 +571,11 @@ static void do_usb_start(void) return; /* Driver model will probe the devices as they are found */ -#ifndef CONFIG_DM_USB # ifdef CONFIG_USB_STORAGE /* try to recognize storage devices immediately */ usb_stor_curr_dev = usb_stor_scan(1); # endif +#ifndef CONFIG_DM_USB # ifdef CONFIG_USB_KEYBOARD drv_usb_kbd_init(); # endif |