linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] mtd:nor:timeout:fix do_write_buffer() timeout error
@ 2014-06-30  7:56 Bean Huo 霍斌斌 (beanhuo)
  2014-07-12  6:30 ` Brian Norris
  0 siblings, 1 reply; 8+ messages in thread
From: Bean Huo 霍斌斌 (beanhuo) @ 2014-06-30  7:56 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, Paul Gortmaker
  Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	Jingoo Han, Artem Bityutskiy, b32955@freescale.com

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 |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index e21fde9..f7098d6 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;
+				}
 		cfi->chips[i].ref_point_counter = 0;
 		init_waitqueue_head(&(cfi->chips[i].wq));
 	}
-
 	map->fldrv = &cfi_amdstd_chipdrv;
 
 	return cfi_amdstd_setup(mtd);
@@ -1462,8 +1476,15 @@ 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;
+	/* 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,see 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH v3] mtd:nor:timeout:fix do_write_buffer() timeout error
@ 2014-07-09  1:00 bean huo
  0 siblings, 0 replies; 8+ messages in thread
From: bean huo @ 2014-07-09  1:00 UTC (permalink / raw)
  To: dwmw2@infradead.org, computersforpeace@gmail.com,
	paul.gortmaker@windriver.com

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@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.
 
 drivers/mtd/chips/cfi_cmdset_0002.c |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
 
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index e21fde9..f7098d6 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;
+                       }
            cfi->chips[i].ref_point_counter = 0;
            init_waitqueue_head(&(cfi->chips[i].wq));
      }
-
      map->fldrv = &cfi_amdstd_chipdrv;
 
      return cfi_amdstd_setup(mtd);
@@ -1462,8 +1476,15 @@ 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;
+     /* 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,see 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 		 	   		  

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH v3] mtd:nor:timeout:fix do_write_buffer() timeout error
@ 2014-07-09  0:43 Bean Huo
  0 siblings, 0 replies; 8+ messages in thread
From: Bean Huo @ 2014-07-09  0:43 UTC (permalink / raw)
  To: dwmw2, computersforpeace, paul.gortmaker
  Cc: linux-mtd, linux-kernel, jg1.han, artem.bityutskiy

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 <jackyard88@gmail.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 |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c
b/drivers/mtd/chips/cfi_cmdset_0002.c
index e21fde9..f7098d6 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;
+                       }
            cfi->chips[i].ref_point_counter = 0;
            init_waitqueue_head(&(cfi->chips[i].wq));
      }
-
      map->fldrv = &cfi_amdstd_chipdrv;

      return cfi_amdstd_setup(mtd);
@@ -1462,8 +1476,15 @@ 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;
+     /* 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,see 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH v3] mtd:nor:timeout:fix do_write_buffer() timeout error
@ 2014-07-07  6:05 Bean Huo 霍斌斌 (beanhuo)
  0 siblings, 0 replies; 8+ messages in thread
From: Bean Huo 霍斌斌 (beanhuo) @ 2014-07-07  6:05 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, Paul Gortmaker
  Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	Jingoo Han, Artem Bityutskiy, b32955@freescale.com

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 |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index e21fde9..f7098d6 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;
+				}
 		cfi->chips[i].ref_point_counter = 0;
 		init_waitqueue_head(&(cfi->chips[i].wq));
 	}
-
 	map->fldrv = &cfi_amdstd_chipdrv;
 
 	return cfi_amdstd_setup(mtd);
@@ -1462,8 +1476,15 @@ 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;
+	/* 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,see 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH v3] mtd:nor:timeout:fix do_write_buffer() timeout error
@ 2014-07-03  0:40 Bean Huo 霍斌斌 (beanhuo)
  0 siblings, 0 replies; 8+ messages in thread
From: Bean Huo 霍斌斌 (beanhuo) @ 2014-07-03  0:40 UTC (permalink / raw)
  To: computersforpeace@gmail.com
  Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	Jingoo Han, Artem Bityutskiy

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 |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index e21fde9..f7098d6 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;
+				}
 		cfi->chips[i].ref_point_counter = 0;
 		init_waitqueue_head(&(cfi->chips[i].wq));
 	}
-
 	map->fldrv = &cfi_amdstd_chipdrv;
 
 	return cfi_amdstd_setup(mtd);
@@ -1462,8 +1476,15 @@ 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;
+	/* 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,see 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH v3] mtd:nor:timeout:fix do_write_buffer() timeout error
@ 2014-06-24 17:03 Bean Huo 霍斌斌 (beanhuo)
  0 siblings, 0 replies; 8+ messages in thread
From: Bean Huo 霍斌斌 (beanhuo) @ 2014-06-24 17:03 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, Paul Gortmaker
  Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	Jingoo Han, Artem Bityutskiy, b32955@freescale.com

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 |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index e21fde9..f7098d6 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;
+				}
 		cfi->chips[i].ref_point_counter = 0;
 		init_waitqueue_head(&(cfi->chips[i].wq));
 	}
-
 	map->fldrv = &cfi_amdstd_chipdrv;
 
 	return cfi_amdstd_setup(mtd);
@@ -1462,8 +1476,15 @@ 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;
+	/* 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,see 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-07-12  6:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-30  7:56 [PATCH v3] mtd:nor:timeout:fix do_write_buffer() timeout error Bean Huo 霍斌斌 (beanhuo)
2014-07-12  6:30 ` Brian Norris
2014-07-12  6:37   ` Brian Norris
  -- strict thread matches above, loose matches on Subject: below --
2014-07-09  1:00 bean huo
2014-07-09  0:43 Bean Huo
2014-07-07  6:05 Bean Huo 霍斌斌 (beanhuo)
2014-07-03  0:40 Bean Huo 霍斌斌 (beanhuo)
2014-06-24 17:03 Bean Huo 霍斌斌 (beanhuo)

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).