xref: /linux/Documentation/ABI/testing/sysfs-class-mtd (revision a62c24d75529118d10c45350c3b75715d52ff574)
119fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/
219fe7f1aSKevin CernekeeDate:		April 2009
319fe7f1aSKevin CernekeeKernelVersion:	2.6.29
419fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
519fe7f1aSKevin CernekeeDescription:
619fe7f1aSKevin Cernekee		The mtd/ class subdirectory belongs to the MTD subsystem
719fe7f1aSKevin Cernekee		(MTD core).
819fe7f1aSKevin Cernekee
919fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdX/
1019fe7f1aSKevin CernekeeDate:		April 2009
1119fe7f1aSKevin CernekeeKernelVersion:	2.6.29
1219fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
1319fe7f1aSKevin CernekeeDescription:
1419fe7f1aSKevin Cernekee		The /sys/class/mtd/mtd{0,1,2,3,...} directories correspond
1519fe7f1aSKevin Cernekee		to each /dev/mtdX character device.  These may represent
1619fe7f1aSKevin Cernekee		physical/simulated flash devices, partitions on a flash
17880113efSArtem Bityutskiy		device, or concatenated flash devices.
1819fe7f1aSKevin Cernekee
1919fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdXro/
2019fe7f1aSKevin CernekeeDate:		April 2009
2119fe7f1aSKevin CernekeeKernelVersion:	2.6.29
2219fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
2319fe7f1aSKevin CernekeeDescription:
2419fe7f1aSKevin Cernekee		These directories provide the corresponding read-only device
25880113efSArtem Bityutskiy		nodes for /sys/class/mtd/mtdX/ .
2619fe7f1aSKevin Cernekee
2719fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdX/dev
2819fe7f1aSKevin CernekeeDate:		April 2009
2919fe7f1aSKevin CernekeeKernelVersion:	2.6.29
3019fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
3119fe7f1aSKevin CernekeeDescription:
3219fe7f1aSKevin Cernekee		Major and minor numbers of the character device corresponding
3319fe7f1aSKevin Cernekee		to this MTD device (in <major>:<minor> format).  This is the
3419fe7f1aSKevin Cernekee		read-write device so <minor> will be even.
3519fe7f1aSKevin Cernekee
3619fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdXro/dev
3719fe7f1aSKevin CernekeeDate:		April 2009
3819fe7f1aSKevin CernekeeKernelVersion:	2.6.29
3919fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
4019fe7f1aSKevin CernekeeDescription:
4119fe7f1aSKevin Cernekee		Major and minor numbers of the character device corresponding
4219fe7f1aSKevin Cernekee		to the read-only variant of thie MTD device (in
4319fe7f1aSKevin Cernekee		<major>:<minor> format).  In this case <minor> will be odd.
4419fe7f1aSKevin Cernekee
4519fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdX/erasesize
4619fe7f1aSKevin CernekeeDate:		April 2009
4719fe7f1aSKevin CernekeeKernelVersion:	2.6.29
4819fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
4919fe7f1aSKevin CernekeeDescription:
5019fe7f1aSKevin Cernekee		"Major" erase size for the device.  If numeraseregions is
5119fe7f1aSKevin Cernekee		zero, this is the eraseblock size for the entire device.
5219fe7f1aSKevin Cernekee		Otherwise, the MEMGETREGIONCOUNT/MEMGETREGIONINFO ioctls
5319fe7f1aSKevin Cernekee		can be used to determine the actual eraseblock layout.
5419fe7f1aSKevin Cernekee
5519fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdX/flags
5619fe7f1aSKevin CernekeeDate:		April 2009
5719fe7f1aSKevin CernekeeKernelVersion:	2.6.29
5819fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
5919fe7f1aSKevin CernekeeDescription:
6019fe7f1aSKevin Cernekee		A hexadecimal value representing the device flags, ORed
6119fe7f1aSKevin Cernekee		together:
6219fe7f1aSKevin Cernekee
6319fe7f1aSKevin Cernekee		0x0400: MTD_WRITEABLE - device is writable
6419fe7f1aSKevin Cernekee		0x0800: MTD_BIT_WRITEABLE - single bits can be flipped
6519fe7f1aSKevin Cernekee		0x1000: MTD_NO_ERASE - no erase necessary
6619fe7f1aSKevin Cernekee		0x2000: MTD_POWERUP_LOCK - always locked after reset
6719fe7f1aSKevin Cernekee
6819fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdX/name
6919fe7f1aSKevin CernekeeDate:		April 2009
7019fe7f1aSKevin CernekeeKernelVersion:	2.6.29
7119fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
7219fe7f1aSKevin CernekeeDescription:
7319fe7f1aSKevin Cernekee		A human-readable ASCII name for the device or partition.
7419fe7f1aSKevin Cernekee		This will match the name in /proc/mtd .
7519fe7f1aSKevin Cernekee
7619fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdX/numeraseregions
7719fe7f1aSKevin CernekeeDate:		April 2009
7819fe7f1aSKevin CernekeeKernelVersion:	2.6.29
7919fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
8019fe7f1aSKevin CernekeeDescription:
8119fe7f1aSKevin Cernekee		For devices that have variable eraseblock sizes, this
8219fe7f1aSKevin Cernekee		provides the total number of erase regions.  Otherwise,
8319fe7f1aSKevin Cernekee		it will read back as zero.
8419fe7f1aSKevin Cernekee
8519fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdX/oobsize
8619fe7f1aSKevin CernekeeDate:		April 2009
8719fe7f1aSKevin CernekeeKernelVersion:	2.6.29
8819fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
8919fe7f1aSKevin CernekeeDescription:
9019fe7f1aSKevin Cernekee		Number of OOB bytes per page.
9119fe7f1aSKevin Cernekee
9219fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdX/size
9319fe7f1aSKevin CernekeeDate:		April 2009
9419fe7f1aSKevin CernekeeKernelVersion:	2.6.29
9519fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
9619fe7f1aSKevin CernekeeDescription:
9719fe7f1aSKevin Cernekee		Total size of the device/partition, in bytes.
9819fe7f1aSKevin Cernekee
9919fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdX/type
10019fe7f1aSKevin CernekeeDate:		April 2009
10119fe7f1aSKevin CernekeeKernelVersion:	2.6.29
10219fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
10319fe7f1aSKevin CernekeeDescription:
10419fe7f1aSKevin Cernekee		One of the following ASCII strings, representing the device
10519fe7f1aSKevin Cernekee		type:
10619fe7f1aSKevin Cernekee
107f4837246SHuang Shijie		absent, ram, rom, nor, nand, mlc-nand, dataflash, ubi, unknown
10819fe7f1aSKevin Cernekee
10919fe7f1aSKevin CernekeeWhat:		/sys/class/mtd/mtdX/writesize
11019fe7f1aSKevin CernekeeDate:		April 2009
11119fe7f1aSKevin CernekeeKernelVersion:	2.6.29
11219fe7f1aSKevin CernekeeContact:	linux-mtd@lists.infradead.org
11319fe7f1aSKevin CernekeeDescription:
11419fe7f1aSKevin Cernekee		Minimal writable flash unit size.  This will always be
11519fe7f1aSKevin Cernekee		a positive integer.
11619fe7f1aSKevin Cernekee
11719fe7f1aSKevin Cernekee		In the case of NOR flash it is 1 (even though individual
11819fe7f1aSKevin Cernekee		bits can be cleared).
11919fe7f1aSKevin Cernekee
12019fe7f1aSKevin Cernekee		In the case of NAND flash it is one NAND page (or a
12119fe7f1aSKevin Cernekee		half page, or a quarter page).
12219fe7f1aSKevin Cernekee
12319fe7f1aSKevin Cernekee		In the case of ECC NOR, it is the ECC block size.
124a9b672e8SMike Dunn
125a9b672e8SMike DunnWhat:		/sys/class/mtd/mtdX/ecc_strength
126a9b672e8SMike DunnDate:		April 2012
127a9b672e8SMike DunnKernelVersion:	3.4
128a9b672e8SMike DunnContact:	linux-mtd@lists.infradead.org
129a9b672e8SMike DunnDescription:
130a9b672e8SMike Dunn		Maximum number of bit errors that the device is capable of
131ed202940SHuang Shijie		correcting within each region covering an ECC step (see
132ed202940SHuang Shijie		ecc_step_size).  This will always be a non-negative integer.
133a9b672e8SMike Dunn
134a9b672e8SMike Dunn		In the case of devices lacking any ECC capability, it is 0.
135d062d4edSMike Dunn
136d062d4edSMike DunnWhat:		/sys/class/mtd/mtdX/bitflip_threshold
137d062d4edSMike DunnDate:		April 2012
138d062d4edSMike DunnKernelVersion:	3.4
139d062d4edSMike DunnContact:	linux-mtd@lists.infradead.org
140d062d4edSMike DunnDescription:
141d062d4edSMike Dunn		This allows the user to examine and adjust the criteria by which
142021796b8SMike Dunn		mtd returns -EUCLEAN from mtd_read() and mtd_read_oob().  If the
143021796b8SMike Dunn		maximum number of bit errors that were corrected on any single
144021796b8SMike Dunn		region comprising an ecc step (as reported by the driver) equals
145021796b8SMike Dunn		or exceeds this value, -EUCLEAN is returned.  Otherwise, absent
146021796b8SMike Dunn		an error, 0 is returned.  Higher layers (e.g., UBI) use this
147021796b8SMike Dunn		return code as an indication that an erase block may be
148021796b8SMike Dunn		degrading and should be scrutinized as a candidate for being
149021796b8SMike Dunn		marked as bad.
150d062d4edSMike Dunn
151d062d4edSMike Dunn		The initial value may be specified by the flash device driver.
152d062d4edSMike Dunn		If not, then the default value is ecc_strength.
153d062d4edSMike Dunn
154d062d4edSMike Dunn		The introduction of this feature brings a subtle change to the
155d062d4edSMike Dunn		meaning of the -EUCLEAN return code.  Previously, it was
156d062d4edSMike Dunn		interpreted to mean simply "one or more bit errors were
157d062d4edSMike Dunn		corrected".  Its new interpretation can be phrased as "a
158d062d4edSMike Dunn		dangerously high number of bit errors were corrected on one or
159d062d4edSMike Dunn		more regions comprising an ecc step".  The precise definition of
160d062d4edSMike Dunn		"dangerously high" can be adjusted by the user with
161d062d4edSMike Dunn		bitflip_threshold.  Users are discouraged from doing this,
162d062d4edSMike Dunn		however, unless they know what they are doing and have intimate
163d062d4edSMike Dunn		knowledge of the properties of their device.  Broadly speaking,
164d062d4edSMike Dunn		bitflip_threshold should be low enough to detect genuine erase
165d062d4edSMike Dunn		block degradation, but high enough to avoid the consequences of
166d062d4edSMike Dunn		a persistent return value of -EUCLEAN on devices where sticky
167d062d4edSMike Dunn		bitflips occur.  Note that if bitflip_threshold exceeds
168021796b8SMike Dunn		ecc_strength, -EUCLEAN is never returned by the read operations.
169edbc4540SMike Dunn		Conversely, if bitflip_threshold is zero, -EUCLEAN is always
170edbc4540SMike Dunn		returned, absent a hard error.
171d062d4edSMike Dunn
172d062d4edSMike Dunn		This is generally applicable only to NAND flash devices with ECC
173edbc4540SMike Dunn		capability.  It is ignored on devices lacking ECC capability;
174edbc4540SMike Dunn		i.e., devices for which ecc_strength is zero.
175ed202940SHuang Shijie
176ed202940SHuang ShijieWhat:		/sys/class/mtd/mtdX/ecc_step_size
177ed202940SHuang ShijieDate:		May 2013
178ed202940SHuang ShijieKernelVersion:	3.10
179ed202940SHuang ShijieContact:	linux-mtd@lists.infradead.org
180ed202940SHuang ShijieDescription:
181ed202940SHuang Shijie		The size of a single region covered by ECC, known as the ECC
182ed202940SHuang Shijie		step.  Devices may have several equally sized ECC steps within
183ed202940SHuang Shijie		each writesize region.
184ed202940SHuang Shijie
185ed202940SHuang Shijie		It will always be a non-negative integer.  In the case of
186ed202940SHuang Shijie		devices lacking any ECC capability, it is 0.
187990a3af0SEzequiel Garcia
188990a3af0SEzequiel GarciaWhat:		/sys/class/mtd/mtdX/ecc_failures
189990a3af0SEzequiel GarciaDate:		June 2014
190990a3af0SEzequiel GarciaKernelVersion:	3.17
191990a3af0SEzequiel GarciaContact:	linux-mtd@lists.infradead.org
192990a3af0SEzequiel GarciaDescription:
193990a3af0SEzequiel Garcia		The number of failures reported by this device's ECC. Typically,
194990a3af0SEzequiel Garcia		these failures are associated with failed read operations.
195990a3af0SEzequiel Garcia
196990a3af0SEzequiel Garcia		It will always be a non-negative integer.  In the case of
197990a3af0SEzequiel Garcia		devices lacking any ECC capability, it is 0.
198990a3af0SEzequiel Garcia
199990a3af0SEzequiel GarciaWhat:		/sys/class/mtd/mtdX/corrected_bits
200990a3af0SEzequiel GarciaDate:		June 2014
201990a3af0SEzequiel GarciaKernelVersion:	3.17
202990a3af0SEzequiel GarciaContact:	linux-mtd@lists.infradead.org
203990a3af0SEzequiel GarciaDescription:
204990a3af0SEzequiel Garcia		The number of bits that have been corrected by means of the
205990a3af0SEzequiel Garcia		device's ECC.
206990a3af0SEzequiel Garcia
207990a3af0SEzequiel Garcia		It will always be a non-negative integer.  In the case of
208990a3af0SEzequiel Garcia		devices lacking any ECC capability, it is 0.
209990a3af0SEzequiel Garcia
210990a3af0SEzequiel GarciaWhat:		/sys/class/mtd/mtdX/bad_blocks
211990a3af0SEzequiel GarciaDate:		June 2014
212990a3af0SEzequiel GarciaKernelVersion:	3.17
213990a3af0SEzequiel GarciaContact:	linux-mtd@lists.infradead.org
214990a3af0SEzequiel GarciaDescription:
215990a3af0SEzequiel Garcia		The number of blocks marked as bad, if any, in this partition.
216990a3af0SEzequiel Garcia
217990a3af0SEzequiel GarciaWhat:		/sys/class/mtd/mtdX/bbt_blocks
218990a3af0SEzequiel GarciaDate:		June 2014
219990a3af0SEzequiel GarciaKernelVersion:	3.17
220990a3af0SEzequiel GarciaContact:	linux-mtd@lists.infradead.org
221990a3af0SEzequiel GarciaDescription:
222990a3af0SEzequiel Garcia		The number of blocks that are marked as reserved, if any, in
223990a3af0SEzequiel Garcia		this partition. These are typically used to store the in-flash
224990a3af0SEzequiel Garcia		bad block table (BBT).
225*a62c24d7SDan Ehrenberg
226*a62c24d7SDan EhrenbergWhat:		/sys/class/mtd/mtdX/offset
227*a62c24d7SDan EhrenbergDate:		March 2015
228*a62c24d7SDan EhrenbergKernelVersion:	4.1
229*a62c24d7SDan EhrenbergContact:	linux-mtd@lists.infradead.org
230*a62c24d7SDan EhrenbergDescription:
231*a62c24d7SDan Ehrenberg		For a partition, the offset of that partition from the start
232*a62c24d7SDan Ehrenberg		of the master device in bytes. This attribute is absent on
233*a62c24d7SDan Ehrenberg		main devices, so it can be used to distinguish between
234*a62c24d7SDan Ehrenberg		partitions and devices that aren't partitions.
235