linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	matthias.bgg@gmail.com, linux-mtd@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] mtd: rawnand: mtk: Fix WAITRDY break condition and timeout
Date: Tue, 9 Mar 2021 08:06:08 +0100	[thread overview]
Message-ID: <20210309080608.63373f78@collabora.com> (raw)
In-Reply-To: <20210309000107.1368404-1-hauke@hauke-m.de>

On Tue,  9 Mar 2021 01:01:07 +0100
Hauke Mehrtens <hauke@hauke-m.de> wrote:

> This fixes NAND_OP_WAITRDY_INSTR operation in the driver. Without this
> change the driver waits till the system is busy, but we should wait till
> the busy flag is cleared. The readl_poll_timeout() function gets a break
> condition, not a wait condition.
> 
> In addition fix the timeout. The timeout_ms is given in ms, but the
> readl_poll_timeout() function takes the timeout in us. Multiple the
> given timeout by 1000 to convert it.
> 
> Without this change, the driver does not work at all, it doesn't even
> identify the NAND chip.
> 
> Fixes: 5197360f9e09 ("mtd: rawnand: mtk: Convert the driver to exec_op()")
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

> ---
>  drivers/mtd/nand/raw/mtk_nand.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
> index 57f1f1708994..5c5c92132287 100644
> --- a/drivers/mtd/nand/raw/mtk_nand.c
> +++ b/drivers/mtd/nand/raw/mtk_nand.c
> @@ -488,8 +488,8 @@ static int mtk_nfc_exec_instr(struct nand_chip *chip,
>  		return 0;
>  	case NAND_OP_WAITRDY_INSTR:
>  		return readl_poll_timeout(nfc->regs + NFI_STA, status,
> -					  status & STA_BUSY, 20,
> -					  instr->ctx.waitrdy.timeout_ms);
> +					  !(status & STA_BUSY), 20,
> +					  instr->ctx.waitrdy.timeout_ms * 1000);
>  	default:
>  		break;
>  	}


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2021-03-09  7:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  0:01 [PATCH] mtd: rawnand: mtk: Fix WAITRDY break condition and timeout Hauke Mehrtens
2021-03-09  7:06 ` Boris Brezillon [this message]
2021-03-11 11:39 ` Miquel Raynal

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=20210309080608.63373f78@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=hauke@hauke-m.de \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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 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).