All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: richard@nod.at, boris.brezillon@collabora.com, 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: Thu, 11 Mar 2021 12:39:30 +0100	[thread overview]
Message-ID: <20210311123930.0c41ec78@xps13> (raw)
In-Reply-To: <20210309000107.1368404-1-hauke@hauke-m.de>

Hi Hauke,

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

> 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>
> ---
>  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;
>  	}

Applied to mtd/fixes.

Thanks,
Miquèl

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: richard@nod.at, boris.brezillon@collabora.com, 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: Thu, 11 Mar 2021 12:39:30 +0100	[thread overview]
Message-ID: <20210311123930.0c41ec78@xps13> (raw)
In-Reply-To: <20210309000107.1368404-1-hauke@hauke-m.de>

Hi Hauke,

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

> 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>
> ---
>  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;
>  	}

Applied to mtd/fixes.

Thanks,
Miquèl

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

  parent reply	other threads:[~2021-03-11 11:44 UTC|newest]

Thread overview: 6+ 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  0:01 ` Hauke Mehrtens
2021-03-09  7:06 ` Boris Brezillon
2021-03-09  7:06   ` Boris Brezillon
2021-03-11 11:39 ` Miquel Raynal [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=20210311123930.0c41ec78@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=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=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 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.