1What:		/sys/class/mtd/
2Date:		April 2009
3KernelVersion:	2.6.29
4Contact:	linux-mtd@lists.infradead.org
5Description:
6		The mtd/ class subdirectory belongs to the MTD subsystem
7		(MTD core).
8
9What:		/sys/class/mtd/mtdX/
10Date:		April 2009
11KernelVersion:	2.6.29
12Contact:	linux-mtd@lists.infradead.org
13Description:
14		The /sys/class/mtd/mtd{0,1,2,3,...} directories correspond
15		to each /dev/mtdX character device.  These may represent
16		physical/simulated flash devices, partitions on a flash
17		device, or concatenated flash devices.
18
19What:		/sys/class/mtd/mtdXro/
20Date:		April 2009
21KernelVersion:	2.6.29
22Contact:	linux-mtd@lists.infradead.org
23Description:
24		These directories provide the corresponding read-only device
25		nodes for /sys/class/mtd/mtdX/ .
26
27What:		/sys/class/mtd/mtdX/dev
28Date:		April 2009
29KernelVersion:	2.6.29
30Contact:	linux-mtd@lists.infradead.org
31Description:
32		Major and minor numbers of the character device corresponding
33		to this MTD device (in <major>:<minor> format).  This is the
34		read-write device so <minor> will be even.
35
36What:		/sys/class/mtd/mtdXro/dev
37Date:		April 2009
38KernelVersion:	2.6.29
39Contact:	linux-mtd@lists.infradead.org
40Description:
41		Major and minor numbers of the character device corresponding
42		to the read-only variant of the MTD device (in
43		<major>:<minor> format).  In this case <minor> will be odd.
44
45What:		/sys/class/mtd/mtdX/erasesize
46Date:		April 2009
47KernelVersion:	2.6.29
48Contact:	linux-mtd@lists.infradead.org
49Description:
50		"Major" erase size for the device.  If numeraseregions is
51		zero, this is the eraseblock size for the entire device.
52		Otherwise, the MEMGETREGIONCOUNT/MEMGETREGIONINFO ioctls
53		can be used to determine the actual eraseblock layout.
54
55What:		/sys/class/mtd/mtdX/flags
56Date:		April 2009
57KernelVersion:	2.6.29
58Contact:	linux-mtd@lists.infradead.org
59Description:
60		A hexadecimal value representing the device flags, ORed
61		together:
62
63		0x0400: MTD_WRITEABLE - device is writable
64		0x0800: MTD_BIT_WRITEABLE - single bits can be flipped
65		0x1000: MTD_NO_ERASE - no erase necessary
66		0x2000: MTD_POWERUP_LOCK - always locked after reset
67
68What:		/sys/class/mtd/mtdX/name
69Date:		April 2009
70KernelVersion:	2.6.29
71Contact:	linux-mtd@lists.infradead.org
72Description:
73		A human-readable ASCII name for the device or partition.
74		This will match the name in /proc/mtd .
75
76What:		/sys/class/mtd/mtdX/numeraseregions
77Date:		April 2009
78KernelVersion:	2.6.29
79Contact:	linux-mtd@lists.infradead.org
80Description:
81		For devices that have variable eraseblock sizes, this
82		provides the total number of erase regions.  Otherwise,
83		it will read back as zero.
84
85What:		/sys/class/mtd/mtdX/oobsize
86Date:		April 2009
87KernelVersion:	2.6.29
88Contact:	linux-mtd@lists.infradead.org
89Description:
90		Number of OOB bytes per page.
91
92What:		/sys/class/mtd/mtdX/size
93Date:		April 2009
94KernelVersion:	2.6.29
95Contact:	linux-mtd@lists.infradead.org
96Description:
97		Total size of the device/partition, in bytes.
98
99What:		/sys/class/mtd/mtdX/type
100Date:		April 2009
101KernelVersion:	2.6.29
102Contact:	linux-mtd@lists.infradead.org
103Description:
104		One of the following ASCII strings, representing the device
105		type:
106
107		absent, ram, rom, nor, nand, mlc-nand, dataflash, ubi, unknown
108
109What:		/sys/class/mtd/mtdX/writesize
110Date:		April 2009
111KernelVersion:	2.6.29
112Contact:	linux-mtd@lists.infradead.org
113Description:
114		Minimal writable flash unit size.  This will always be
115		a positive integer.
116
117		In the case of NOR flash it is 1 (even though individual
118		bits can be cleared).
119
120		In the case of NAND flash it is one NAND page (or a
121		half page, or a quarter page).
122
123		In the case of ECC NOR, it is the ECC block size.
124
125What:		/sys/class/mtd/mtdX/ecc_strength
126Date:		April 2012
127KernelVersion:	3.4
128Contact:	linux-mtd@lists.infradead.org
129Description:
130		Maximum number of bit errors that the device is capable of
131		correcting within each region covering an ECC step (see
132		ecc_step_size).  This will always be a non-negative integer.
133
134		In the case of devices lacking any ECC capability, it is 0.
135
136What:		/sys/class/mtd/mtdX/bitflip_threshold
137Date:		April 2012
138KernelVersion:	3.4
139Contact:	linux-mtd@lists.infradead.org
140Description:
141		This allows the user to examine and adjust the criteria by which
142		mtd returns -EUCLEAN from mtd_read() and mtd_read_oob().  If the
143		maximum number of bit errors that were corrected on any single
144		region comprising an ecc step (as reported by the driver) equals
145		or exceeds this value, -EUCLEAN is returned.  Otherwise, absent
146		an error, 0 is returned.  Higher layers (e.g., UBI) use this
147		return code as an indication that an erase block may be
148		degrading and should be scrutinized as a candidate for being
149		marked as bad.
150
151		The initial value may be specified by the flash device driver.
152		If not, then the default value is ecc_strength.
153
154		The introduction of this feature brings a subtle change to the
155		meaning of the -EUCLEAN return code.  Previously, it was
156		interpreted to mean simply "one or more bit errors were
157		corrected".  Its new interpretation can be phrased as "a
158		dangerously high number of bit errors were corrected on one or
159		more regions comprising an ecc step".  The precise definition of
160		"dangerously high" can be adjusted by the user with
161		bitflip_threshold.  Users are discouraged from doing this,
162		however, unless they know what they are doing and have intimate
163		knowledge of the properties of their device.  Broadly speaking,
164		bitflip_threshold should be low enough to detect genuine erase
165		block degradation, but high enough to avoid the consequences of
166		a persistent return value of -EUCLEAN on devices where sticky
167		bitflips occur.  Note that if bitflip_threshold exceeds
168		ecc_strength, -EUCLEAN is never returned by the read operations.
169		Conversely, if bitflip_threshold is zero, -EUCLEAN is always
170		returned, absent a hard error.
171
172		This is generally applicable only to NAND flash devices with ECC
173		capability.  It is ignored on devices lacking ECC capability;
174		i.e., devices for which ecc_strength is zero.
175
176What:		/sys/class/mtd/mtdX/ecc_step_size
177Date:		May 2013
178KernelVersion:	3.10
179Contact:	linux-mtd@lists.infradead.org
180Description:
181		The size of a single region covered by ECC, known as the ECC
182		step.  Devices may have several equally sized ECC steps within
183		each writesize region.
184
185		It will always be a non-negative integer.  In the case of
186		devices lacking any ECC capability, it is 0.
187
188What:		/sys/class/mtd/mtdX/ecc_failures
189Date:		June 2014
190KernelVersion:	3.17
191Contact:	linux-mtd@lists.infradead.org
192Description:
193		The number of failures reported by this device's ECC. Typically,
194		these failures are associated with failed read operations.
195
196		It will always be a non-negative integer.  In the case of
197		devices lacking any ECC capability, it is 0.
198
199What:		/sys/class/mtd/mtdX/corrected_bits
200Date:		June 2014
201KernelVersion:	3.17
202Contact:	linux-mtd@lists.infradead.org
203Description:
204		The number of bits that have been corrected by means of the
205		device's ECC.
206
207		It will always be a non-negative integer.  In the case of
208		devices lacking any ECC capability, it is 0.
209
210What:		/sys/class/mtd/mtdX/bad_blocks
211Date:		June 2014
212KernelVersion:	3.17
213Contact:	linux-mtd@lists.infradead.org
214Description:
215		The number of blocks marked as bad, if any, in this partition.
216
217What:		/sys/class/mtd/mtdX/bbt_blocks
218Date:		June 2014
219KernelVersion:	3.17
220Contact:	linux-mtd@lists.infradead.org
221Description:
222		The number of blocks that are marked as reserved, if any, in
223		this partition. These are typically used to store the in-flash
224		bad block table (BBT).
225
226What:		/sys/class/mtd/mtdX/offset
227Date:		March 2015
228KernelVersion:	4.1
229Contact:	linux-mtd@lists.infradead.org
230Description:
231		For a partition, the offset of that partition from the start
232		of the parent (another partition or a flash device) in bytes.
233		This attribute is absent on flash devices, so it can be used
234		to distinguish them from partitions.
235
236What:		/sys/class/mtd/mtdX/oobavail
237Date:		April 2018
238KernelVersion:	4.16
239Contact:	linux-mtd@lists.infradead.org
240Description:
241		Number of bytes available for a client to place data into
242		the out of band area.
243