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