All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bartłomiej Ochman" <fback@home.fback.net>
To: linux-mtd@lists.infradead.org
Subject: Patch to support (some?) flash chips from Samsung.
Date: Mon, 23 Oct 2006 21:48:07 +0200	[thread overview]
Message-ID: <20061023194806.GA32351@red.fback.net> (raw)

Hello,

following patch brings back support to (some?) flash chips from Samsung.
This applies cleanly against linux-2.6.17, for 2.6.18 requires only
trivial change.

The bad news is, that mtd doesn't work for these chips. It was working
with 2.4.30, under 2.4.32 it doesn't anymore. I try to investigate why,
maybe that is because -Os switch with gcc-3.4.x. What's interesting,
programming single bytes (words?) seems to work perfectly, changes to
a filesystem on a flash are valid -- files have proper contents, there
are no problems with filesystem consistency, etc). I hope tomorrow I will
have JTAG cable to see what went wrong with programming with mtd util.

Regards,
BO

--- cfi_cmdset_0002.c	2006-10-23 21:14:11.618024794 +0200
+++ cfi_cmdset_0002.c.new	2006-10-23 21:01:22.970876922 +0200
@@ -49,6 +49,7 @@
 #define MANUFACTURER_SST	0x00BF
 #define SST49LF004B	        0x0060
 #define SST49LF008A		0x005a
+#define MANUFACTURER_SAMSUNG	0x00ec
 
 static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
 static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
@@ -253,7 +254,21 @@
 			return NULL;
 		}
 
-		if (extp->MajorVersion != '1' ||
+		if (cfi->mfr == MANUFACTURER_SAMSUNG) {
+		    printk(KERN_NOTICE "  Samsung flash chip detected, should "
+		           "be compatibile with Amd/Fujitsu.\n");
+		    /* according to the specs, version should always be 3.3 */
+		    if (extp->MajorVersion != '3' || 
+		        extp->MinorVersion != '3') {
+		            printk(KERN_ERR "  Unknown Samsung Extended Query "
+			           "version %c.%c.\n", extp->MajorVersion,
+			           extp->MinorVersion);
+			    kfree(extp);
+			    kfree(mtd);
+			    return NULL;
+	            }
+		} /* this added support to (some?) Samsung flashes */
+		else if (extp->MajorVersion != '1' ||
 		    (extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
 			printk(KERN_ERR "  Unknown Amd/Fujitsu Extended Query "
 			       "version %c.%c.\n",  extp->MajorVersion,

                 reply	other threads:[~2006-10-23 19:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20061023194806.GA32351@red.fback.net \
    --to=fback@home.fback.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.