1. 10 1月, 2012 29 次提交
  2. 02 11月, 2011 1 次提交
  3. 21 9月, 2011 1 次提交
  4. 11 9月, 2011 9 次提交
    • B
      mtd: kill old field for `struct mtd_info_user' · 19fb4341
      Brian Norris 提交于
      The ecctype and eccsize fields have been obsolete for a while. Since they
      don't have any users, we can kill them and leave padding in their place
      for now.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@intel.com>
      19fb4341
    • B
      mtd: add MEMWRITE ioctl · e99d8b08
      Brian Norris 提交于
      Implement a new ioctl for writing both page data and OOB to flash at the
      same time. This ioctl is intended to be a generic interface that can
      replace other ioctls (MEMWRITEOOB and MEMWRITEOOB64) and cover the
      functionality of several other old ones, e.g., MEMWRITE can:
      
      * write autoplaced OOB instead of using ECCGETLAYOUT (deprecated) and
        working around the reserved areas
      * write raw (no ECC) OOB instead of using MTDFILEMODE to set the
        per-file-descriptor MTD_FILE_MODE_RAW
      * write raw (no ECC) data instead of using MTDFILEMODE
        (MTD_FILE_MODE_RAW) and using standard character device "write"
      
      This ioctl is especially useful for MLC NAND, which cannot be written
      twice (i.e., we cannot successfully write the page data and OOB in two
      separate operations). Instead, MEMWRITE can write both in a single
      operation.
      
      Note that this ioctl is not affected by the MTD file mode (i.e.,
      MTD_FILE_MODE_RAW vs. MTD_FILE_MODE_NORMAL), since it receives its write
      mode as an input parameter.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@intel.com>
      e99d8b08
    • B
      mtd: rename MTD_MODE_* to MTD_FILE_MODE_* · beb133fc
      Brian Norris 提交于
      These modes hold their state only for the life of their file descriptor,
      and they overlap functionality with the MTD_OPS_* modes. Particularly,
      MTD_MODE_RAW and MTD_OPS_RAW cover the same function: to provide raw
      (i.e., without ECC) access to the flash. In fact, although it may not be
      clear, MTD_MODE_RAW implied that operations should enable the
      MTD_OPS_RAW mode.
      
      Thus, we should be specific on what each mode means. This is a start,
      where MTD_FILE_MODE_* actually represents a "file mode," not necessarily
      a true global MTD mode.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@intel.com>
      beb133fc
    • B
      mtd: rename MTD_OOB_* to MTD_OPS_* · 0612b9dd
      Brian Norris 提交于
      These modes are not necessarily for OOB only. Particularly, MTD_OOB_RAW
      affected operations on in-band page data as well. To clarify these
      options and to emphasize that their effect is applied per-operation, we
      change the primary prefix to MTD_OPS_.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@intel.com>
      0612b9dd
    • B
      mtd: support reading OOB without ECC · c46f6483
      Brian Norris 提交于
      This fixes issues with `nanddump -n' and the MEMREADOOB[64] ioctls on
      hardware that performs error correction when reading only OOB data. A
      driver for such hardware needs to know when we're doing a RAW vs. a
      normal write, but mtd_do_read_oob does not pass such information to the
      lower layers (e.g., NAND). We should pass MTD_OOB_RAW or MTD_OOB_PLACE
      based on the MTD file mode.
      
      For now, most drivers can get away with just setting:
      
        chip->ecc.read_oob_raw = chip->ecc.read_oob
      
      This is done by default; but for systems that behave as described above,
      you must supply your own replacement function.
      
      This was tested with nandsim as well as on actual SLC NAND.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Cc: Jim Quinlan <jim2101024@gmail.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@intel.com>
      c46f6483
    • B
      mtd: support writing OOB without ECC · 9ce244b3
      Brian Norris 提交于
      This fixes issues with `nandwrite -n -o' and the MEMWRITEOOB[64] ioctls
      on hardware that writes ECC when writing OOB. The problem arises as
      follows: `nandwrite -n' can write page data to flash without applying
      ECC, but when used with the `-o' option, ECC is applied (incorrectly),
      contrary to the `--noecc' option.
      
      I found that this is the case because my hardware computes and writes
      ECC data to flash upon either OOB write or page write. Thus, to support
      a proper "no ECC" write, my driver must know when we're performing a raw
      OOB write vs. a normal ECC OOB write. However, MTD does not pass any raw
      mode information to the write_oob functions.  This patch addresses the
      problems by:
      
      1) Passing MTD_OOB_RAW down to lower layers, instead of just defaulting
         to MTD_OOB_PLACE
      2) Handling MTD_OOB_RAW within the NAND layer's `nand_do_write_oob'
      3) Adding a new (replaceable) function pointer in struct ecc_ctrl; this
         function should support writing OOB without ECC data. Current
         hardware often can use the same OOB write function when writing
         either with or without ECC
      
      This was tested with nandsim as well as on actual SLC NAND.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Cc: Jim Quinlan <jim2101024@gmail.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@intel.com>
      9ce244b3
    • B
      mtd: do not assume oobsize is power of 2 · 305b93f1
      Brian Norris 提交于
      Previous generations of MTDs all used OOB sizes that were powers of 2,
      (e.g., 64, 128). However, newer generations of flash, especially NAND,
      use irregular OOB sizes that are not powers of 2 (e.g., 218, 224, 448).
      This means we cannot use masks like "mtd->oobsize - 1" to assume that we
      will get a proper bitmask for OOB operations.
      
      These masks are really only intended to hide the "page" portion of the
      offset, leaving any OOB offset intact, so a masking with the writesize
      (which *is* always a power of 2) is valid and makes more sense.
      
      This has been tested for read/write of NAND devices (nanddump/nandwrite)
      using nandsim and actual NAND flash.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@intel.com>
      305b93f1
    • B
      mtd: spelling fixes · 92394b5c
      Brian Norris 提交于
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@intel.com>
      92394b5c
    • B
      mtd: replace DEBUG() with pr_debug() · 289c0522
      Brian Norris 提交于
      Start moving away from the MTD_DEBUG_LEVEL messages. The dynamic
      debugging feature is a generic kernel feature that provides more
      flexibility.
      
      (See Documentation/dynamic-debug-howto.txt)
      
      Also fix some punctuation, indentation, and capitalization that went
      along with the affected lines.
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@intel.com>
      289c0522