Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1739551

Re: [PATCH] mtd: nand: wait for tWHR after NAND_CMD_STATUS / NAND_CMD_READID

From Boris Brezillon <boris.brezillon@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mtd: nand: wait for tWHR after NAND_CMD_STATUS / NAND_CMD_READID
Date 2017-09-26 08:50 +0200
Message-ID <utRQR-150-9@gated-at.bofh.it> (permalink)
References <utP2F-7zs-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 26 Sep 2017 12:39:24 +0900
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:

> Read Status and Read ID require tWHR before reading the first data.
> Insert a very short wait to make sure to meet the spec.
> 
> I have not seen any problem report for now, but nand_command() and
> nand_command_lP() are generic hooks, so it makes sense to implement
> fail-safe code here.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  drivers/mtd/nand/nand_base.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index b1cf32c..55c0ba5 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -742,9 +742,12 @@ static void nand_command(struct mtd_info *mtd, unsigned int command,
>  	case NAND_CMD_ERASE1:
>  	case NAND_CMD_ERASE2:
>  	case NAND_CMD_SEQIN:
> +	case NAND_CMD_SET_FEATURES:
> +		return;
> +
>  	case NAND_CMD_STATUS:
>  	case NAND_CMD_READID:
> -	case NAND_CMD_SET_FEATURES:
> +		ndelay(200);	/* tWHR */
>  		return;
>  
>  	case NAND_CMD_RESET:
> @@ -871,9 +874,12 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
>  	case NAND_CMD_ERASE1:
>  	case NAND_CMD_ERASE2:
>  	case NAND_CMD_SEQIN:
> +	case NAND_CMD_SET_FEATURES:
> +		return;
> +
>  	case NAND_CMD_STATUS:
>  	case NAND_CMD_READID:
> -	case NAND_CMD_SET_FEATURES:
> +		ndelay(200);	/* tWHR */

Can you do something like nand_ccs_delay() [1] instead of
unconditionally adding this 200ns delay here? I'm not worried about the
overhead introduced by this ndelay(), but I don't want to risk
introducing a regression.
 

>  		return;
>  
>  	case NAND_CMD_RNDIN:

[1]http://elixir.free-electrons.com/linux/v4.14-rc2/source/drivers/mtd/nand/nand_base.c#L793

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mtd: nand: wait for tWHR after NAND_CMD_STATUS / NAND_CMD_READID Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-09-26 05:50 +0200
  Re: [PATCH] mtd: nand: wait for tWHR after NAND_CMD_STATUS /  NAND_CMD_READID Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-09-26 08:50 +0200
    Re: [PATCH] mtd: nand: wait for tWHR after NAND_CMD_STATUS / NAND_CMD_READID Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-09-26 10:20 +0200
      Re: [PATCH] mtd: nand: wait for tWHR after NAND_CMD_STATUS /  NAND_CMD_READID Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-09-26 10:30 +0200

csiph-web