xref: /linux-6.15/drivers/mtd/ubi/Kconfig (revision db7e21c2)
1menuconfig MTD_UBI
2	tristate "Enable UBI - Unsorted block images"
3	select CRC32
4	help
5	  UBI is a software layer above MTD layer which admits of LVM-like
6	  logical volumes on top of MTD devices, hides some complexities of
7	  flash chips like wear and bad blocks and provides some other useful
8	  capabilities. Please, consult the MTD web site for more details
9	  (www.linux-mtd.infradead.org).
10
11if MTD_UBI
12
13config MTD_UBI_WL_THRESHOLD
14	int "UBI wear-leveling threshold"
15	default 4096
16	range 2 65536
17	help
18	  This parameter defines the maximum difference between the highest
19	  erase counter value and the lowest erase counter value of eraseblocks
20	  of UBI devices. When this threshold is exceeded, UBI starts performing
21	  wear leveling by means of moving data from eraseblock with low erase
22	  counter to eraseblocks with high erase counter.
23
24	  The default value should be OK for SLC NAND flashes, NOR flashes and
25	  other flashes which have eraseblock life-cycle 100000 or more.
26	  However, in case of MLC NAND flashes which typically have eraseblock
27	  life-cycle less than 10000, the threshold should be lessened (e.g.,
28	  to 128 or 256, although it does not have to be power of 2).
29
30config MTD_UBI_BEB_LIMIT
31	int "Maximum expected bad eraseblock count per 1024 eraseblocks"
32	default 20
33	range 0 768
34	help
35	  This option specifies the maximum bad physical eraseblocks UBI
36	  expects on the MTD device (per 1024 eraseblocks). If the underlying
37	  flash does not admit of bad eraseblocks (e.g. NOR flash), this value
38	  is ignored.
39
40	  NAND datasheets often specify the minimum and maximum NVM (Number of
41	  Valid Blocks) for the flashes' endurance lifetime. The maximum
42	  expected bad eraseblocks per 1024 eraseblocks then can be calculated
43	  as "1024 * (1 - MinNVB / MaxNVB)", which gives 20 for most NANDs
44	  (MaxNVB is basically the total count of eraseblocks on the chip).
45
46	  To put it differently, if this value is 20, UBI will try to reserve
47	  about 1.9% of physical eraseblocks for bad blocks handling. And that
48	  will be 1.9% of eraseblocks on the entire NAND chip, not just the MTD
49	  partition UBI attaches. This means that if you have, say, a NAND
50	  flash chip admits maximum 40 bad eraseblocks, and it is split on two
51	  MTD partitions of the same size, UBI will reserve 40 eraseblocks when
52	  attaching a partition.
53
54	  This option can be overridden by the "mtd=" UBI module parameter or
55	  by the "attach" ioctl.
56
57	  Leave the default value if unsure.
58
59config MTD_UBI_GLUEBI
60	tristate "MTD devices emulation driver (gluebi)"
61	help
62	   This option enables gluebi - an additional driver which emulates MTD
63	   devices on top of UBI volumes: for each UBI volumes an MTD device is
64	   created, and all I/O to this MTD device is redirected to the UBI
65	   volume. This is handy to make MTD-oriented software (like JFFS2)
66	   work on top of UBI. Do not enable this unless you use legacy
67	   software.
68
69endif # MTD_UBI
70