From: Brian Norris <computersforpeace@gmail.com>
To: <linux-mtd@lists.infradead.org>
Cc: Li Yang <leoli@freescale.com>, Mike Dunn <mikedunn@newsguy.com>,
Prabhakar Kushwaha <prabhakar@freescale.com>,
Artem Bityutskiy <dedekind1@gmail.com>,
Lei Wen <leiwen@marvell.com>, Kevin Cernekee <cernekee@gmail.com>,
Wolfram Sang <w.sang@pengutronix.de>,
Matthieu CASTET <matthieu.castet@parrot.com>,
Huang Shijie <b32955@freescale.com>,
Shmulik Ladkani <shmulik.ladkani@gmail.com>,
Jiandong Zheng <jdzheng@broadcom.com>,
Florian Fainelli <ffainelli@freebox.fr>,
Scott Wood <scottwood@freescale.com>,
Jamie Iles <jamie@jamieiles.com>,
Thomas Gleixner <tglx@linutronix.de>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Axel Lin <axel.lin@gmail.com>,
Bastian Hecht <hechtb@googlemail.com>
Subject: [PATCH v4 02/10] mtd: nand: pass proper 'oob_required' parameter
Date: Wed, 2 May 2012 10:14:56 -0700 [thread overview]
Message-ID: <1335978904-8005-3-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1335978904-8005-1-git-send-email-computersforpeace@gmail.com>
We now have an interface for notifying the nand_ecc_ctrl functions when OOB
data must be returned to the upper layers and when it may be left untouched.
This patch fills in the 'oob_required' parameter properly from
nand_do_{read,write}_ops. When utilized properly in the lower layers, this
parameter can improve performance and/or reduce complexity for NAND HW and SW
that can simply avoid transferring the OOB data.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Acked-by: Jiandong Zheng <jdzheng@broadcom.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 6d4894a..464b742 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1480,7 +1480,7 @@ static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob,
static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
struct mtd_oob_ops *ops)
{
- int chipnr, page, realpage, col, bytes, aligned;
+ int chipnr, page, realpage, col, bytes, aligned, oob_required;
struct nand_chip *chip = mtd->priv;
struct mtd_ecc_stats stats;
int ret = 0;
@@ -1504,6 +1504,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
buf = ops->datbuf;
oob = ops->oobbuf;
+ oob_required = oob ? 1 : 0;
while (1) {
bytes = min(mtd->writesize - col, readlen);
@@ -1521,13 +1522,14 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
*/
if (unlikely(ops->mode == MTD_OPS_RAW))
ret = chip->ecc.read_page_raw(mtd, chip, bufpoi,
- 1, page);
+ oob_required,
+ 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,
- 1, page);
+ oob_required, page);
if (ret < 0) {
if (!aligned)
/* Invalidate page cache */
@@ -1554,7 +1556,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) {
@@ -2213,6 +2214,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
uint8_t *oob = ops->oobbuf;
uint8_t *buf = ops->datbuf;
int ret, subpage;
+ int oob_required = oob ? 1 : 0;
ops->retlen = 0;
if (!writelen)
@@ -2275,8 +2277,8 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
memset(chip->oob_poi, 0xff, mtd->oobsize);
}
- ret = chip->write_page(mtd, chip, wbuf, 1, page, cached,
- (ops->mode == MTD_OPS_RAW));
+ ret = chip->write_page(mtd, chip, wbuf, oob_required, page,
+ cached, (ops->mode == MTD_OPS_RAW));
if (ret)
break;
--
1.7.5.4.2.g519b1
next prev parent reply other threads:[~2012-05-02 17:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-02 17:14 [PATCH v4 00/10] mtd: nand: rework nand_ecc_ctrl interface for OOB Brian Norris
2012-05-02 17:14 ` [PATCH v4 01/10] mtd: nand: add 'oob_required' argument to NAND {read, write}_page interfaces Brian Norris
2012-05-03 17:16 ` Mike Dunn
2012-05-03 17:43 ` Shmulik Ladkani
2012-05-03 22:34 ` Brian Norris
2012-05-04 7:58 ` Artem Bityutskiy
2012-05-02 17:14 ` Brian Norris [this message]
2012-05-02 17:14 ` [PATCH v4 03/10] mtd: Blackfin NFC: utilize oob_required parameter Brian Norris
2012-05-03 9:55 ` Artem Bityutskiy
2012-05-02 17:14 ` [PATCH v4 04/10] mtd: cafe_nand: " Brian Norris
2012-05-02 17:14 ` [PATCH v4 05/10] mtd: denali: " Brian Norris
2012-05-02 17:15 ` [PATCH v4 06/10] mtd: eLBC NAND: " Brian Norris
2012-05-02 17:15 ` [PATCH v4 07/10] mtd: IFC " Brian Norris
2012-05-02 17:15 ` [PATCH v4 08/10] mtd: gpmi-nand: utilize oob_requested parameter Brian Norris
2012-05-02 17:15 ` [PATCH v4 09/10] mtd: nand: utilize oob_required parameter Brian Norris
2012-05-02 17:15 ` [PATCH v4 10/10] mtd: pxa3xx_nand: " Brian Norris
2012-05-03 10:00 ` [PATCH v4 00/10] mtd: nand: rework nand_ecc_ctrl interface for OOB Artem Bityutskiy
2012-05-03 17:11 ` Mike Dunn
2012-05-04 7:23 ` Artem Bityutskiy
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=1335978904-8005-3-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=axel.lin@gmail.com \
--cc=b32955@freescale.com \
--cc=cernekee@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=ffainelli@freebox.fr \
--cc=hechtb@googlemail.com \
--cc=jamie@jamieiles.com \
--cc=jdzheng@broadcom.com \
--cc=leiwen@marvell.com \
--cc=leoli@freescale.com \
--cc=linux-mtd@lists.infradead.org \
--cc=matthieu.castet@parrot.com \
--cc=mikedunn@newsguy.com \
--cc=prabhakar@freescale.com \
--cc=scottwood@freescale.com \
--cc=shmulik.ladkani@gmail.com \
--cc=tglx@linutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).