1. 11 9月, 2011 8 次提交
    • T
      mtd: nand_base: always initialise oob_poi before writing OOB data · f722013e
      THOMSON, Adam (Adam) 提交于
      In nand_do_write_ops() code it is possible for a caller to provide
      ops.oobbuf populated and ops.mode == MTD_OOB_AUTO, which currently
      means that the chip->oob_poi buffer isn't initialised to all 0xFF.
      The nand_fill_oob() method then carries out the task of copying
      the provided OOB data to oob_poi, but with MTD_OOB_AUTO it skips
      areas marked as unavailable by the layout struct, including the
      bad block marker bytes.
      
      An example of this causing issues is when the last OOB data read
      was from the start of a bad block where the markers are not 0xFF,
      and the caller wishes to write new OOB data at the beginning of
      another block. In this scenario the caller would provide OOB data,
      but nand_fill_oob() would skip the bad block marker bytes in
      oob_poi before copying the OOB data provided by the caller.
      This means that when the OOB data is written back to NAND,
      the block is inadvertently marked as bad without the caller knowing.
      This has been witnessed when using YAFFS2 where tags are stored
      in the OOB.
      
      To avoid this oob_poi is always initialised to 0xFF to make sure
      no left over data is inadvertently written back to the OOB area.
      
      Credits to Brian Norris <computersforpeace@gmail.com> for fixing this
      patch.
      Signed-off-by: NAdam Thomson <adam.thomson@alcatel-lucent.com>
      Signed-off-by: NArtem Bityutskiy <dedekind1@gmail.com>
      Cc: stable@kernel.org [2.6.20+]
      f722013e
    • B
      mtd: nand: multi-line comment style fixups · 8b6e50c9
      Brian Norris 提交于
      Artem: while on it, do other commentaries clean-ups:
      1. Start one-line comments with capital letter and no dot at the end
      2. Turn sparse multi-line comments into one-line comments
      3. Change "phrase ?" to "phrase?" and the same with "!".
      4. Remove tabs from the kerneldoc parameters comments - they are mixed
         with tabs often, and inconsistent.
      5. Put dot at the end of descriptions in kerneldoc comments.
      6. Some other small commentaries clean-ups
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      8b6e50c9
    • B
      mtd: nand: remove unnecessary TODO · 5507766b
      Brian Norris 提交于
      I believe this TODO was unnecessary back when it was introduced:
      	commit d1e1f4e4
      	mtd: nand: add support for reading ONFI parameters...
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      5507766b
    • J
      mtd: nand: remove meaningless delay from nand_unlock · d3f2ed52
      Jiri Pinkava 提交于
      This delay is meaningless. If delay is needed it is device specific
      and must be reimplemented by specific driver, otherwise no delay is
      needed.
      Signed-off-by: NJiri Pinkava <jiri.pinkava@vscht.cz>
      Acked-by: NVimal Singh <vimal.newwork@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      d3f2ed52
    • B
      mtd: nand: rename NAND_USE_FLASH_BBT · bb9ebd4e
      Brian Norris 提交于
      Recall the recently added prefix requirements:
       * "NAND_" for flags in nand.h, used in nand_chip.options
       * "NAND_BBT_" for flags in bbm.h, used in nand_chip.bbt_options
              or in nand_bbt_descr.options
      
      Thus, I am changing NAND_USE_FLASH_BBT to NAND_BBT_USE_FLASH.
      
      Again, this flag is found in bbm.h and so should NOT be used in the
      "nand_chip.options" field.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      bb9ebd4e
    • B
      mtd: nand: consolidate redundant flash-based BBT flags · a40f7341
      Brian Norris 提交于
      This patch works with the following three flags from two headers (nand.h
      and bbm.h):
        (1) NAND_USE_FLASH_BBT (nand.h)
        (2) NAND_USE_FLASH_BBT_NO_OOB (nand.h)
        (3) NAND_BBT_NO_OOB (bbm.h)
      
      These flags are all related and interdependent, yet they were in
      different headers. Flag (2) is simply the combination of (1) and (3) and
      can be eliminated.
      
      This patch accomplishes the following:
        * eliminate NAND_USE_FLASH_BBT_NO_OOB (i.e., flag (2))
        * move NAND_USE_FLASH_BBT (i.e., flag (1)) to bbm.h
      
      It's important to note that because (1) and (3) are now both found in
      bbm.h, they should NOT be used in the "nand_chip.options" field.
      
      I removed a small section from the mtdnand DocBook because it referes to
      NAND_USE_FLASH_BBT in nand.h, which has been moved to bbm.h.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      a40f7341
    • B
      mtd: nand: separate chip options / bbt_options · 5fb1549d
      Brian Norris 提交于
      This patch handles the problems we've been having with using conflicting
      flags from nand.h and bbm.h in the same nand_chip.options field. We
      should try to separate these two spaces a little more clearly, and so I
      have added a bbt_options field to nand_chip.
      
      Important notes about nand_chip fields:
      * bbt_options field should contain ONLY flags from bbm.h. They should be
        able to pass safely to a nand_bbt_descr data structure.
          - BBT option flags start with the "NAND_BBT_" prefix.
      * options field should contian ONLY flags from nand.h. Ideally, they
        should not be involved in any BBT related options.
          - NAND chip option flags start with the "NAND_" prefix.
      * Every flag should have a nice comment explaining what the flag is. While
        this is not yet the case on all existing flags, please be sure to write
        one for new flags. Even better, you can help document the code better
        yourself!
      
      Please try to follow these conventions to make everyone's lives easier.
      
      Among the flags that are being moved to the new bbt_options field
      throughout various drivers, etc. are:
       * NAND_BBT_SCANLASTPAGE
       * NAND_BBT_SCAN2NDPAGE
      and there will be more to come.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      5fb1549d
    • B
      mtd: nand: remove NAND_BBT_SCANBYTE1AND6 option · a0dc5529
      Brian Norris 提交于
      This patch reverts most of:
          commit 58373ff0
          mtd: nand: more BB Detection refactoring and dynamic scan options
      
      According to the discussion at:
          http://lists.infradead.org/pipermail/linux-mtd/2011-May/035696.html
      the NAND_BBT_SCANBYTE1AND6 flag, although technically valid, can break
      some existing ECC layouts that use the 6th byte in the OOB for ECC data.
      Furthermore, we apparently do not need to scan both bytes 1 and 6 in
      the OOB region of the devices under consideration; instead, we only need
      to scan one or the other.
      
      Thus, the NAND_BBT_SCANBYTE1AND6 flag is at best unnecessary and at
      worst a regression.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      a0dc5529
  2. 25 5月, 2011 3 次提交
  3. 31 3月, 2011 1 次提交
  4. 12 3月, 2011 1 次提交
    • I
      mtd: nand: add software BCH ECC support · 193bd400
      Ivan Djelic 提交于
      This patch adds software BCH ECC support to mtd, in order to handle recent
      NAND device ecc requirements (4 bits or more).
      
      It does so by adding a new ecc mode (NAND_ECC_SOFT_BCH) for use by board
      drivers, and a new Kconfig option to enable BCH support. It relies on the
      generic BCH library introduced in a previous patch.
      
      When a board driver uses mode NAND_ECC_SOFT_BCH, it should also set fields
      chip->ecc.size and chip->ecc.bytes to select BCH ecc data size and required
      error correction capability. See nand_bch_init() documentation for details.
      
      It has been tested on the following platforms using mtd-utils, UBI and
      UBIFS: x86 (with nandsim), arm926ejs.
      Signed-off-by: NIvan Djelic <ivan.djelic@parrot.com>
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      193bd400
  5. 11 3月, 2011 1 次提交
  6. 06 1月, 2011 4 次提交
  7. 04 12月, 2010 2 次提交
  8. 02 11月, 2010 1 次提交
  9. 25 10月, 2010 11 次提交
  10. 21 8月, 2010 1 次提交
  11. 19 8月, 2010 1 次提交
  12. 11 8月, 2010 2 次提交
    • R
      mtd/nand_base: fix kernel-doc warnings & typos · b6d676db
      Randy Dunlap 提交于
      Fix mtd/nand_base.c kernel-doc warnings and typos.
      
      Warning(drivers/mtd/nand/nand_base.c:893): No description found for parameter 'mtd'
      Warning(drivers/mtd/nand/nand_base.c:893): No description found for parameter 'ofs'
      Warning(drivers/mtd/nand/nand_base.c:893): No description found for parameter 'len'
      Warning(drivers/mtd/nand/nand_base.c:893): No description found for parameter 'invert'
      Warning(drivers/mtd/nand/nand_base.c:930): No description found for parameter 'mtd'
      Warning(drivers/mtd/nand/nand_base.c:930): No description found for parameter 'ofs'
      Warning(drivers/mtd/nand/nand_base.c:930): No description found for parameter 'len'
      Warning(drivers/mtd/nand/nand_base.c:987): No description found for parameter 'mtd'
      Warning(drivers/mtd/nand/nand_base.c:987): No description found for parameter 'ofs'
      Warning(drivers/mtd/nand/nand_base.c:987): No description found for parameter 'len'
      Warning(drivers/mtd/nand/nand_base.c:2087): No description found for parameter 'len'
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b6d676db
    • R
      mtd/nand_base: fix kernel-doc warnings & typos · db9ebb7c
      Randy Dunlap 提交于
      Fix mtd/nand_base.c kernel-doc warnings and typos.
      
      Warning(drivers/mtd/nand/nand_base.c:893): No description found for parameter 'mtd'
      Warning(drivers/mtd/nand/nand_base.c:893): No description found for parameter 'ofs'
      Warning(drivers/mtd/nand/nand_base.c:893): No description found for parameter 'len'
      Warning(drivers/mtd/nand/nand_base.c:893): No description found for parameter 'invert'
      Warning(drivers/mtd/nand/nand_base.c:930): No description found for parameter 'mtd'
      Warning(drivers/mtd/nand/nand_base.c:930): No description found for parameter 'ofs'
      Warning(drivers/mtd/nand/nand_base.c:930): No description found for parameter 'len'
      Warning(drivers/mtd/nand/nand_base.c:987): No description found for parameter 'mtd'
      Warning(drivers/mtd/nand/nand_base.c:987): No description found for parameter 'ofs'
      Warning(drivers/mtd/nand/nand_base.c:987): No description found for parameter 'len'
      Warning(drivers/mtd/nand/nand_base.c:2087): No description found for parameter 'len'
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      db9ebb7c
  13. 09 8月, 2010 1 次提交
  14. 02 8月, 2010 3 次提交
    • B
      mtd: nand: update nand_default_block_markbad() · 02ed70bb
      Brian Norris 提交于
      This is an update that depends on the previous patches I sent.
      
      We can now write to all the appropriate BB marker locations (i.e.
      pages 1 AND 2, bytes 1 AND 6) with nand_default_block_markbad() if
      necessary, according to the flags marked in chip->options.
      
      Note that I removed the line:
      	ofs += mtd->oobsize;
      Unless I am wrong, this line was completely unnecessary in the
      first place.
      Signed-off-by: NBrian Norris <norris@broadcom.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      02ed70bb
    • B
      mtd: nand: more BB Detection refactoring and dynamic scan options · 58373ff0
      Brian Norris 提交于
      This is a revision to PATCH 2/2 that I sent. Link:
      http://lists.infradead.org/pipermail/linux-mtd/2010-July/030911.html
      
      Added new flag for scanning of both bytes 1 and 6 of the OOB for
      a BB marker (instead of simply one or the other).
      
      The "check_pattern" and "check_short_pattern" functions were updated
      to include support for scanning the two different locations in the OOB.
      
      In order to handle increases in variety of necessary scanning patterns,
      I implemented dynamic memory allocation of nand_bbt_descr structs
      in new function 'nand_create_default_bbt_descr()'. This replaces
      some increasingly-unwieldy, statically-declared descriptors. It can
      replace several more (e.g. "flashbased" structs). However, I do not
      test the flashbased options personally.
      
      How this was tested:
      
      I referenced 30+ data sheets (covering 100+ parts), and I tested a
      selection of 10 different chips to varying degrees. Particularly, I
      tested the creation of bad-block descriptors and basic BB scanning on
      three parts:
      
      ST NAND04GW3B2D, 2K page
      ST NAND128W3A, 512B page
      Samsung K9F1G08U0A, 2K page
      
      To test these, I wrote some fake bad block markers to the flash (in OOB
      bytes 1, 6, and elsewhere) to see if the scanning routine would detect
      them properly. However, this method was somewhat limited because the
      driver I am using has some bugs in its OOB write functionality.
      Signed-off-by: NBrian Norris <norris@broadcom.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      58373ff0
    • B
      mtd: nand: refactor BB marker detection · c7b28e25
      Brian Norris 提交于
      Some level of support for various scanning locations was already built in,
      but this required clean-up. First, BB marker location cannot be determined
      _only_ by the page size. Instead, I implemented some heuristic detection
      based on data sheets from various manufacturers (all found in
      nand_base.c:nand_get_flash_type()).
      
      Second, once these options were identified, they were not handled properly
      by nand_bbt.c:nand_default_bbt(). I updated the static nand_bbt_desc structs
      to reflect the need for more combinations of detection. The memory allocation
      here probably needs to be done dynamically in the very near future (see next
      patches).
      Signed-off-by: NBrian Norris <norris@broadcom.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      c7b28e25