1. 30 Aug, 2013 27 commits
  2. 05 Aug, 2013 13 commits
    • Josh Wu's avatar
      mtd: ofpart: add compatible check for child nodes · e79265ba
      Josh Wu authored
      In case that the nand device will support some features like Nand Flash
      Controller, we want to make the sub feature as a sub node of nand device.
      
      Use such organization it is easy to enable/disable feature, also it is back
      compatible and more readable.
      
      If the sub-node has a compatible property then it is a driver not partition.
      Signed-off-by: default avatarJosh Wu <josh.wu@atmel.com>
      Acked-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Acked-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      [ added a missing newline -Brian ]
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      e79265ba
    • Josh Wu's avatar
      mtd: atmel_nand: enable Nand Flash Controller (NFC) write via sram · 6054d4d5
      Josh Wu authored
      This patch enable writing nand flash via NFC SRAM. It will minimize the CPU
      overhead. The SRAM write only support ECC_NONE and ECC_HW with PMECC.
      
      To enable this NFC write by SRAM feature, you can add a string in dts under
      NFC driver node.
      
      This driver has been tested on SAMA5D3X-EK with JFFS2, YAFFS2, UBIFS and
      mtd-utils.
      
      Here is part of mtd_speedtest (writing test) result, compare with non-NFC
      writing, it reduces %65 cpu load with loss %12 speed.
      
      - commands use to test:
        # insmod /mnt/mtd_speedtest.ko dev=2 &
        # top -n 30 -d 1 | grep speedtest
      
      - test result:
      =================================================
      mtd_speedtest: MTD device: 2
      mtd_speedtest: MTD device size 41943040, eraseblock size 131072, page size 2048, count of eraseblocks 320, pages per eraseblock 64, OOB size 64
      mtd_speedtest: testing eraseblock write speed
        509   495 root     D     1164   0%   7% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%   8% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     R     1164   0%   5% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: eraseblock write speed is 5194 KiB/s
      mtd_speedtest: testing page write speed
        509   495 root     D     1164   0%  32% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  27% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  25% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  30% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: page write speed is 5024 KiB/s
      Signed-off-by: default avatarJosh Wu <josh.wu@atmel.com>
      Acked-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      6054d4d5
    • Josh Wu's avatar
      mtd: atmel_nand: enable Nand Flash Controller (NFC) read data via sram · 1ae9c092
      Josh Wu authored
      NFC has embedded sram which can use to transfer data. This patch enable reading
      nand flash via NFC SRAM. It will minimize the CPU overhead.
      
      This driver has been tested on SAMA5D3X-EK with JFFS2, YAFFS2, UBIFS and
      mtd-utils.
      
      Here puts the part of mtd_speedtest (read test) result as following:
      Compare with non-NFC mtd_speedtest result, reading will reduce %45 cpu load
      with increase %80 speed.
      
      - commands use to test:
        # insmod /mnt/mtd_speedtest.ko dev=2 &
        # top -n 30 -d 1 | grep speedtest
      
      - test result:
      =================================================
      mtd_speedtest: MTD device: 2
      mtd_speedtest: MTD device size 41943040, eraseblock size 131072, page size 2048, count of eraseblocks 320, pages per eraseblock 64, OOB size 64
      mtd_speedtest: testing eraseblock read speed
        509   495 root     D     1164   0%  28% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  25% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  26% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: eraseblock read speed is 9403 KiB/s
      mtd_speedtest: testing page read speed
        509   495 root     R     1164   0%  31% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  57% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  53% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  71% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: page read speed is 9258 KiB/s
      Signed-off-by: default avatarJosh Wu <josh.wu@atmel.com>
      Acked-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      1ae9c092
    • Josh Wu's avatar
      mtd: atmel_nand: add Nand Flash Controller (NFC) support · 7dc37de7
      Josh Wu authored
      Nand Flash Controller (NFC) can handle automatic transfers, sending the
      commands and address cycles to the NAND Flash.
      
      To use NFC in this driver, user needs to add NFC child node in nand flash
      driver. The NFC child node includes NFC's compatible string and regiters
      of the address and size of NFC command registers, NFC registers (embedded
      in HSMC) and NFC SRAM.
      Also user need to set up the HSMC irq, which use to check whether nfc
      command is finish or not.
      
      This driver has been tested on SAMA5D3X-EK board with JFFS2, YAFFS,
      UBIFS and mtd-utils.
      
      I put the part of the mtd_speedtest result here for your information.
      >From the mtd_speedtest, we can see the NFC will reduce the %50 of cpu load
      when writing nand flash. No change when reading.
      In the meantime, the speed will be slow about %8.
      
      - commands use to test:
          #insmod /mnt/mtd_speedtest.ko dev=2 &
          #top -n 30 -d 1 | grep speedtest
      
      - test result:
      
      Before the patch:
      =================================================
      mtd_speedtest: MTD device: 2
      mtd_speedtest: MTD device size 41943040, eraseblock size 131072, page size 2048, count of eraseblocks 320, pages per eraseblock 64, OOB size 64
        515   495 root     R     1164   0%  93% insmod /mnt/mtd_speedtest.ko dev=2
        515   495 root     R     1164   0%  98% insmod /mnt/mtd_speedtest.ko dev=2
        515   495 root     R     1164   0%  99% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: eraseblock write speed is 5768 KiB/s
      mtd_speedtest: testing eraseblock read speed
        515   495 root     R     1164   0%  92% insmod /mnt/mtd_speedtest.ko dev=2
        515   495 root     R     1164   0%  91% insmod /mnt/mtd_speedtest.ko dev=2
        515   495 root     R     1164   0%  94% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: eraseblock read speed is 5932 KiB/s
      mtd_speedtest: testing page write speed
        515   495 root     R     1164   0%  94% insmod /mnt/mtd_speedtest.ko dev=2
        515   495 root     R     1164   0%  98% insmod /mnt/mtd_speedtest.ko dev=2
        515   495 root     R     1164   0%  98% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: page write speed is 5770 KiB/s
      mtd_speedtest: testing page read speed
        515   495 root     R     1164   0%  91% insmod /mnt/mtd_speedtest.ko dev=2
        515   495 root     R     1164   0%  89% insmod /mnt/mtd_speedtest.ko dev=2
        515   495 root     R     1164   0%  91% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: page read speed is 5910 KiB/s
      
      After the patch:
      =================================================
      mtd_speedtest: MTD device: 2
      mtd_speedtest: MTD device size 41943040, eraseblock size 131072, page size 2048, count of eraseblocks 320, pages per eraseblock 64, OOB size 64
      mtd_speedtest: testing eraseblock write speed
        509   495 root     D     1164   0%  49% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  50% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  47% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: eraseblock write speed is 5370 KiB/s
      mtd_speedtest: testing eraseblock read speed
        509   495 root     R     1164   0%  92% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     R     1164   0%  91% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     R     1164   0%  95% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: eraseblock read speed is 5715 KiB/s
      mtd_speedtest: testing page write speed
        509   495 root     D     1164   0%  48% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  47% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     D     1164   0%  50% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: page write speed is 5224 KiB/s
      mtd_speedtest: testing page read speed
        509   495 root     R     1164   0%  89% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     R     1164   0%  94% insmod /mnt/mtd_speedtest.ko dev=2
        509   495 root     R     1164   0%  93% insmod /mnt/mtd_speedtest.ko dev=2
      mtd_speedtest: page read speed is 5641 KiB/s
      Signed-off-by: default avatarJosh Wu <josh.wu@atmel.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      7dc37de7
    • Josh Wu's avatar
    • Jean-Christophe PLAGNIOL-VILLARD's avatar
      mtd: atmel_nand: use devm_xxx gpio kzalloc, gpio and ioremap · 0d63748d
      Jean-Christophe PLAGNIOL-VILLARD authored
      this will allow to simply the error and remove path
      
      Cc: linux-mtd@lists.infradead.org
      Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
      [josh.wu@atmel.com: fix checkpatch warnings and rebase to latest mtd git tree]
      [josh.wu@atmel.com: replace devm_request_and_ioremap with devm_ioremap_resource]
      Signed-off-by: default avatarJosh Wu <josh.wu@atmel.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      0d63748d
    • Akinobu Mita's avatar
      mtd: nandsim: remove unused ns->geom.oobshift · 2f3b07a7
      Akinobu Mita authored
      ns->geom.oobshift holds bits number in OOB size, but OOB size is not
      always power of two.  So it is useless and it actually isn't used in
      this driver except for just printing the value at module loading.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      2f3b07a7
    • Akinobu Mita's avatar
      mtd: nandsim: remove unused code · 8e716a8b
      Akinobu Mita authored
      Remove the leftover from commit 831d316b
      ("mtd: nandsim: remove autoincrement code").
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      8e716a8b
    • Akinobu Mita's avatar
      mtd: nandsim: use NS_RAW_OFFSET() · 6d07fcf7
      Akinobu Mita authored
      Use NS_RAW_OFFSET() to calculate the page offset in flash RAM image by
      (row, column) address.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      6d07fcf7
    • Akinobu Mita's avatar
      mtd: nandsim: simplify NS_RAW_OFFSET() · 3b8b8fa1
      Akinobu Mita authored
      Simplify the definision of NS_RAW_OFFSET() by using (ns)->geom.pgszoob
      which holds the sum of page size and OOB size.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      3b8b8fa1
    • Akinobu Mita's avatar
      mtd: nandsim: use kasprintf() · f03a5729
      Akinobu Mita authored
      Use kasprintf() which combines kmalloc and sprintf.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      f03a5729
    • Akinobu Mita's avatar
      mtd: nandsim: convert pages_written[] to bitmap · 08efe91a
      Akinobu Mita authored
      nandsim.pages_written[] is the array of unsigned char which is indexed
      by the page number and used for identifying which pages have been written
      when cache_file is used.  Each entry holds 0 (not written) or 1 (written),
      so it can be converted to bitmap.  This reduces the allocation size of
      pages_written[] by 1/8.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      08efe91a
    • Brian Norris's avatar
      mtd: nand: detect OOB size for Toshiba 24nm raw SLC · 60c67382
      Brian Norris authored
      Toshiba NAND datasheets have not been very forthcoming on OOB size
      information; they do not provide any bitfields in the ID string for
      spare area. In their 24nm technology flash, however, Toshiba migrated
      their NAND to have 32 bytes spare per 512 bytes of page area (up from
      the traditional 16 bytes), as they now require 8-bit ECC or higher.
      
      I have discussed this issue directly with Toshiba representatives, and
      they acknowledge this problem. They recommend detecting these flash
      based on their technology node as follows:
      
        For 24nm Toshiba SLC raw NAND (not BENAND -- Built-in Ecc NAND), there
        are 32 bytes of spare area for every 512 bytes of in-band data area.
      
      We can implement this rule with the following snippet of a device ID
      decode table, which applies to all their 43nm, 32nm, and 24nm SLC NAND
      (this table is not fully in the NAND datasheets, but it was provided
      directly by Toshiba representatives):
      
        - ID byte 5, bit[7]:
                1    -> BENAND
                0    -> raw SLC
      
        - ID byte 6, bits[2:0]:
                100b -> 43nm
                101b -> 32nm
                110b -> 24nm
                111b -> Reserved
      
      I'm also working with Toshiba on including this bitfield description for
      their 5th and 6th ID bytes in their public data sheets.
      
      I will provide the 8-byte ID strings from the two 24nm Toshiba samples I
      have; their first 6 bytes match the documentation I received from
      Toshiba:
      
        24nm SLC 1Gbit TC58NVG0S3HTA00
        0x98 0xf1 0x80 0x15 0x72 0x16 0x08 0x00
      
        24nm SLC 2Gbit TC58NVG1S3HTA00
        0x98 0xda 0x90 0x15 0x76 0x16 0x08 0x00
      
      I have also tested for regressions with:
      
        43nm SLC 4Gbit TC58NVG2S3ETA00
        0x98 0xdc 0x90 0x15 0x76 0x14 0x03 0x10
      
        32nm SLC 8Gbit TC58NVG3SOFA00
        0x98 0xd3 0x90 0x26 0x76 0x15 0x02 0x08
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      60c67382