* [PATCH] mtd: cfi_cmdset_0001: Fix problem with unlocking timeout
@ 2012-08-28 9:34 Stefan Roese
2012-08-28 17:51 ` Stephan Gatzka
2012-08-30 7:02 ` Artem Bityutskiy
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Roese @ 2012-08-28 9:34 UTC (permalink / raw)
To: linux-mtd; +Cc: dedekind, Andreas Friesen, Stephan Gatzka
Unlocking may take up to 1.4 seconds on some Intel flashes. So
lets use a max. of 1.5 seconds (1500ms) as timeout.
See "Clear Block Lock-Bits Time" on page 40 in
"3 Volt Intel StrataFlash Memory" 28F128J3,28F640J3,28F320J3 manual
from February 2003
This patch also fixes some other problems with this timeout:
- Don't use HZ in timeout "calculation"!
While testing we noticed that an unlocking timeout occured with
HZ=1000 and didn't occur with HZ=300. This was because the
timeout parameter was calculated differently depending on the
HZ value. Now a fixed value of 1500ms is used.
- The last parameter of WAIT_TIMEOUT (defined to
inval_cache_and_wait_for_operation) has to be passed in
micro-seconds. So multiply the ms value with 1000 and not 100
to calculate this value.
- Use variable name "mdelay" instead of misleading "udelay".
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Stephan Gatzka <stephan.gatzka@hbm.com>
Cc: Andreas Friesen <andreas.friesen@hbm.com>
---
drivers/mtd/chips/cfi_cmdset_0001.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index dbbd2ed..7751443 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -2043,7 +2043,7 @@ static int __xipram do_xxlock_oneblock(struct map_info *map, struct flchip *chip
{
struct cfi_private *cfi = map->fldrv_priv;
struct cfi_pri_intelext *extp = cfi->cmdset_priv;
- int udelay;
+ int mdelay;
int ret;
adr += chip->start;
@@ -2072,9 +2072,17 @@ static int __xipram do_xxlock_oneblock(struct map_info *map, struct flchip *chip
* If Instant Individual Block Locking supported then no need
* to delay.
*/
- udelay = (!extp || !(extp->FeatureSupport & (1 << 5))) ? 1000000/HZ : 0;
+ /*
+ * Unlocking may take up to 1.4 seconds on some Intel flashes. So
+ * lets use a max of 1.5 seconds (1500ms) as timeout.
+ *
+ * See "Clear Block Lock-Bits Time" on page 40 in
+ * "3 Volt Intel StrataFlash Memory" 28F128J3,28F640J3,28F320J3 manual
+ * from February 2003
+ */
+ mdelay = (!extp || !(extp->FeatureSupport & (1 << 5))) ? 1500 : 0;
- ret = WAIT_TIMEOUT(map, chip, adr, udelay, udelay * 100);
+ ret = WAIT_TIMEOUT(map, chip, adr, mdelay, mdelay * 1000);
if (ret) {
map_write(map, CMD(0x70), adr);
chip->state = FL_STATUS;
--
1.7.12
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: cfi_cmdset_0001: Fix problem with unlocking timeout
2012-08-28 9:34 [PATCH] mtd: cfi_cmdset_0001: Fix problem with unlocking timeout Stefan Roese
@ 2012-08-28 17:51 ` Stephan Gatzka
2012-08-30 7:02 ` Artem Bityutskiy
1 sibling, 0 replies; 3+ messages in thread
From: Stephan Gatzka @ 2012-08-28 17:51 UTC (permalink / raw)
To: linux-mtd
[-- Attachment #1: Type: text/plain, Size: 307 bytes --]
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Stephan Gatzka <stephan.gatzka@hbm.com>
> Cc: Andreas Friesen <andreas.friesen@hbm.com>
Successfully tested on MPC5200b with Intel StrataFlash using different
values for HZ.
No problems, so
Tested-by: Stephan Gatzka <stephan@gatzka.org>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4931 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: cfi_cmdset_0001: Fix problem with unlocking timeout
2012-08-28 9:34 [PATCH] mtd: cfi_cmdset_0001: Fix problem with unlocking timeout Stefan Roese
2012-08-28 17:51 ` Stephan Gatzka
@ 2012-08-30 7:02 ` Artem Bityutskiy
1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2012-08-30 7:02 UTC (permalink / raw)
To: Stefan Roese; +Cc: Andreas Friesen, linux-mtd, Stephan Gatzka
[-- Attachment #1: Type: text/plain, Size: 369 bytes --]
On Tue, 2012-08-28 at 11:34 +0200, Stefan Roese wrote:
> Unlocking may take up to 1.4 seconds on some Intel flashes. So
> lets use a max. of 1.5 seconds (1500ms) as timeout.
>
> See "Clear Block Lock-Bits Time" on page 40 in
> "3 Volt Intel StrataFlash Memory" 28F128J3,28F640J3,28F320J3 manual
> from February 2003
Pushed to l2-mtd.git, thanks!
Artem.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-30 6:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-28 9:34 [PATCH] mtd: cfi_cmdset_0001: Fix problem with unlocking timeout Stefan Roese
2012-08-28 17:51 ` Stephan Gatzka
2012-08-30 7:02 ` Artem Bityutskiy
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).