mtd: cfi_cmdset_0002: fix the check for valid primary extension versions

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Aug 4 06:59:08 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=e17f47a14b3418711d9fee5c0a77ef0b672f5eaa
Commit:     e17f47a14b3418711d9fee5c0a77ef0b672f5eaa
Parent:     9d2c4f3fe50a6d07275de91b392aaaf4773bc8b6
Author:     Guillaume LECERF <glecerf at gmail.com>
AuthorDate: Fri Jul 2 14:39:10 2010 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Wed Aug 4 10:58:36 2010 +0100

    mtd: cfi_cmdset_0002: fix the check for valid primary extension versions
    
    Valid primary extension versions are: 1.0, 1.1, 1.2, 1.3 [1][2].
    Fix the check in cfi_cmdset_0002 accordingly.
    
    [1] http://www.amd.com/us-en/assets/content_type/DownloadableAssets/cfi_r20.pdf, page 19
    [2] http://www.amd.com/us-en/assets/content_type/DownloadableAssets/cfi_100_20011201.pdf
    
    Signed-off-by: Florian Fainelli <florian at openwrt.org>
    Signed-off-by: Guillaume LECERF <glecerf at gmail.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/chips/cfi_cmdset_0002.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index d81079e..749203f 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -417,16 +417,25 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
 			 */
 			cfi_fixup_major_minor(cfi, extp);
 
+			/*
+			 * Valid primary extension versions are: 1.0, 1.1, 1.2, 1.3
+			 * see: http://www.amd.com/us-en/assets/content_type/DownloadableAssets/cfi_r20.pdf, page 19 and on
+			 *      http://www.amd.com/us-en/assets/content_type/DownloadableAssets/cfi_100_20011201.pdf
+			 */
 			if (extp->MajorVersion != '1' ||
-			    (extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
+			    (extp->MajorVersion == '1' && ( extp->MinorVersion < '0' || extp->MinorVersion > '3'))) {
 				printk(KERN_ERR "  Unknown Amd/Fujitsu Extended Query "
-				       "version %c.%c.\n",  extp->MajorVersion,
-				       extp->MinorVersion);
+				       "version %c.%c (%#02x/%#02x).\n",
+				       extp->MajorVersion, extp->MinorVersion,
+				       extp->MajorVersion, extp->MinorVersion);
 				kfree(extp);
 				kfree(mtd);
 				return NULL;
 			}
 
+			printk(KERN_INFO "  Amd/Fujitsu Extended Query version %c.%c.\n",
+			       extp->MajorVersion, extp->MinorVersion);
+
 			/* Install our own private info structure */
 			cfi->cmdset_priv = extp;
 



More information about the linux-mtd-cvs mailing list