mtd: CFI 1.0 and CFI 1.1

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Jun 5 14:59:16 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=e1b158abc532f5a9d355c187583038c4f75ab11d
Commit:     e1b158abc532f5a9d355c187583038c4f75ab11d
Parent:     ec2d0d842577854eee18f0dc06bd48fe17189b54
Author:     Daniel Ribeiro <drwyrm at gmail.com>
AuthorDate: Sun May 17 08:02:08 2009 -0300
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Jun 5 17:55:10 2009 +0100

    mtd: CFI 1.0 and CFI 1.1
    
    This patch allows otpinfo for CFI >= 1.0 and burst read for CFI >= 1.1.
    
    references:
    1.0:	http://www.datasheetcatalog.org/datasheets2/81/816884_1.pdf
    
    1.1:	http://milkymist.org/doc/MT28F640J3.pdf
    	http://www.delorie.com/agenda/specs/29066709.pdf
    
    Signed-off-by: Daniel Ribeiro <drwyrm at gmail.com>
    Acked-by: Nicolas Pitre <nico at cam.org>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/chips/cfi_cmdset_0001.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index e772803..8664fee 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -329,6 +329,7 @@ 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);
 
  again:
@@ -352,19 +353,24 @@ read_pri_intelext(struct map_info *map, __u16 adr)
 	extp->BlkStatusRegMask = le16_to_cpu(extp->BlkStatusRegMask);
 	extp->ProtRegAddr = le16_to_cpu(extp->ProtRegAddr);
 
-	if (extp->MajorVersion == '1' && extp->MinorVersion >= '3') {
-		unsigned int extra_size = 0;
-		int nb_parts, i;
+	if (extp->MinorVersion >= '0') {
+		extra_size = 0;
 
 		/* Protection Register info */
 		extra_size += (extp->NumProtectionFields - 1) *
 			      sizeof(struct cfi_intelext_otpinfo);
+	}
 
+	if (extp->MinorVersion >= '1') {
 		/* Burst Read info */
 		extra_size += 2;
 		if (extp_size < sizeof(*extp) + extra_size)
 			goto need_more;
-		extra_size += extp->extra[extra_size-1];
+		extra_size += extp->extra[extra_size - 1];
+	}
+
+	if (extp->MinorVersion >= '3') {
+		int nb_parts, i;
 
 		/* Number of hardware-partitions */
 		extra_size += 1;



More information about the linux-mtd-cvs mailing list