18c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/ 28c2ecf20Sopenharmony_ciDate: April 2009 38c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 48c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 58c2ecf20Sopenharmony_ciDescription: 68c2ecf20Sopenharmony_ci The mtd/ class subdirectory belongs to the MTD subsystem 78c2ecf20Sopenharmony_ci (MTD core). 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/ 108c2ecf20Sopenharmony_ciDate: April 2009 118c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 128c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 138c2ecf20Sopenharmony_ciDescription: 148c2ecf20Sopenharmony_ci The /sys/class/mtd/mtd{0,1,2,3,...} directories correspond 158c2ecf20Sopenharmony_ci to each /dev/mtdX character device. These may represent 168c2ecf20Sopenharmony_ci physical/simulated flash devices, partitions on a flash 178c2ecf20Sopenharmony_ci device, or concatenated flash devices. 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdXro/ 208c2ecf20Sopenharmony_ciDate: April 2009 218c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 228c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 238c2ecf20Sopenharmony_ciDescription: 248c2ecf20Sopenharmony_ci These directories provide the corresponding read-only device 258c2ecf20Sopenharmony_ci nodes for /sys/class/mtd/mtdX/ . 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/dev 288c2ecf20Sopenharmony_ciDate: April 2009 298c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 308c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 318c2ecf20Sopenharmony_ciDescription: 328c2ecf20Sopenharmony_ci Major and minor numbers of the character device corresponding 338c2ecf20Sopenharmony_ci to this MTD device (in <major>:<minor> format). This is the 348c2ecf20Sopenharmony_ci read-write device so <minor> will be even. 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdXro/dev 378c2ecf20Sopenharmony_ciDate: April 2009 388c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 398c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 408c2ecf20Sopenharmony_ciDescription: 418c2ecf20Sopenharmony_ci Major and minor numbers of the character device corresponding 428c2ecf20Sopenharmony_ci to the read-only variant of thie MTD device (in 438c2ecf20Sopenharmony_ci <major>:<minor> format). In this case <minor> will be odd. 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/erasesize 468c2ecf20Sopenharmony_ciDate: April 2009 478c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 488c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 498c2ecf20Sopenharmony_ciDescription: 508c2ecf20Sopenharmony_ci "Major" erase size for the device. If numeraseregions is 518c2ecf20Sopenharmony_ci zero, this is the eraseblock size for the entire device. 528c2ecf20Sopenharmony_ci Otherwise, the MEMGETREGIONCOUNT/MEMGETREGIONINFO ioctls 538c2ecf20Sopenharmony_ci can be used to determine the actual eraseblock layout. 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/flags 568c2ecf20Sopenharmony_ciDate: April 2009 578c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 588c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 598c2ecf20Sopenharmony_ciDescription: 608c2ecf20Sopenharmony_ci A hexadecimal value representing the device flags, ORed 618c2ecf20Sopenharmony_ci together: 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci 0x0400: MTD_WRITEABLE - device is writable 648c2ecf20Sopenharmony_ci 0x0800: MTD_BIT_WRITEABLE - single bits can be flipped 658c2ecf20Sopenharmony_ci 0x1000: MTD_NO_ERASE - no erase necessary 668c2ecf20Sopenharmony_ci 0x2000: MTD_POWERUP_LOCK - always locked after reset 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/name 698c2ecf20Sopenharmony_ciDate: April 2009 708c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 718c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 728c2ecf20Sopenharmony_ciDescription: 738c2ecf20Sopenharmony_ci A human-readable ASCII name for the device or partition. 748c2ecf20Sopenharmony_ci This will match the name in /proc/mtd . 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/numeraseregions 778c2ecf20Sopenharmony_ciDate: April 2009 788c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 798c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 808c2ecf20Sopenharmony_ciDescription: 818c2ecf20Sopenharmony_ci For devices that have variable eraseblock sizes, this 828c2ecf20Sopenharmony_ci provides the total number of erase regions. Otherwise, 838c2ecf20Sopenharmony_ci it will read back as zero. 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/oobsize 868c2ecf20Sopenharmony_ciDate: April 2009 878c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 888c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 898c2ecf20Sopenharmony_ciDescription: 908c2ecf20Sopenharmony_ci Number of OOB bytes per page. 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/size 938c2ecf20Sopenharmony_ciDate: April 2009 948c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 958c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 968c2ecf20Sopenharmony_ciDescription: 978c2ecf20Sopenharmony_ci Total size of the device/partition, in bytes. 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/type 1008c2ecf20Sopenharmony_ciDate: April 2009 1018c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 1028c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 1038c2ecf20Sopenharmony_ciDescription: 1048c2ecf20Sopenharmony_ci One of the following ASCII strings, representing the device 1058c2ecf20Sopenharmony_ci type: 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci absent, ram, rom, nor, nand, mlc-nand, dataflash, ubi, unknown 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/writesize 1108c2ecf20Sopenharmony_ciDate: April 2009 1118c2ecf20Sopenharmony_ciKernelVersion: 2.6.29 1128c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 1138c2ecf20Sopenharmony_ciDescription: 1148c2ecf20Sopenharmony_ci Minimal writable flash unit size. This will always be 1158c2ecf20Sopenharmony_ci a positive integer. 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci In the case of NOR flash it is 1 (even though individual 1188c2ecf20Sopenharmony_ci bits can be cleared). 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci In the case of NAND flash it is one NAND page (or a 1218c2ecf20Sopenharmony_ci half page, or a quarter page). 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci In the case of ECC NOR, it is the ECC block size. 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/ecc_strength 1268c2ecf20Sopenharmony_ciDate: April 2012 1278c2ecf20Sopenharmony_ciKernelVersion: 3.4 1288c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 1298c2ecf20Sopenharmony_ciDescription: 1308c2ecf20Sopenharmony_ci Maximum number of bit errors that the device is capable of 1318c2ecf20Sopenharmony_ci correcting within each region covering an ECC step (see 1328c2ecf20Sopenharmony_ci ecc_step_size). This will always be a non-negative integer. 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci In the case of devices lacking any ECC capability, it is 0. 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/bitflip_threshold 1378c2ecf20Sopenharmony_ciDate: April 2012 1388c2ecf20Sopenharmony_ciKernelVersion: 3.4 1398c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 1408c2ecf20Sopenharmony_ciDescription: 1418c2ecf20Sopenharmony_ci This allows the user to examine and adjust the criteria by which 1428c2ecf20Sopenharmony_ci mtd returns -EUCLEAN from mtd_read() and mtd_read_oob(). If the 1438c2ecf20Sopenharmony_ci maximum number of bit errors that were corrected on any single 1448c2ecf20Sopenharmony_ci region comprising an ecc step (as reported by the driver) equals 1458c2ecf20Sopenharmony_ci or exceeds this value, -EUCLEAN is returned. Otherwise, absent 1468c2ecf20Sopenharmony_ci an error, 0 is returned. Higher layers (e.g., UBI) use this 1478c2ecf20Sopenharmony_ci return code as an indication that an erase block may be 1488c2ecf20Sopenharmony_ci degrading and should be scrutinized as a candidate for being 1498c2ecf20Sopenharmony_ci marked as bad. 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci The initial value may be specified by the flash device driver. 1528c2ecf20Sopenharmony_ci If not, then the default value is ecc_strength. 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci The introduction of this feature brings a subtle change to the 1558c2ecf20Sopenharmony_ci meaning of the -EUCLEAN return code. Previously, it was 1568c2ecf20Sopenharmony_ci interpreted to mean simply "one or more bit errors were 1578c2ecf20Sopenharmony_ci corrected". Its new interpretation can be phrased as "a 1588c2ecf20Sopenharmony_ci dangerously high number of bit errors were corrected on one or 1598c2ecf20Sopenharmony_ci more regions comprising an ecc step". The precise definition of 1608c2ecf20Sopenharmony_ci "dangerously high" can be adjusted by the user with 1618c2ecf20Sopenharmony_ci bitflip_threshold. Users are discouraged from doing this, 1628c2ecf20Sopenharmony_ci however, unless they know what they are doing and have intimate 1638c2ecf20Sopenharmony_ci knowledge of the properties of their device. Broadly speaking, 1648c2ecf20Sopenharmony_ci bitflip_threshold should be low enough to detect genuine erase 1658c2ecf20Sopenharmony_ci block degradation, but high enough to avoid the consequences of 1668c2ecf20Sopenharmony_ci a persistent return value of -EUCLEAN on devices where sticky 1678c2ecf20Sopenharmony_ci bitflips occur. Note that if bitflip_threshold exceeds 1688c2ecf20Sopenharmony_ci ecc_strength, -EUCLEAN is never returned by the read operations. 1698c2ecf20Sopenharmony_ci Conversely, if bitflip_threshold is zero, -EUCLEAN is always 1708c2ecf20Sopenharmony_ci returned, absent a hard error. 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci This is generally applicable only to NAND flash devices with ECC 1738c2ecf20Sopenharmony_ci capability. It is ignored on devices lacking ECC capability; 1748c2ecf20Sopenharmony_ci i.e., devices for which ecc_strength is zero. 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/ecc_step_size 1778c2ecf20Sopenharmony_ciDate: May 2013 1788c2ecf20Sopenharmony_ciKernelVersion: 3.10 1798c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 1808c2ecf20Sopenharmony_ciDescription: 1818c2ecf20Sopenharmony_ci The size of a single region covered by ECC, known as the ECC 1828c2ecf20Sopenharmony_ci step. Devices may have several equally sized ECC steps within 1838c2ecf20Sopenharmony_ci each writesize region. 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci It will always be a non-negative integer. In the case of 1868c2ecf20Sopenharmony_ci devices lacking any ECC capability, it is 0. 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/ecc_failures 1898c2ecf20Sopenharmony_ciDate: June 2014 1908c2ecf20Sopenharmony_ciKernelVersion: 3.17 1918c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 1928c2ecf20Sopenharmony_ciDescription: 1938c2ecf20Sopenharmony_ci The number of failures reported by this device's ECC. Typically, 1948c2ecf20Sopenharmony_ci these failures are associated with failed read operations. 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci It will always be a non-negative integer. In the case of 1978c2ecf20Sopenharmony_ci devices lacking any ECC capability, it is 0. 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/corrected_bits 2008c2ecf20Sopenharmony_ciDate: June 2014 2018c2ecf20Sopenharmony_ciKernelVersion: 3.17 2028c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 2038c2ecf20Sopenharmony_ciDescription: 2048c2ecf20Sopenharmony_ci The number of bits that have been corrected by means of the 2058c2ecf20Sopenharmony_ci device's ECC. 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci It will always be a non-negative integer. In the case of 2088c2ecf20Sopenharmony_ci devices lacking any ECC capability, it is 0. 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/bad_blocks 2118c2ecf20Sopenharmony_ciDate: June 2014 2128c2ecf20Sopenharmony_ciKernelVersion: 3.17 2138c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 2148c2ecf20Sopenharmony_ciDescription: 2158c2ecf20Sopenharmony_ci The number of blocks marked as bad, if any, in this partition. 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/bbt_blocks 2188c2ecf20Sopenharmony_ciDate: June 2014 2198c2ecf20Sopenharmony_ciKernelVersion: 3.17 2208c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 2218c2ecf20Sopenharmony_ciDescription: 2228c2ecf20Sopenharmony_ci The number of blocks that are marked as reserved, if any, in 2238c2ecf20Sopenharmony_ci this partition. These are typically used to store the in-flash 2248c2ecf20Sopenharmony_ci bad block table (BBT). 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/offset 2278c2ecf20Sopenharmony_ciDate: March 2015 2288c2ecf20Sopenharmony_ciKernelVersion: 4.1 2298c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 2308c2ecf20Sopenharmony_ciDescription: 2318c2ecf20Sopenharmony_ci For a partition, the offset of that partition from the start 2328c2ecf20Sopenharmony_ci of the parent (another partition or a flash device) in bytes. 2338c2ecf20Sopenharmony_ci This attribute is absent on flash devices, so it can be used 2348c2ecf20Sopenharmony_ci to distinguish them from partitions. 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ciWhat: /sys/class/mtd/mtdX/oobavail 2378c2ecf20Sopenharmony_ciDate: April 2018 2388c2ecf20Sopenharmony_ciKernelVersion: 4.16 2398c2ecf20Sopenharmony_ciContact: linux-mtd@lists.infradead.org 2408c2ecf20Sopenharmony_ciDescription: 2418c2ecf20Sopenharmony_ci Number of bytes available for a client to place data into 2428c2ecf20Sopenharmony_ci the out of band area. 243