remarkable-linux/drivers/mtd
Richard Genoud ba4087e956 UBI: use the whole MTD device size to get bad_peb_limit
On NAND flash devices, UBI reserves some physical erase blocks (PEB) for
bad block handling. Today, the number of reserved PEB can only be set as a
percentage of the total number of PEB in each MTD partition. For example, for a
NAND flash with 128KiB PEB, 2 MTD partition of 20MiB (mtd0) and 100MiB (mtd1)
and 2% reserved PEB:
 - the UBI device on mtd0 will have 2 PEB reserved
 - the UBI device on mtd1 will have 16 PEB reserved

The problem with this behaviour is that NAND flash manufacturers give a
minimum number of valid block (NVB) during the endurance life of the
device, e.g.:

Parameter             Symbol    Min    Max    Unit      Notes
--------------------------------------------------------------
Valid block number     NVB     1004    1024   Blocks     1

From this number we can deduce the maximum number of bad PEB that a device will
contain during its endurance life: a 128MiB NAND flash (1024 PEB) will not have
less than 20 bad blocks during the flash endurance life.

But the manufacturer doesn't tell where those bad block will appear. He doesn't
say either if they will be equally disposed on the whole device (and I'm pretty
sure they won't). So, according to the datasheets, we should reserve the
maximum number of bad PEB for each UBI device (worst case scenario: 20 bad
blocks appears on the smallest MTD partition).

So this patch make UBI use the whole MTD device size to calculate the maximum
bad expected eraseblocks.

The Kconfig option is in per1024 blocks, thus it can have a default value of 20
which is *very* common for NAND devices.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-09-04 09:39:00 +03:00
..
chips mtd: cfi_cmdset_0002: Slight cleanup of fixup messages 2012-05-13 23:34:36 -05:00
devices - More robust parsing especially of xattr data in JFFS2 2012-06-01 16:55:42 -07:00
lpddr mtd: lpddr: replace open-coded ARRAY_SIZE with macro 2012-05-13 22:47:31 -05:00
maps mtd/uclinux: Use generic __bss_stop instead of _ebss 2012-06-27 09:59:43 +02:00
nand Merge branch 'testing/new-warnings' into fixes 2012-08-10 12:28:57 +02:00
onenand mtd: driver _read() returns max_bitflips; mtd_read() returns -EUCLEAN 2012-05-13 23:14:23 -05:00
tests
ubi UBI: use the whole MTD device size to get bad_peb_limit 2012-09-04 09:39:00 +03:00
afs.c
ar7part.c
bcm63xxpart.c mtd: bcm63xxpart: handle Broadcom partition order 2012-05-13 22:55:03 -05:00
cmdlinepart.c mtd: cmdlinepart: fix commentary 2012-05-13 23:03:36 -05:00
ftl.c
inftlcore.c mtd: add leading underscore to all mtd functions 2012-03-27 00:20:01 +01:00
inftlmount.c
Kconfig mtd: of_parts: fix breakage in Kconfig 2012-06-01 20:06:59 +01:00
Makefile
mtd_blkdevs.c mtd: mtdblock: call mtd_sync() only if opened for write 2012-03-27 00:11:11 +01:00
mtdblock.c mtd: mtdblock: call mtd_sync() only if opened for write 2012-03-27 00:11:11 +01:00
mtdblock_ro.c
mtdchar.c mtd: fix oops in dataflash driver 2012-05-07 20:29:50 +01:00
mtdconcat.c mtd: unify initialization of erase_info->fail_addr 2012-03-27 01:02:24 +01:00
mtdcore.c mtd: driver _read() returns max_bitflips; mtd_read() returns -EUCLEAN 2012-05-13 23:14:23 -05:00
mtdcore.h
mtdoops.c kmsg - kmsg_dump() use iterator to receive log buffer content 2012-06-15 14:53:59 -07:00
mtdpart.c mtd: mtdparts: introduce mtd_get_device_size 2012-09-04 09:38:58 +03:00
mtdsuper.c VFS: Pass mount flags to sget() 2012-07-14 16:38:34 +04:00
mtdswap.c
nftlcore.c mtd: nftlcore: remove out-of-date and now irrelevant piece of code 2012-03-27 00:24:03 +01:00
nftlmount.c
ofpart.c
redboot.c mtd: redboot: remove useless code 2012-03-27 00:24:14 +01:00
rfd_ftl.c
sm_ftl.c mtd: sm_ftl: fix typo in major number. 2012-03-27 01:01:26 +01:00
sm_ftl.h
ssfdc.c