From: Brian Norris <computersforpeace@gmail.com>
To: <linux-mtd@lists.infradead.org>
Cc: Viresh Kumar <viresh.kumar@st.com>,
Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
Nicolas Ferre <nicolas.ferre@atmel.com>,
Vipin Kumar <vipin.kumar@st.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Florian Fainelli <ffainelli@freebox.fr>,
Jamie Iles <jamie@jamieiles.com>,
Mike Dunn <mikedunn@newsguy.com>,
Bastian Hecht <hechtb@gmail.com>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
Kevin Cernekee <cernekee@gmail.com>, Lei Wen <leiwen@marvell.com>,
Axel Lin <axel.lin@gmail.com>, Li Yang <leoli@freescale.com>,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
Armando Visconti <armando.visconti@st.com>,
Liu Shuo <b35362@freescale.com>,
Thomas Gleixner <tglx@linutronix.de>,
Scott Branden <sbranden@broadcom.com>,
Artem Bityutskiy <dedekind1@gmail.com>,
Wolfram Sang <w.sang@pengutronix.de>,
Huang Shijie <b32955@freescale.com>,
Shmulik Ladkani <shmulik.ladkani@gmail.com>,
Jiandong Zheng <jdzheng@broadcom.com>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: [PATCH 2/2] mtd: nand: nand_do_{read, write}_ops - pass OOB buffer through
Date: Mon, 16 Apr 2012 15:35:55 -0700 [thread overview]
Message-ID: <1334615755-15418-3-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1334615755-15418-1-git-send-email-computersforpeace@gmail.com>
Now that we have a function parameter for the OOB buffer, we can pass the OOB
buffer as an argument to the nand_ecc_ctrl functions. This allows drivers to
know when OOB data must be returned to the upper layers and when it is simply
needed for internal calculations, potentially saving time for NAND HW/SW that
can simply avoid reading the OOB data.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/mtd/nand/nand_base.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 95ba987..a206f43 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1475,7 +1475,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
uint32_t max_oobsize = ops->mode == MTD_OPS_AUTO_OOB ?
mtd->oobavail : mtd->oobsize;
- uint8_t *bufpoi, *oob, *buf;
+ uint8_t *bufpoi, *oobpoi, *oob, *buf;
stats = mtd->ecc_stats;
@@ -1489,6 +1489,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
buf = ops->datbuf;
oob = ops->oobbuf;
+ oobpoi = oob ? chip->oob_poi : NULL;
while (1) {
bytes = min(mtd->writesize - col, readlen);
@@ -1506,13 +1507,13 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
/* Now read the page into the buffer */
if (unlikely(ops->mode == MTD_OPS_RAW))
ret = chip->ecc.read_page_raw(mtd, chip, bufpoi,
- NULL, page);
+ oobpoi, page);
else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob)
ret = chip->ecc.read_subpage(mtd, chip,
col, bytes, bufpoi);
else
ret = chip->ecc.read_page(mtd, chip, bufpoi,
- NULL, page);
+ oobpoi, page);
if (ret < 0) {
if (!aligned)
/* Invalidate page cache */
@@ -1535,7 +1536,6 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
buf += bytes;
if (unlikely(oob)) {
-
int toread = min(oobreadlen, max_oobsize);
if (toread) {
@@ -2256,7 +2256,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
while (1) {
int bytes = mtd->writesize;
int cached = writelen > bytes && page != blockmask;
- uint8_t *wbuf = buf;
+ uint8_t *wbuf = buf, *oobpoi;
/* Partial page write? */
if (unlikely(column || writelen < (mtd->writesize - 1))) {
@@ -2272,12 +2272,14 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
size_t len = min(oobwritelen, oobmaxlen);
oob = nand_fill_oob(mtd, oob, len, ops);
oobwritelen -= len;
+ oobpoi = chip->oob_poi;
} else {
+ oobpoi = NULL;
/* We still need to erase leftover OOB data */
memset(chip->oob_poi, 0xff, mtd->oobsize);
}
- ret = chip->write_page(mtd, chip, wbuf, NULL, page, cached,
+ ret = chip->write_page(mtd, chip, wbuf, oobpoi, page, cached,
(ops->mode == MTD_OPS_RAW));
if (ret)
break;
--
1.7.5.4.2.g519b1
next prev parent reply other threads:[~2012-04-16 22:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-16 22:35 [PATCH 0/2] mtd: nand: rework nand_ecc_ctrl interface for OOB Brian Norris
2012-04-16 22:35 ` [PATCH 1/2] mtd: nand: add OOB argument to NAND {read, write}_page interfaces Brian Norris
2012-04-17 7:50 ` Matthieu CASTET
2012-04-18 3:44 ` Brian Norris
2012-04-19 16:50 ` Mike Dunn
2012-04-19 22:06 ` Brian Norris
2012-04-20 1:10 ` Jon Povey
2012-04-20 16:25 ` Mike Dunn
2012-04-20 19:19 ` Brian Norris
2012-04-20 16:17 ` Mike Dunn
2012-04-22 7:58 ` Shmulik Ladkani
2012-04-23 9:14 ` Bastian Hecht
2012-04-23 17:14 ` Mike Dunn
2012-04-24 6:02 ` Shmulik Ladkani
2012-04-25 13:17 ` Bastian Hecht
2012-04-17 14:29 ` [PATCH 1/2] mtd: nand: add OOB argument to NAND {read,write}_page interfaces Shmulik Ladkani
2012-04-18 4:11 ` [PATCH 1/2] mtd: nand: add OOB argument to NAND {read, write}_page interfaces Brian Norris
2012-04-18 7:56 ` Bastian Hecht
2012-04-18 9:37 ` Bastian Hecht
2012-04-18 16:22 ` Brian Norris
2012-04-19 9:26 ` Bastian Hecht
2012-04-16 22:35 ` Brian Norris [this message]
2012-04-18 11:52 ` [PATCH 2/2] mtd: nand: nand_do_{read,write}_ops - pass OOB buffer through Shmulik Ladkani
2012-04-18 16:13 ` [PATCH 2/2] mtd: nand: nand_do_{read, write}_ops " Brian Norris
2012-04-18 19:43 ` [PATCH 2/2] mtd: nand: nand_do_{read,write}_ops " Shmulik Ladkani
2012-04-25 14:16 ` [PATCH 0/2] mtd: nand: rework nand_ecc_ctrl interface for OOB Artem Bityutskiy
2012-04-25 18:26 ` Brian Norris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334615755-15418-3-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=armando.visconti@st.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=axel.lin@gmail.com \
--cc=b32955@freescale.com \
--cc=b35362@freescale.com \
--cc=cernekee@gmail.com \
--cc=dbaryshkov@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=ffainelli@freebox.fr \
--cc=hechtb@gmail.com \
--cc=jamie@jamieiles.com \
--cc=jdzheng@broadcom.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=leiwen@marvell.com \
--cc=leoli@freescale.com \
--cc=linux-mtd@lists.infradead.org \
--cc=mikedunn@newsguy.com \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
--cc=sbranden@broadcom.com \
--cc=shmulik.ladkani@gmail.com \
--cc=tglx@linutronix.de \
--cc=vipin.kumar@st.com \
--cc=viresh.kumar@st.com \
--cc=w.sang@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.