All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shmulik Ladkani <shmulik.ladkani@gmail.com>
To: Bastian Hecht <hechtb@googlemail.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Mike Dunn <mikedunn@newsguy.com>,
	prabhakar@freescale.com
Subject: Re: [PATCH 1/2] mtd: nand: add OOB argument to NAND {read, write}_page interfaces
Date: Tue, 24 Apr 2012 09:02:42 +0300	[thread overview]
Message-ID: <20120424090242.5023df12@pixies.home.jungo.com> (raw)
In-Reply-To: <CABYn4sy6fOEMwF_Gj24HdnaR55Sf1cFftT=JA-2PPSU1+zFjYA@mail.gmail.com>

Hi Bastian,

On Mon, 23 Apr 2012 11:14:39 +0200 Bastian Hecht <hechtb@googlemail.com> wrote:
> Following this thread, I wondered how mtd_write_oob is meant to work.
> The sh_flctl code simply writes the OOB data 1 to 1 into the oob area
> of the nand chip when using hardware ECC. So when reading this, it
> should result in a corrupted page. Is the driver meant to OR the ECC
> code to the buffer? Then the driver would need a page read and write
> it back applying the oob data, no?

The beahvior is dependent on mtd_oob_ops->mode.

If mode is MTD_OPS_AUTO_OOB, 'nand_fill_oob' places the user provided
'oobbuf' into the "free" locations within the OOB layout (as defined by
'chip->ecc.layout->oobfree').
Implementor of 'chip->ecc.write_page' is expected to take care of ECC
caclulation and fill the ECC bytes (driver's or HW responsibility).

If the mode is MTD_OPS_RAW, user provided 'oobbuf' should be transferred
as-is, without error correction ('chip->ecc.write_page_raw' will be
invoked).

If the mode is MTD_OPS_PLACE_OOB, then 'nand_fill_oob' copies user's
'oobbuf' onto 'oob_poi'.
As with MTD_OPS_AUTO_OOB, implementor of 'chip->ecc.write_page' is
expected to take care of ECC calculation; the ECC locations are assumed
to be overwritten (ignoring user's bytes at the ECC locations).

This is according to the nand_base.c default methods.
For example, you can follow nand_do_write_ops, nand_write_page,
nand_write_page_swecc.

Regards,
Shmulik

  parent reply	other threads:[~2012-04-24  6:02 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 [this message]
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 ` [PATCH 2/2] mtd: nand: nand_do_{read, write}_ops - pass OOB buffer through Brian Norris
2012-04-18 11:52   ` [PATCH 2/2] mtd: nand: nand_do_{read,write}_ops " 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=20120424090242.5023df12@pixies.home.jungo.com \
    --to=shmulik.ladkani@gmail.com \
    --cc=computersforpeace@gmail.com \
    --cc=hechtb@googlemail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mikedunn@newsguy.com \
    --cc=prabhakar@freescale.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.