xref: /rk3399_rockchip-uboot/drivers/mtd/ubi/Kconfig (revision f8dc5a0f9b4faf6b9633e1d128885eee0f792a2b)
18f2fe0c8SHeiko Schochermenu "UBI support"
28f2fe0c8SHeiko Schocher
38f2fe0c8SHeiko Schocherconfig MTD_UBI
48f2fe0c8SHeiko Schocher	bool "Enable UBI - Unsorted block images"
58f2fe0c8SHeiko Schocher	select CRC32
6fc94f209SKarl Beldan	select RBTREE
7*f8dc5a0fSKarl Beldan	select MTD_PARTITIONS
88f2fe0c8SHeiko Schocher	help
98f2fe0c8SHeiko Schocher	  UBI is a software layer above MTD layer which admits of LVM-like
108f2fe0c8SHeiko Schocher	  logical volumes on top of MTD devices, hides some complexities of
118f2fe0c8SHeiko Schocher	  flash chips like wear and bad blocks and provides some other useful
128f2fe0c8SHeiko Schocher	  capabilities. Please, consult the MTD web site for more details
138f2fe0c8SHeiko Schocher	  (www.linux-mtd.infradead.org).
148f2fe0c8SHeiko Schocher
158f2fe0c8SHeiko Schocherif MTD_UBI
168f2fe0c8SHeiko Schocher
178f2fe0c8SHeiko Schocherconfig MTD_UBI_WL_THRESHOLD
188f2fe0c8SHeiko Schocher	int "UBI wear-leveling threshold"
198f2fe0c8SHeiko Schocher	default 4096
208f2fe0c8SHeiko Schocher	range 2 65536
218f2fe0c8SHeiko Schocher	help
228f2fe0c8SHeiko Schocher	  This parameter defines the maximum difference between the highest
238f2fe0c8SHeiko Schocher	  erase counter value and the lowest erase counter value of eraseblocks
248f2fe0c8SHeiko Schocher	  of UBI devices. When this threshold is exceeded, UBI starts performing
258f2fe0c8SHeiko Schocher	  wear leveling by means of moving data from eraseblock with low erase
268f2fe0c8SHeiko Schocher	  counter to eraseblocks with high erase counter.
278f2fe0c8SHeiko Schocher
288f2fe0c8SHeiko Schocher	  The default value should be OK for SLC NAND flashes, NOR flashes and
298f2fe0c8SHeiko Schocher	  other flashes which have eraseblock life-cycle 100000 or more.
308f2fe0c8SHeiko Schocher	  However, in case of MLC NAND flashes which typically have eraseblock
318f2fe0c8SHeiko Schocher	  life-cycle less than 10000, the threshold should be lessened (e.g.,
328f2fe0c8SHeiko Schocher	  to 128 or 256, although it does not have to be power of 2).
338f2fe0c8SHeiko Schocher
348f2fe0c8SHeiko Schocherconfig MTD_UBI_BEB_LIMIT
358f2fe0c8SHeiko Schocher	int "Maximum expected bad eraseblock count per 1024 eraseblocks"
368f2fe0c8SHeiko Schocher	default 20
378f2fe0c8SHeiko Schocher	range 0 768
388f2fe0c8SHeiko Schocher	help
398f2fe0c8SHeiko Schocher	  This option specifies the maximum bad physical eraseblocks UBI
408f2fe0c8SHeiko Schocher	  expects on the MTD device (per 1024 eraseblocks). If the underlying
418f2fe0c8SHeiko Schocher	  flash does not admit of bad eraseblocks (e.g. NOR flash), this value
428f2fe0c8SHeiko Schocher	  is ignored.
438f2fe0c8SHeiko Schocher
448f2fe0c8SHeiko Schocher	  NAND datasheets often specify the minimum and maximum NVM (Number of
458f2fe0c8SHeiko Schocher	  Valid Blocks) for the flashes' endurance lifetime. The maximum
468f2fe0c8SHeiko Schocher	  expected bad eraseblocks per 1024 eraseblocks then can be calculated
478f2fe0c8SHeiko Schocher	  as "1024 * (1 - MinNVB / MaxNVB)", which gives 20 for most NANDs
488f2fe0c8SHeiko Schocher	  (MaxNVB is basically the total count of eraseblocks on the chip).
498f2fe0c8SHeiko Schocher
508f2fe0c8SHeiko Schocher	  To put it differently, if this value is 20, UBI will try to reserve
518f2fe0c8SHeiko Schocher	  about 1.9% of physical eraseblocks for bad blocks handling. And that
528f2fe0c8SHeiko Schocher	  will be 1.9% of eraseblocks on the entire NAND chip, not just the MTD
538f2fe0c8SHeiko Schocher	  partition UBI attaches. This means that if you have, say, a NAND
548f2fe0c8SHeiko Schocher	  flash chip admits maximum 40 bad eraseblocks, and it is split on two
558f2fe0c8SHeiko Schocher	  MTD partitions of the same size, UBI will reserve 40 eraseblocks when
568f2fe0c8SHeiko Schocher	  attaching a partition.
578f2fe0c8SHeiko Schocher
588f2fe0c8SHeiko Schocher	  This option can be overridden by the "mtd=" UBI module parameter or
598f2fe0c8SHeiko Schocher	  by the "attach" ioctl.
608f2fe0c8SHeiko Schocher
618f2fe0c8SHeiko Schocher	  Leave the default value if unsure.
628f2fe0c8SHeiko Schocher
638f2fe0c8SHeiko Schocherconfig MTD_UBI_FASTMAP
648f2fe0c8SHeiko Schocher	bool "UBI Fastmap (Experimental feature)"
658f2fe0c8SHeiko Schocher	default n
668f2fe0c8SHeiko Schocher	help
678f2fe0c8SHeiko Schocher	   Important: this feature is experimental so far and the on-flash
688f2fe0c8SHeiko Schocher	   format for fastmap may change in the next kernel versions
698f2fe0c8SHeiko Schocher
708f2fe0c8SHeiko Schocher	   Fastmap is a mechanism which allows attaching an UBI device
718f2fe0c8SHeiko Schocher	   in nearly constant time. Instead of scanning the whole MTD device it
728f2fe0c8SHeiko Schocher	   only has to locate a checkpoint (called fastmap) on the device.
738f2fe0c8SHeiko Schocher	   The on-flash fastmap contains all information needed to attach
748f2fe0c8SHeiko Schocher	   the device. Using fastmap makes only sense on large devices where
758f2fe0c8SHeiko Schocher	   attaching by scanning takes long. UBI will not automatically install
768f2fe0c8SHeiko Schocher	   a fastmap on old images, but you can set the UBI module parameter
778f2fe0c8SHeiko Schocher	   fm_autoconvert to 1 if you want so. Please note that fastmap-enabled
788f2fe0c8SHeiko Schocher	   images are still usable with UBI implementations without
798f2fe0c8SHeiko Schocher	   fastmap support. On typical flash devices the whole fastmap fits
808f2fe0c8SHeiko Schocher	   into one PEB. UBI will reserve PEBs to hold two fastmaps.
818f2fe0c8SHeiko Schocher
828f2fe0c8SHeiko Schocher	   If in doubt, say "N".
838f2fe0c8SHeiko Schocher
848f2fe0c8SHeiko Schocherconfig MTD_UBI_FASTMAP_AUTOCONVERT
858f2fe0c8SHeiko Schocher	int "enable UBI Fastmap autoconvert"
868f2fe0c8SHeiko Schocher	depends on MTD_UBI_FASTMAP
878f2fe0c8SHeiko Schocher	default 0
888f2fe0c8SHeiko Schocher	help
898f2fe0c8SHeiko Schocher	  Set this parameter to enable fastmap automatically on images
908f2fe0c8SHeiko Schocher	  without a fastmap.
918f2fe0c8SHeiko Schocher
928f2fe0c8SHeiko Schocherconfig MTD_UBI_FM_DEBUG
938f2fe0c8SHeiko Schocher	int "Enable UBI fastmap debug"
948f2fe0c8SHeiko Schocher	depends on MTD_UBI_FASTMAP
958f2fe0c8SHeiko Schocher	default 0
968f2fe0c8SHeiko Schocher	help
978f2fe0c8SHeiko Schocher	  Enable UBI fastmap debug
988f2fe0c8SHeiko Schocher
998f2fe0c8SHeiko Schocherendif # MTD_UBI
1008f2fe0c8SHeiko Schocherendmenu # "Enable UBI - Unsorted block images"
101