Patchwork cfi_cmdset_0001.c: quirk for PF38F4476.

login
register
mail settings
Submitter Daniel Ribeiro
Date May 16, 2009, 11:41 a.m.
Message ID <1242474072.30413.32.camel@brutus>
Download mbox | patch
Permalink /patch/27301/
State New
Headers show

Comments

Daniel Ribeiro - May 16, 2009, 11:41 a.m.
This chip reports CFI 1.3, but the CFI PRI is like CFI 1.1. Add a quirk
to pass probe on this chip.
(This patch depends on "cfi_cmdset_0001.c: CFI 1.0 and CFI 1.1")

Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
---
 drivers/mtd/chips/cfi_cmdset_0001.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Artem Bityutskiy - May 17, 2009, 7:32 a.m.
On Sat, 2009-05-16 at 08:41 -0300, Daniel Ribeiro wrote:
> This chip reports CFI 1.3, but the CFI PRI is like CFI 1.1. Add a quirk
> to pass probe on this chip.
> (This patch depends on "cfi_cmdset_0001.c: CFI 1.0 and CFI 1.1")
> 
> Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>

Would be good to CC Nicolas Pitre <nico@cam.org> when sending these
patches.

Patch

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index bf07d14..0e01ab9 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -46,6 +46,7 @@ 
 #define MANUFACTURER_INTEL	0x0089
 #define I82802AB	0x00ad
 #define I82802AC	0x00ac
+#define PF38F4476	0x881c
 #define MANUFACTURER_ST         0x0020
 #define M50LPW080       0x002F
 #define M50FLW080A	0x0080
@@ -315,9 +316,18 @@  static struct cfi_fixup fixup_table[] = {
 	{ 0, 0, NULL, NULL }
 };
 
+static void cfi_fixup_major_minor(struct cfi_private *cfi,
+						struct cfi_pri_intelext *extp)
+{
+	if (cfi->mfr == MANUFACTURER_INTEL &&
+			cfi->id == PF38F4476 && extp->MinorVersion == '3')
+		extp->MinorVersion = '1';
+}
+
 static inline struct cfi_pri_intelext *
 read_pri_intelext(struct map_info *map, __u16 adr)
 {
+	struct cfi_private *cfi = map->fldrv_priv;
 	struct cfi_pri_intelext *extp;
 	unsigned int extra_size = 0;
 	unsigned int extp_size = sizeof(*extp);
@@ -327,6 +337,8 @@  read_pri_intelext(struct map_info *map, __u16 adr)
 	if (!extp)
 		return NULL;
 
+	cfi_fixup_major_minor(cfi, extp);
+
 	if (extp->MajorVersion != '1' ||
 	    (extp->MinorVersion < '0' || extp->MinorVersion > '5')) {
 		printk(KERN_ERR "  Unknown Intel/Sharp Extended Query "