diff options
author | Minkyu Kang <mk7.kang@samsung.com> | 2010-03-15 10:51:36 +0900 |
---|---|---|
committer | Minkyu Kang <mk7.kang@samsung.com> | 2010-03-15 10:51:36 +0900 |
commit | 995a4b1d83a08223c82c1e15778b02e85e5bba51 (patch) | |
tree | 0acb85278216df76d8fb7284b32d6dd95a1fc978 /common | |
parent | a8d25fc26f681a9c4dfb062ebb4b00b9509a7966 (diff) | |
parent | 44de3e8ff7ed48bf96ec6c5e2173187d9c1c61e6 (diff) | |
download | u-boot-imx-995a4b1d83a08223c82c1e15778b02e85e5bba51.zip u-boot-imx-995a4b1d83a08223c82c1e15778b02e85e5bba51.tar.gz u-boot-imx-995a4b1d83a08223c82c1e15778b02e85e5bba51.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-arm
Conflicts:
board/davinci/da830evm/da830evm.c
board/edb93xx/sdram_cfg.c
board/esd/otc570/otc570.c
board/netstar/eeprom.c
board/netstar/eeprom_start.S
cpu/arm920t/ep93xx/timer.c
include/configs/netstar.h
include/configs/otc570.h
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_itest.c | 9 | ||||
-rw-r--r-- | common/cmd_ximg.c | 33 | ||||
-rw-r--r-- | common/env_nand.c | 7 | ||||
-rw-r--r-- | common/lcd.c | 8 | ||||
-rw-r--r-- | common/miiphyutil.c | 12 | ||||
-rw-r--r-- | common/usb.c | 19 |
6 files changed, 51 insertions, 37 deletions
diff --git a/common/cmd_itest.c b/common/cmd_itest.c index 5b301bf..58c5e7b 100644 --- a/common/cmd_itest.c +++ b/common/cmd_itest.c @@ -66,12 +66,17 @@ op_tbl_t op_table [] = { static long evalexp(char *s, int w) { - long l, *p; + long l = 0; + long *p; /* if the parameter starts with a * then assume is a pointer to the value we want */ if (s[0] == '*') { p = (long *)simple_strtoul(&s[1], NULL, 16); - l = *p; + switch (w) { + case 1: return((long)(*(unsigned char *)p)); + case 2: return((long)(*(unsigned short *)p)); + case 4: return(*p); + } } else { l = simple_strtoul(s, NULL, 16); } diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c index 3e5fb44..b34c4d0 100644 --- a/common/cmd_ximg.c +++ b/common/cmd_ximg.c @@ -225,20 +225,25 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) break; #if defined(CONFIG_BZIP2) case IH_COMP_BZIP2: - printf (" Uncompressing part %d ... ", part); - /* - * If we've got less than 4 MB of malloc() 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); - return 1; + { + int i; + + printf (" Uncompressing part %d ... ", part); + /* + * If we've got less than 4 MB of malloc() + * 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); + return 1; + } } break; #endif /* CONFIG_BZIP2 */ diff --git a/common/env_nand.c b/common/env_nand.c index ca631af..a15a950 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -298,6 +298,13 @@ void env_relocate_spec (void) tmp_env1 = (env_t *) malloc(CONFIG_ENV_SIZE); tmp_env2 = (env_t *) malloc(CONFIG_ENV_SIZE); + if ((tmp_env1 == NULL) || (tmp_env2 == NULL)) { + puts("Can't allocate buffers for environment\n"); + free (tmp_env1); + free (tmp_env2); + return use_default(); + } + if (readenv(CONFIG_ENV_OFFSET, (u_char *) tmp_env1)) puts("No Valid Environment Area Found\n"); if (readenv(CONFIG_ENV_OFFSET_REDUND, (u_char *) tmp_env2)) diff --git a/common/lcd.c b/common/lcd.c index 4e31618..db799db 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -456,22 +456,14 @@ ulong lcd_setmem (ulong addr) static void lcd_setfgcolor (int color) { -#ifdef CONFIG_ATMEL_LCD lcd_color_fg = color; -#else - lcd_color_fg = color & 0x0F; -#endif } /*----------------------------------------------------------------------*/ static void lcd_setbgcolor (int color) { -#ifdef CONFIG_ATMEL_LCD lcd_color_bg = color; -#else - lcd_color_bg = color & 0x0F; -#endif } /*----------------------------------------------------------------------*/ diff --git a/common/miiphyutil.c b/common/miiphyutil.c index 196ef4a..856fbc7 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -293,7 +293,7 @@ int miiphy_info (char *devname, unsigned char addr, unsigned int *oui, int miiphy_reset (char *devname, unsigned char addr) { unsigned short reg; - int loop_cnt; + int timeout = 500; if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) { debug ("PHY status read failed\n"); @@ -311,13 +311,13 @@ int miiphy_reset (char *devname, unsigned char addr) * auto-clearing). This should happen within 0.5 seconds per the * IEEE spec. */ - loop_cnt = 0; reg = 0x8000; - while (((reg & 0x8000) != 0) && (loop_cnt++ < 1000000)) { - if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) { - debug ("PHY status read failed\n"); - return (-1); + while (((reg & 0x8000) != 0) && timeout--) { + if (miiphy_read(devname, addr, PHY_BMCR, ®) != 0) { + debug("PHY status read failed\n"); + return -1; } + udelay(1000); } if ((reg & 0x8000) == 0) { return (0); diff --git a/common/usb.c b/common/usb.c index eef4b34..10e23de 100644 --- a/common/usb.c +++ b/common/usb.c @@ -197,16 +197,21 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, if (timeout == 0) return (int)size; - if (dev->status != 0) { - /* - * Let's wait a while for the timeout to elapse. - * It has no real use, but it keeps the interface happy. - */ - wait_ms(timeout); - return -1; + /* + * Wait for status to update until timeout expires, USB driver + * interrupt handler may set the status when the USB operation has + * been completed. + */ + while (timeout--) { + if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC)) + break; + wait_ms(1); } + if (dev->status) + return -1; return dev->act_len; + } /*------------------------------------------------------------------- |