All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	linux-mtd@lists.infradead.org
Cc: Marek Vasut <marek.vasut@gmail.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	stable@vger.kernel.org,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
Subject: Re: [PATCH v2] mtd: rawnand: Make sure we wait tWB before polling the STATUS reg
Date: Mon, 7 May 2018 11:35:22 +0200	[thread overview]
Message-ID: <20180507113522.03a52da9@bbrezillon> (raw)
In-Reply-To: <20180504192431.16661-1-boris.brezillon@bootlin.com>

On Fri,  4 May 2018 21:24:31 +0200
Boris Brezillon <boris.brezillon@bootlin.com> wrote:

> NAND chips require a bit of time to take the NAND operation into
> account and set the BUSY bit in the STATUS reg. Make sure we don't poll
> the STATUS reg too early in nand_soft_waitrdy().
> 
> Fixes: 8878b126df76 ("mtd: nand: add ->exec_op() implementation")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---
> Changes in v2:
> - Move the ndelay() to nand_soft_waitrdy() instead of having it in the
>   FSMC driver
> ---
>  drivers/mtd/nand/raw/nand_base.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index 72f3a89da513..da94fcb4dd9b 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -706,12 +706,17 @@ static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo)
>   */
>  int nand_soft_waitrdy(struct nand_chip *chip, unsigned long timeout_ms)
>  {
> +	const struct nand_sdr_timings *timings;
>  	u8 status = 0;
>  	int ret;
>  
>  	if (!chip->exec_op)
>  		return -ENOTSUPP;
>  
> +	/* Wait tWB before polling the STATUS reg. */
> +	timings = nand_get_sdr_timings(&chip->data_interface);
> +	ndelay(PSEC_TO_NSEC(sdr->tWB_max));

			    ^ timings->tWB_max

And for those who wonder, yes, I compiled the code, but it seems I
forgot to amend the commit after fixing the bug locally :-).

> +
>  	ret = nand_status_op(chip, NULL);
>  	if (ret)
>  		return ret;

  parent reply	other threads:[~2018-05-07  9:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 19:24 [PATCH v2] mtd: rawnand: Make sure we wait tWB before polling the STATUS reg Boris Brezillon
2018-05-06 21:56 ` Miquel Raynal
2018-05-07  9:35 ` Boris Brezillon [this message]
2018-05-08 21:11   ` Boris Brezillon

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=20180507113522.03a52da9@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    /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.