xref: /openbmc/u-boot/drivers/mtd/ubi/Kconfig (revision d9b23e26)
1menu "UBI support"
2
3config MTD_UBI
4	bool "Enable UBI - Unsorted block images"
5	select CRC32
6	select RBTREE
7	select MTD_PARTITIONS
8	help
9	  UBI is a software layer above MTD layer which admits of LVM-like
10	  logical volumes on top of MTD devices, hides some complexities of
11	  flash chips like wear and bad blocks and provides some other useful
12	  capabilities. Please, consult the MTD web site for more details
13	  (www.linux-mtd.infradead.org).
14
15if MTD_UBI
16
17config MTD_UBI_WL_THRESHOLD
18	int "UBI wear-leveling threshold"
19	default 4096
20	range 2 65536
21	help
22	  This parameter defines the maximum difference between the highest
23	  erase counter value and the lowest erase counter value of eraseblocks
24	  of UBI devices. When this threshold is exceeded, UBI starts performing
25	  wear leveling by means of moving data from eraseblock with low erase
26	  counter to eraseblocks with high erase counter.
27
28	  The default value should be OK for SLC NAND flashes, NOR flashes and
29	  other flashes which have eraseblock life-cycle 100000 or more.
30	  However, in case of MLC NAND flashes which typically have eraseblock
31	  life-cycle less than 10000, the threshold should be lessened (e.g.,
32	  to 128 or 256, although it does not have to be power of 2).
33
34config MTD_UBI_BEB_LIMIT
35	int "Maximum expected bad eraseblock count per 1024 eraseblocks"
36	default 20
37	range 0 768
38	help
39	  This option specifies the maximum bad physical eraseblocks UBI
40	  expects on the MTD device (per 1024 eraseblocks). If the underlying
41	  flash does not admit of bad eraseblocks (e.g. NOR flash), this value
42	  is ignored.
43
44	  NAND datasheets often specify the minimum and maximum NVM (Number of
45	  Valid Blocks) for the flashes' endurance lifetime. The maximum
46	  expected bad eraseblocks per 1024 eraseblocks then can be calculated
47	  as "1024 * (1 - MinNVB / MaxNVB)", which gives 20 for most NANDs
48	  (MaxNVB is basically the total count of eraseblocks on the chip).
49
50	  To put it differently, if this value is 20, UBI will try to reserve
51	  about 1.9% of physical eraseblocks for bad blocks handling. And that
52	  will be 1.9% of eraseblocks on the entire NAND chip, not just the MTD
53	  partition UBI attaches. This means that if you have, say, a NAND
54	  flash chip admits maximum 40 bad eraseblocks, and it is split on two
55	  MTD partitions of the same size, UBI will reserve 40 eraseblocks when
56	  attaching a partition.
57
58	  This option can be overridden by the "mtd=" UBI module parameter or
59	  by the "attach" ioctl.
60
61	  Leave the default value if unsure.
62
63config MTD_UBI_FASTMAP
64	bool "UBI Fastmap (Experimental feature)"
65	default n
66	help
67	   Important: this feature is experimental so far and the on-flash
68	   format for fastmap may change in the next kernel versions
69
70	   Fastmap is a mechanism which allows attaching an UBI device
71	   in nearly constant time. Instead of scanning the whole MTD device it
72	   only has to locate a checkpoint (called fastmap) on the device.
73	   The on-flash fastmap contains all information needed to attach
74	   the device. Using fastmap makes only sense on large devices where
75	   attaching by scanning takes long. UBI will not automatically install
76	   a fastmap on old images, but you can set the UBI module parameter
77	   fm_autoconvert to 1 if you want so. Please note that fastmap-enabled
78	   images are still usable with UBI implementations without
79	   fastmap support. On typical flash devices the whole fastmap fits
80	   into one PEB. UBI will reserve PEBs to hold two fastmaps.
81
82	   If in doubt, say "N".
83
84config MTD_UBI_FASTMAP_AUTOCONVERT
85	int "enable UBI Fastmap autoconvert"
86	depends on MTD_UBI_FASTMAP
87	default 0
88	help
89	  Set this parameter to enable fastmap automatically on images
90	  without a fastmap.
91
92config MTD_UBI_FM_DEBUG
93	int "Enable UBI fastmap debug"
94	depends on MTD_UBI_FASTMAP
95	default 0
96	help
97	  Enable UBI fastmap debug
98
99endif # MTD_UBI
100endmenu # "Enable UBI - Unsorted block images"
101