public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: 'Bean Huo' <beanhuo@outlook.com>,
	dwmw2@infradead.org, computersforpeace@gmail.com
Cc: b32955@freescale.com, artem.bityutskiy@linux.intel.com,
	'Jingoo Han' <jg1.han@samsung.com>,
	linux-kernel@vger.kernel.org, paul.gortmaker@windriver.com,
	linux-mtd@lists.infradead.org, christian.riesch@omicron.at
Subject: Re: [PATCH v5] mtd:nor:timeout:fix do_write_buffer() timeout error
Date: Wed, 16 Jul 2014 16:51:25 +0900	[thread overview]
Message-ID: <002201cfa0ca$be634b10$3b29e130$%han@samsung.com> (raw)
In-Reply-To: <BLU185-W62B0858FCD7D3A71127B41A6F70@phx.gbl>

On Wednesday, July 16, 2014 4:19 PM, Bean Huo wrote:
> 
> For some Norflashes,the size of the buffer program has been
> increased from 256 bytes to 512 bytes,2ms maximum timeout can
> not adapt to all the different vendor's norflash.There maximum
> timeout information in the CFI area,so the best way is to choose
> the result calculated according to timeout field of struct cfi_ident
> that probed from norflash's CFI aera.This is also a standard defined
> by CFI.If haven't probed this information,or smaller than 2000us,then
> specify a defualt value 2000us.
> 
> Tested with Micron JS28F512M29EWx and Micron MT28EW512ABA flash devices.
> 
> Signed-off-by: bean huo <beanhuo@outlook.com>
> ---
> changes
> 	v1->v2:Deleted unused parameters in this patch
> 		(word_write_time_max and erase_time_max).Using usecs_to_jiffies
> 		instead of msecs_to_jiffies for convert timeout value into jiffies.
> 	v2->v3:Removed unnecessary messages form comments and deleted trailing whitespace.
> 	V3->v4:If haven't probed timeout information,or smaller than 2000us,specify default
> 	       2000us.
> 	v4->v5:add one whitespace
>  drivers/mtd/chips/cfi_cmdset_0002.c |   28 ++++++++++++++++++++++++++--
>  1 file changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
> index e21fde9..c248a8c 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0002.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
> @@ -628,6 +628,24 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
>  		cfi->chips[i].word_write_time = 1<<cfi->cfiq->WordWriteTimeoutTyp;
>  		cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp;
>  		cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp;
> +		/*
> +		 * First calculate the timeout max according to timeout
> +		 * field of struct cfi_ident that probed from chip's CFI
> +		 * aera.If haven't probed this information,or smaller than
> +		 * 2000us,we will specify defualt value 2000us,and the time
> +		 * unit is us.
> +		 */
> +		if (cfi->cfiq->BufWriteTimeoutTyp &&
> +			cfi->cfiq->BufWriteTimeoutMax){
> +			cfi->chips[i].buffer_write_time_max =
> +				1<<(cfi->cfiq->BufWriteTimeoutTyp +
> +					cfi->cfiq->BufWriteTimeoutMax);
> +			} else {
> +				cfi->chips[i].buffer_write_time_max = 0;
> +				}

Please keep the coding style as below.

		if ( ) {
			...
		} else {
			...
		}

Best regards,
Jingoo Han

> +		cfi->chips[i].buffer_write_time_max =
> +			((cfi->chips[i].buffer_write_time_max>= 2000)
> +			 ? cfi->chips[i].buffer_write_time_max : 2000);
>  		cfi->chips[i].ref_point_counter = 0;
>  		init_waitqueue_head(&(cfi->chips[i].wq));
>  	}
> @@ -1462,8 +1480,14 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
>  {
>  	struct cfi_private *cfi = map->fldrv_priv;
>  	unsigned long timeo = jiffies + HZ;
> -	/* see comments in do_write_oneword() regarding uWriteTimeo. */
> -	unsigned long uWriteTimeout = ( HZ / 1000 ) + 1;
> +	/*
> +	 * Use the result that calculated according to timeout field
> +	 * of struct cfi_ident that probed from norflash's CFI aera.
> +	 * See more comments in cfi_cmdset_0002().uWriteTimeout is
> +	 * used for timeout step,it must be concerted into jiffies.
> +	 */
> +	unsigned long uWriteTimeout =
> +				usecs_to_jiffies(chip->buffer_write_time_max);
>  	int ret = -EIO;
>  	unsigned long cmd_adr;
>  	int z, words;
> --
> 1.7.9.5 		 	   		  =

  reply	other threads:[~2014-07-16  7:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16  7:09 [PATCH v4] mtd:nor:timeout:fix do_write_buffer() timeout error Bean Huo
2014-07-16  7:19 ` [PATCH v5] " Bean Huo
2014-07-16  7:51   ` Jingoo Han [this message]
2014-07-16  8:48     ` Bean Huo
2014-07-16 10:22       ` Jingoo Han
2014-07-16 16:10         ` Bean Huo

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='002201cfa0ca$be634b10$3b29e130$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=b32955@freescale.com \
    --cc=beanhuo@outlook.com \
    --cc=christian.riesch@omicron.at \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=paul.gortmaker@windriver.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