Patchwork CFI: remove major/minor version check for command set 0x0002

login
register
mail settings
Submitter Wolfgang Grandegger
Date Jan. 8, 2009, 4:07 p.m.
Message ID <496624A4.3050808@grandegger.com>
Download mbox | patch
Permalink /patch/17380/
State New
Headers show

Comments

Wolfgang Grandegger - Jan. 8, 2009, 4:07 p.m.
The NOR Flash memory K8P2815UQB from Samsung uses the major version
number '0', which seems to be unusual but not illegal, IIUC. This
patch removes the major-minor version check to get this Flash memory
supported as well.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
 drivers/mtd/chips/cfi_cmdset_0002.c |   10 ----------
 1 file changed, 10 deletions(-)
Nicolas Pitre - Jan. 8, 2009, 4:47 p.m.
On Thu, 8 Jan 2009, Wolfgang Grandegger wrote:

> The NOR Flash memory K8P2815UQB from Samsung uses the major version
> number '0', which seems to be unusual but not illegal, IIUC. This
> patch removes the major-minor version check to get this Flash memory
> supported as well.

Instead of removing the test entirely, I'd suggest you augment it with 
the manufacturer ID (cfi->mfr and cfi->id).  Or better yet, just use 
that information to fix up the version number to something sensible.


Nicolas
David Woodhouse - Jan. 8, 2009, 4:48 p.m.
On Thu, 2009-01-08 at 11:47 -0500, Nicolas Pitre wrote:
> > The NOR Flash memory K8P2815UQB from Samsung uses the major version
> > number '0', which seems to be unusual but not illegal, IIUC. This
> > patch removes the major-minor version check to get this Flash memory
> > supported as well.
> 
> Instead of removing the test entirely, I'd suggest you augment it with 
> the manufacturer ID (cfi->mfr and cfi->id).  Or better yet, just use 
> that information to fix up the version number to something sensible.

Couldn't you use a quirk to do the latter?
Wolfgang Grandegger - Jan. 8, 2009, 4:59 p.m.
David Woodhouse wrote:
> On Thu, 2009-01-08 at 11:47 -0500, Nicolas Pitre wrote:
>>> The NOR Flash memory K8P2815UQB from Samsung uses the major version
>>> number '0', which seems to be unusual but not illegal, IIUC. This
>>> patch removes the major-minor version check to get this Flash memory
>>> supported as well.
>> Instead of removing the test entirely, I'd suggest you augment it with 
>> the manufacturer ID (cfi->mfr and cfi->id).  Or better yet, just use 
>> that information to fix up the version number to something sensible.
> 
> Couldn't you use a quirk to do the latter?

The major/minor version number is not used anywhere else and therefore a
quirk seems to be overkill too me. But we may want to keep the message:

  Unknown Amd/Fujitsu Extended Query version 0.0.

Wolfgang.
Nicolas Pitre - Jan. 8, 2009, 5:42 p.m.
On Thu, 8 Jan 2009, Wolfgang Grandegger wrote:

> David Woodhouse wrote:
> > On Thu, 2009-01-08 at 11:47 -0500, Nicolas Pitre wrote:
> >>> The NOR Flash memory K8P2815UQB from Samsung uses the major version
> >>> number '0', which seems to be unusual but not illegal, IIUC. This
> >>> patch removes the major-minor version check to get this Flash memory
> >>> supported as well.
> >> Instead of removing the test entirely, I'd suggest you augment it with 
> >> the manufacturer ID (cfi->mfr and cfi->id).  Or better yet, just use 
> >> that information to fix up the version number to something sensible.
> > 
> > Couldn't you use a quirk to do the latter?
> 
> The major/minor version number is not used anywhere else and therefore a
> quirk seems to be overkill too me.

Please look again.  Searching for "MinorVersion" turns up a couple 
places.

A quirk is not overkill at all.  To the contrary it's the whole purpose 
of quirks to fix up things like this.

Although, in this case, I think quirks are evaluated only after the CFI 
version is tested, meaning that the fixup might have to be done inline.


Nicolas

Patch

Index: linux-2.6/drivers/mtd/chips/cfi_cmdset_0002.c
===================================================================
--- linux-2.6.orig/drivers/mtd/chips/cfi_cmdset_0002.c
+++ linux-2.6/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -363,16 +363,6 @@  struct mtd_info *cfi_cmdset_0002(struct 
 			return NULL;
 		}
 
-		if (extp->MajorVersion != '1' ||
-		    (extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
-			printk(KERN_ERR "  Unknown Amd/Fujitsu Extended Query "
-			       "version %c.%c.\n",  extp->MajorVersion,
-			       extp->MinorVersion);
-			kfree(extp);
-			kfree(mtd);
-			return NULL;
-		}
-
 		/* Install our own private info structure */
 		cfi->cmdset_priv = extp;