summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/blspec'Sascha Hauer2015-07-061-0/+1
|\
| * fs: ubifs: Implement Linux rootargSascha Hauer2015-06-181-0/+1
| | | | | | | | | | | | | | | | Add the parameter to boot from ubifs fileystems. This assumes that there will be only one UBI device registered in the kernel, otherwise there is no way to predict the ubi number. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ubi: Lower 'already attached' message to debug levelSascha Hauer2015-06-261-1/+1
| | | | | | | | | | | | | | | | The caller will show a message, no need to do this in UBI. This is for the case when mtd_detect calls ubi_attach_mtd_dev. mtd_detect does not know whether this is already attached and it's not an error. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ubi: Use preditable device namesSascha Hauer2015-06-262-7/+4
|/ | | | | | | | | Instead of naming all ubi devices and cdev names ubi<num> append '.ubi' to the original mtd name. This makes ubi device and cdev names predictable. With this ubi0 becomes nand0.root.ubi. Also do the same for volume names, so ubi0.root becomes nand0.root.ubi.root. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: cdev: remove trailing newline from debug messagesMarc Kleine-Budde2015-04-231-7/+7
| | | | | | | | This patch removes the trailing newline "\n" from the ubi/cdev.c debug messages, as the macro ifself already adds a newine. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: ubi: get_bad_peb_limit from mtd masterJan Weitzel2014-11-201-1/+5
| | | | | | | | | | | | Like mentioned in the coment we need the size of the entire flash chip. Check if a master exists and take his size. Otherwise the limit will be too small and kernel prints: UBI warning: print_rsvd_warning: cannot reserve enough PEBs for \ bad PEB handling, reserved 19, need 20 Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: bugfix in ubi_wl_flush()Richard Weinberger2014-09-111-2/+2
| | | | | | | | Use the _safe variant because we're iterating over a list where items get deleted and freed. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: init_volumes: Ignore volumes with no LEBsRichard Weinberger2014-09-111-1/+1
| | | | | | | | | | | | | | | | UBI assumes that ubi_attach_info will only contain ubi_ainf_volume structures for volumes with at least one LEB. In scanning mode this is true because UBI can nicely create a ubi_ainf_volume on demand while creating the EBA table. For fastmap this is not true, the fastmap on-flash structure has a list of all volumes, the ubi_ainf_volume structures are created from this list. So it can happen that an empty volume ends up in init_volumes(). We can easely deal with that by looking into ->leb_count too. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: fastmap: do not miss bit-flipsBrian Norris2014-09-111-1/+1
| | | | | | | | | | | | | | The return value from 'ubi_io_read_ec_hdr()' was stored in 'err', not in 'ret'. This fix makes sure Fastmap-enabled UBI does not miss bit-flip while reading EC headers, events and scrubs the affected PEBs. This issue was reported by Coverity Scan. Artem: improved the commit message. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: fix the volumes tree sorting criteriaHeiko Schocher2014-09-111-1/+1
| | | | | | | | | | | | | Commig "604b592 UBI: fix rb_tree node comparison in add_map" broke fastmap backward compatibility and older fastmap images cannot be mounted anymore. The reason is that it changes the volumes RB-tree sorting criteria. This patch fixes the problem. Artem: re-write the commit message Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: fix rb_tree node comparison in add_mapMike Snitzer2014-09-111-2/+2
| | | | | | | | | The comparisons used in add_vol() shouldn't be identical. Pretty sure the following is correct but it is completely untested. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: fix ubi free PEBs count calculationTanya Brokhman2014-09-111-0/+3
| | | | | | | | | | The ubi->free_count should be updated with every insert/remove to/from the ubi->free list. Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org> Reviewed-by: Dolev Raviv <draviv@codeaurora.org> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: fix error path in __wl_get_pebTanya Brokhman2014-09-111-0/+3
| | | | | | | | | | | In case of an error (if there are not free PEB's for example), __wl_get_peb will return a negative value. In order to prevent access violation we need to test the returned value prior to using it later on. Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Reviewed-by: Dolev Raviv <draviv@codeaurora.org> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: fix some use after free bugsDan Carpenter2014-09-111-4/+4
| | | | | | | Move the kmem_cache_free() calls down a couple lines. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: avoid program operation on NOR flash after erasure interruptedQi Wang 王起 (qiwang)2014-09-111-32/+22
| | | | | | | | | | | | | | | | | | nor_erase_prepare() will be called before erase a NOR flash, it will program '0' into a block to mark this block. But program data into a erasure interrupted block can cause program timtout(several minutes at most) error, could impact other operation on NOR flash. So UBIFS can read this block first to avoid unneeded program operation. This patch try to put read operation at head of write operation in nor_erase_prepare(), read out the data. If the data is already corrupt, then no need to program any data into this block, just go to erase this block. This patch is validated on Micron NOR flash, part number is:JS28F512M29EWHA Signed-off-by: Qi Wang <qiwang@micron.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: fix error return codeJulia Lawall2014-09-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Set the return variable to an error code as done elsewhere in the function. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Richard Weinberger <richard@nod.at>
* treewide: remove address of the Free Software FoundationAntony Pavlov2014-06-1114-56/+0
| | | | | | | | | | | | | | | | | | The FSF address has changed; The FSF site says that address is Free Software Foundation 51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA (see http://www.fsf.org/about/contact/) Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drop CONFIG_PARTITION_NEED_MTDSascha Hauer2014-05-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | With CONFIG_PARTITION_NEED_MTD enabled we use mtd rather than devfs directly to create partitions on mtd devices. Since: | commit b32cd8df87b87ef744365138e145b829c02eb719 | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Wed Apr 9 15:49:32 2014 +0200 | | mtd: nand: bb: use mtd api directly | | The devfs layer just adds an addition indirection between mtd | and the bb devices with no purpose. Drop it. | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> The bad block aware device creation doesn't work if this option is disabled. With this we remove CONFIG_PARTITION_NEED_MTD and always use mtd partitions on mtd devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2014-04-041-1/+1
|\
| * ubi: Fix for creating ubi volumes with 64bit sizeDmitry Lavnikevich2014-03-121-1/+1
| | | | | | | | | | | | | | | | | | Since MTD is already supports >= 4GB device sizes it is better to allow ubi valumes also be created of larger sizes. Signed-off-by: Dmitry Lavnikevich <d.lavnikevich@sam-solutions.com> Signed-off-by: Grigory Milev <g.milev@sam-solutions.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: ubi: avoid NULL pointer dereference in ubi_get_devicePhilipp Zabel2014-03-231-0/+2
|/ | | | | | | | | | If the ubidetach command is given a number that passes the range check in ubi_detach_mtd_dev, but at which index the ubi_devices array contains a NULL pointer, ubi_get_device tries to dereference this NULL pointer to increment the ubi device reference count. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubi'Sascha Hauer2014-03-074-20/+33
|\ | | | | | | | | Conflicts: drivers/mtd/ubi/cdev.c
| * mtd: ubi: rework loggingSascha Hauer2014-02-284-20/+33
| | | | | | | | | | | | | | | | By default UBI is very verbose. Decrease the verbosity, turn printf messages into ubi_ messages and add device parameters for the values which are not printed anymore. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ubi: register ubi devices and volumes as devicesSascha Hauer2014-02-263-1/+31
|/ | | | | | | | struct ubi_device and struct ubi_volume have devices attached to them. Register them to make them part of the barebox device hierarchy. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Add some asserts to ubi_attach_fastmap()Richard Weinberger2014-01-071-0/+4
| | | | | | | | Add more paranioa asserts to make it easier to detect implementation errors. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Fix memory leak in ubi_attach_fastmap() error pathRichard Weinberger2014-01-071-0/+13
| | | | | | | | On error we have to free all three temporary lists. Reported-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: simplify image sequence testRichard Genoud2014-01-071-3/+2
| | | | | | | | | | | | | | | | | The test: if (!a && b) a = b; can be symplified in: if (!a) a = b; And there's no need to test if ubi->image_seq is not null, because if it is, it is set to image_seq. So, we just test if image_seq is not null. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: fastmap: fix backward compatibility with image_seqRichard Genoud2014-01-071-3/+19
| | | | | | | | | | | | | | | | | | Some old UBI implementations (e.g. U-Boot) have not implemented the image sequence feature. So, when erase blocks are written, the image sequence in the ec header is lost (set to zero). UBI scan_all() takes this case into account (commits 32bc4820287a1a03982979515949e8ea56eac641 and 2eadaad67b2b6bd132eda105128d2d466298b8e3) But fastmap scan functions (ubi_scan_fastmap() and scan_pool()) didn't. This patch fixes the issue. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Call scan_all() with correct offset in error caseRichard Weinberger2014-01-071-2/+4
| | | | | | | | | If we find an invalid fastmap we have to scan from the very beginning. Otherwise we leak the first 64 PEBs. Reported-and-tested-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Fix error path in scan_pool()Richard Weinberger2014-01-071-1/+1
| | | | | | | | We have to set "ret", not "err" in case of an error. Reported-and-tested-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: fix refill_wl_user_pool()Richard Weinberger2014-01-071-4/+0
| | | | | | | | | | If no free PEBs are available refill_wl_user_pool() must not return with -ENOSPC immediately. It has to block till produce_free_peb() produced a free PEB. Reported-and-Tested-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Fix invalidate_fastmap()Richard Weinberger2014-01-071-4/+1
| | | | | | | | | Onging tests uncovered that invalidate_fastmap() is broken. It must not call ubi_wl_put_fm_peb() because all PEBs used by the old fastmap have already been put back. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: Fix PEB leak in wear_leveling_worker()Richard Weinberger2014-01-071-0/+3
| | | | | | | | | | | | | | get_peb_for_wl() removes the PEB from the free list. If the WL subsystem detects that no wear leveling is needed it cancels the operation and drops the gained PEB. In this case we have to put the PEB back into the free list. This issue was introduced with commit ed4b7021c (UBI: remove PEB from free tree in get_peb_for_wl()). Cc: <stable@vger.kernel.org> # 3.7.x Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* move print_hex_dump function to include/common.hSascha Hauer2013-08-071-8/+0
| | | | | | | | print_hex_dump is a standard kernel function, so move it outside the ubi header files to make it usable for other code derived from the kernel aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: ubi: Add support for opening a volume by cdevSascha Hauer2013-08-073-0/+25
| | | | | | Needed by ubifs support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: ubi: add ubi info functionsSascha Hauer2013-08-071-0/+76
| | | | | | Needed for ubifs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: ubi: add missing prototype for ubi_volume_notifySascha Hauer2013-08-061-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: ubi: remove calls to nonexisting functionsSascha Hauer2013-08-061-5/+0
| | | | | | | | We do not have ubi_do_get_volume_info and ubi_do_get_device_info and do not need them yet, so remove calls to these functions to fix compilation. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: ubi: implement ubi_volume_notifySascha Hauer2013-07-273-0/+37
| | | | | | This is necessary to update the fastmap after ubi manipulations. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: reimport UBI from Linux v3.10Sascha Hauer2013-07-2519-0/+13538
| | | | | | | | | | | This is a fresh UBI import from Linux v3.10 This is done mainly to get fastmap support. This was tested with the i.MX nand driver, the MXS nand driver and on CFI NOR flash. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: remove old ubi supportSascha Hauer2013-07-2419-11113/+0
| | | | | | | To update to the latest UBI support from the Kernel first remove the old UBI support. Without it the update will be even less reviewable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Use mtd_* functions where appropriateSascha Hauer2013-02-141-4/+4
| | | | | | | | Instead of dereferencing struct mtd_info members directly use the wrapper functions which have an additional check if the callback exists if it is optional, like mark_bad or is_bad. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: consolidate ubi-media.hWolfram Sang2012-12-192-370/+2
| | | | | | | | We have two versions in the tree. Use the newer one, and put it into the mtd directory while we are at it. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: drop custom is_power_of_2()Wolfram Sang2012-12-191-4/+1
| | | | | | | We have proper version in log2.h these days. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Cleanup Kconfig filesAlexander Shiyan2012-12-081-1/+1
| | | | | | | | | This patch provides a global cleanup barebox Kconfig files. This includes replacing spaces to tabs, formatting in accordance format, removing extraneous lines and spaces. No functional changes. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2012-11-161-1/+1
|\ | | | | | | | | Conflicts: arch/arm/configs/at91sam9x5ek_defconfig
| * mtd: introduce mtd_block_isbadJean-Christophe PLAGNIOL-VILLARD2012-11-031-1/+1
| | | | | | | | | | | | | | | | this allow to do not provide block_isbad at mtd driver level as example spi flash Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: ubi: fix typos in comment of build.cWolfram Sang2012-10-251-1/+1
| | | | | | | | | | Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: ubi: cdev: fix build warning for 64-bitWolfram Sang2012-10-231-1/+1
|/ | | | | | | | | | Got this when compiling sandbox on a 64-bit system: drivers/mtd/ubi/cdev.c: In function ‘ubi_volume_cdev_read’: drivers/mtd/ubi/cdev.c:26:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-1715-45/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>