xref: /openbmc/linux/drivers/mtd/ubi/Kconfig (revision 58e16d792a6a8c6b750f637a4649967fcac853dc)
1*ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
21dd78632SH Hartley Sweetenmenuconfig MTD_UBI
31dd78632SH Hartley Sweeten	tristate "Enable UBI - Unsorted block images"
4801c135cSArtem B. Bityutskiy	select CRC32
5801c135cSArtem B. Bityutskiy	help
62fae1312SAndrew F. Davis	  UBI is a software layer above MTD layer which admits use of LVM-like
7801c135cSArtem B. Bityutskiy	  logical volumes on top of MTD devices, hides some complexities of
8801c135cSArtem B. Bityutskiy	  flash chips like wear and bad blocks and provides some other useful
9801c135cSArtem B. Bityutskiy	  capabilities. Please, consult the MTD web site for more details
10801c135cSArtem B. Bityutskiy	  (www.linux-mtd.infradead.org).
11801c135cSArtem B. Bityutskiy
121dd78632SH Hartley Sweetenif MTD_UBI
131dd78632SH Hartley Sweeten
14801c135cSArtem B. Bityutskiyconfig MTD_UBI_WL_THRESHOLD
15801c135cSArtem B. Bityutskiy	int "UBI wear-leveling threshold"
16801c135cSArtem B. Bityutskiy	default 4096
17801c135cSArtem B. Bityutskiy	range 2 65536
18801c135cSArtem B. Bityutskiy	help
19801c135cSArtem B. Bityutskiy	  This parameter defines the maximum difference between the highest
20801c135cSArtem B. Bityutskiy	  erase counter value and the lowest erase counter value of eraseblocks
21801c135cSArtem B. Bityutskiy	  of UBI devices. When this threshold is exceeded, UBI starts performing
22801c135cSArtem B. Bityutskiy	  wear leveling by means of moving data from eraseblock with low erase
236e0c84e3SArtem Bityutskiy	  counter to eraseblocks with high erase counter.
246e0c84e3SArtem Bityutskiy
256e0c84e3SArtem Bityutskiy	  The default value should be OK for SLC NAND flashes, NOR flashes and
266e0c84e3SArtem Bityutskiy	  other flashes which have eraseblock life-cycle 100000 or more.
276e0c84e3SArtem Bityutskiy	  However, in case of MLC NAND flashes which typically have eraseblock
283f502622SShinya Kuribayashi	  life-cycle less than 10000, the threshold should be lessened (e.g.,
296e0c84e3SArtem Bityutskiy	  to 128 or 256, although it does not have to be power of 2).
30801c135cSArtem B. Bityutskiy
318beeb3bbSShmulik Ladkaniconfig MTD_UBI_BEB_LIMIT
32ba4087e9SRichard Genoud	int "Maximum expected bad eraseblock count per 1024 eraseblocks"
33ba4087e9SRichard Genoud	default 20
34ba4087e9SRichard Genoud	range 0 768
358beeb3bbSShmulik Ladkani	help
368beeb3bbSShmulik Ladkani	  This option specifies the maximum bad physical eraseblocks UBI
37ba4087e9SRichard Genoud	  expects on the MTD device (per 1024 eraseblocks). If the underlying
38ba4087e9SRichard Genoud	  flash does not admit of bad eraseblocks (e.g. NOR flash), this value
39ba4087e9SRichard Genoud	  is ignored.
40ba4087e9SRichard Genoud
41ba4087e9SRichard Genoud	  NAND datasheets often specify the minimum and maximum NVM (Number of
42ba4087e9SRichard Genoud	  Valid Blocks) for the flashes' endurance lifetime. The maximum
43ba4087e9SRichard Genoud	  expected bad eraseblocks per 1024 eraseblocks then can be calculated
44ba4087e9SRichard Genoud	  as "1024 * (1 - MinNVB / MaxNVB)", which gives 20 for most NANDs
45ba4087e9SRichard Genoud	  (MaxNVB is basically the total count of eraseblocks on the chip).
46ba4087e9SRichard Genoud
47ba4087e9SRichard Genoud	  To put it differently, if this value is 20, UBI will try to reserve
48ba4087e9SRichard Genoud	  about 1.9% of physical eraseblocks for bad blocks handling. And that
49ba4087e9SRichard Genoud	  will be 1.9% of eraseblocks on the entire NAND chip, not just the MTD
50ba4087e9SRichard Genoud	  partition UBI attaches. This means that if you have, say, a NAND
51ba4087e9SRichard Genoud	  flash chip admits maximum 40 bad eraseblocks, and it is split on two
52ba4087e9SRichard Genoud	  MTD partitions of the same size, UBI will reserve 40 eraseblocks when
53ba4087e9SRichard Genoud	  attaching a partition.
54ba4087e9SRichard Genoud
55db7e21c2SRichard Genoud	  This option can be overridden by the "mtd=" UBI module parameter or
56db7e21c2SRichard Genoud	  by the "attach" ioctl.
57edac493dSRichard Genoud
588beeb3bbSShmulik Ladkani	  Leave the default value if unsure.
59801c135cSArtem B. Bityutskiy
6076ac66e4SRichard Weinbergerconfig MTD_UBI_FASTMAP
6176ac66e4SRichard Weinberger	bool "UBI Fastmap (Experimental feature)"
6276ac66e4SRichard Weinberger	default n
6376ac66e4SRichard Weinberger	help
6476ac66e4SRichard Weinberger	   Important: this feature is experimental so far and the on-flash
6576ac66e4SRichard Weinberger	   format for fastmap may change in the next kernel versions
6676ac66e4SRichard Weinberger
6776ac66e4SRichard Weinberger	   Fastmap is a mechanism which allows attaching an UBI device
6876ac66e4SRichard Weinberger	   in nearly constant time. Instead of scanning the whole MTD device it
6976ac66e4SRichard Weinberger	   only has to locate a checkpoint (called fastmap) on the device.
7076ac66e4SRichard Weinberger	   The on-flash fastmap contains all information needed to attach
7176ac66e4SRichard Weinberger	   the device. Using fastmap makes only sense on large devices where
7276ac66e4SRichard Weinberger	   attaching by scanning takes long. UBI will not automatically install
7376ac66e4SRichard Weinberger	   a fastmap on old images, but you can set the UBI module parameter
7476ac66e4SRichard Weinberger	   fm_autoconvert to 1 if you want so. Please note that fastmap-enabled
7576ac66e4SRichard Weinberger	   images are still usable with UBI implementations without
7676ac66e4SRichard Weinberger	   fastmap support. On typical flash devices the whole fastmap fits
7776ac66e4SRichard Weinberger	   into one PEB. UBI will reserve PEBs to hold two fastmaps.
7876ac66e4SRichard Weinberger
7976ac66e4SRichard Weinberger	   If in doubt, say "N".
8076ac66e4SRichard Weinberger
81801c135cSArtem B. Bityutskiyconfig MTD_UBI_GLUEBI
822ba3d76aSDmitry Pervushin	tristate "MTD devices emulation driver (gluebi)"
83801c135cSArtem B. Bityutskiy	help
842ba3d76aSDmitry Pervushin	   This option enables gluebi - an additional driver which emulates MTD
852ba3d76aSDmitry Pervushin	   devices on top of UBI volumes: for each UBI volumes an MTD device is
862ba3d76aSDmitry Pervushin	   created, and all I/O to this MTD device is redirected to the UBI
872ba3d76aSDmitry Pervushin	   volume. This is handy to make MTD-oriented software (like JFFS2)
882ba3d76aSDmitry Pervushin	   work on top of UBI. Do not enable this unless you use legacy
892ba3d76aSDmitry Pervushin	   software.
90801c135cSArtem B. Bityutskiy
919d54c8a3SEzequiel Garciaconfig MTD_UBI_BLOCK
929d54c8a3SEzequiel Garcia	bool "Read-only block devices on top of UBI volumes"
939d54c8a3SEzequiel Garcia	default n
9422d3ee5cSEzequiel Garcia	depends on BLOCK
959d54c8a3SEzequiel Garcia	help
969d54c8a3SEzequiel Garcia	   This option enables read-only UBI block devices support. UBI block
979d54c8a3SEzequiel Garcia	   devices will be layered on top of UBI volumes, which means that the
989d54c8a3SEzequiel Garcia	   UBI driver will transparently handle things like bad eraseblocks and
999d54c8a3SEzequiel Garcia	   bit-flips. You can put any block-oriented file system on top of UBI
1009d54c8a3SEzequiel Garcia	   volumes in read-only mode (e.g., ext4), but it is probably most
1019d54c8a3SEzequiel Garcia	   practical for read-only file systems, like squashfs.
1029d54c8a3SEzequiel Garcia
1039d54c8a3SEzequiel Garcia	   When selected, this feature will be built in the UBI driver.
1049d54c8a3SEzequiel Garcia
1059d54c8a3SEzequiel Garcia	   If in doubt, say "N".
1069d54c8a3SEzequiel Garcia
1071dd78632SH Hartley Sweetenendif # MTD_UBI
108