From: Miquel Raynal <miquel.raynal@free-electrons.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-mtd@lists.infradead.org,
Boris Brezillon <boris.brezillon@free-electrons.com>,
kernel@pengutronix.de, Richard Weinberger <richard@nod.at>
Subject: Re: [PATCH 6/8] mtd: nand: mxc: Add own write_page
Date: Thu, 18 Jan 2018 08:16:10 +0100 [thread overview]
Message-ID: <20180118081610.32937f54@xps13> (raw)
In-Reply-To: <20180117104009.geal4fs6eykqai3a@pengutronix.de>
Hi Sascha,
On Wed, 17 Jan 2018 11:40:09 +0100
Sascha Hauer <s.hauer@pengutronix.de> wrote:
> Hi Miquel,
>
> On Sat, Jan 13, 2018 at 05:25:51PM +0100, Miquel Raynal wrote:
> > Hi Sascha,
> >
> > On Tue, 9 Jan 2018 11:11:46 +0100
> > Sascha Hauer <s.hauer@pengutronix.de> wrote:
> >
> > > Now that we have our own read_page function add a write_page
> > > function for consistency aswell. This can be a lot easier than
> > > the generic function since we do not have to iterate over
> > > subpages but can write the whole page at once. Also add
> > > write_page_raw and write_oob for proper raw and oob write support.
> > >
> > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > ---
> > > drivers/mtd/nand/mxc_nand.c | 56
> > > +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56
> > > insertions(+)
> > >
> > > diff --git a/drivers/mtd/nand/mxc_nand.c
> > > b/drivers/mtd/nand/mxc_nand.c index 83bb01ab7079..6fbf98851a96
> > > 100644 --- a/drivers/mtd/nand/mxc_nand.c
> > > +++ b/drivers/mtd/nand/mxc_nand.c
> > > @@ -893,6 +893,59 @@ static int mxc_nand_read_oob(struct mtd_info
> > > *mtd, struct nand_chip *chip, page);
> > > }
> > >
> > > +static int __mxc_nand_write_page(struct mtd_info *mtd, struct
> > > nand_chip *chip,
> > > + const uint8_t *buf, int
> > > oob_required, int page) +{
> > > + struct mxc_nand_host *host =
> > > nand_get_controller_data(chip); +
> > > + host->devtype_data->send_cmd(host, NAND_CMD_SEQIN,
> > > false);
> > > + mxc_do_addr_cycle(mtd, 0, page);
> > > +
> > > + memcpy32_toio(host->main_area0, buf, mtd->writesize);
> > > + copy_spare(mtd, false, chip->oob_poi);
> >
> > If I remember correctly, there was a "spare only" mechanism to avoid
> > doing full page read/write when unnecessary. What about using it
> > here when (buf == NULL && oob_required)?
>
> You are probably referring to the SP_EN bit in the NAND_FLASH_CONFIG1
> register right? This is described as:
>
> > NAND Flash spare enable. This bit determines whether host
> > reads/writes are to NAND Flash spare data only or NAND Flash main
> > and spare data. This feature is supported only with memories with
> > 1/2K page size. Note: There is no ECC in this mode of operation.
> > 0 NAND Flash main and spare data is enabled
> > 1 NAND Flash spare only data is enabled
>
> At least the i.MX25 has the limitation of 1/2k page size for this
> feature. It's not in the i.MX27 manual. I don't know if the i.MX27
> documentation is inaccurate or if this limitation is there already.
Ok, I ignored this limitation on i.MX25. Better write generic code
then.
>
> Anyway, I don't think it's worth optimizing for this case given that
> we still need to support a full page write for 2k pages (which should
> be much more widespread nowadays than the 512b page size NANDs).
Sure!
Thanks,
Miquèl
next prev parent reply other threads:[~2018-01-18 7:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 10:11 mxc_nand controller fixes Sascha Hauer
2018-01-09 10:11 ` [PATCH 1/8] mtd: nand: mxc: reorder functions to avoid forward declarations Sascha Hauer
2018-01-09 10:11 ` [PATCH 2/8] mtd: nand: mxc: Add function to control hardware ECC Sascha Hauer
2018-01-09 10:11 ` [PATCH 3/8] mtd: nand: mxc: Add buffer argument to copy_spare Sascha Hauer
2018-01-09 10:11 ` [PATCH 4/8] mtd: nand: mxc: Fix failed/corrected values for v2/v3 controllers Sascha Hauer
2018-01-12 15:31 ` Boris Brezillon
2018-01-09 10:11 ` [PATCH 5/8] mtd: nand: mxc: Fix failed/corrected values for v1 controllers Sascha Hauer
2018-01-12 15:28 ` Boris Brezillon
2018-01-09 10:11 ` [PATCH 6/8] mtd: nand: mxc: Add own write_page Sascha Hauer
2018-01-12 15:36 ` Boris Brezillon
2018-01-13 16:25 ` Miquel Raynal
2018-01-17 10:40 ` Sascha Hauer
2018-01-18 7:16 ` Miquel Raynal [this message]
2018-01-09 10:11 ` [PATCH 7/8] mtd: nand: mxc: Drop now unnecessary functions Sascha Hauer
2018-01-09 10:11 ` [PATCH 8/8] mtd: nand: mxc: remove now unused code Sascha Hauer
-- strict thread matches above, loose matches on Subject: below --
2018-01-17 11:32 [PATCH v2] mxc_nand controller fixes Sascha Hauer
2018-01-17 11:32 ` [PATCH 6/8] mtd: nand: mxc: Add own write_page Sascha Hauer
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=20180118081610.32937f54@xps13 \
--to=miquel.raynal@free-electrons.com \
--cc=boris.brezillon@free-electrons.com \
--cc=kernel@pengutronix.de \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=s.hauer@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).