Merge remote branch 'origin/master' into next
authorWolfgang Denk <wd@denx.de>
Mon, 29 Mar 2010 10:33:43 +0000 (12:33 +0200)
committerWolfgang Denk <wd@denx.de>
Mon, 29 Mar 2010 10:33:43 +0000 (12:33 +0200)
1  2 
MAKEALL
Makefile
drivers/mtd/cfi_flash.c

diff --combined MAKEALL
index eec02a35880681faf16cc3b3063664839a17a01d,5c303f9a42f4af8853f1a3302cf39b1032003bc2..a88c31eff460ff8e1c795d26fb505c4df6e6a9d9
+++ b/MAKEALL
@@@ -61,6 -61,7 +61,6 @@@ LIST_5xxx="           
        EVAL5200        \
        fo300           \
        galaxy5200      \
 -      icecube_5100    \
        icecube_5200    \
        inka4x0         \
        ipek01          \
@@@ -75,6 -76,7 +75,6 @@@
        pf5200          \
        PM520           \
        TB5200          \
 -      Total5100       \
        Total5200       \
        Total5200_Rev2  \
        TQM5200         \
@@@ -236,7 -238,6 +236,6 @@@ LIST_4xx="         
        MIP405          \
        MIP405T         \
        ML2             \
-       ml300           \
        ml507           \
        ml507_flash     \
        neo             \
@@@ -839,7 -840,6 +838,7 @@@ LIST_microblaze="                  
  #########################################################################
  
  LIST_coldfire="                       \
 +      astro_mcf5373l          \
        cobra5272               \
        EB+MCF-EV123            \
        EB+MCF-EV123_internal   \
diff --combined Makefile
index 804430234c76a417f9456762b11d3a50bb6c5d51,67e62d746cafb0005b942b68feedbb9564be3981..c0e73de0eaea1dd96d07c5897abb068d2bfb7846
+++ b/Makefile
@@@ -1,5 -1,5 +1,5 @@@
  #
 -# (C) Copyright 2000-2009
 +# (C) Copyright 2000-2010
  # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  #
  # See file CREDITS for list of people who contributed to this
@@@ -24,7 -24,7 +24,7 @@@
  VERSION = 2010
  PATCHLEVEL = 03
  SUBLEVEL =
- EXTRAVERSION = -rc2
+ EXTRAVERSION = -rc3
  ifneq "$(SUBLEVEL)" ""
  U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
  else
@@@ -548,7 -548,8 +548,7 @@@ icecube_5200_LOWBOOT_config                
  icecube_5200_LOWBOOT08_config         \
  icecube_5200_DDR_config                       \
  icecube_5200_DDR_LOWBOOT_config               \
 -icecube_5200_DDR_LOWBOOT08_config     \
 -icecube_5100_config:                  unconfig
 +icecube_5200_DDR_LOWBOOT08_config:    unconfig
        @mkdir -p $(obj)include
        @mkdir -p $(obj)board/icecube
        @[ -z "$(findstring LOWBOOT_,$@)" ] || \
                { echo "#define CONFIG_MPC5200_DDR"     >>$(obj)include/config.h ; \
                  $(XECHO) "... DDR memory revision" ; \
                }
 -      @[ -z "$(findstring 5200,$@)" ] || \
 -              { echo "#define CONFIG_MPC5200"         >>$(obj)include/config.h ; \
 -                $(XECHO) "... with MPC5200 processor" ; \
 -              }
 -      @[ -z "$(findstring 5100,$@)" ] || \
 -              { echo "#define CONFIG_MGT5100"         >>$(obj)include/config.h ; \
 -                $(XECHO) "... with MGT5100 processor" ; \
 -              }
        @$(MKCONFIG) -a IceCube ppc mpc5xxx icecube
  
  jupiter_config:       unconfig
