From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] mtd: nand-imx: repair reading the oob area
Date: Fri, 23 Oct 2020 09:05:11 +0200 [thread overview]
Message-ID: <20201023070511.GP26805@pengutronix.de> (raw)
In-Reply-To: <20201022122522.3303-1-u.kleine-koenig@pengutronix.de>
On Thu, Oct 22, 2020 at 02:25:22PM +0200, Uwe Kleine-König wrote:
> After sending the READOOB command the core (in nand_read_oob_std()) uses
> the read_buf callback to fetch the result. So in the imx driver it is
> necessary to emit the NFC_OUTPUT command to make the controller actually
> read the requested data into the internal buffer and then copy the data
> to the location where read_buf expects it.
>
> This fixes reading from /dev/nand0.oob and also (somewhat) reading bad
> block markers in the absence of a bad block table.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> I failed to find the commit that broke reading from /dev/nand0.oob but
> failed to identify it. I think this bug is quite old. I didn't test, but
> I think this was already broken in 2010.09.0 where the nand support was
> moved from drivers/nand to drivers/mtd/nand. (This is where gitk output
> ended :-)
>
> Best regards
> Uwe
Tested on i.MX27 and applied, thanks
Sascha
>
> drivers/mtd/nand/nand_imx.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c
> index d69a012f017b..f9d3c2e34a99 100644
> --- a/drivers/mtd/nand/nand_imx.c
> +++ b/drivers/mtd/nand/nand_imx.c
> @@ -996,14 +996,23 @@ static void imx_nand_command(struct mtd_info *mtd, unsigned command,
> else
> host->buf_start = column + mtd->writesize;
>
> - command = NAND_CMD_READ0;
> -
> - host->send_cmd(host, command);
> + host->send_cmd(host, NAND_CMD_READ0);
> mxc_do_addr_cycle(mtd, column, page_addr);
>
> if (host->pagesize_2k)
> /* send read confirm command */
> host->send_cmd(host, NAND_CMD_READSTART);
> +
> + /*
> + * After the core issued READOOB the result is read using
> + * .read_buf, so we have to make sure the data is actually
> + * there.
> + */
> + if (command == NAND_CMD_READOOB) {
> + host->send_page(host, NFC_OUTPUT);
> + copy_spare(mtd, 1, host->data_buf + mtd->writesize);
> + }
> +
> break;
>
> case NAND_CMD_SEQIN:
> --
> 2.28.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2020-10-23 7:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 12:25 Uwe Kleine-König
2020-10-23 7:05 ` Sascha Hauer [this message]
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=20201023070511.GP26805@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=u.kleine-koenig@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