1. 27 3月, 2012 1 次提交
    • A
      mtd: add leading underscore to all mtd functions · 3c3c10bb
      Artem Bityutskiy 提交于
      This patch renames all MTD functions by adding a "_" prefix:
      
      mtd->erase -> mtd->_erase
      mtd->read_oob -> mtd->_read_oob
      ...
      
      The reason is that we are re-working the MTD API and from now on it is
      an error to use MTD function pointers directly - we have a corresponding
      API call for every pointer. By adding a leading "_" we achieve the following:
      
      1. Make sure we convert every direct pointer users
      2. A leading "_" suggests that this interface is internal and it becomes
         less likely that people will use them directly
      3. Make sure all the out-of-tree modules stop compiling and the owners
         spot the big API change and amend them.
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      3c3c10bb
  2. 10 1月, 2012 31 次提交
  3. 02 11月, 2011 1 次提交
  4. 21 9月, 2011 1 次提交
  5. 11 9月, 2011 6 次提交
    • 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