06 Dec, 2018

2 commits


03 Oct, 2018

1 commit

  • Instead of collecting partitions in a flat list, create a hierarchy
    within the mtd_info structure: use a partitions list to keep track of
    the partitions of an MTD device (which might be itself a partition of
    another MTD device), a pointer to the parent device (NULL when the MTD
    device is the root one, not a partition).

    By also saving directly in mtd_info the offset of the partition, we
    can get rid of the mtd_part structure.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Stefan Roese
    Reviewed-by: Boris Brezillon

    Miquel Raynal
     

20 Sep, 2018

4 commits

  • Some MTD sublayers/drivers are implementing ->_read/write() and
    not ->_read/write_oob().

    While for NAND devices both are usually valid, for NOR devices, using
    the _oob variant has no real meaning. But, as the MTD layer is supposed
    to hide as much as possible the flash complexity to the user, there is
    no reason to error out while it is just a matter of rewritting things
    internally.

    Add a fallback on mtd->_read() (resp. mtd->_write()) when the user calls
    mtd_read_oob() (resp. mtd_write_oob()) while mtd->_read_oob() (resp.
    mtd->_write_oob) is not implemented. There is already a fallback on the
    _oob variant if the former is used.

    Signed-off-by: Miquel Raynal
    Reviewed-by: Boris Brezillon

    Miquel Raynal
     
  • Unlike what's done in mtd_read/write(), there are no checks to make sure
    the parameters passed to mtd_read/write_oob() are consistent, which
    forces implementers of ->_read/write_oob() to do it, which in turn leads
    to code duplication and possibly errors in the logic.

    Do general sanity checks, like ops fields consistency and range checking.

    Signed-off-by: Boris Brezillon
    Cc: Peter Pan
    Signed-off-by: Richard Weinberger
    [Miquel: squashed the fix about the chip's size check]
    Signed-off-by: Miquel Raynal

    Boris Brezillon
     
  • There's no reason for having mtd_write_oob inlined in mtd.h header.
    Move it to mtdcore.c where it belongs.

    Signed-off-by: Ezequiel Garcia
    Acked-by: Boris Brezillon
    Signed-off-by: Jacek Anaszewski
    Signed-off-by: Miquel Raynal

    Ezequiel Garcia
     
  • Some MTD sublayers/drivers are implementing ->_read/write_oob() and
    provide dummy wrappers for their ->_read/write() implementations.
    Let the core handle this case instead of duplicating the logic.

    Signed-off-by: Boris Brezillon
    Acked-by: Robert Jarzmik
    Acked-by: Brian Norris
    Reviewed-by: Miquel Raynal
    Tested-by: Ladislav Michl
    Signed-off-by: Miquel Raynal
    Reviewed-by: Jagan Teki

    Boris Brezillon
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

28 Nov, 2017

1 commit

  • In order to make the ecclayout definition completely dynamic we need to
    rework the way the OOB layout are defined and iterated.

    Create a few mtd_ooblayout_xxx() helpers to ease OOB bytes manipulation
    and hide ecclayout internals to their users.

    Signed-off-by: Boris Brezillon
    [Linux commit: 75eb2cec251fda33c9bb716ecc372819abb9278a]
    [masahiro:
    cherry-pick more code from adbbc3bc827eb1f43a932d783f09ba55c8ec8379]
    Signed-off-by: Masahiro Yamada

    Boris Brezillon
     

06 Nov, 2015

1 commit


26 Aug, 2015

1 commit

  • In addition to mtd_block_isbad(), which checks if a block is bad or
    reserved, it's needed to check if a block is reserved only (but not
    bad). This commit adds an MTD interface for it, in a similar fashion to
    mtd_block_isbad().

    While here, fix mtd_block_isbad() so the out-of-bounds checking is done
    before the callback check.

    Signed-off-by: Ezequiel Garcia
    Tested-by: Pekon Gupta
    Signed-off-by: Brian Norris
    [scottwood: Cherry-picked from Linux 8471bb73ba10ed67]
    Signed-off-by: Scott Wood

    Ezequiel Garcia
     

17 Sep, 2014

2 commits


26 Aug, 2014

3 commits

  • snyc with linux v3.15:

    commit 1860e379875dfe7271c649058aeddffe5afd9d0d
    Author: Linus Torvalds
    Date: Sun Jun 8 11:19:54 2014 -0700

    Linux 3.15

    Signed-off-by: Heiko Schocher
    Cc: Scott Wood
    Cc: Tom Rini

    Heiko Schocher
     
  • while playing with the new mtd/ubi/ubifs sync, found some
    small updates for it:

    - add del_mtd_partition() to include/linux/mtd/mtd
    - mtd: add a debug_printf
    - remove some not used functions

    Signed-off-by: Heiko Schocher
    Cc: Scott Wood
    Cc: Tom Rini

    Heiko Schocher
     
  • resync ubi subsystem with linux:

    commit 455c6fdbd219161bd09b1165f11699d6d73de11c
    Author: Linus Torvalds
    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
    Signed-off-by: Tom Rini
    Cc: Marek Vasut
    Cc: Sergey Lapin
    Cc: Scott Wood
    Cc: Joerg Krause

    Heiko Schocher
     

15 Oct, 2013

1 commit


10 Oct, 2013

1 commit

  • 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: Paul Burton
    Acked-by: Stefan Roese

    Paul Burton
     

01 Jun, 2013

1 commit

  • 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: Sergey Lapin
    [scottwood@freescale.com: some eccstrength and build fixes]
    Signed-off-by: Scott Wood

    Sergey Lapin
     

30 Apr, 2012

1 commit


12 Oct, 2010

2 commits

  • Consolidate some code in mtd_get_len_incl_bad(), and fix a condition
    where a valid partition could be reported as truncated if it has a
    good block at the end of the device (unlikely, since the BBT is usually
    there).

    Fix mid-block declarations in net_part_size().

    Signed-off-by: Scott Wood
    Reviewed-by: Ben Gardiner

    Scott Wood
     
  • The logic to 'spread' mtd partitions needs to calculate the length in
    the mtd device, including bad blocks.

    This patch introduces a new function, mtd_get_len_incl_bad that can
    return both the length including bad blocks and whether that length
    was truncated on the device. This new function will be used by the
    mtdparts spread command later in this series. The definition of the
    function is #ifdef'd out in configurations that do not use the new
    'mtdparts spread' command.

    Signed-off-by: Ben Gardiner
    CC: Scott Wood

    Ben Gardiner
     

24 Nov, 2008

1 commit


20 Nov, 2008

1 commit