public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Patch to support (some?) flash chips from Samsung.
@ 2006-10-23 19:48 Bartłomiej Ochman
  0 siblings, 0 replies; only message in thread
From: Bartłomiej Ochman @ 2006-10-23 19:48 UTC (permalink / raw)
  To: linux-mtd

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,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-23 19:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-23 19:48 Patch to support (some?) flash chips from Samsung Bartłomiej Ochman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox