diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_mtdparts.c | 5 | ||||
-rw-r--r-- | common/cmd_nand.c | 2 | ||||
-rw-r--r-- | common/cmd_ubi.c | 3 | ||||
-rw-r--r-- | common/cmd_usb.c | 35 | ||||
-rw-r--r-- | common/cmd_ximg.c | 28 | ||||
-rw-r--r-- | common/fdt_decode.c | 19 |
6 files changed, 67 insertions, 25 deletions
diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index 5481c885d3e..66a4c302a1c 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -838,7 +838,7 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_ struct mtdids *id; const char *mtd_id; unsigned int mtd_id_len; - const char *p, *pend; + const char *p; LIST_HEAD(tmp_list); struct list_head *entry, *n; u16 num_parts; @@ -871,8 +871,7 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_ debug("dev type = %d (%s), dev num = %d, mtd-id = %s\n", id->type, MTD_DEV_TYPE(id->type), id->num, id->mtd_id); - pend = strchr(p, ';'); - debug("parsing partitions %.*s\n", (pend ? pend - p : strlen(p)), p); + debug("parsing partitions %.*s\n", (strchr(p, ';') ? strchr(p, ';') - p : strlen(p)), p); /* parse partitions */ diff --git a/common/cmd_nand.c b/common/cmd_nand.c index ef1253f50b5..d42054e0d2d 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -190,7 +190,7 @@ static int arg_off_size(int argc, char *const argv[], int *idx, loff_t *off, loff_t *size) { int ret; - loff_t maxsize; + loff_t maxsize=0; if (argc == 0) { *off = 0; diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c index 629758fdf5e..8c1bc23a5a9 100644 --- a/common/cmd_ubi.c +++ b/common/cmd_ubi.c @@ -316,7 +316,6 @@ static int ubi_volume_write(char *volume, void *buf, size_t size) static int ubi_volume_read(char *volume, char *buf, size_t size) { int err, lnum, off, len, tbuf_size; - size_t count_save = size; void *tbuf; unsigned long long tmp; struct ubi_volume *vol; @@ -347,7 +346,7 @@ static int ubi_volume_read(char *volume, char *buf, size_t size) if (vol->corrupted) printf("read from corrupted volume %d", vol->vol_id); if (offp + size > vol->used_bytes) - count_save = size = vol->used_bytes - offp; + size = vol->used_bytes - offp; tbuf_size = vol->usable_leb_size; if (size < tbuf_size) diff --git a/common/cmd_usb.c b/common/cmd_usb.c index e04f1c54790..0cfde07e2c6 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -1,6 +1,8 @@ /* * (C) Copyright 2001 * Denis Peter, MPL AG Switzerland + * (C) Copyright 2012 + * Toradex, Inc. * * Most of this source has been derived from the Linux USB * project. @@ -277,11 +279,12 @@ static inline char *portspeed(int speed) return "12 Mb/s"; } -/* shows the device tree recursively */ -void usb_show_tree_graph(struct usb_device *dev, char *pre) +/* shows the device tree recursively + returns device number of leaf node or zero otherwise (e.g. root hub only) */ +int usb_show_tree_graph(struct usb_device *dev, char *pre) { int i, index; - int has_child, last_child; + int has_child, last_child, leaf = 0; index = strlen(pre); printf(" %s", pre); @@ -311,8 +314,10 @@ void usb_show_tree_graph(struct usb_device *dev, char *pre) } /* for all children of the parent */ printf("\b+-"); /* correct last child */ - if (last_child) + if (last_child) { + leaf = dev->devnum; pre[index-1] = ' '; + } } /* if not root hub */ else printf(" "); @@ -330,20 +335,21 @@ void usb_show_tree_graph(struct usb_device *dev, char *pre) if (dev->maxchild > 0) { for (i = 0; i < dev->maxchild; i++) { if (dev->children[i] != NULL) { - usb_show_tree_graph(dev->children[i], pre); + leaf = usb_show_tree_graph(dev->children[i], pre); pre[index] = 0; } } } + return leaf; } /* main routine for the tree command */ -void usb_show_tree(struct usb_device *dev) +int usb_show_tree(struct usb_device *dev) { char preamble[32]; memset(preamble, 0, 32); - usb_show_tree_graph(dev, &preamble[0]); + return usb_show_tree_graph(dev, &preamble[0]); } @@ -563,8 +569,21 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 1; } if (strncmp(argv[1], "tree", 4) == 0) { + int dev_index = 0, previous_dev_index = 0; + struct usb_device *usb; + printf("\nDevice Tree:\n"); - usb_show_tree(usb_get_dev_index(0)); + do { + usb = usb_get_dev_index(dev_index); + if (usb) { + dev_index = usb_show_tree(usb); + if (!dev_index) + dev_index = previous_dev_index + 1; + } + else + dev_index = 0; + previous_dev_index = dev_index; + } while (dev_index); return 0; } if (strncmp(argv[1], "inf", 3) == 0) { diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c index dceb975498b..929ee238416 100644 --- a/common/cmd_ximg.c +++ b/common/cmd_ximg.c @@ -42,6 +42,10 @@ #define CONFIG_SYS_XIMG_LEN 0x800000 #endif +/* Chromium U-Boot treats all errors as warnings, 'hdr' may be used + uninitialized in below function. The pragma disables this warning. */ +#pragma GCC diagnostic warning "-Wuninitialized" + int do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { @@ -51,7 +55,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) int verify; int part = 0; char pbuf[10]; - image_header_t *hdr; + image_header_t *hdr = NULL; #if defined(CONFIG_FIT) const char *uname = NULL; const void* fit_hdr; @@ -234,16 +238,22 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) * space, use slower decompression algorithm * which requires at most 2300 KB of memory. */ - i = BZ2_bzBuffToBuffDecompress( - (char*)ntohl(hdr->ih_load), - &unc_len, (char *)data, len, - CONFIG_SYS_MALLOC_LEN < (4096 * 1024), - 0); - if (i != BZ_OK) { - printf ("BUNZIP2 ERROR %d - " - "image not loaded\n", i); + if(hdr == NULL) { + printf ("hdr not set\n"); return 1; } + else { + i = BZ2_bzBuffToBuffDecompress( + (char*)ntohl(hdr->ih_load), + &unc_len, (char *)data, len, + CONFIG_SYS_MALLOC_LEN < (4096 * 1024), + 0); + if (i != BZ_OK) { + printf ("BUNZIP2 ERROR %d - " + "image not loaded\n", i); + return 1; + } + } } break; #endif /* CONFIG_BZIP2 */ diff --git a/common/fdt_decode.c b/common/fdt_decode.c index 4f1eb59b2ca..afa070f2d6b 100644 --- a/common/fdt_decode.c +++ b/common/fdt_decode.c @@ -28,6 +28,10 @@ /* we need a generic GPIO interface here */ #include <asm/arch/gpio.h> +#include <asm/sizes.h> +#include <asm/global_data.h> +DECLARE_GLOBAL_DATA_PTR; + /* * Here are the type we know about. One day we might allow drivers to * register. For now we just put them here. The COMPAT macro allows us to @@ -533,8 +537,14 @@ int fdt_decode_lcd(const void *blob, struct fdt_lcd *config) config->width == -1 || config->height == -1 || !config->pwfm || !config->disp) return -FDT_ERR_MISSING; - config->frame_buffer = get_addr(blob, node, "frame-buffer"); - + if(gd->ram_size == SZ_256M) + { + config->frame_buffer = get_addr(blob, node, "frame-buffer_256"); + } + else + { + config->frame_buffer = get_addr(blob, node, "frame-buffer_512"); + } err |= fdt_decode_gpio(blob, node, "backlight-enable", &config->backlight_en); err |= fdt_decode_gpio(blob, node, "lvds-shutdown", @@ -708,6 +718,11 @@ int fdt_decode_nand(const void *blob, int node, struct fdt_nand *config) if (err < 0) return err; + err = get_int_array(blob, node, "nv-partitions", config->nv_partitions, + FDT_NAND_PARTOFFSET_COUNT); + if (err < 0) + return err; + /* Now look up the controller and decode that */ node = lookup_phandle(blob, node, "controller"); if (node < 0) |