[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <A765B125120D1346A63912DDE6D8B6310BF4CECC@NTXXIAMBX02.xacn.micron.com>
Date: Mon, 28 Sep 2015 07:02:37 +0000
From: Bean Huo 霍斌斌 (beanhuo)
<beanhuo@...ron.com>
To: "dedekind1@...il.com" <dedekind1@...il.com>,
"adrian.hunter@...el.com" <adrian.hunter@...el.com>,
"computersforpeace@...il.com" <computersforpeace@...il.com>,
"baruch@...s.co.il" <baruch@...s.co.il>,
"asierra@...-inc.com" <asierra@...-inc.com>,
"guz.fnst@...fujitsu.com" <guz.fnst@...fujitsu.com>,
"gsi@...x.de" <gsi@...x.de>, "richard@....at" <richard@....at>,
Boris Brezillon <boris.brezillon@...e-electrons.com>
CC: Boris Brezillon <boris.brezillon@...e-electrons.com>,
David Woodhouse <dwmw2@...radead.org>,
"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
Artem Bityutskiy <dedekind1@...il.com>,
Richard Weinberger <richard@....at>,
Frank Liu 刘群 (frankliu)
<frankliu@...ron.com>, Andrea Scian <rnd4@...e-tech.it>,
Peter Pan 潘柏宏 (peterpan)
<peterpan@...ron.com>,
Karl Zhang 张双锣 (karlzhang)
<karlzhang@...ron.com>,
Iwo Mergler <Iwo.Mergler@...commwireless.com>,
"Jeff Lauruhn (jlauruhn)" <jlauruhn@...ron.com>,
Stefan Roese <sr@...x.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/9] drivers:nand:mtd: add support for UBI bakvol in mtd
layer
Add support for UBI bakvol in mtd layer.
This solution based on MLC NAND dual plane program.
so add hook in mtd layer.
Signed-off-by: Bean Huo <beanhuo@...ron.com>
---
include/linux/mtd/mtd.h | 19 +++++++++++++++++++
include/linux/mtd/nand.h | 4 ++++
include/linux/mtd/ubi.h | 9 +++++++++
3 files changed, 32 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,
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 272f429..4c5be01 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -77,6 +77,7 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
#define NAND_CMD_READ1 1
#define NAND_CMD_RNDOUT 5
#define NAND_CMD_PAGEPROG 0x10
+#define NAND_CMD_MULTI_PAGEPROG 0x11
#define NAND_CMD_READOOB 0x50
#define NAND_CMD_ERASE1 0x60
#define NAND_CMD_STATUS 0x70
@@ -671,6 +672,9 @@ struct nand_chip {
int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
uint32_t offset, int data_len, const uint8_t *buf,
int oob_required, int page, int cached, int raw);
+ int (*write_plane_page)(struct mtd_info *mtd, struct nand_chip *chip,
+ uint32_t offset, int data_len, const uint8_t *buf,
+ int oob_required, int page, int plane, int raw);
int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip,
int feature_addr, uint8_t *subfeature_para);
int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index 1e271cb..1da3418 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -35,6 +35,15 @@
*/
#define UBI_MAX_SG_COUNT 64
+enum {
+ UBI_BAKVOL_UNONE,
+ UBI_BAKVOL_INIT_INFO,
+ UBI_BAKVOL_INIT_INFO_DONE,
+ UBI_BAKVOL_INIT_VOLUME,
+ UBI_BAKVOL_INIT_VOLUME_DONE,
+ UBI_BAKVOL_RUN
+};
+
/*
* enum ubi_open_mode - UBI volume open mode constants.
*
--
1.9.1
Powered by blists - more mailing lists