summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
Commit message (Collapse)AuthorAgeFilesLines
...
* UBI: add an helper to check lnum validityBoris Brezillon2018-08-312-6/+11
| | | | | | | | | | | ubi_leb_valid() is here to replace the lnum < 0 || lnum >= vol->reserved_pebs checks. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> [Fixed conflicts due missing cdev] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: simplify LEB write and atomic LEB change codeBoris Brezillon2018-08-311-158/+113
| | | | | | | | | | | | | | ubi_eba_write_leb(), ubi_eba_write_leb_st() and ubi_eba_atomic_leb_change() are using a convoluted retry/exit path. Add the try_write_vid_and_data() function to simplify the retry logic and make sure we have a single exit path instead of manually releasing the resources in each error path. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> [Fix conflicts] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: simplify recover_peb() codeBoris Brezillon2018-08-311-40/+74
| | | | | | | | | | | | recover_peb() is using a convoluted retry/exit path. Add try_recover_peb() to simplify the retry logic and make sure we have a single exit path instead of manually releasing the resource in each error path. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> [Fix conflicts] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: move the global ech and vidh variables into struct ubi_attach_infoBoris Brezillon2018-08-312-20/+23
| | | | | | | | | | | | | | | Even if it works fine with those global variables, attaching the temporary ech and vidh objects used during UBI scan to the ubi_attach_info object sounds like a more future-proof option. For example, attaching several UBI devices in parallel is prevented by this use of global variable. And also because global variables should be avoided in general. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: provide helpers to allocate and free aeb elementsBoris Brezillon2018-08-314-35/+69
| | | | | | | | | | | | This not only hides the aeb allocation internals (which is always good in case we ever want to change the allocation system), but also helps us factorize the initialization of some common fields (ec and pnum). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> [Fixed kzalloc/free conflicts] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: fastmap: use ubi_io_{read, write}_data() instead of ubi_io_{read, write}()Boris Brezillon2018-08-311-5/+5
| | | | | | | | | | | ubi_io_{read,write}_data() are wrappers around ubi_io_{read/write}() that are used to read/write eraseblock payload data, which is exactly what fastmap does when calling ubi_io_{read,write}(). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: fastmap: use ubi_rb_for_each_entry() in unmap_peb()Boris Brezillon2018-08-311-6/+2
| | | | | | | | | Use the ubi_rb_for_each_entry() macro instead of open-coding it. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: factorize destroy_av() and ubi_remove_av() codeBoris Brezillon2018-08-311-13/+12
| | | | | | | | | | | | | | Those functions are pretty much doing the same thing, except ubi_remove_av() is putting the aeb elements attached to the volume into the ai->erase list and the destroy_av() is freeing them. Rework destroy_av() to handle both cases. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> [Fix conflict] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: factorize code used to manipulate volumes at attach timeBoris Brezillon2018-08-313-67/+112
| | | | | | | | | | Volume creation/search code is duplicated in a few places (fastmap and non fastmap code). Create some helpers to factorize the code. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: fastmap: scrub PEB when bitflips are detected in a free PEB EC headerBoris Brezillon2018-08-311-3/+4
| | | | | | | | | | | | | | scan_pool() does not mark the PEB for scrubing when bitflips are detected in the EC header of a free PEB (VID header region left to 0xff). Make sure we scrub the PEB in this case. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Fixes: dbb7d2a88d2a ("UBI: Add fastmap core") Signed-off-by: Richard Weinberger <richard@nod.at> [Fixed conflict] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: fastmap: avoid multiple be32_to_cpu() when unneccesaryBoris Brezillon2018-08-311-4/+4
| | | | | | | | | | | process_pool_aeb() does several times the be32_to_cpu(new_vh->vol_id) operation. Create a temporary variable and do it once. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> [Fix conflict] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: fix add_fastmap() to use the vid_hdr passed in argumentBoris Brezillon2018-08-311-2/+2
| | | | | | | | | | | | add_fastmap() is passed a ubi_vid_hdr pointer in argument, but is referencing the global vidh pointer. Even if this is correct from a functional point of view (vidh and vid_hdr point to the same object), it is confusing. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: fastmap: use ubi_find_volume() instead of open coding itBoris Brezillon2018-08-311-20/+3
| | | | | | | | | | process_pool_aeb() re-implements the logic found in ubi_find_volume(). Call ubi_find_volume() to avoid this duplication. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: Be more paranoid while seaching for the most recent FastmapRichard Weinberger2018-08-312-4/+27
| | | | | | | | | | | | | | | | | | | | | Since PEB erasure is asynchornous it can happen that there is more than one Fastmap on the MTD. This is fine because the attach logic will pick the Fastmap data structure with the highest sequence number. On a not so well configured MTD stack spurious ECC errors are common. Causes can be different, bad hardware, wrong operating modes, etc... If the most current Fastmap renders bad due to ECC errors UBI might pick an older Fastmap to attach from. While this can only happen on an anyway broken setup it will show completely different sympthoms and makes finding the root cause much more difficult. So, be debug friendly and fall back to scanning mode of we're facing an ECC error while scanning for Fastmap. Cc: <stable@vger.kernel.org> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: Check whether the Fastmap anchor matches the super blockRichard Weinberger2018-08-311-0/+7
| | | | | | | | | This helps to detect cases where an user copies an UBI image to another target with different bad blocks. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: Rework Fastmap attach base codeRichard Weinberger2018-08-314-43/+160
| | | | | | | | | | | | Introduce a new list to the UBI attach information object to be able to deal better with old and corrupted Fastmap eraseblocks. Also move more Fastmap specific code into fastmap.c. Signed-off-by: Richard Weinberger <richard@nod.at> [Fixed conflicts in attach and fastmap] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: Fix whitespace issue in count_fastmap_pebs()Richard Weinberger2018-08-311-1/+1
| | | | | | Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: Introduce vol_ignored()Richard Weinberger2018-08-312-6/+33
| | | | | | | | This makes the logic more easy to follow. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: Fix scan_fast() commentRichard Weinberger2018-08-311-1/+1
| | | | | | Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: Make volume resize power cut awareRichard Weinberger2018-08-311-7/+18
| | | | | | | | | | | | | | | | | | | When the volume resize operation shrinks a volume, LEBs will be unmapped. Since unmapping will not erase these LEBs immediately we have to wait for that operation to finish. Otherwise in case of a power cut right after writing the new volume table the UBI attach process can find more LEBs than the volume table knows. This will render the UBI image unattachable. Fix this issue by waiting for erase to complete and write the new volume table afterward. Cc: <stable@vger.kernel.org> Reported-by: Boris Brezillon <boris.brezillon@free-electrons.com> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: Fix early loggingRichard Weinberger2018-08-311-4/+4
| | | | | | | | | | | | We cannot use ubi_* logging functions before the UBI object is initialized. Cc: <stable@vger.kernel.org> Fixes: 3260870331 ("UBI: Extend UBI layer debug/messaging capabilities") Signed-off-by: Richard Weinberger <richard@nod.at> [Fixed minor conflict] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: Fix race condition between ubi device creation and udevIosif Harutyunov2018-08-311-2/+4
| | | | | | | | | | | | | | Install the UBI device object before we arm sysfs. Otherwise udev tries to read sysfs attributes before UBI is ready and udev rules will not match. Cc: <stable@vger.kernel.org> Signed-off-by: Iosif Harutyunov <iharutyunov@sonicwall.com> [rw: massaged commit message] Signed-off-by: Richard Weinberger <richard@nod.at> [Fixed minor conflict] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubi: Make recover_peb power cut awareRichard Weinberger2018-08-311-5/+12
| | | | | | | | | | | | | | | | | | | | | | recover_peb() was never power cut aware, if a power cut happened right after writing the VID header upon next attach UBI would blindly use the new partial written PEB and all data from the old PEB is lost. In order to make recover_peb() power cut aware, write the new VID with a proper crc and copy_flag set such that the UBI attach process will detect whether the new PEB is completely written or not. We cannot directly use ubi_eba_atomic_leb_change() since we'd have to unlock the LEB which is facing a write error. Cc: stable@vger.kernel.org Reported-by: Jörg Pfähler <pfaehler@isse.de> Reviewed-by: Jörg Pfähler <pfaehler@isse.de> Signed-off-by: Richard Weinberger <richard@nod.at> [Fixed minor conflict] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Fix static volume checks when Fastmap is usedRichard Weinberger2018-08-313-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ezequiel reported that he's facing UBI going into read-only mode after power cut. It turned out that this behavior happens only when updating a static volume is interrupted and Fastmap is used. A possible trace can look like: ubi0 warning: ubi_io_read_vid_hdr [ubi]: no VID header found at PEB 2323, only 0xFF bytes ubi0 warning: ubi_eba_read_leb [ubi]: switch to read-only mode CPU: 0 PID: 833 Comm: ubiupdatevol Not tainted 4.6.0-rc2-ARCH #4 Hardware name: SAMSUNG ELECTRONICS CO., LTD. 300E4C/300E5C/300E7C/NP300E5C-AD8AR, BIOS P04RAP 10/15/2012 0000000000000286 00000000eba949bd ffff8800c45a7b38 ffffffff8140d841 ffff8801964be000 ffff88018eaa4800 ffff8800c45a7bb8 ffffffffa003abf6 ffffffff850e2ac0 8000000000000163 ffff8801850e2ac0 ffff8801850e2ac0 Call Trace: [<ffffffff8140d841>] dump_stack+0x63/0x82 [<ffffffffa003abf6>] ubi_eba_read_leb+0x486/0x4a0 [ubi] [<ffffffffa00453b3>] ubi_check_volume+0x83/0xf0 [ubi] [<ffffffffa0039d97>] ubi_open_volume+0x177/0x350 [ubi] [<ffffffffa00375d8>] vol_cdev_open+0x58/0xb0 [ubi] [<ffffffff8124b08e>] chrdev_open+0xae/0x1d0 [<ffffffff81243bcf>] do_dentry_open+0x1ff/0x300 [<ffffffff8124afe0>] ? cdev_put+0x30/0x30 [<ffffffff81244d36>] vfs_open+0x56/0x60 [<ffffffff812545f4>] path_openat+0x4f4/0x1190 [<ffffffff81256621>] do_filp_open+0x91/0x100 [<ffffffff81263547>] ? __alloc_fd+0xc7/0x190 [<ffffffff812450df>] do_sys_open+0x13f/0x210 [<ffffffff812451ce>] SyS_open+0x1e/0x20 [<ffffffff81a99e32>] entry_SYSCALL_64_fastpath+0x1a/0xa4 UBI checks static volumes for data consistency and reads the whole volume upon first open. If the volume is found erroneous users of UBI cannot read from it, but another volume update is possible to fix it. The check is performed by running ubi_eba_read_leb() on every allocated LEB of the volume. For static volumes ubi_eba_read_leb() computes the checksum of all data stored in a LEB. To verify the computed checksum it has to read the LEB's volume header which stores the original checksum. If the volume header is not found UBI treats this as fatal internal error and switches to RO mode. If the UBI device was attached via a full scan the assumption is correct, the volume header has to be present as it had to be there while scanning to get known as mapped. If the attach operation happened via Fastmap the assumption is no longer correct. When attaching via Fastmap UBI learns the mapping table from Fastmap's snapshot of the system state and not via a full scan. It can happen that a LEB got unmapped after a Fastmap was written to the flash. Then UBI can learn the LEB still as mapped and accessing it returns only 0xFF bytes. As UBI is not a FTL it is allowed to have mappings to empty PEBs, it assumes that the layer above takes care of LEB accounting and referencing. UBIFS does so using the LEB property tree (LPT). For static volumes UBI blindly assumes that all LEBs are present and therefore special actions have to be taken. The described situation can happen when updating a static volume is interrupted, either by a user or a power cut. The volume update code first unmaps all LEBs of a volume and then writes LEB by LEB. If the sequence of operations is interrupted UBI detects this either by the absence of LEBs, no volume header present at scan time, or corrupted payload, detected via checksum. In the Fastmap case the former method won't trigger as no scan happened and UBI automatically thinks all LEBs are present. Only by reading data from a LEB it detects that the volume header is missing and incorrectly treats this as fatal error. To deal with the situation ubi_eba_read_leb() from now on checks whether we attached via Fastmap and handles the absence of a volume header like a data corruption error. This way interrupted static volume updates will correctly get detected also when Fastmap is used. Cc: <stable@vger.kernel.org> Reported-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Richard Weinberger <richard@nod.at> [Fixed conflict] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Set free_count to zero before walking through erase listHeiko Schocher2018-08-311-1/+1
| | | | | | | | | | | | | | | | | Set free_count to zero before walking through ai->erase list in wl_init(). Found in U-Boot as U-Boot has no workqueue/threads, it immediately calls erase_worker(), which increase for each erased block free_count. Without this patch, free_count gets after this initialized to zero in wl_init(), so the free_count variable always has the maybe wrong value 0 in U-Boot. Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Clean up return in ubi_remove_volume()Dan Carpenter2018-08-311-1/+1
| | | | | | | | | | | My static checker says that "err" can be uninitialized if "vol->reserved_pebs" is <= 0. I don't think that can happen but returning a literal is cleaner anyway. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Modify wrong comment in ubi_leb_map function.z001895122018-08-311-1/+1
| | | | | | | Signed-off-by: z00189512 <abc.zhangliang@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Don't read back all data in ubi_eba_copy_leb()Richard Weinberger2018-08-311-24/+0
| | | | | | | | | | | | | | Drop this paranoia check from the old days. If our MTD driver or the flash is so bad that we even cannot trust it to write data we have bigger problems. If one really does not trust the flash and wants write-verify she can enable UBI io checks using debugfs. Signed-off-by: Richard Weinberger <richard@nod.at> [Fixed up conflicts due to non exsisting logging in barebox] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Remove alloc_ai() slab name from parameter listRichard Weinberger2018-08-311-5/+5
| | | | | | | | | | There is always exactly one ubi_attach_info object allocated, therefore we don't have to care about the name. Signed-off-by: Richard Weinberger <richard@nod.at> [Fixed conflict] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: Fastmap: Fix memory leak while attachingRichard Weinberger2018-08-312-26/+26
| | | | | | | | | Currently we leak a few ubi_ainf_pebs while attaching. Signed-off-by: Richard Weinberger <richard@nod.at> [Fix conflicts] Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-07-091-0/+2
|\
| * nand-bb: mtd_del_bb: fix missing pointer resetHeinrich Toews2018-06-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | If an attached bb device was removed before the actual mtd device the code would try due to a missing pointer reset to access the no more present bb device handle which leads to a page fault. This bug was made visible by commit "7649473 mtd: nand: remove automatically created bb devices" which relys on a correct mtd->cdev_bb handling. Signed-off-by: Heinrich Toews <heinrich.toews@wago.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: gpmi-nand: Make sure clock is disabled during rate changeSascha Hauer2018-07-061-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On i.MX6 GPMI Nand controller the clock must be disabled during a rate change. Otherwise glitches on the clock line may occur which result in errors like: MXS NAND: Error sending command MXS NAND: DMA read error There were previous attempts to fix this. One is in: 54961378f0 imx6: clk: Gate off ENFC clock before setting clock rate This patch added a clk_disable() right before the rate change. Since a clk_disable() on a disabled clk is a no-op, the patch added a clk_enable() to the i.MX6 clk driver in the hope that the clk is enabled in the nand driver probe and the clk_disable() really takes place. This patch doesn't work. First of all it enabled the enfc_podf clk which was not the one that was actually disabled in the nand driver, resulting in the nand drivers call to clk_disable() still being a no-op. Then this patch also only works only on the classic i.MX6 which was the only one supported at that time, but not on the i.MX6UL, i.MX6SX and i.MX6SL which have a separate clk driver. Instead of adding more quirks to the other i.MX6 clk drivers, fix this in the GPMI driver. We no longer call clk_disable() on a disabled clk, but instead do a clk_enable() first which makes sure the hardware state is synchronized to the usage count and the following clk_disable() is really effective. At the same time we can (and actually must) remove the quirk in the i.MX6 clk driver. Also add clk_disable()/clk_enable() around another rate change in the GPMI driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: mtd_dataflash: Don't print bogus command values for READsAndrey Smirnov2018-07-021-3/+3
|/ | | | | | | | | | Call to dev_dbg in dataflash_read() is located to early, before command[] is initialize to correct values, so it end up printing values from previous invocation. Move it such that it prints current call's values. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-06-111-61/+55
|\
| * mtd: nand: omap_gpmc: fix: remove bch4 string extantHeinrich.Toews@wago.com2018-05-311-1/+0
| | | | | | | | | | | | | | | | | | | | | | Remove an erroneous bch4 string leftover that leads to a false ecc mode mapping. BCH4 support was previously removed by Teresa Remmet: d316cda 'mtd: nand: omap_gpmc: Remove BCH4 support' Signed-off-by: Heinrich Toews <heinrich.toews@wago.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: nand_omap_gpmc: Fix ecc stepsTeresa Remmet2018-05-241-60/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The eccsteps where set wrong for OMAP_ECC_BCH8_CODE_HW_ROMCODE. So the ECC was only corrected for the first 512 bytes chunk of a 2k page. Moved out the ecc step iteration out of the correcting loop to make it more alike the generic nand functions. And made sure that the ECC is caclulated for all chunks. This patch is based on work of Sascha Hauer. Fixes commit dec7b4d2bf9c ("mtd: nand_omap_gpmc: fix BCH error correction"). Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mips'Sascha Hauer2018-06-111-1/+1
|\ \
| * | mtd: cfi-flash: fix write_buff() for 64 bit systemsPeter Mamonov2018-05-241-1/+1
| |/ | | | | | | | | | | | | | | | | | | write_buff() uses ~(flash_info.portwidth - 1) to mask lower bits of addr. This causes higher 32 bits of addr to be discarded on a 64 bit system, since flash_info.portwidth is 32 bits long (unsigned int) and addr is 64 bits long (unsigned long). Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / mtd: core: Fix printing partitions in hexTeresa Remmet2018-06-071-1/+1
|/ | | | | | | | When printing the partition size with "0x" prefix the value has to be displayed in hex. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2018-04-062-0/+5
|\
| * mtd: spi-nor: add manufacturer IDs for ISSI and Winbondmichael grassmann2018-03-221-0/+4
| | | | | | | | | | | | | | | | | | | | This patch includes new NOR flash IDs to support flashes from the manufacturers ISSI and Winbond - ISSI IS25LP128-JBLA3 and IS25LP128-JBLE - Winbond W25Q128JVSIM Signed-off-by: michael grassmann <m.grassmann@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * mtd: nand: Add Winbond manufacturer IDStefan Riedmueller2018-03-221-0/+1
| | | | | | | | | | | | | | | | Add Winbond 0xef manufacturer ID for NAND flashes to support Winbond as an additional manufacturer. Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
* | rename file_operations -> cdev_operationsSascha Hauer2018-04-065-7/+7
|/ | | | | | | | Linux also has struct file_operations which are something different. Rename our file_operations to cdev_operations which better matches what we have. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: spi-nor: add support for w25q16dwMichael Grzeschik2018-03-051-0/+1
| | | | | Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: spi-nor: mx25l3205d/mx25l6405d: append SECT_4KUlrich Ölmann2017-11-281-2/+2
| | | | | | | | | | | | | | | | | | This is a port of Linux kernel commit | commit 0501f2e5ff28a02295e42fc9e7164a20ef4c30d5 | Author: Andreas Fenkart <afenkart@gmail.com> | Date: Thu Nov 5 10:04:23 2015 +0100 | | mtd: spi-nor: mx25l3205d/mx25l6405d: append SECT_4K | | according datasheet both chips can erase 4kByte sectors individually | | Signed-off-by: Andreas Fenkart <andreas.fenkart@dev.digitalstrom.org> | Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: m25p80: make it possible to use 4K erase blockAntony Pavlov2017-10-161-0/+13
| | | | | | | | | | | | | We already have the MTD_SPI_NOR_USE_4K_SECTORS option handling in C code for 4K erase block support. Alas this 4K erase block support code can't be used because the MTD_SPI_NOR_USE_4K_SECTORS option support is missed in Kconfig. This patch imports necessary Kconfig MTD_SPI_NOR_USE_4K_SECTORS option declaration from linux v4.11-rc8. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* UBI: attach: add missing newline at end of pr_err()Marc Kleine-Budde2017-10-161-1/+1
| | | | | | | | This patch adds the missing newline at the end of the pr_err() statement. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove checks for xzalloc() returning NULLUwe Kleine-König2017-09-261-2/+0
| | | | | | | xzalloc() either returns memory or panics, so checking for NULL is useless. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: nand_mxs: Don't call get/set features on chips which do not ↵Sascha Hauer2017-09-061-9/+13
| | | | | | | | | support it Older versions of the ONFI spec do not support get/set features, so do not call these commands when they are not available. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>