All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	linux-mtd@lists.infradead.org,
	Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [PATCH v3 09/10] mtd: nand: utilize oob_required parameter
Date: Mon, 30 Apr 2012 12:59:52 -0700	[thread overview]
Message-ID: <CAN8TOE-+4FP1rR82L2Kfg__MgmsmMQZuZ_BO_FCcvSZDasChNw@mail.gmail.com> (raw)
In-Reply-To: <20120429154707.01c7be55@pixies.home.jungo.com>

On Sun, Apr 29, 2012 at 5:47 AM, Shmulik Ladkani
<shmulik.ladkani@gmail.com> wrote:
> On Fri, 27 Apr 2012 18:29:53 -0700 Brian Norris <computersforpeace@gmail.com> wrote:
>> Don't read/write OOB if the caller doesn't requre it.
>
> Re-thinking this, I think this might be incorrect.
> Sorry I havn't noticed this earlier.
>
> Suppose the nand chip is working in "sequential" (aka "incremental")
> mode.
> Meaning, a NAND_CMD_READ0 command is issued, and then adjacent pages are
> read sequencially, without having to re-issue NAND_CMD_READ0.
>
> (see for example the loop within 'nand_do_read_ops', especially the
> 'sndcmd' variable).
>
> In that case, we MUST read the 'oob', because the OOB bytes will always
> arrive on the bus following the inband data.
...

I see. This is the kind of issue I was alluding to back in v2:

"For instance, is there any sort of hardware that expects the whole
page + OOB to be read via chip->read_buf() for all reads..."

This situation comes up if NAND_NO_AUTOINCR is not set. But really, it
looks like we *always* have NAND_NO_AUTOINCR enabled, and so we
*always* send a new READ cmd. I know that it's possible for some board
driver to override this, but I don't see that anywhere...

> I have no idea if this issue is also relevant for 'read_page' implementors
> other than of nand_base.c; should carefully review.
>
> There are 2 options for fixing the issue in nand_base.c:
>
> - Disregard the 'oob_required' parameter in all nand_base's
>  'read_page' implementations (not future proof, someone might miss the
>  nuance; also bug might still exist in the non-default implementations)
>
> - Fix your 02/10 patch, in away that the passed 'oob_required' argument
>  will be somehow set according to the 'snd_cmd'

I'm fine with adding an 'else' to the 'if (likely(sndcmd))', so that
we get something like this in patch 2:

               if (likely(sndcmd)) {
                       chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
                       sndcmd = 0;
+              } else {
+                      /* force driver to read OOB, for sequential read */
+                      oob_required = 1;
               }

I think that would take care of the corner case where we use autoincrement.

Brian

  reply	other threads:[~2012-04-30 19:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-28  1:29 [PATCH v3 00/10] mtd: nand: rework nand_ecc_ctrl interface for OOB Brian Norris
2012-04-28  1:29 ` [PATCH v3 01/10] mtd: nand: add 'oob_required' argument to NAND {read, write}_page interfaces Brian Norris
2012-04-29 11:36   ` [PATCH v3 01/10] mtd: nand: add 'oob_required' argument to NAND {read,write}_page interfaces Shmulik Ladkani
2012-04-29 13:25     ` Artem Bityutskiy
2012-04-30 19:16       ` Brian Norris
2012-04-30 19:21         ` Scott Wood
2012-04-28  1:29 ` [PATCH v3 02/10] mtd: nand: pass proper 'oob_required' parameter Brian Norris
2012-04-29 11:41   ` Shmulik Ladkani
2012-04-28  1:29 ` [PATCH v3 03/10] mtd: Blackfin NFC: utilize oob_required parameter Brian Norris
2012-04-28  1:29 ` [PATCH v3 04/10] mtd: cafe_nand: " Brian Norris
2012-04-28  1:29 ` [PATCH v3 05/10] mtd: denali: " Brian Norris
2012-04-28  1:29 ` [PATCH v3 06/10] mtd: eLBD NAND: " Brian Norris
2012-04-28  1:29 ` [PATCH v3 07/10] mtd: IFC " Brian Norris
2012-04-30 16:43   ` Scott Wood
2012-04-30 19:08     ` Brian Norris
2012-04-30 19:13       ` Scott Wood
2012-04-30 19:23         ` Brian Norris
2012-04-30 19:32           ` Scott Wood
2012-04-28  1:29 ` [PATCH v3 08/10] mtd: gpmi-nand: utilize oob_requested parameter Brian Norris
2012-04-28  2:32   ` Huang Shijie
2012-04-28  1:29 ` [PATCH v3 09/10] mtd: nand: utilize oob_required parameter Brian Norris
2012-04-29 12:47   ` Shmulik Ladkani
2012-04-30 19:59     ` Brian Norris [this message]
2012-04-30 20:12       ` Brian Norris
2012-04-30 20:21       ` Scott Wood
2012-04-30 21:49         ` Brian Norris
2012-05-01 12:12           ` Artem Bityutskiy
2012-05-01  8:29       ` Shmulik Ladkani
2012-04-28  1:29 ` [PATCH v3 10/10] mtd: pxa3xx_nand: " Brian Norris
2012-04-30  7:10 ` [PATCH v3 00/10] mtd: nand: rework nand_ecc_ctrl interface for OOB 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=CAN8TOE-+4FP1rR82L2Kfg__MgmsmMQZuZ_BO_FCcvSZDasChNw@mail.gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=shmulik.ladkani@gmail.com \
    /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.