public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Harald Nordgard-Hansen <hhansen@pvv.org>
To: dedekind1@gmail.com
Cc: linux-mtd@lists.infradead.org
Subject: Re: Fix recovery after failed write-buffer operation in cfi_cmdset_0002.c
Date: Fri, 23 Nov 2012 23:11:03 +0100	[thread overview]
Message-ID: <50AFF477.2030803@pvv.org> (raw)
In-Reply-To: <1353484119.2701.4.camel@sauron.fi.intel.com>

[-- Attachment #1: Type: text/plain, Size: 611 bytes --]

On 11/21/12 08:48, Artem Bityutskiy wrote:
> Hi, your patch is not applicable, it is line-wrapped. Can you
> please send a patch I can easily apply?

Sorry about that.  It's been way too many years since I regularly sent
patches in mail.  If this attempt does not work better, I'll just do
it all manually instead of trying to use these new-fangled MUAs. :-)

> Would be nice to put a short comment about what you do and why, may
> be some reference as well. Just to make sure if someone reads the
> code, he/she has some clue what are these about.

Hopefully in place now.

-Harald
-- 
Harald Nordgård-Hansen

[-- Attachment #2: write_buffer_recovery.patch --]
[-- Type: text/x-patch, Size: 1110 bytes --]

diff -ru a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
--- a/drivers/mtd/chips/cfi_cmdset_0002.c	2012-11-23 22:43:05.000000000 +0100
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c	2012-11-23 23:01:58.000000000 +0100
@@ -1536,8 +1536,16 @@
 		UDELAY(map, chip, adr, 1);
 	}
 
-	/* reset on all failures. */
-	map_write( map, CMD(0xF0), chip->start );
+	/*
+	 * Recovery from write-buffer programming failures requires
+	 * the write-to-buffer-reset sequence.  Since the last part
+	 * of the sequence also works as a normal reset, we can run
+	 * the same commands regardless of why we are here.
+	 * See e.g. http://www.spansion.com/Support/Application%20Notes/MirrorBit_Write_Buffer_Prog_Page_Buffer_Read_AN.pdf
+	 */
+	cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL);
+	cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type, NULL);
+	cfi_send_gen_cmd(0xF0, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL);
 	xip_enable(map, chip, adr);
 	/* FIXME - should have reset delay before continuing */
 

  reply	other threads:[~2012-11-23 22:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-09 13:23 Fix recovery after failed write-buffer operation in cfi_cmdset_0002.c Harald Nordgard-Hansen
2012-11-21  7:48 ` Artem Bityutskiy
2012-11-23 22:11   ` Harald Nordgard-Hansen [this message]
2012-12-03 13:24     ` Artem Bityutskiy

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=50AFF477.2030803@pvv.org \
    --to=hhansen@pvv.org \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /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