1. 11 3月, 2014 2 次提交
  2. 15 2月, 2014 1 次提交
    • B
      mtd: nand: fix off-by-one read retry mode counting · 28fa65e6
      Brian Norris 提交于
      A flash may support N read retry voltage threshold modes, numbered 0
      through N-1 (where mode 0 represents the initial state). However,
      nand_do_read_ops() tries to use mode 0 through N.
      
      This off-by-one error shows up, for instance, when using nanddump, and
      we have cycled through available modes:
      
          nand: setting READ RETRY mode 0
          nand: setting READ RETRY mode 1
          nand: setting READ RETRY mode 2
          nand: setting READ RETRY mode 3
          nand: setting READ RETRY mode 4
          nand: setting READ RETRY mode 5
          nand: setting READ RETRY mode 6
          nand: setting READ RETRY mode 7
          nand: setting READ RETRY mode 8
          libmtd: error!: cannot read 8192 bytes from mtd0 (eraseblock 20, offset 0)
                  error 22 (Invalid argument)
          nanddump: error!: mtd_read
      
      Tested on Micron MT29F64G08CBCBBH1, with 8 retry modes.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Acked-by: NHuang Shijie <b32955@freescale.com>
      28fa65e6
  3. 21 1月, 2014 1 次提交
  4. 15 1月, 2014 1 次提交
  5. 14 1月, 2014 3 次提交
    • B
      mtd: nand: support Micron READ RETRY · 8429bb39
      Brian Norris 提交于
      Micron provides READ RETRY support via the ONFI vendor-specific
      parameter block (to indicate how many read-retry modes are available)
      and the ONFI {GET,SET}_FEATURES commands with a vendor-specific feature
      address (to support reading/switching the current read-retry mode).
      
      The recommended sequence is as follows:
      
        1. Perform PAGE_READ operation
        2. If no ECC error, we are done
        3. Run SET_FEATURES with feature address 89h, mode 1
        4. Retry PAGE_READ operation
        5. If ECC error and there are remaining supported modes, increment the
           mode and return to step 3. Otherwise, this is a true ECC error.
        6. Run SET_FEATURES with feature address 89h, mode 0, to return to the
           default state.
      
      This patch implements the chip->setup_read_retry() callback for
      Micron and fills in the chip->read_retries.
      
      Tested on Micron MT29F32G08CBADA, which supports 8 read-retry modes.
      
      The Micron vendor-specific table was checked against the datasheets for
      the following Micron NAND:
      
      Needs retry   Cell-type    Part number          Vendor revision    Byte 180
      -----------   ---------    ----------------     ---------------    ------------
      No            SLC          MT29F16G08ABABA      1                  Reserved (0)
      No            MLC          MT29F32G08CBABA      1                  Reserved (0)
      No            SLC          MT29F1G08AACWP       1                  0
      Yes           MLC          MT29F32G08CBADA      1                  08h
      Yes           MLC          MT29F64G08CBABA      2                  08h
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Acked-by: NHuang Shijie <b32955@freescale.com>
      8429bb39
    • B
      mtd: nand: add generic READ RETRY support · ba84fb59
      Brian Norris 提交于
      Modern MLC (and even SLC?) NAND can experience a large number of
      bitflips (beyond the recommended correctability capacity) due to drifts
      in the voltage threshold (Vt). These bitflips can cause ECC errors to
      occur well within the expected lifetime of the flash. To account for
      this, some manufacturers provide a mechanism for shifting the Vt
      threshold after a corrupted read.
      
      The generic pattern seems to be that a particular flash has N read retry
      modes (where N = 0, traditionally), and after an ECC failure, the host
      should reconfigure the flash to use the next available mode, then retry
      the read operation. This process repeats until all bitfips can be
      corrected or until the host has tried all available retry modes.
      
      This patch adds the infrastructure support for a
      vendor-specific/flash-specific callback, used for setting the read-retry
      mode (i.e., voltage threshold).
      
      For now, this patch always returns the flash to mode 0 (the default
      mode) after a successful read-retry, according to the flowchart found in
      Micron's datasheets. This may need to change in the future if it is
      determined that eventually, mode 0 is insufficient for the majority of
      the flash cells (and so for performance reasons, we should leave the
      flash in mode 1, 2, etc.).
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Acked-by: NHuang Shijie <b32955@freescale.com>
      ba84fb59
    • B
      mtd: nand: localize ECC failures per page · b72f3dfb
      Brian Norris 提交于
      ECC failures can be tracked at the page level, not the do_read_ops level
      (i.e., a potentially multi-page transaction).
      
      This helps prepare for READ RETRY support.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Acked-by: NHuang Shijie <b32955@freescale.com>
      b72f3dfb
  6. 12 1月, 2014 1 次提交
  7. 04 1月, 2014 1 次提交
  8. 07 11月, 2013 2 次提交
    • H
      mtd: nand: use a local variable to simplify the nand_scan_tail · 97de79e0
      Huang Shijie 提交于
      There are too many "chip->ecc" in the nand_scan_tail() which makes the eyes
      sore.
      
      This patch uses a local variable "ecc" to replace the "chip->ecc" to
      make the code more graceful.
      
      Do the code change with "s/chip->ecc\./ecc->/g" in the nand_scan_tail,
      and also change some lines by hand.
      Signed-off-by: NHuang Shijie <b32955@freescale.com>
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      97de79e0
    • B
      mtd: nand: hack ONFI for non-power-of-2 dimensions · 4355b70c
      Brian Norris 提交于
      Some bright specification writers decided to write this in the ONFI spec
      (from ONFI 3.0, Section 3.1):
      
        "The number of blocks and number of pages per block is not required to
        be a power of two. In the case where one of these values is not a
        power of two, the corresponding address shall be rounded to an
        integral number of bits such that it addresses a range up to the
        subsequent power of two value. The host shall not access upper
        addresses in a range that is shown as not supported."
      
      This breaks every assumption MTD makes about NAND block/chip-size
      dimensions -- they *must* be a power of two!
      
      And of course, an enterprising manufacturer has made use of this lovely
      freedom. Exhibit A: Micron MT29F32G08CBADAWP
      
        "- Plane size: 2 planes x 1064 blocks per plane
         - Device size: 32Gb: 2128 blockss [sic]"
      
      This quickly hits a BUG() in nand_base.c, since the extra dimensions
      overflow so we think it's a second chip (on my single-chip setup):
      
          ONFI param page 0 valid
          ONFI flash detected
          NAND device: Manufacturer ID: 0x2c, Chip ID: 0x44 (Micron MT29F32G08CBADAWP), 4256MiB, page size: 8192, OOB size: 744
          ------------[ cut here ]------------
          kernel BUG at drivers/mtd/nand/nand_base.c:203!
          Internal error: Oops - BUG: 0 [#1] SMP ARM
          [... trim ...]
          [<c02cf3e4>] (nand_select_chip+0x18/0x2c) from [<c02d25c0>] (nand_do_read_ops+0x90/0x424)
          [<c02d25c0>] (nand_do_read_ops+0x90/0x424) from [<c02d2dd8>] (nand_read+0x54/0x78)
          [<c02d2dd8>] (nand_read+0x54/0x78) from [<c02ad2c8>] (mtd_read+0x84/0xbc)
          [<c02ad2c8>] (mtd_read+0x84/0xbc) from [<c02d4b28>] (scan_read.clone.4+0x4c/0x64)
          [<c02d4b28>] (scan_read.clone.4+0x4c/0x64) from [<c02d4c88>] (search_bbt+0x148/0x290)
          [<c02d4c88>] (search_bbt+0x148/0x290) from [<c02d4ea4>] (nand_scan_bbt+0xd4/0x5c0)
          [... trim ...]
          ---[ end trace 0c9363860d865ff2 ]---
      
      So to fix this, just truncate these dimensions down to the greatest
      power-of-2 dimension that is less than or equal to the specified
      dimension.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Cc: <stable@vger.kernel.org>
      4355b70c
  9. 28 10月, 2013 8 次提交
  10. 27 9月, 2013 1 次提交
  11. 31 8月, 2013 8 次提交
  12. 30 8月, 2013 2 次提交
  13. 06 8月, 2013 4 次提交
  14. 05 4月, 2013 5 次提交