Skip to content
Snippets Groups Projects
  1. Apr 21, 2011
    • Mike Frysinger's avatar
      cfi_flash: reverse geometry for M29W800DT parts · 6a011ce8
      Mike Frysinger authored
      
      The M29W800DT parts also report their geometry with the sector layout
      reversed.  So add that ID to the flash_fixup_stm function.
      
      Otherwise, we get:
      bfin> flinfo
      
      Bank # 1: CFI conformant FLASH (16 x 16)  Size: 1 MB in 19 Sectors
        AMD Standard command set, Manufacturer ID: 0x20, Device ID: 0x22D7
        Erase timeout: 8192 ms, write timeout: 1 ms
      
        Sector Start Addresses:
        20000000        20004000        20006000        20008000        20010000
        20020000        20030000        20040000        20050000        20060000
        20070000        20080000        20090000        200A0000        200B0000
        200C0000        200D0000        200E0000        200F0000
      
      Reported-by: default avatarJianxi Fu <fujianxi@gmail.com>
      Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      6a011ce8
  2. Apr 13, 2011
    • Peter Tyser's avatar
      cfi_flash: Fix CONFIG_SYS_FLASH_AUTOPROTECT_LIST usage · 2c51983b
      Peter Tyser authored
      
      Commit 6ee1416e (mtd, cfi: introduce
      void flash_protect_default(void)) introduced a bug which resulted in
      boards that define CONFIG_SYS_FLASH_AUTOPROTECT_LIST not compiling with
      the the following errors and warning:
        ptyser@petert u-boot $ make -s xpedite520x
        Configuring for xpedite520x board...
        cfi_flash.c: In function 'flash_protect_default':
        cfi_flash.c:2118: error: 'i' undeclared (first use in this function)
        cfi_flash.c:2118: error: (Each undeclared identifier is reported only once
        cfi_flash.c:2118: error: for each function it appears in.)
        cfi_flash.c:2118: error: 'apl' undeclared (first use in this function)
        cfi_flash.c:2118: error: invalid application of 'sizeof' to incomplete type 'struct apl_s'
        cfi_flash.c: In function 'flash_init':
        cfi_flash.c:2137: warning: unused variable 'apl'
      
      Signed-off-by: default avatarPeter Tyser <ptyser@xes-inc.com>
      Reported-by: default avatarKumar Gala <galak@kernel.crashing.org>
      Cc: Heiko Schocher <hs@denx.de>
      2c51983b
  3. Apr 07, 2011
  4. Mar 28, 2011
    • Martin Krause's avatar
      cfi_flash: fix bug with flash banks with different sector numbers · af567301
      Martin Krause authored
      
      The function find_sector() does not take into account if the flash bank
      has changed since the last call. This could lead to illegal accesses inside
      and beyond the flash_info_t info strcture. For example if the current
      flash bank has less sectors than the last used flash bank.
      
      This patch adds two cheks. One that insures, that the current sector does
      not exceed the allowed maximum (which is always a good idea). And one that
      checks if the current access is to the same flash bank as the last access.
      If not, the search loop will start with sector 0.
      
      Signed-off-by: default avatarMartin Krause <martin.krause@tqs.de>
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      af567301
  5. Jan 18, 2011
  6. Jan 09, 2011
  7. Dec 17, 2010
    • Stefan Roese's avatar
      cfi_flash: Add optional config register write to cfi-detection · 6f726f95
      Stefan Roese authored
      
      This patch adds the possibility to (optinally) write to the
      flash configuration register. The Intel style CFI chips support
      such a register that can be used to configure the operation
      mode to a non-default value.
      
      This method will be used by the t3corp board, which needs to
      configure the DS617 Xilinx flash for async read mode.
      
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      6f726f95
    • Stefan Roese's avatar
      cfi_flash: Use flash_read32() in sector_erased() · 4d2ca9d6
      Stefan Roese authored
      
      The function sector_erased() is modified to not use pointer
      access, but to use the correct accessor functions. This fixes a
      problem on the t3corp board with the Xilinx DS617 flash chips. Here
      a board specific accessor function is needed to read from flash
      in 32bit mode. This patch enables such an operation mode.
      
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      4d2ca9d6
    • Stefan Roese's avatar
      cfi_flash: Fix problems with status/id read mode · df4e813b
      Stefan Roese authored
      
      This patch adds some calls to set the flash chip in the read-status-
      register- or read-id-mode before the corresponding register is
      read back. This problem was detected while porting the common CFI
      driver to support the Xilinx DS617 flash chips.
      
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      df4e813b
  8. Nov 28, 2010
    • Anatolij Gustschin's avatar
      cfi_flash: fix bug introduced while recent change to flash_get_size() · 34bbb8fb
      Anatolij Gustschin authored
      
      commit ec50a8e3
      "cfi_flash: handle 'chip size exceeds address window' situation"
      added 3rd argument to flash_get_size() but didn't fix all the
      function calls from the board specific code. Many boards have
      their own flash_get_size() definitions in the board code and
      use them there, but some boards (e.g. tqm834x, tqm85xx, pdm360ng)
      use flash_get_size() from the cfi_flash.c driver.
      
      The bug shows up if the value of the "max_size" argument (which
      is not defined when calling the function with two arguments)
      happens to be less than "info->size". In this case on the
      affected boards we end up with a bank of reduced size and
      in the worst case might even be not able to update U-Boot or
      to boot the kernel from flash:
      
      => fli
      
      Bank # 1: CFI conformant FLASH (32 x 16)  Size: 0 kB in 1 Sectors
        AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E
        Erase timeout: 4096 ms, write timeout: 1 ms
        Buffer write timeout: 3 ms, buffer size: 64 bytes
      
        Sector Start Addresses:
        F0000000   RO
      
      Bank # 2: CFI conformant FLASH (32 x 16)  Size: 128 MB in 512 Sectors
        AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E
        Erase timeout: 4096 ms, write timeout: 1 ms
        Buffer write timeout: 3 ms, buffer size: 64 bytes
      
        Sector Start Addresses:
        F8000000        F8040000        F8080000        F80C0000        F8100000
        F8140000        F8180000        F81C0000        F8200000        F8240000
        ...
      
      E.g., updating U-Boot is not possible now:
      
      => protect off ${u-boot_addr} +${u-boot_size}
      Error: end address (0xf007ffff) not in flash!
      Bad address format
      => era ${u-boot_addr} +${u-boot_size}
      Error: end address (0xf007ffff) not in flash!
      Bad address format
      
      This patch removes the 3rd argument of flash_get_size() again
      and sets "max_size" in the function itself instead of passing
      it as a function argument.
      
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      34bbb8fb
  9. Oct 23, 2010
    • Ilya Yanok's avatar
      cfi_flash: handle 'chip size exceeds address window' situation · ec50a8e3
      Ilya Yanok authored
      
      On some boards we have flash mapped high in the address space with
      considerably small window (say 0xFE000000 and 32MB). When we install
      bigger chip (say 64MB) on such a board strange things happen
      (flash_write() doesn't work at all, for ex). That's because cfi_flash
      driver doesn't care about window size at all.
      Of course, cleanest solution would probably be to just extend address
      window to be able to map the whole flash but for legacy/compatibility
      reasons some people prefer just truncate the flash size and never use
      the upper part.
      This patch adds an option for cfi_flash driver to handle this situation
      properly. To achieve this we add the new function cfi_flash_bank_size()
      which can be provided by the board code and weak-aliased to default
      implementation that returns value from the CONFIG_SYS_FLASH_BANKS_SIZES
      array if it's defined or 0 otherwise (the last case is added for
      compatibility).
      If non-zero flash bank size is provided and detected chip size is bigger
      than provided address window size the warning will be displayed and
      flash chip will be truncated.
      
      Signed-off-by: default avatarIlya Yanok <yanok@emcraft.com>
      
      Changed cfi_flash_bank_size() return type to unsigned long
      to match caller function.
      Signed-off-by: default avatarWolfgang Denk <wd@denx.de>
      ec50a8e3
  10. Oct 12, 2010
  11. Sep 20, 2010
    • Stefan Roese's avatar
      cfi_flash: Simplify dynamic flash bank number detection · ca5def3f
      Stefan Roese authored
      
      This patch simplifies the use of CONFIG_SYS_MAX_FLASH_BANKS_DETECT. By
      moving these optional variables and defines into the common code, board
      specific code is minimized. Currently only the following board use
      this feature:
      
      APC405, IDS8247, TQM834x
      
      And IDS8247 doesn't seem to really need this feature, since its not
      updating the bank number variable at all. So this patch removes the
      definition of CONFIG_SYS_MAX_FLASH_BANKS_DETECT from this board port.
      
      This new framework will be used by the upcoming lwmon5 update as well.
      
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      Acked-by: default avatarHeiko Schocher <hs@denx.de>
      Cc: Matthias Fuchs <matthias.fuchs@esd.eu>
      ca5def3f
    • Stefan Roese's avatar
      cfi_flash: Add weak default for cfi_flash_bank_addr() · b00e19cc
      Stefan Roese authored
      
      cfi_flash_bank_addr(int bank_nr) returns the base addresses of the
      requested bank. Introducing this weak default enables boards to override
      this functions with a board specific version when required.
      
      This feature will be used in the lwmon5 board update, supporting runtime
      detection of 2 board revisions with different flash layouts.
      
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      b00e19cc
    • Stefan Roese's avatar
      cfi_flash: Simplify flash_get_info() · cba34aaf
      Stefan Roese authored
      
      This patch removes an unecessary check in the return statement. This is
      not needed, since "info" is initializes to NULL. And "info" will not be
      written to again, if the flash address is not found.
      
      Additionally "info" is not initialized to "0" but to "NULL".
      
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      cba34aaf
  12. Aug 18, 2010
    • Philippe De Muyter's avatar
      Work around bug in Numonyx P33/P30 256-Mbit 65nm flash chips. · 54652991
      Philippe De Muyter authored
      
      I have "ported" U-boot to a in house made board with Numonyx Axcell P33/P30
      256-Mbit 65nm flash chips.
      
      After some time :( searching for bugs in our board or soft, we have
      discovered that those chips have a small but annoying bug, documented in
      "Numonyx Axcell P33/P30 256-Mbit Specification Update"
      
      It states :
      When customer uses [...] block unlock, the block lock status might be
      altered inadvertently. Lock status might be set to either 01h or 03h
      unexpectedly (00h as expected data), which leads to program/erase failure
      on certain blocks.
      
      A working workaround is given, which I have applied and tested with success :
      
      Workaround:  If the interval between 60h and its subsequent command
      	     can be guaranteed within 20us, Option I is recommended,
      	     otherwise Option II (involves hardware) should be selected.
      Option I: The table below lists the detail command sequences:
      Command
      	      Data bus           Address bus       Remarks
      Sequence
        1              90h            Block Address
      						   Read Lock Status
        2             Read         Block Address + 02h
       (2)(3)                                      (1)
      3                60h           Block Address
       (2)(3)                                      (1)   Lock/Unlock/RCR Configuration
      4           D0h/01h/03h        Block Address
      Notes:
      (1) Block Address refers to RCR configuration data only when the 60h
          command sequence is used to set RCR register combined with 03h
          subsequent command.
      (2) For the third and fourth command sequences, the Block Address must
          be the same.
      (3) The interval between 60h command and its subsequent D0h/01h/2Fh/03h
          commands should be less than 20us.
      
      And here is a log comparison of a simple (destructive) flash test without
      and with the workaround.
      
       diff without-numonyx-workaround.log with-numonyx-workaround.log
       -U-Boot 2010.06-00696-g22b002c-dirty (Aug 16 2010 - 15:07:47)
       +U-Boot 2010.06-00696-g22b002c-dirty (Aug 16 2010 - 15:25:19)
      
        CPU:   Freescale MCF5484
               CPU CLK 200 MHz BUS CLK 100 MHz
        Board: Macq Electronique ME2060
        I2C:   ready
        DRAM:  64 MiB
        FLASH: 32 MiB
        In:    serial
        Out:   serial
        Err:   serial
        Net:   FEC0, FEC1
        -> flinfo
      
        Bank # 1: CFI conformant FLASH (16 x 16)  Size: 32 MB in 259 Sectors
          Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x8922
          Erase timeout: 4096 ms, write timeout: 1 ms
          Buffer write timeout: 5 ms, buffer size: 1024 bytes
      
          Sector Start Addresses:
          FE000000 RO   FE008000 RO   FE010000 RO   FE018000 RO   FE020000 RO
          FE040000 RO   FE060000 RO   FE080000 RO   FE0A0000 RO   FE0C0000 RO
          ...
          FFF80000 RO   FFFA0000 RO   FFFC0000 RO   FFFE0000 RO
        -> protect off all
        Un-Protect Flash Bank # 1
        ................... done
        -> erase all
        Erase Flash Bank # 1
        ................... done
        -> cp.b 1000000 fe000000 2000000
       -Copy to Flash... Flash not Erased
       +Copy to Flash... done
        ->
      
      Signed-off-by: default avatarPhilippe De Muyter <phdm@macqel.be>
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      54652991
    • Stefan Roese's avatar
      cfi_flash: Cleanup flash_print_info() · 70084df7
      Stefan Roese authored
      
      This patch does the following:
      
      - Extract code to detect if sector is erased into function
        sector_erased().
      - Because of this, we don't have variable declarations inside the
        sector loop in flash_print_info()
      - Change "return" to "break" in the "if (ctrlc()) statement:
        This fixes a problem with the resulting output. Before this
        patch the output was:
      
        Sector Start Addresses:
        FC000000        FC020000        FC040000   =>
      
        With this patch it is now:
      
        Sector Start Addresses:
        FC000000        FC020000        FC040000
        =>
      
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      Cc: Kim Phillips <kim.phillips@freescale.com>
      Cc: Wolfgang Denk <wd@denx.de>
      70084df7
    • Philippe De Muyter's avatar
      Fix printing & reading of 16-bit CFI device identifiers · d77c7ac4
      Philippe De Muyter authored
      
      Fix reading and printing of CFI flashes 16-bit devices identifiers
      
      Nowadays CFI flashes have a 16-bit device identifier.  U-boot still
      print them and read them as if they were only 8-bit wide.  Fix that.
      Before:
        Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x1B
      After:
        Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x881B
      
      Signed-off-by: default avatarPhilippe De Muyter <phdm@macqel.be>
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      d77c7ac4
    • Kim Phillips's avatar
      cfi_flash: flinfo: allow user interrupt in flash print info fn · 2e97394a
      Kim Phillips authored
      
      flashes getting larger, users more impatient.
      
      Signed-off-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      2e97394a
  13. Aug 03, 2010
    • Wolfgang Denk's avatar
      Rename getenv_r() into getenv_f() · cdb74977
      Wolfgang Denk authored
      
      While running from flash, i. e. before relocation, we have only a
      limited C runtime environment without writable data segment. In this
      phase, some configurations (for example with environment in EEPROM)
      must not use the normal getenv(), but a special function.  This
      function had been called getenv_r(), with the idea that the "_r"
      suffix would mean the same as in the _r_eentrant versions of some of
      the C library functions (for example getdate vs. getdate_r, getgrent
      vs. getgrent_r, etc.).
      
      Unfortunately this was a misleading name, as in U-Boot the "_r"
      generally means "running from RAM", i. e. _after_ relocation.
      
      To avoid confusion, rename into getenv_f() [as "running from flash"]
      
      Signed-off-by: default avatarWolfgang Denk <wd@denx.de>
      Acked-by: default avatarDetlev Zundel <dzu@denx.de>
      cdb74977
  14. Apr 07, 2010
    • Thomas Chou's avatar
      cfi_flash: reset timer in flash status check · 22d6c8fa
      Thomas Chou authored
      
      This patch adds reset_timer() before the flash status check
      waiting loop.
      
      Since the timer is basically running asynchronous to the cfi
      code, it is possible to call get_timer(0), then only a few
      _SYSCLK_ cycles later an interrupt is generated. This causes
      timeout even though much less time has elapsed. So the timer
      period registers should be reset before get_timer(0) is
      called.
      
      There is similar usage in nand_base.c.
      
      Signed-off-by: default avatarThomas Chou <thomas@wytron.com.tw>
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      22d6c8fa
  15. Mar 26, 2010
    • Thomas Chou's avatar
      cfi flash: add status polling method for amd flash · e5720823
      Thomas Chou authored
      
      This patch adds status polling method to offer an alternative to
      data toggle method for amd flash chips.
      
      This patch is needed for nios2 cfi flash interface, where the bus
      controller performs 4 bytes read cycles for a single byte read
      instruction. The data toggle method can not detect chip busy
      status correctly. So we have to poll DQ7, which will be inverted
      when the chip is busy.
      
      This feature is enabled with the config def,
      CONFIG_SYS_CFI_FLASH_STATUS_POLL
      
      Signed-off-by: default avatarThomas Chou <thomas@wytron.com.tw>
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      e5720823
  16. Mar 25, 2010
  17. Mar 04, 2010
  18. Oct 28, 2009
    • Stefan Roese's avatar
      cfi: Add weak default function for flash_cmd_reset() · fa36ae79
      Stefan Roese authored
      
      Currently the CFI driver issues both AMD and Intel reset commands.
      This is because the driver doesn't know yet which chips are connected.
      This dual reset seems to cause problems with the M29W128G chips as
      reported by Richard Retanubun. This patch now introduces a weak default
      function for the CFI reset command, still with both resets. This can
      be overridden by a board specific version if necessary.
      
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      Cc: Richard Retanubun <RichardRetanubun@ruggedcom.com>
      fa36ae79
  19. Aug 26, 2009
  20. Aug 13, 2009
  21. Jul 13, 2009
    • Po-Yu Chuang's avatar
      issue write command to base for JEDEC flash · b4db4a76
      Po-Yu Chuang authored
      
      For JEDEC flash, we should issue word programming command relative to
      base address rather than sector base address. Original source makes
      SST Flash fails to program sectors which are not on the 0x10000 boundaries.
      
      e.g.
      SST39LF040 uses addr1=0x5555 and addr2=0x2AAA, however, each sector
      is 0x1000 bytes.
      
      Thus, if we issue command to "sector base (0x41000) + offset(0x5555)",
      it sends to 0x46555 and the chip fails to recognize that address.
      
      This patch is tested with SST39LF040.
      
      Signed-off-by: default avatarPo-Yu Chuang <ratbert@faraday-tech.com>
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      b4db4a76
  22. Jun 03, 2009
    • Wolfgang Denk's avatar
      Redundant Environment: protect full sector size · dfcd7f21
      Wolfgang Denk authored
      
      Several boards used different ways to specify the size of the
      protected area when enabling flash write protection for the sectors
      holding the environment variables: some used CONFIG_ENV_SIZE and
      CONFIG_ENV_SIZE_REDUND, some used CONFIG_ENV_SECT_SIZE, and some even
      a mix of both for the "normal" and the "redundant" areas.
      
      Normally, this makes no difference at all. However, things are
      different when you have to deal with boards that can come with
      different types of flash chips, which may have different sector
      sizes.
      
      Here we may have to chose CONFIG_ENV_SECT_SIZE such that it fits the
      biggest sector size, which may include several sectors on boards using
      the smaller sector flash types. In such a case, using CONFIG_ENV_SIZE
      or CONFIG_ENV_SIZE_REDUND to enable the protection may lead to the
      case that only the first of these sectors get protected, while the
      following ones aren't.
      
      This is no real problem, but it can be confusing for the user -
      especially on boards that use CONFIG_ENV_SECT_SIZE to protect the
      "normal" areas, while using CONFIG_ENV_SIZE_REDUND for the
      "redundant" area.
      
      To avoid such inconsistencies, I changed all sucn boards that I found
      to consistently use CONFIG_ENV_SECT_SIZE for protection. This should
      not cause any functional changes to the code.
      
      Signed-off-by: default avatarWolfgang Denk <wd@denx.de>
      Cc: Paul Ruhland
      Cc: Pantelis Antoniou <panto@intracom.gr>
      Cc: Stefan Roese <sr@denx.de>
      Cc: Gary Jennejohn <garyj@denx.de>
      Cc: Dave Ellis <DGE@sixnetio.com>
      Acked-by: default avatarStefan Roese <sr@denx.de>
      dfcd7f21
  23. Apr 04, 2009
  24. Mar 23, 2009
  25. Mar 19, 2009
  26. Feb 11, 2009
  27. Feb 05, 2009
    • Stefan Roese's avatar
      cfi_flash: Fix typo in cfi_flash.c · e1fb6d0d
      Stefan Roese authored
      
      Patch "flash/cfi_flash: Use virtual sector start address, not phys"
      introduced a small typo and compilation warning for systems with CFI
      legacy support (e.g. hcu4). This patch fixes it.
      
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      e1fb6d0d
    • Stefan Roese's avatar
      cfi_flash: Silence compilation warning · ec21d5cf
      Stefan Roese authored
      
      Patch "flash/cfi_flash: Use virtual sector start address, not phys"
      introduced a small compilation warning. This patch fixes it.
      
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      ec21d5cf
    • Becky Bruce's avatar
      flash/cfi_flash: Use virtual sector start address, not phys · 09ce9921
      Becky Bruce authored
      
      include/flash.h was commented to say that the address in
      flash_info->start was a physical address.  However, from u-boot's
      point of view, and looking at most flash code, it makes more
      sense for this to be a virtual address.  So I corrected the
      comment to indicate that this was a virtual address.
      
      The only flash driver that was actually treating the address
      as physical was the mtd/cfi_flash driver.  However, this code
      was using it inconsistently as it actually directly dereferenced
      the "start" element, while it used map_physmem to get a
      virtual address in other places.  I changed this driver so
      that the code which initializes the info->start field calls
      map_physmem to get a virtual address, eliminating the need for
      further map_physmem calls.  The code is now consistent.
      
      The *only* place a physical address should be used is when defining the
      flash banks list that is used to initialize the flash_info struct,
      usually found in the board config file.
      
      Signed-off-by: default avatarBecky Bruce <beckyb@kernel.crashing.org>
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      09ce9921
  28. Feb 04, 2009
  29. Jan 26, 2009
Loading