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