@@@ -585,6 -594,7 +585,6 @@@ lite5200b_LOWBOOT_config:  unconfi
        @mkdir -p $(obj)board/icecube
        @ echo "#define CONFIG_MPC5200_DDR"     >>$(obj)include/config.h
        @ $(XECHO) "... DDR memory revision"
 -      @ echo "#define CONFIG_MPC5200"         >>$(obj)include/config.h
        @ echo "#define CONFIG_LITE5200B"       >>$(obj)include/config.h
        @[ -z "$(findstring _PM_,$@)" ] || \
                { echo "#define CONFIG_LITE5200B_PM"    >>$(obj)include/config.h ; \
                { echo "TEXT_BASE = 0xFF000000" >$(obj)board/icecube/config.tmp ; \
                  $(XECHO) "... with LOWBOOT configuration" ; \
                }
 -      @ $(XECHO) "... with MPC5200B processor"
        @$(MKCONFIG) -a IceCube  ppc mpc5xxx icecube
  
  mcc200_config \
@@@ -717,12 -728,21 +717,12 @@@ TOP5200_config: unconfi
        @ echo "#define CONFIG_$(@:_config=) 1" >$(obj)include/config.h
        @$(MKCONFIG) -n $@ -a TOP5200 ppc mpc5xxx top5200 emk
  
 -Total5100_config              \
  Total5200_config              \
  Total5200_lowboot_config      \
  Total5200_Rev2_config         \
  Total5200_Rev2_lowboot_config:        unconfig
        @mkdir -p $(obj)include
        @mkdir -p $(obj)board/total5200
 -      @[ -z "$(findstring 5100,$@)" ] || \
 -              { echo "#define CONFIG_MGT5100"         >>$(obj)include/config.h ; \
 -                $(XECHO) "... with MGT5100 processor" ; \
 -              }
 -      @[ -z "$(findstring 5200,$@)" ] || \
 -              { echo "#define CONFIG_MPC5200"         >>$(obj)include/config.h ; \
 -                $(XECHO) "... with MPC5200 processor" ; \
 -              }
        @[ -n "$(findstring Rev,$@)" ] || \
                { echo "#define CONFIG_TOTAL5200_REV 1" >>$(obj)include/config.h ; \
                  $(XECHO) "... revision 1 board" ; \
@@@ -1415,9 -1435,6 +1415,6 @@@ MIP405T_config: unconfi
  ML2_config:   unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx ml2
  
- ml300_config: unconfig
-       @$(MKCONFIG) $(@:_config=) ppc ppc4xx ml300 xilinx
  ml507_flash_config: unconfig
        @mkdir -p $(obj)include $(obj)board/xilinx/ppc440-generic
        @mkdir -p $(obj)include $(obj)board/xilinx/ml507
@@@ -1976,10 -1993,6 +1973,10 @@@ ZPC1900_config: unconfi
  ## Coldfire
  #########################################################################
  
 +astro_mcf5373l_config \
 +astro_mcf5373l_RAM_config :   unconfig
 +      @$(MKCONFIG) -t $(@:_config=) astro_mcf5373l m68k mcf532x mcf5373l astro
 +
  M5208EVBE_config :            unconfig
        @$(MKCONFIG) $(@:_config=) m68k mcf52x2 m5208evbe freescale
  
@@@ -2048,9 -2061,6 +2045,9 @@@ EB+MCF-EV123_internal_config :  unconfi
        @echo "TEXT_BASE = 0xF0000000"|tee $(obj)board/BuS/EB+MCF-EV123/textbase.mk
        @$(MKCONFIG) EB+MCF-EV123 m68k mcf52x2 EB+MCF-EV123 BuS
  
 +EP2500_config:                        unconfig
 +      @$(MKCONFIG) $(@:_config=) m68k mcf52x2 ep2500 Mercury
 +
  idmr_config :                 unconfig
        @$(MKCONFIG) $(@:_config=) m68k mcf52x2 idmr
  
diff --combined drivers/mtd/cfi_flash.c
index 15a4220d4f3bb191b8172710491e2d6df4700697,cd1a86ebad27c734a2e1d99705dae8196d7f9c43..d0240f55d4996fe8148b9950dd2eb47ca85b845d
@@@ -537,7 -537,10 +537,10 @@@ static int flash_status_check (flash_in
        ulong start;
  
  #if CONFIG_SYS_HZ != 1000
-       tout *= CONFIG_SYS_HZ/1000;
+       if ((ulong)CONFIG_SYS_HZ > 100000)
+               tout *= (ulong)CONFIG_SYS_HZ / 1000;  /* for a big HZ, avoid overflow */
+       else
+               tout = DIV_ROUND_UP(tout * (ulong)CONFIG_SYS_HZ, 1000);
  #endif
  
        /* Wait for command completion */
@@@ -602,63 -605,6 +605,63 @@@ static int flash_full_status_check (fla
        return retcode;
  }
  
 +static int use_flash_status_poll(flash_info_t *info)
 +{
 +#ifdef CONFIG_SYS_CFI_FLASH_STATUS_POLL
 +      if (info->vendor == CFI_CMDSET_AMD_EXTENDED ||
 +          info->vendor == CFI_CMDSET_AMD_STANDARD)
 +              return 1;
 +#endif
 +      return 0;
 +}
 +
 +static int flash_status_poll(flash_info_t *info, void *src, void *dst,
 +                           ulong tout, char *prompt)
 +{
 +#ifdef CONFIG_SYS_CFI_FLASH_STATUS_POLL
 +      ulong start;
 +      int ready;
 +
 +#if CONFIG_SYS_HZ != 1000
 +      if ((ulong)CONFIG_SYS_HZ > 100000)
 +              tout *= (ulong)CONFIG_SYS_HZ / 1000;  /* for a big HZ, avoid overflow */
 +      else
 +              tout = DIV_ROUND_UP(tout * (ulong)CONFIG_SYS_HZ, 1000);
 +#endif
 +
 +      /* Wait for command completion */
 +      start = get_timer(0);
 +      while (1) {
 +              switch (info->portwidth) {
 +              case FLASH_CFI_8BIT:
 +                      ready = flash_read8(dst) == flash_read8(src);
 +                      break;
 +              case FLASH_CFI_16BIT:
 +                      ready = flash_read16(dst) == flash_read16(src);
 +                      break;
 +              case FLASH_CFI_32BIT:
 +                      ready = flash_read32(dst) == flash_read32(src);
 +                      break;
 +              case FLASH_CFI_64BIT:
 +                      ready = flash_read64(dst) == flash_read64(src);
 +                      break;
 +              default:
 +                      ready = 0;
 +                      break;
 +              }
 +              if (ready)
 +                      break;
 +              if (get_timer(start) > tout) {
 +                      printf("Flash %s timeout at address %lx data %lx\n",
 +                             prompt, (ulong)dst, (ulong)flash_read8(dst));
 +                      return ERR_TIMOUT;
 +              }
 +              udelay(1);              /* also triggers watchdog */
 +      }
 +#endif /* CONFIG_SYS_CFI_FLASH_STATUS_POLL */
 +      return ERR_OK;
 +}
 +
  /*-----------------------------------------------------------------------
   */
  static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c)
@@@ -806,12 -752,7 +809,12 @@@ static int flash_write_cfiword (flash_i
        if (!sect_found)
                sect = find_sector (info, dest);
  
 -      return flash_full_status_check (info, sect, info->write_tout, "write");
 +      if (use_flash_status_poll(info))
 +              return flash_status_poll(info, &cword, dstaddr,
 +                                       info->write_tout, "write");
 +      else
 +              return flash_full_status_check(info, sect,
 +                                             info->write_tout, "write");
  }
  
  #ifdef CONFIG_SYS_FLASH_USE_BUFFER_WRITE
@@@ -973,15 -914,9 +976,15 @@@ static int flash_write_cfibuffer (flash
                }
  
                flash_write_cmd (info, sector, 0, AMD_CMD_WRITE_BUFFER_CONFIRM);
 -              retcode = flash_full_status_check (info, sector,
 -                                                 info->buffer_write_tout,
 -                                                 "buffer write");
 +              if (use_flash_status_poll(info))
 +                      retcode = flash_status_poll(info, src - (1 << shift),
 +                                                  dst - (1 << shift),
 +                                                  info->buffer_write_tout,
 +                                                  "buffer write");
 +              else
 +                      retcode = flash_full_status_check(info, sector,
 +                                                        info->buffer_write_tout,
 +                                                        "buffer write");
                break;
  
        default:
@@@ -1003,7 -938,6 +1006,7 @@@ int flash_erase (flash_info_t * info, i
        int rcode = 0;
        int prot;
        flash_sect_t sect;
 +      int st;
  
        if (info->flash_id != FLASH_MAN_CFI) {
                puts ("Can't erase unknown flash type - aborted\n");
                                break;
                        }
  
 -                      if (flash_full_status_check
 -                          (info, sect, info->erase_blk_tout, "erase")) {
 +                      if (use_flash_status_poll(info)) {
 +                              cfiword_t cword = (cfiword_t)0xffffffffffffffffULL;
 +                              void *dest;
 +                              dest = flash_map(info, sect, 0);
 +                              st = flash_status_poll(info, &cword, dest,
 +                                                     info->erase_blk_tout, "erase");
 +                              flash_unmap(info, sect, 0, dest);
 +                      } else
 +                              st = flash_full_status_check(info, sect,
 +                                                           info->erase_blk_tout,
 +                                                           "erase");
 +                      if (st)
                                rcode = 1;
 -                      else if (flash_verbose)
 +                      else if (flash_verbose)
                                putc ('.');
                }
        }