| #
301f8dd1 |
| 03-Feb-2020 |
Simon Glass <sjg@chromium.org> |
UPSTREAM: mtd: Rename free() to rfree()
This function name conflicts with our desire to #define free() to something else on sandbox. Since it deals with resources, rename it to rfree().
Change-Id:
UPSTREAM: mtd: Rename free() to rfree()
This function name conflicts with our desire to #define free() to something else on sandbox. Since it deals with resources, rename it to rfree().
Change-Id: I2718843dd4646b7450c36e84cc16e6440c718959 Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit 8d38a8459b0de45f5ff41f3e11c278a5cf395fd0)
show more ...
|
| #
584c2880 |
| 18-Nov-2018 |
Miquel Raynal <miquel.raynal@bootlin.com> |
UPSTREAM: mtd: fix Coverity integer handling issue
A Coverity robot reported an integer handling issue (OVERFLOW_BEFORE_WIDEN) in the potentially overflowing expression:
(mtd_div_by_ws(mtd->siz
UPSTREAM: mtd: fix Coverity integer handling issue
A Coverity robot reported an integer handling issue (OVERFLOW_BEFORE_WIDEN) in the potentially overflowing expression:
(mtd_div_by_ws(mtd->size, mtd) - mtd_div_by_ws(offs, mtd)) * mtd_oobavail(mtd, ops)
While such overflow will certainly never happen due to the numbers handled, it is cleaner to fix this operation anyway.
The problem is that all the maths include 32-bit quantities, while the result is stored in an explicit 64-bit value.
As maxooblen will just be compared with a size_t, let's change the type of the variable to a size_t. This will not fix anything but will clarify a bit the situation. Then, do an explicit cast to fix Coverity warning.
Addresses-Coverity-ID: 184180 ("Integer handling issues") Change-Id: Iab6b48d8709a7dcb70eebeb33088e866ee17dadf Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit 3f3aef4b9dc88278f31567fe6f26095fd9477b1a)
show more ...
|
| #
002d1762 |
| 02-Dec-2018 |
Boris Brezillon <boris.brezillon@bootlin.com> |
UPSTREAM: mtd: Delete partitions attached to the device when a device is deleted
If we don't do that, partitions might still be exposed while the underlying device is gone.
Fixes: 2a74930da57f ("mt
UPSTREAM: mtd: Delete partitions attached to the device when a device is deleted
If we don't do that, partitions might still be exposed while the underlying device is gone.
Fixes: 2a74930da57f ("mtd: mtdpart: implement proper partition handling") Change-Id: Ibf4a89f2caab24e6fdfb9c2dbd42fc4114b4bbe6 Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Tested-by: Heiko Schocher <hs@denx.de> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit a02820fca90ce9ccf243b3fce59c04dabd5671a8)
show more ...
|
| #
90108c6c |
| 02-Dec-2018 |
Boris Brezillon <boris.brezillon@bootlin.com> |
UPSTREAM: mtd: Add a function to report when the MTD dev list has been updated
We need to parse mtdparts/mtids again everytime a device has been added/removed from the MTD list, but there's currentl
UPSTREAM: mtd: Add a function to report when the MTD dev list has been updated
We need to parse mtdparts/mtids again everytime a device has been added/removed from the MTD list, but there's currently no way to know when such an update has been done.
Add an ->updated field to the idr struct that we set to true every time a device is added/removed and expose a function returning the value of this field and resetting it to false.
Change-Id: If7edb8fde01051087b43eb16683aca6b991daace Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Tested-by: Heiko Schocher <hs@denx.de> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit 4c47fd0b6bce62162e11b8a22e2eaf0d8f6673b1)
show more ...
|
| #
c7314be4 |
| 29-Sep-2018 |
Miquel Raynal <miquel.raynal@bootlin.com> |
UPSTREAM: mtd: mtdpart: implement proper partition handling
Instead of collecting partitions in a flat list, create a hierarchy within the mtd_info structure: use a partitions list to keep track of
UPSTREAM: mtd: mtdpart: implement proper partition handling
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 <miquel.raynal@bootlin.com> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com> Change-Id: I87c81be7b75c7d71db5dce2fb4b0cfb1ec1a0fe2 Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit 2a74930da57f6fbe3c24509f1d481f435acd2356)
show more ...
|
| #
fd9fa580 |
| 16-Aug-2018 |
Miquel Raynal <miquel.raynal@bootlin.com> |
UPSTREAM: mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing
Some MTD sublayers/drivers are implementing ->_read/write() and not ->_read/write_oob().
While for NAND devices both a
UPSTREAM: mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing
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.
Change-Id: Ic8f4749900a2034cfaa103effcdace78242bcbe7 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit ca040d8512f4d93a7eb83f7b8fec8f4b8b1d3192)
show more ...
|
| #
300aab2a |
| 16-Aug-2018 |
Boris Brezillon <boris.brezillon@free-electrons.com> |
UPSTREAM: mtd: Add sanity checks in mtd_write/read_oob()
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
UPSTREAM: mtd: Add sanity checks in mtd_write/read_oob()
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.
Change-Id: Ibe2de07dfd3d7504d615b1c22cdcb34c79eca63e Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Cc: Peter Pan <peterpandong@micron.com> Signed-off-by: Richard Weinberger <richard@nod.at> [Miquel: squashed the fix about the chip's size check] Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit 8fad769f1eab88a2bcf0b714694158968f58715a)
show more ...
|
| #
86db6a45 |
| 16-Aug-2018 |
Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> |
UPSTREAM: mtd: Uninline mtd_write_oob and move it to mtdcore.c
There's no reason for having mtd_write_oob inlined in mtd.h header. Move it to mtdcore.c where it belongs.
Change-Id: I1e06b1519126891
UPSTREAM: mtd: Uninline mtd_write_oob and move it to mtdcore.c
There's no reason for having mtd_write_oob inlined in mtd.h header. Move it to mtdcore.c where it belongs.
Change-Id: I1e06b151912689171ff9c66f95cba13f256d27a1 Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit 5f50d82d8918b711717b4bbd96c6f348eb6e2a2c)
show more ...
|
| #
042673ef |
| 16-Aug-2018 |
Boris Brezillon <boris.brezillon@free-electrons.com> |
UPSTREAM: mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing
Some MTD sublayers/drivers are implementing ->_read/write_oob() and provide dummy wrappers for their ->_read/write() im
UPSTREAM: mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing
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.
Change-Id: I7276effeba2885da48ab4834e272c51a258588dd Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Acked-by: Brian Norris <computersforpeace@gmail.com> Reviewed-by: Miquel Raynal <miquel.raynal@free-electrons.com> Tested-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jagan Teki <jagan@openedev.com> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit 596cf083da34c2007f8ec760c8b077f6f28ee655)
show more ...
|
| #
c44c4cce |
| 21-Nov-2017 |
Boris Brezillon <boris.brezillon@free-electrons.com> |
UPSTREAM: mtd: add mtd_ooblayout_xxx() helper functions
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
UPSTREAM: mtd: add mtd_ooblayout_xxx() helper functions
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.
Change-Id: I6248b25d56d8ac9074bfb8e76140a78f0803a433 Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> [Linux commit: 75eb2cec251fda33c9bb716ecc372819abb9278a] [masahiro: cherry-pick more code from adbbc3bc827eb1f43a932d783f09ba55c8ec8379] Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit 13f3b04f61aa6a0ec61bf01bb404f21c10b48bd0)
show more ...
|
| #
5f5620ab |
| 12-Nov-2015 |
Stefano Babic <sbabic@denx.de> |
Merge git://git.denx.de/u-boot
|
| #
f8fdb81f |
| 05-Nov-2015 |
Fabio Estevam <fabio.estevam@freescale.com> |
compat: Remove is_power_of_2() definition
Use the is_power_of_2() definition from log2.h to align with the kernel implementation.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed
compat: Remove is_power_of_2() definition
Use the is_power_of_2() definition from log2.h to align with the kernel implementation.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Jagan Teki <jteki@openedev.com>
show more ...
|
| #
ad608a21 |
| 26-Aug-2015 |
Tom Rini <trini@konsulko.com> |
Merge git://git.denx.de/u-boot-nand-flash
|
| #
86a720aa |
| 21-May-2014 |
Ezequiel Garcia <ezequiel.garcia@free-electrons.com> |
mtd: Introduce mtd_block_isreserved()
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 a
mtd: Introduce mtd_block_isreserved()
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 <ezequiel.garcia@free-electrons.com> Tested-by: Pekon Gupta <pekon@ti.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> [scottwood: Cherry-picked from Linux 8471bb73ba10ed67] Signed-off-by: Scott Wood <scottwood@freescale.com>
show more ...
|
| #
3cc83f9d |
| 07-Oct-2014 |
Minkyu Kang <mk7.kang@samsung.com> |
Merge branch 'uboot'
|
| #
42817eb8 |
| 22-Sep-2014 |
Stefano Babic <sbabic@denx.de> |
Merge branch 'master' of git://git.denx.de/u-boot-arm
|
| #
5da163d6 |
| 08-Sep-2014 |
maxin.john@enea.com <maxin.john@enea.com> |
mtdcore: Fix a build error with CONFIG_CMD_MTDPARTS_SPREAD
This patch fixes the build error for CONFIG_CMD_MTDPARTS_SPREAD
Signed-off-by: Maxin B. John <maxin.john@enea.com>
|
| #
3b612970 |
| 31-Aug-2014 |
Masahiro Yamada <yamada.m@jp.panasonic.com> |
kbuild: force to define __UBOOT__ in all the C sources
U-Boot has imported various source files from other projects, mostly Linux.
Something like
#ifdef __UBOOT__ [ modification for U-Boot ]
kbuild: force to define __UBOOT__ in all the C sources
U-Boot has imported various source files from other projects, mostly Linux.
Something like
#ifdef __UBOOT__ [ modification for U-Boot ] #else [ original code ] #endif
is an often used strategy for clarification of adjusted parts, that is, easier re-sync in future.
Instead of defining __UBOOT__ in each source file, passing it from the top Makefile would be easier.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Heiko Schocher <hs@denx.de>
show more ...
|
| #
4e67c571 |
| 15-Jul-2014 |
Heiko Schocher <hs@denx.de> |
mtd,ubi,ubifs: sync with linux v3.15
snyc with linux v3.15:
commit 1860e379875dfe7271c649058aeddffe5afd9d0d Author: Linus Torvalds <torvalds@linux-foundation.org> Date: Sun Jun 8 11:19:54 2014 -0
mtd,ubi,ubifs: sync with linux v3.15
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 <hs@denx.de> Cc: Scott Wood <scottwood@freescale.com> Cc: Tom Rini <trini@ti.com>
show more ...
|
| #
ddf7bcfa |
| 15-Jul-2014 |
Heiko Schocher <hs@denx.de> |
mtd, ubi, ubifs: update for the sync with linux v3.14
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
mtd, ubi, ubifs: update for the sync with linux v3.14
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 <hs@denx.de> Cc: Scott Wood <scottwood@freescale.com> Cc: Tom Rini <trini@ti.com>
show more ...
|
| #
ff94bc40 |
| 24-Jun-2014 |
Heiko Schocher <hs@denx.de> |
mtd, ubi, ubifs: resync with Linux-3.14
resync ubi subsystem with linux:
commit 455c6fdbd219161bd09b1165f11699d6d73de11c Author: Linus Torvalds <torvalds@linux-foundation.org> Date: Sun Mar 30 20
mtd, ubi, ubifs: resync with Linux-3.14
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 <hs@denx.de> Signed-off-by: Tom 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>
show more ...
|
| #
d4c8aa9c |
| 04-Oct-2013 |
Wolfgang Denk <wd@denx.de> |
Coding Style cleanup: remove trailing empty lines
Signed-off-by: Wolfgang Denk <wd@denx.de>
|
| #
bff4fae4 |
| 14-Oct-2013 |
Tom Rini <trini@ti.com> |
Merge branch 'master' of git://git.denx.de/u-boot-nand-flash
|
| #
40462e54 |
| 04-Sep-2013 |
Paul Burton <paul.burton@imgtec.com> |
mtd: driver _read() returns max_bitflips; mtd_read() returns -EUCLEAN
Linux modified the MTD driver interface in commit edbc4540 (with the same name as this commit). The effect is that calls to mtd_
mtd: driver _read() returns max_bitflips; mtd_read() returns -EUCLEAN
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 <paul.burton@imgtec.com> Acked-by: Stefan Roese <sr@denx.de>
show more ...
|
| #
d6639d10 |
| 31-May-2013 |
Tom Rini <trini@ti.com> |
Merge branch 'master' of git://git.denx.de/u-boot-nand-flash
|