Re: [PATCH v3] mtd:nor:timeout:fix do_write_buffer() timeout error

Christian Riesch
2014-06-24T06:55:51Z

Hi,
sorry, I found something else.

On Tue, Jun 24, 2014 at 4:02 AM, Bean Huo 霍斌斌 (beanhuo)
<beanhuo@micron.com> wrote:
> The size of the buffer program has been increased from 256 to 512 ,
> 2ms maximum timeout for do_write_buffer 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.
>
> Without this change, if the size of buffer program is 512 or bigger than 256,
> due to timeout is the shorter than that the chip required,do_write_buffer
> sometimes fails.
>
> Tested with Micron JS28F512M29EWx and Micron MT28EW512ABA flash devices.
>
> Signed-off-by: bean huo <beanhuo@micron.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.
>
> drivers/mtd/chips/cfi_cmdset_0002.c | 25 ++++++++++++++++++++++---
> 1 file changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
> index e21fde9..3ee43cf 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0002.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
> @@ -628,10 +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;
> + /*
> + * We 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,we will specify
> + * a default value,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 {
> + /* specify maximum timeout for buffer program 2000us */
> + cfi->chips[i].buffer_write_time_max = 2000;
> + }

Wrong indentation above. Please fix that.

Christian