From: Stuart Menefy <stuart.menefy@st.com>
To: gromit1463@mailworks.org
Cc: linux-mtd@lists.infradead.org
Subject: Re: "Read-only file system" error while writing
Date: Wed, 31 Jul 2002 16:35:30 +0100 [thread overview]
Message-ID: <20020731163530.70c45960.stuart.menefy@st.com> (raw)
In-Reply-To: <1028064443.23642.52.camel@mahi190.austin.ibm.com>
Stephen
On Tue, 30 Jul 2002 16:27:23 -0500
gromit1463@mailworks.org wrote:
> I have a set of STMicro flash chips (M28W320CT) that use the Intel
> Extended CFI command set (0001), and I'm using kernel 2.4.2. I can
> partition the chips, lock and unlock the chips, erase the chips and read
> from (dd) the chips perfectly fine.
I had problems getting these devices to work as well, and ended up deciding
there were a couple of bugs which had to be worked around. One is a problem
in the state machine which handles unlocking returns to read mode when
it should stay in command mode, and the other is a simple error in the CFI
data, which gets the size of the device wrong!
The attached changes work for me. Unfortuntaly my cfi_cmdset_0001.c is
pretty heavily modified, so the patch may not apply cleanly. The two
changes are for do_lock_onblock() and do_unlock_oneblock().
Note that I was using the bottom bank version, so if you find you also
need the work around for the CFI data being wrong, you will probably have
to adjust the device ID being checked for.
Hope this helps
Stuart
diff -ru --exclude=CVS mtd.orig/drivers/mtd/chips/cfi_cmdset_0001.c mtd/drivers/mtd/chips/cfi_cmdset_0001.c
--- mtd.orig/drivers/mtd/chips/cfi_cmdset_0001.c Tue Nov 27 14:55:12 2001
+++ mtd/drivers/mtd/chips/cfi_cmdset_0001.c Mon Dec 10 17:46:05 2001
@@ -1400,6 +1479,10 @@
ENABLE_VPP(map);
cfi_write(map, CMD(0x60), adr);
cfi_write(map, CMD(0x01), adr);
+
+// SIM: I've added this for the ST chip which reverts to read mode. Ahhh
+cfi_write(map, CMD(0x70), adr);
+
chip->state = FL_LOCKING;
spin_unlock_bh(chip->mutex);
@@ -1550,7 +1621,10 @@
cfi_write(map, CMD(0x60), adr);
cfi_write(map, CMD(0xD0), adr);
chip->state = FL_UNLOCKING;
-
+
+// SIM: I've added this for the ST chip which reverts to read mode. Ahhh
+cfi_write(map, CMD(0x70), adr);
+
spin_unlock_bh(chip->mutex);
schedule_timeout(HZ);
spin_lock_bh(chip->mutex);
diff -ru --exclude=CVS mtd.orig/drivers/mtd/chips/cfi_probe.c mtd/drivers/mtd/chips/cfi_probe.c
--- mtd.orig/drivers/mtd/chips/cfi_probe.c Tue Oct 2 16:05:12 2001
+++ mtd/drivers/mtd/chips/cfi_probe.c Mon Dec 10 17:51:24 2001
@@ -147,6 +145,22 @@
((unsigned char *)cfi->cfiq)[i] = cfi_read_query(map,base + (0x10 + i)*ofs_factor);
}
+ /* The STMicroelectronics M28W320CB device reports incorrect CFI data.
+ * Check here and fix up if necessary.
+ */
+#define VENDOR_STMICROELECTRONICS 0x0020
+#define DEVICE_M28W320CB 0xbb
+ {
+ unsigned int vendor, id;
+ vendor = cfi_read_query(map,base + 0*ofs_factor);
+ id = cfi_read_query(map,base + 1*ofs_factor);
+printk("Vendor %08x id %08x\n", vendor, id);
+ if ((vendor == VENDOR_STMICROELECTRONICS) && (id == DEVICE_M28W320CB)) {
+ printk("Detected STM M28W320CB, applying CFI fixups\n");
+ ((unsigned char*)cfi->cfiq)[0x31 - 0x10] = 0x3e;
+ }
+ }
+
/* Do any necessary byteswapping */
cfi->cfiq->P_ID = le16_to_cpu(cfi->cfiq->P_ID);
--
Stuart Menefy stuart.menefy@st.com
STMicroelectronics Ltd ST Intranet: mo.bri.st.com
Bristol, UK Rest of the World: www.linuxsh.st.com
next prev parent reply other threads:[~2002-07-31 15:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-30 21:27 "Read-only file system" error while writing Stephen Hui
2002-07-30 22:25 ` David Woodhouse
2002-07-31 11:53 ` Jörn Engel
2003-05-21 11:33 ` Gordon J Milne
2003-05-21 14:18 ` Thayne Harbaugh
2003-05-22 21:57 ` Gordon J Milne
2002-07-31 15:35 ` Stuart Menefy [this message]
2002-07-31 20:24 ` Stephen Hui
2002-08-01 10:31 ` David Woodhouse
2002-08-01 18:05 ` Stuart Menefy
2002-08-01 18:26 ` Stuart Menefy
2002-08-01 19:45 ` Stephen Hui
2002-08-01 22:37 ` Stuart Menefy
2002-08-02 14:46 ` Stephen Hui
2002-08-01 10:35 ` David Woodhouse
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=20020731163530.70c45960.stuart.menefy@st.com \
--to=stuart.menefy@st.com \
--cc=gromit1463@mailworks.org \
--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