summaryrefslogtreecommitdiff
path: root/include/mtd
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-09-09 20:59:03 +0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 16:56:25 +0400
commite99d8b089a6c6fd72f022168e3bf8f22d4e5e137 (patch)
tree6f0041c3ca51a7a7ee782900429f07617bdc940f /include/mtd
parentbeb133fc165e1289c858d8f952b982b7d0b313cd (diff)
downloadlinux-e99d8b089a6c6fd72f022168e3bf8f22d4e5e137.tar.xz
mtd: add MEMWRITE ioctl
Implement a new ioctl for writing both page data and OOB to flash at the same time. This ioctl is intended to be a generic interface that can replace other ioctls (MEMWRITEOOB and MEMWRITEOOB64) and cover the functionality of several other old ones, e.g., MEMWRITE can: * write autoplaced OOB instead of using ECCGETLAYOUT (deprecated) and working around the reserved areas * write raw (no ECC) OOB instead of using MTDFILEMODE to set the per-file-descriptor MTD_FILE_MODE_RAW * write raw (no ECC) data instead of using MTDFILEMODE (MTD_FILE_MODE_RAW) and using standard character device "write" This ioctl is especially useful for MLC NAND, which cannot be written twice (i.e., we cannot successfully write the page data and OOB in two separate operations). Instead, MEMWRITE can write both in a single operation. Note that this ioctl is not affected by the MTD file mode (i.e., MTD_FILE_MODE_RAW vs. MTD_FILE_MODE_NORMAL), since it receives its write mode as an input parameter. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Diffstat (limited to 'include/mtd')
-rw-r--r--include/mtd/mtd-abi.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 1885aa98b311..1a16046b1d97 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -60,6 +60,16 @@ enum {
MTD_OPS_RAW = 2,
};
+struct mtd_write_req {
+ __u64 start;
+ __u64 len;
+ __u64 ooblen;
+ __u64 usr_data;
+ __u64 usr_oob;
+ __u8 mode;
+ __u8 padding[7];
+};
+
#define MTD_ABSENT 0
#define MTD_RAM 1
#define MTD_ROM 2
@@ -147,6 +157,7 @@ struct otp_info {
#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
#define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
+#define MEMWRITE _IOWR('M', 24, struct mtd_write_req)
/*
* Obsolete legacy interface. Keep it in order not to break userspace