summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_bbt.c
Commit message (Collapse)AuthorAgeFilesLines
* mtd: nand_bbt: scan for next free bbt block if writing bbt failsKyle Roeschley2016-09-231-6/+45
| | | | | | | | | | | | If erasing or writing the BBT fails, we should mark the current BBT block as bad and use the BBT descriptor to scan for the next available unused block in the BBT. We should only return a failure if there isn't any space left. Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com> Suggested-by: Jeff Westfahl <jeff.westfahl@ni.com> Tested-by: Kyle Roeschley <kyle.roeschley@ni.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand_bbt: Move BBT block selection logic out of write_bbt()Boris Brezillon2016-09-231-36/+74
| | | | | | | | This clarifies the write_bbt() function by removing the write label and simplifying the error/exit path. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Tested-by: Kyle Roeschley <kyle.roeschley@ni.com>
* mtd: nand: remove EXPORT_SYMBOL of nand_scan_bbt()Thomas Petazzoni2016-01-231-2/+0
| | | | | | | | | | | | | Since commit 17799359e7b3fa6ef4f2bf926cd6821cf7903ecf ("mtd: nand_bbt: make nand_scan_bbt() static"), the nand_scan_bbt() function is marked as static but is still exported using EXPORT_SYMBOL(), which doesn't make much sense. This commit gets rid of the useless EXPORT_SYMBOL. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand: make use of mtd_to_nand() in NAND core codeBoris BREZILLON2015-12-081-16/+16
| | | | | | | | mtd_to_nand() was recently introduced to avoid direct access to the mtd->priv field. Update core code to use mtd_to_nand(). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand_bbt: set the smallest size of bbt tableSheng Yong2015-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using nandsim to simulate a 128K block nand with `overridesize = 1', the size of mtd device is too small (mtd_size = 4 * block_size) to get the right length of bbt. Then when creating bbt, kzmalloc() will return ZERO_SIZE_PTR. This causes a NULL pointer oops when scanning bbt. [ 952.156166] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010 [ 952.157064] IP: [<ffffffff8148ad4a>] nand_isreserved_bbt+0x2a/0x40 [ 952.157064] PGD 0 [ 952.157064] Oops: 0000 [#1] SMP [ 952.157064] Modules linked in: nandsim(+) [last unloaded: nandsim] [ 952.157064] CPU: 1 PID: 7103 Comm: modprobe Not tainted 4.2.0-rc3-next-20150724 #4 [ 952.157064] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 952.157064] task: ffff88003e24b980 ti: ffff88003d274000 task.ti: ffff88003d274000 [ 952.157064] RIP: 0010:[<ffffffff8148ad4a>] [<ffffffff8148ad4a>] nand_isreserved_bbt+0x2a/0x40 [ 952.157064] RSP: 0018:ffff88003d277b90 EFLAGS: 00010246 [ 952.157064] RAX: 0000000000000010 RBX: ffff88003d5a1000 RCX: 0000000000000000 [ 952.157064] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88003d919000 [ 952.157064] RBP: ffff88003d277b98 R08: 0000000000020000 R09: 0000000000000000 [ 952.157064] R10: 0000000000000000 R11: 0000000000000195 R12: ffff88003d919000 [ 952.157064] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [ 952.157064] FS: 00007fada4d07700(0000) GS:ffff88003fd00000(0000) knlGS:0000000000000000 [ 952.157064] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 952.157064] CR2: 0000000000000010 CR3: 0000000037924000 CR4: 00000000000006a0 [ 952.157064] Stack: [ 952.157064] ffffffff814851ec ffff88003d277ba8 ffffffff8147e35f ffff88003d277bf8 [ 952.157064] ffffffff814816f3 ffff88003d277c08 ffff88003d277bc8 0000000000000282 [ 952.157064] 0000000000000001 0000000000000000 ffff88003d209540 0000000000000001 [ 952.157064] Call Trace: [ 952.157064] [<ffffffff814851ec>] ? nand_block_isreserved+0x1c/0x20 [ 952.157064] [<ffffffff8147e35f>] mtd_block_isreserved+0x1f/0x30 [ 952.157064] [<ffffffff814816f3>] allocate_partition+0x463/0x6a0 [ 952.157064] [<ffffffff81481b3b>] add_mtd_partitions+0x4b/0xe0 [ 952.157064] [<ffffffff8147f14c>] mtd_device_parse_register+0x4c/0xe0 [ 952.157064] [<ffffffffa0013daf>] ns_init_module+0xdaf/0xde4 [nandsim] [ 952.157064] [<ffffffff8128d7c8>] ? kasprintf+0x38/0x40 [ 952.157064] [<ffffffffa0013000>] ? 0xffffffffa0013000 [ 952.157064] [<ffffffff810002c3>] do_one_initcall+0x83/0x1b0 [ 952.157064] [<ffffffff8113afab>] ? kmem_cache_alloc_trace+0x6b/0x120 [ 952.157064] [<ffffffff8160b503>] do_init_module+0x5c/0x1dd [ 952.157064] [<ffffffff810aa4db>] load_module+0x1bbb/0x20b0 [ 952.157064] [<ffffffff810a6fc0>] ? __symbol_put+0x30/0x30 [ 952.157064] [<ffffffff810aaac9>] SyS_init_module+0xf9/0x110 [ 952.157064] [<ffffffff810aa9d1>] ? SyS_init_module+0x1/0x110 [ 952.157064] [<ffffffff81615f57>] entry_SYSCALL_64_fastpath+0x12/0x6a [ 952.157064] Code: 00 55 48 8b 87 80 01 00 00 48 89 e5 8b 88 cc 00 00 00 48 8b 80 f0 03 00 00 5d 48 d3 fe 89 f2 83 e6 03 c1 fa 02 8d 0c 36 48 63 d2 <0f> b6 04 10 d3 f8 83 e0 03 3c 02 0f 94 c0 0f b6 c0 c3 0f 1f 40 [ 952.157064] RIP [<ffffffff8148ad4a>] nand_isreserved_bbt+0x2a/0x40 [ 952.157064] RSP <ffff88003d277b90> [ 952.157064] CR2: 0000000000000010 [ 952.204010] ---[ end trace 6ca2e1c041fdba36 ]--- This patch gives a smallest length to bbt, 1 byte, which is enough to represent up to 4 blocks. Signed-off-by: Sheng Yong <shengyong1@huawei.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: remove incorrect file nameBrian Norris2015-05-221-2/+0
| | | | | | | | This is an example of why it doesn't make much sense to put this information here in the first place. I don't really know what purpose it serves. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand_bbt: fix theoretical integer overflow in BBT writeBrian Norris2015-05-061-1/+1
| | | | | | | | | | | | This statement was written with a cast-to-loff_t to be sure to have a full 64-bit mask. However, we don't account for the fact that '1 << this->bbt_erase_shift' might already overflow. This will not be a problem in practice, since eraseblocks should never be anywhere near 4GiB. But we can do this for completeness, and quiet Coverity in the meantime. CID #1226806. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand_bbt: unify/fix error handling in nand_scan_bbt()Brian Norris2015-05-061-7/+12
| | | | | | | Don't leak this->bbt, and return early if check_create() fails. It helps to have a single error path to avoid these problems. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand_bbt: make nand_scan_bbt() staticBrian Norris2015-05-061-1/+1
| | | | | | This implementation detail is no longer needed outside of nand_bbt.c. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand_bbt: drop unnecessary headerBrian Norris2015-05-061-1/+0
| | | | Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand: don't break long print messagesRafał Miłecki2014-09-171-13/+10
| | | | | | | | | This follows Chapter 2 of Linux's CodingStyle: > However, never break user-visible strings such as printk messages, > because that breaks the ability to grep for them. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: Introduce mtd_block_isreserved()Ezequiel Garcia2014-07-081-0/+14
| | | | | | | | | | | | | | 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>
* mtd: nand_bbt: handle error case for nand_create_badblock_pattern()Brian Norris2014-05-281-2/+6
| | | | Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand_bbt: remove unused variableBrian Norris2014-05-281-4/+1
| | | | | | Set, but unused, variable. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand_bbt: kill NAND_BBT_SCANALLPAGESBrian Norris2013-11-061-34/+3
| | | | | | | | | Now that the last user of NAND_BBT_SCANALLPAGES has been removed, let's kill this peculiar BBT feature flag. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* mtd: nand: stop exporting nand_default_bbtBrian Norris2013-10-271-1/+0
| | | | | | | | I removed the last non-nand_base users of this, and we shouldn't have any more modules that need to access it. It's only non-static to share between nand_base and nand_bbt. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand: remove NAND_BBT_SCANEMPTYBrian Norris2013-08-301-28/+5
| | | | | | | | | | | | | | | | | | NAND_BBT_SCANEMPTY is a strange, badly-supported option with omap as its single remaining user. NAND_BBT_SCANEMPTY was likely used by accident in omap2[1]. And anyway, omap2 doesn't scan the chip for bad blocks (courtesy of NAND_SKIP_BBTSCAN), and so its use of this option is irrelevant. This patch drops the NAND_BBT_SCANEMPTY option. [1] http://lists.infradead.org/pipermail/linux-mtd/2012-July/042902.html Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: Ivan Djelic <ivan.djelic@parrot.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: hide in-memory BBT implementation detailsBrian Norris2013-08-301-2/+26
| | | | | | | | | | | | | | | | nand_base.c shouldn't have to know the implementation details of nand_bbt's in-memory BBT. Specifically, nand_base shouldn't perform the bit masking and shifting to isolate a BBT entry. Instead, just move some of the BBT code into a new nand_markbad_bbt() interface. This interface allows external users (i.e., nand_base) to mark a single block as bad in the BBT. Then nand_bbt will take care of modifying the in-memory BBT and updating the flash-based BBT (if applicable). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: refactor chip->block_markbad interfaceBrian Norris2013-08-301-1/+0
| | | | | | | | | | | | | | | | | | | | | The chip->block_markbad pointer should really only be responsible for writing a bad block marker for new bad blocks. It should not take care of BBT-related functionality, nor should it handle bookkeeping of bad block stats. This patch refactors the 3 users of the block_markbad interface (plus the default nand_base implementation) so that the common code is kept in nand_block_markbad_lowlevel(). It removes some inconsistencies between the various implementations and should allow for more centralized improvements in the future. Because gpmi-nand no longer needs the nand_update_bbt() function, let's stop exporting it as well. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Huang Shijie <b32955@freescale.com> (for gpmi-nand parts) Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: eliminate castBrian Norris2013-08-301-3/+2
| | | | | | | | Just make 'res' an int. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: remove multiplied-by-2 block logicBrian Norris2013-08-301-48/+35
| | | | | | | | | | | | | | | | | | | | | | | | The parent commit 771c568bcf915e708ae819ef9d07d862f7e2da86 ("mtd: nand: add accessors, macros for in-memory BBT") makes the following comment obsolete: /* * Note that numblocks is 2 * (real numblocks) here, see i+=2 * below as it makes shifting and masking less painful */ I don't think it ever could have been "less painful" to have to shift an extra bit (or 2, or 3) at various points in nand_bbt.c (and even outside, since we leak our in-memory format). But now it is certainly more painful, since we have nice macros and functions to retrieve the relevant portions of the BBT. This patch removes any points where the block number is doubled/halved/otherwise-shifted, instead representing the block number in its most natural form: as the actual block number. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: add accessors, macros for in-memory BBTBrian Norris2013-08-301-22/+48
| | | | | | | | | | | | | | There is an abundance of magic numbers and complicated shifting/masking logic in the in-memory BBT code which makes the code unnecessary complex and hard to read. This patch adds macros to represent the 00b, 01b, 10b, and 11b memory-BBT magic numbers, as well as two accessor functions for reading and marking the memory-BBT bitfield for a given block. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: remove AG-AND supportArtem Bityutskiy2013-04-051-25/+0
| | | | | | | | | | | | | | | We have only one AG-AND driver and it was not touched since 2005. It looks like AG-AND was not really make it to mass-production and can be considered a dead technology. Along with the AG-AND support, this patch removes the BBT_AUTO_REFRESH feature, because the only user of this feature is AG-AND. And even though it is implemented as a generic feature, I prefer to remove it because NAND flashes do not really need it in this form. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Acked-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: use NAND_BBT_SCAN_MAXBLOCKSRichard Genoud2012-09-291-4/+5
| | | | | | | | | | | | In nand_bbt.c, a hardcoded value was used instead of the define meant for that, so we use the define. There's no functional change. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Acked-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: nand_bbt: export nand_update_bbtFabio Estevam2012-09-291-1/+2
| | | | | | | | | | | | When building MTD_NAND_GPMI_NAND as module, the following error shows up: ERROR: "nand_update_bbt" [drivers/mtd/nand/gpmi-nand/gpmi_nand.ko] undefined! Export nand_update_bbt to fix it. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: rename create_bbt()'s 'len' variable to 'numpages'Shmulik Ladkani2012-09-291-12/+12
| | | | | | | | | | | Rename 'len' variable of create_bbt/scan_block_fast/scan_block_full to 'numpages', since it really means number of pages to scan when searching for the BBM (and not the byte length of the scan). Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> Reviewed-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: rename '_raw' BBT scan functionsBrian Norris2012-09-291-10/+10
| | | | | | | | | | None of these scanning functions use MTD_OPS_RAW mode any more, so there's really nothing 'raw' about them. Rename them to (hopefully) make the code a little clearer. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: use ECC, if present, when scanning OOBBrian Norris2012-09-291-7/+20
| | | | | | | | | | | | | | | | | | | | | | | scan_read_raw_oob() is used in only in places where the MTD_OPS_PLACE_OOB mode is preferable to MTD_OPS_RAW mode, so use MTD_OPS_PLACE_OOB instead. MTD_OPS_PLACE_OOB provides the same functionality with the potential[1] added bonus of error correction. This brings scan_block_full() in line with scan_block_fast() so that they both read bad block markers with MTD_OPS_PLACE_OOB. This can help in preventing 0xff markers (in good blocks) from being interpreted as bad block indicators in the presence of a single bitflip. Note that ECC error codes (EUCLEAN or EBADMSG) are already silently ignored in all users of scan_read_raw_oob(). [1] Few drivers perform proper error correction on OOB data. In those cases, the use of MTD_OPS_RAW vs. MTD_OPS_PLACE_OOB is not significant. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand_bbt: use string libraryBrian Norris2012-09-291-18/+9
| | | | | | | | | | | Some nand_bbt code can be shortened by using memcmp() and memchr_inv(). As an added bonus, there is a possible performance benefit. Borrowed some code from Akinobu Mita. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: remove unused 'int' return codesBrian Norris2012-09-291-11/+8
| | | | | | | | | | The return codes for read_abs_bbts() and search_read_bbts() are always non-zero, and so don't have much meaning. Just remove them. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Reviewed-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: fix typo in commentHuang Shijie2012-07-161-1/+1
| | | | | | | | fix the comment for nand_bbt.c Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand_bbt: refactor check_pattern_no_oob()Brian Norris2012-07-061-6/+3
| | | | | | | | This function only returns 0 or -1, so make that clear. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: rename "no_bbt" descriptors to "no_oob"Brian Norris2012-07-061-4/+4
| | | | | | | | | These descriptors are for BBT's that don't use OOB; the "no_bbt" name doesn't really make sense. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: Use the mirror BBT descriptor when reading its versionShmulik Ladkani2012-07-061-1/+1
| | | | | | | | | | | | | | The code responsible for reading the version of the mirror bbt was incorrectly using the descriptor of the main bbt. Pass the mirror bbt descriptor to 'scan_read_raw' when reading the version of the mirror bbt. Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: stable@vger.kernel.org [v2.6.37+] Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nand: fix scan_read_raw_oobDmitry Maluka2012-05-291-0/+1
| | | | | | | | | | It seems there is a bug in scan_read_raw_oob() in nand_bbt.c which should cause wrong functioning of NAND_BBT_SCANALLPAGES option. Artem: the patch did not apply and I had to amend it a bit. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Cc: stable@kernel.org
* mtd: introduce mtd_write_oob interfaceArtem Bityutskiy2012-01-091-1/+1
| | | | | Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: introduce mtd_read_oob interfaceArtem Bityutskiy2012-01-091-3/+3
| | | | | Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: introduce mtd_read interfaceArtem Bityutskiy2012-01-091-3/+3
| | | | | Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* Merge git://git.infradead.org/mtd-2.6Linus Torvalds2011-11-071-368/+324
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git://git.infradead.org/mtd-2.6: (226 commits) mtd: tests: annotate as DANGEROUS in Kconfig mtd: tests: don't use mtd0 as a default mtd: clean up usage of MTD_DOCPROBE_ADDRESS jffs2: add compr=lzo and compr=zlib options jffs2: implement mount option parsing and compression overriding mtd: nand: initialize ops.mode mtd: provide an alias for the redboot module name mtd: m25p80: don't probe device which has status of 'disabled' mtd: nand_h1900 never worked mtd: Add DiskOnChip G3 support mtd: m25p80: add EON flash EN25Q32B into spi flash id table mtd: mark block device queue as non-rotational mtd: r852: make r852_pm_ops static mtd: m25p80: add support for at25df321a spi data flash mtd: mxc_nand: preset_v1_v2: unlock all NAND flash blocks mtd: nand: switch `check_pattern()' to standard `memcmp()' mtd: nand: invalidate cache on unaligned reads mtd: nand: do not scan bad blocks with NAND_BBT_NO_OOB set mtd: nand: wait to set BBT version mtd: nand: scrub BBT on ECC errors ... Fix up trivial conflicts: - arch/arm/mach-at91/board-usb-a9260.c Merged into board-usb-a926x.c - drivers/mtd/maps/lantiq-flash.c add_mtd_partitions -> mtd_device_register vs changed to use mtd_device_parse_register.
| * mtd: nand: switch `check_pattern()' to standard `memcmp()'Brian Norris2011-09-211-4/+2
| | | | | | | | | | | | | | | | | | A portion of the `check_pattern()' function is basically a `memcmp()'. Since it's possible for `memcmp()' to be optimized for a particular architecture, we should use it instead. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
| * mtd: nand: do not scan bad blocks with NAND_BBT_NO_OOB setBrian Norris2011-09-211-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updates to our default function for creating bad block patterns have broken the "no OOB" feature. The NAND_BBT_NO_OOB option should not be set while scanning for bad blocks, but we've been passing all BBT options from nand_chip.bbt_options to the bad block scan. This causes us to hit the: BUG_ON(bd->options & NAND_BBT_NO_OOB); in create_bbt() when we scan the flash for bad blocks. Thus, while it can be legal to set NAND_BBT_NO_OOB in a custom badblock pattern descriptor (presumably with NAND_BBT_CREATE disabled?), we should not pass it through in our default function. Also, to help clarify and emphasize that the function creates bad block patterns only (not, for example, table descriptors for locating flash-based BBT), I renamed `nand_create_default_bbt_descr' to `nand_create_badblock_pattern'. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
| * mtd: nand: wait to set BBT versionBrian Norris2011-09-211-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because there are so many cases of checking, writing, and re-writing of the bad block table(s), we might as well wait until the we've settled on a valid, clean copy of the table. This also prevents us from falsely incrementing the table version. For example, we may have the following: Primary table, with version 0x02 Mirror table, with version 0x01 Primary table has uncorrectable ECC errors If we don't have this fix applied, then we will: Choose to read the primary table (higher version) Set mirror table version to 0x02 Read back primary table Invalidate table because of ECC errors Retry readback operation with mirror table, now version 0x02 Mirrored table reads cleanly Writeback BBT to primary table location (with "version 0x02") However, the mirrored table shouldn't have a new version number. Instead, we actually want: Choose to read the primary table (higher version) Read back primary table Invalidate table because of ECC errors Retry readback with mirror table (version 0x01) Mirrored table reads cleanly Set both tables to version 0x01 Writeback BBT to primary table location (version 0x01) Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
| * mtd: nand: scrub BBT on ECC errorsBrian Norris2011-09-211-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that `read_bbt()' returns ECC error codes properly, we handle those codes when checking the integrity of our flash-based BBT. The modifications can be described by this new policy: *) On any uncorrected ECC error, we invalidate the corresponding table and retry our version-checking integrity logic. *) On corrected bitflips, we mark both tables for re-writing to flash (a.k.a. scrubbing). Current integrity checks (i.e., comparing version numbers, etc.) should take care of all the cases that result in rescanning the device for bad blocks or falling back to the BBT as found in the mirror descriptor. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
| * mtd: nand: report ECC errors properly when reading BBTBrian Norris2011-09-211-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of just printing a warning when encountering ECC errors, we should return a proper error status and print a more informative warning. Later, we will handle these error messages in the upper layers of the BBT scan. Note that this patch makes our check for ECC error codes a little bit more restrictive, leaving all unrecognized errors to the generic "else" clause. This shouldn't cause problems and could even be a benefit. This code is based on some findings reported by Matthieu Castet. Reported-by: Matthieu CASTET <matthieu.castet@parrot.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
| * mtd: utilize `mtd_is_*()' functionsBrian Norris2011-09-211-2/+2
| | | | | | | | | | Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
| * mtd: nand: remove gotos in `check_create()'Brian Norris2011-09-111-16/+19
| | | | | | | | | | | | | | | | | | This is a second step in restructuring `check_create()'. When we don't rely on goto statements for our main functionality, the code will become a little easier to manipulate. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
| * mtd: nand: begin restructuring check_createBrian Norris2011-09-111-19/+5
| | | | | | | | | | | | | | | | | | | | | | | | We will begin restructuring the code for check_create so that we can make some important changes. For now, we should just begin to get rid of some goto statements to make things cleaner. This is the first step of a few, which are separated to make them easier to follow. This step should just be a code refactor. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
| * mtd: nand: fix styleBrian Norris2011-09-111-14/+14
| | | | | | | | | | | | | | | | | | Remove some extra spaces Consistently use '0x' prefix for bitfield-like constants Spelling: "aplies" -> "applies" Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
| * mtd: nand: remove unnecessary variableBrian Norris2011-09-111-5/+3
| | | | | | | | | | | | | | `writeops' is unnecessary in the function `nand_update_bbt()' Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
| * mtd: nand: do not ignore all ECC errorsBrian Norris2011-09-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a few reasons not to ignore ECC errors here. First, mtd->read_oob is being called in raw mode, so there should be no error correction in the first place. Second, if we change this such that there *is* error correction in this function, then we will want to pass the error message upward. In fact, the code I introduced to "ignore ECC errors" would have been better if it had just placed this test down in `scan_block_full()' in the first place. We would like to ignore ECC errors when we are simply checking for bad block markers (e.g., factory marked), but we may not want to ignore ECC errors when scanning OOB for a flash-based BBT pattern (in `scan_read_raw()'; note that the return codes from `scan_read_raw()' are not actually handled yet). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
OpenPOWER on IntegriCloud