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