Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1323733

[PATCH v2 02/17] include:mtd:add multi-plane program in mtd_info

From Bean Huo <jackyard88@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v2 02/17] include:mtd:add multi-plane program in mtd_info
Date 2016-02-02 03:40 +0100
Message-ID <qXz2P-3Wf-47@gated-at.bofh.it> (permalink)
References <qXz2N-3Wf-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Bean Huo <beanhuo@micron.com>

This patch file is to add support for multi-plane page program hook in mtd_info,
callback this in one new inline function mtd_write_dual_plane_oob.

Signed-off-by: BeanHuo <beanhuo@micron.com>
---
 include/linux/mtd/mtd.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index f17fa75..cfcb3a68 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -204,6 +204,9 @@ struct mtd_info {
 			  struct mtd_oob_ops *ops);
 	int (*_write_oob) (struct mtd_info *mtd, loff_t to,
 			   struct mtd_oob_ops *ops);
+	int (*_dual_plane_write_oob) (struct mtd_info *mtd, loff_t to_plane0,
+			struct mtd_oob_ops *ops_plane0, loff_t to_plane1,
+					struct mtd_oob_ops *ops_plane1);
 	int (*_get_fact_prot_info) (struct mtd_info *mtd, size_t len,
 				    size_t *retlen, struct otp_info *buf);
 	int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from,
@@ -280,6 +283,22 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
 	return mtd->_write_oob(mtd, to, ops);
 }
 
+static inline int mtd_write_dual_plane_oob(struct mtd_info *mtd,
+		loff_t to_plane0, struct mtd_oob_ops *ops0, loff_t to_plane1,
+						struct mtd_oob_ops *ops1)
+{
+	ops0->retlen = ops0->oobretlen = 0;
+	ops1->retlen = ops1->oobretlen = 0;
+
+	if (!mtd->_dual_plane_write_oob)
+		return -EOPNOTSUPP;
+	if (!(mtd->flags & MTD_WRITEABLE))
+		return -EROFS;
+
+	return mtd->_dual_plane_write_oob(mtd, to_plane0, ops0,
+						to_plane1, ops1);
+}
+
 int mtd_get_fact_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen,
 			   struct otp_info *buf);
 int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
-- 
1.9.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v2 02/17] include:mtd:add multi-plane program in mtd_info Bean Huo <jackyard88@gmail.com> - 2016-02-02 03:40 +0100

csiph-web