1. 23 Sep, 2016 1 commit
  2. 25 Jul, 2016 2 commits
    • Hector Palacios's avatar
      mtd: nand: fix bug writing 1 byte less than page size · ebb7febc
      Hector Palacios authored
      
      
      nand_do_write_ops() determines if it is writing a partial page with the
      formula:
      	part_pagewr = (column || writelen < (mtd->writesize - 1))
      
      When 'writelen' is exactly 1 byte less than the NAND page size the formula
      equates to zero, so the code doesn't process it as a partial write, although
      it should.
      As a consequence the function remains in the while(1) loop with 'writelen'
      becoming 0xffffffff and iterating until the watchdog timeout triggers.
      
      To reproduce the issue on a NAND with 2K page (0x800):
      	=> nand erase.part <partition>
      	=> nand write $loadaddr <partition> 7ff
      Signed-off-by: default avatarHector Palacios <hector.palacios@digi.com>
      ebb7febc
    • Brian Norris's avatar
      mtd: nand: add common DT init code · 42bd19ce
      Brian Norris authored
      
      
      These are already-documented common bindings for NAND chips. Let's
      handle them in nand_base.
      
      If NAND controller drivers need to act on this data before bringing up
      the NAND chip (e.g., fill out ECC callback functions, change HW modes,
      etc.), then they can do so between calling nand_scan_ident() and
      nand_scan_tail().
      
      The original commit has been slightly reworked to use the fdtdec_xxx()
      helpers (instead of the of_xxxx() ones).
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
      Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
      42bd19ce
  3. 24 Jun, 2016 1 commit
  4. 04 Jun, 2016 3 commits
  5. 26 Aug, 2015 3 commits
  6. 31 Mar, 2015 1 commit
  7. 23 Jan, 2015 1 commit
  8. 09 Jan, 2015 3 commits
    • Masahiro Yamada's avatar
      mtd: nand: do not scan BBT after scrub · ab37b76d
      Masahiro Yamada authored
      
      
      Currently, "nand scrub" runs chip->scan_bbt at the end of
      nand_erase_opts() even if NAND_SKIP_BBTSCAN flag is set.
      
      It violates the intention of NAND_SKIP_BBTSCAN.
      
      Move NAND_SKIP_BBTSCAN flag check to nand_block_checkbad() so that
      chip->scan_bbt() is never run if NAND_SKIP_BBTSCAN is set.
      
      Also, unset NAND_BBT_SCANNED flag instead of running chip->scan_bbt()
      right after scrub.  We can be lazier here because the BBT is scanned
      at the next call of nand_block_checkbad().
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      Cc: Scott Wood <scottwood@freescale.com>
      ab37b76d
    • Masahiro Yamada's avatar
      mtd: nand: Mark the BBT as scanned prior to calling scan_bbt again · bf80ee6e
      Masahiro Yamada authored
      Commit 35c204d8 (nand: reinstate lazy bad block scanning)
      broke NAND_BBT_USE_FLASH feature.
      
      Its git-log claimed that it reinstated the change as by commit
      fb49454b ("nand: reinstate lazy bad block scanning"), but it moved
      "chip->options |= NAND_BBT_SCANNED" below "chip->scan_bbt(mtd);".
      
      It causes recursion if scan_bbt does not find a flash based BBT
      and tries to write one, and the attempt to erase the BBT area
      causes a bad block check.
      
      Reinstate commit ff49ea89
      
       (NAND: Mark the BBT as scanned prior to
      calling scan_bbt.).
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      Cc: Rostislav Lisovy <lisovy@merica.cz>
      Cc: Heiko Schocher <hs@denx.de>
      Cc: Scott Wood <scottwood@freescale.com>
      bf80ee6e
    • Masahiro Yamada's avatar
      mtd: nand: revive "nand scrub" command · 756963d7
      Masahiro Yamada authored
      Since commit ff94bc40
      
       (mtd, ubi, ubifs: resync with Linux-3.14),
      the "nand scrub" command has not been working.
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      Cc: Scott Wood <scottwood@freescale.com>
      Cc: Heiko Schocher <hs@denx.de>
      756963d7
  9. 27 Nov, 2014 1 commit
  10. 25 Sep, 2014 1 commit
    • Stefan Roese's avatar
      mtd: nand: Fix length bug in ioread16_rep() and iowrite16_rep() · be16aba5
      Stefan Roese authored
      
      
      The ioread16_rep() and iowrite16_rep() implementations are U-Boot specific
      and have been introduced with the Linux MTD v3.14 sync. While introducing
      these functions, the length for the loop has been miscalculated. The ">> 1"
      is already present in the caller. So lets remove it in the function.
      
      Tested on omap3_ha.
      Signed-off-by: Stefan Roese's avatarStefan Roese <sr@denx.de>
      Cc: Heiko Schocher <hs@denx.de>
      Cc: Tom Rini <trini@ti.com>
      Cc: Scott Wood <scottwood@freescale.com>
      Acked-by: Heiko Schocher's avatarHeiko Schocher <hs@denx.de>
      be16aba5
  11. 16 Sep, 2014 1 commit
  12. 25 Aug, 2014 2 commits
    • Heiko Schocher's avatar
      mtd,ubi,ubifs: sync with linux v3.15 · 4e67c571
      Heiko Schocher authored
      
      
      snyc with linux v3.15:
      
      commit 1860e379875dfe7271c649058aeddffe5afd9d0d
      Author: Linus Torvalds <torvalds@linux-foundation.org>
      Date:   Sun Jun 8 11:19:54 2014 -0700
      
          Linux 3.15
      Signed-off-by: Heiko Schocher's avatarHeiko Schocher <hs@denx.de>
      Cc: Scott Wood <scottwood@freescale.com>
      Cc: Tom Rini <trini@ti.com>
      4e67c571
    • Heiko Schocher's avatar
      mtd, ubi, ubifs: resync with Linux-3.14 · ff94bc40
      Heiko Schocher authored
      
      
      resync ubi subsystem with linux:
      
      commit 455c6fdbd219161bd09b1165f11699d6d73de11c
      Author: Linus Torvalds <torvalds@linux-foundation.org>
      Date:   Sun Mar 30 20:40:15 2014 -0700
      
          Linux 3.14
      
      A nice side effect of this, is we introduce UBI Fastmap support
      to U-Boot.
      Signed-off-by: Heiko Schocher's avatarHeiko Schocher <hs@denx.de>
      Signed-off-by: default avatarTom Rini <trini@ti.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Sergey Lapin <slapin@ossfans.org>
      Cc: Scott Wood <scottwood@freescale.com>
      Cc: Joerg Krause <jkrause@posteo.de>
      ff94bc40
  13. 06 Jun, 2014 2 commits
    • Brian Norris's avatar
      mtd: nand: force NAND_CMD_READID onto 8-bit bus · 27ce9e42
      Brian Norris authored
      
      
      As per following Sections in ONFI Spec, NAND_CMD_READID should use only
      lower 8-bit for transfering command, address and data even on x16 NAND device.
      
      *Section: Target Initialization"
      "The Read ID and Read Parameter Page commands only use the lower 8-bits of the
       data bus. The host shall not issue commands that use a word data width on x16
       devices until the host determines the device supports a 16-bit data bus width
       in the parameter page."
      
      *Section: Bus Width Requirements*
      "When the host supports a 16-bit bus width, only data is transferred at the
       16-bit width. All address and command line transfers shall use only the lower
       8-bits of the data bus. During command transfers, the host may place any value
       on the upper 8-bits of the data bus. During address transfers, the host shall
       set the upper 8-bits of the data bus to 00h."
      
      Thus porting  following commit from linux-kernel to ensure that column address
      is not altered to align to x16 bus when issuing NAND_CMD_READID command.
      
          commit 3dad2344e92c6e1aeae42df1c4824f307c51bcc7
          mtd: nand: force NAND_CMD_READID onto 8-bit bus
          Author: Brian Norris <computersforpeace@gmail.com> (preserving authorship)
      
          The NAND command helpers tend to automatically shift the column address
          for x16 bus devices, since most commands expect a word address, not a
          byte address. The Read ID command, however, expects an 8-bit address
          (i.e., 0x00, 0x20, or 0x40 should not be translated to 0x00, 0x10, or
          0x20).
      
          This fixes the column address for a few drivers which imitate the
          nand_base defaults.
      Signed-off-by: default avatarPekon Gupta <pekon@ti.com>
      27ce9e42
    • Brian Norris's avatar
      mtd: nand: don't use read_buf for 8-bit ONFI transfers · b9ae609f
      Brian Norris authored
      
      
      Porting below commit from linux-tree, preserving original authorship & commit log
      commit bd9c6e99b58255b9de1982711ac9487c9a2f18be
      Author:     Brian Norris <computersforpeace@gmail.com>
      mtd: nand: don't use read_buf for 8-bit ONFI transfers
      
        Use a repeated read_byte() instead of read_buf(), since for x16 buswidth
        devices, we need to avoid the upper I/O[16:9] bits. See the following
        commit for reference:
      
        commit 05f7835975dad6b3b517f9e23415985e648fb875 (from linux-tree)
        Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
        Date:   Thu Dec 5 22:22:04 2013 +0100
      
            mtd: nand: don't use {read,write}_buf for 8-bit transfers
      
        Now, I think that all barriers to probing ONFI on x16 devices are
        removed, so remove the check from nand_flash_detect_onfi().
      Signed-off-by: default avatarPekon Gupta <pekon@ti.com>
      b9ae609f
  14. 14 Oct, 2013 1 commit
  15. 09 Oct, 2013 1 commit
    • Paul Burton's avatar
      mtd: driver _read() returns max_bitflips; mtd_read() returns -EUCLEAN · 40462e54
      Paul Burton authored
      
      
      Linux modified the MTD driver interface in commit edbc4540 (with the
      same name as this commit). The effect is that calls to mtd_read will
      not return -EUCLEAN if the number of ECC-corrected bit errors is below
      a certain threshold, which defaults to the strength of the ECC. This
      allows -EUCLEAN to stop indicating "some bits were corrected" and begin
      indicating "a large number of bits were corrected, the data held in
      this region of flash may be lost soon". UBI makes use of this and when
      -EUCLEAN is returned from mtd_read it will move data to another block
      of flash. Without adopting this interface change UBI on U-boot attempts
      to move data between blocks every time a single bit is corrected using
      the ECC, which is a very common occurance on some devices.
      
      For some devices where bit errors are common enough, UBI can get stuck
      constantly moving data around because each block it attempts to use has
      a single bit error. This condition is hit when wear_leveling_worker
      attempts to move data from one PEB to another in response to an
      -EUCLEAN/UBI_IO_BITFLIPS error. When this happens ubi_eba_copy_leb is
      called to perform the data copy, and after the data is written it is
      read back to check its validity. If that read returns UBI_IO_BITFLIPS
      (in response to an MTD -EUCLEAN) then ubi_eba_copy_leb returns 1 to
      wear_leveling worker, which then proceeds to schedule the destination
      PEB for erasure. This leads to erase_worker running on the PEB, and
      following a successful erase wear_leveling_worker is called which
      begins this whole cycle all over again. The end result is that (without
      UBI debug output enabled) the boot appears to simply hang whilst in
      reality U-boot busily works away at destroying a block of the NAND
      flash. Debug output from this situation:
      
        UBI DBG: ensure_wear_leveling: schedule scrubbing
        UBI DBG: wear_leveling_worker: scrub PEB 1027 to PEB 4083
        UBI DBG: ubi_io_read_vid_hdr: read VID header from PEB 1027
        UBI DBG: ubi_io_read: read 4096 bytes from PEB 1027:4096
        UBI DBG: ubi_eba_copy_leb: copy LEB 0:0, PEB 1027 to PEB 4083
        UBI DBG: ubi_eba_copy_leb: read 1040384 bytes of data
        UBI DBG: ubi_io_read: read 1040384 bytes from PEB 1027:8192
        UBI: fixable bit-flip detected at PEB 1027
        UBI DBG: ubi_io_write_vid_hdr: write VID header to PEB 4083
        UBI DBG: ubi_io_write: write 4096 bytes to PEB 4083:4096
        UBI DBG: ubi_io_read_vid_hdr: read VID header from PEB 4083
        UBI DBG: ubi_io_read: read 4096 bytes from PEB 4083:4096
        UBI DBG: ubi_io_write: write 4096 bytes to PEB 4083:8192
        UBI DBG: ubi_io_read: read 4096 bytes from PEB 4083:8192
        UBI: fixable bit-flip detected at PEB 4083
        UBI DBG: schedule_erase: schedule erasure of PEB 4083, EC 55, torture 0
        UBI DBG: erase_worker: erase PEB 4083 EC 55
        UBI DBG: sync_erase: erase PEB 4083, old EC 55
        UBI DBG: do_sync_erase: erase PEB 4083
        UBI DBG: sync_erase: erased PEB 4083, new EC 56
        UBI DBG: ubi_io_write_ec_hdr: write EC header to PEB 4083
        UBI DBG: ubi_io_write: write 4096 bytes to PEB 4083:0
        UBI DBG: ensure_wear_leveling: schedule scrubbing
        UBI DBG: wear_leveling_worker: scrub PEB 1027 to PEB 4083
        ...
      
      This patch adopts the interface change as in Linux commit edbc4540 in
      order to avoid such situations. Given that none of the drivers under
      drivers/mtd return -EUCLEAN, this should only affect those using
      software ECC. I have tested that it works on a board which is
      currently out of tree, but which I hope to be able to begin
      upstreaming soon.
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Acked-by: Stefan Roese's avatarStefan Roese <sr@denx.de>
      40462e54
  16. 31 May, 2013 1 commit
    • Sergey Lapin's avatar
      mtd: resync with Linux-3.7.1 · dfe64e2c
      Sergey Lapin authored
      
      
      This patch is essentially an update of u-boot MTD subsystem to
      the state of Linux-3.7.1 with exclusion of some bits:
      
      - the update is concentrated on NAND, no onenand or CFI/NOR/SPI
      flashes interfaces are updated EXCEPT for API changes.
      
      - new large NAND chips support is there, though some updates
      have got in Linux-3.8.-rc1, (which will follow on top of this patch).
      
      To produce this update I used tag v3.7.1 of linux-stable repository.
      
      The update was made using application of relevant patches,
      with changes relevant to U-Boot-only stuff sticked together
      to keep bisectability. Then all changes were grouped together
      to this patch.
      Signed-off-by: default avatarSergey Lapin <slapin@ossfans.org>
      [scottwood@freescale.com: some eccstrength and build fixes]
      Signed-off-by: default avatarScott Wood <scottwood@freescale.com>
      dfe64e2c
  17. 22 May, 2013 1 commit
  18. 26 Nov, 2012 1 commit
  19. 04 Nov, 2012 1 commit
  20. 17 Sep, 2012 2 commits
    • Marek Vasut's avatar
      mtd: nand: allow NAND_NO_SUBPAGE_WRITE to be set from driver · 9c790a74
      Marek Vasut authored
      
      
      This is based on Linux kernel -next:
      
      commit 14f44abf1dafc20ba42ce8616a8fc8fbd1b3712b
      Author: Brian Norris <computersforpeace@gmail.com>
      Date:   Fri Jul 13 09:28:24 2012 -0700
      
          mtd: nand: allow NAND_NO_SUBPAGE_WRITE to be set from driver
      
          The NAND_CHIPOPTIONS_MSK has limited utility and is causing real bugs. It
          silently masks off at least one flag that might be set by the driver
          (NAND_NO_SUBPAGE_WRITE). This breaks the GPMI NAND driver and possibly
          others.
      
          Really, as long as driver writers exercise a small amount of care with
          NAND_* options, this mask is not necessary at all; it was only here to
          prevent certain options from accidentally being set by the driver. But the
          original thought turns out to be a bad idea occasionally. Thus, kill it.
      
          Note, this patch fixes some major gpmi-nand breakage.
      Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Cc: Eric Nelson <eric.nelson@boundarydevices.com>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Otavio Salvador <otavio@ossystems.com.br>
      Cc: Scott Wood <scottwood@freescale.com>
      Signed-off-by: default avatarScott Wood <scottwood@freescale.com>
      9c790a74
    • Matthieu CASTET's avatar
      mtd: support ONFI multi lun NAND · d62e9caa
      Matthieu CASTET authored
      
      
      With onfi a flash is organized into one or more logical units (LUNs).
      A logical unit (LUN) is the minimum unit that can independently execute
      commands and report status.
      
      Mtd does not exploit LUN, so make it see a big single flash where size is
      lun_size * number_of_lun.
      
      Without this patch MT29F8G08ADBDAH4 size is 512MiB instead of 1GiB.
      
      Artem: split long line on 2 shorter ones.
      
      This is commit 637957551c0ac80de8dfc7650d320c5a98c2c0c0 from Linux
      Signed-off-by: default avatarMatthieu Castet <matthieu.castet@parrot.com>
      Acked-by: default avatarFlorian Fainelli <ffainelli@freebox.fr>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      [scottwood@freescale.com: picked from Linux into U-Boot]
      Reported-by: default avatarRafael Beims <rafael.beims@gmail.com>
      Signed-off-by: default avatarScott Wood <scottwood@freescale.com>
      d62e9caa
  21. 07 Sep, 2012 1 commit
  22. 18 May, 2012 1 commit
  23. 30 Apr, 2012 1 commit
  24. 28 Feb, 2012 2 commits
  25. 26 Jan, 2012 5 commits