From 04f692f68d87060b27b37e790080e0e11054fedd Mon Sep 17 00:00:00 2001
From: Mike Dunn Table of contents
mtdblock
driver
sysfs
interface instead of older ioctl
or
- /proc/mtd
interfaces, when possible.
+ /proc/mtd
interfaces, when possible. The sysfs
+ interface for the mtd subsystem is documentated in the kernel, and
+ currently can be found at
+ Documentation/ABI/testing/sysfs-class-mtd
.
/proc/mtd
proc file system file provides general
MTD information. This is a legacy interface and the sysfs interface
@@ -69,6 +73,37 @@ not maintained very much.
+The MTD subsystem API is defined in include/linux/mtd/mtd.h
.
+The methods and data structures in this file are used by higher layer kernel
+code such as flash file systems to access and control the mtd devices, and also
+by device driver authors to interface their device to the mtd subsystem. The
+various methods by which a driver provides access to the device are defined
+within struct mtd_info
. Prior to kernel version 3.4, higher layers
+called the driver methods directly by way of a pointer to struct
+mtd_info
. As of kernel 3.4, these methods are implemented within the mtd
+subsystem core code, which then calls the corresponding driver methods. Users
+of kernel 3.4 and later should not call the driver methods directly, but instead
+use those prototyped in mtd.h
outside of struct
+mtd_info
. These methods include mtd_read()
,
+mtd_write()
, etc.
mtd_read()
may return -EUCLEAN
in some circumstances.
+This return code is applicable mainly to NAND flash devices, and is used to
+indicate that some bit errors were corrected by the device's ECC facility.
+Prior to kernel version 3.4, -EUCLEAN
was returned if one or more
+bit errors were corrected during the read operation. As of kernel 3.4, the
+meaning is more nuanced, and can be broadly interpreted to mean "a dangerously
+high number of bit errors were corrected". The -EUCLEAN
return
+code is intended to help higher layers detect degradation of erase blocks. The
+conditions by which mtd_read()
returns -EUCLEAN
can be
+tuned using the bitflip_threshold
element of the sysfs interface.
+Please see the kernel documentation for the MTD sysfs interface (referenced
+above) before adjusting this value.
+
+
The MTD subsystem includes a set of tests which you may run to verify your -- 2.49.0