mtd: spi-nor: fix the wrong dummy value

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Dec 15 19:59:04 PST 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=0b78a2cf2a73b5f32ffda8cde7866ca61ce0e0b7
Commit:     0b78a2cf2a73b5f32ffda8cde7866ca61ce0e0b7
Parent:     438320dd34a4d0b2b177fbae749c3b9d00532faf
Author:     Huang Shijie <b32955 at freescale.com>
AuthorDate: Mon Apr 28 11:53:38 2014 +0800
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed Nov 5 00:26:06 2014 -0800

    mtd: spi-nor: fix the wrong dummy value
    
    For the DDR Quad read, the dummy cycles maybe 3 or 6 which is less then 8.
    The dummy cycles is actually 8 for SPI fast/dual/quad read.
    
    This patch makes preparations for the DDR quad read, it fixes the wrong dummy
    value for both the spi-nor.c and m25p80.c.
    
    Signed-off-by: Huang Shijie <b32955 at freescale.com>
    Acked-by: Marek Vasut <marex at denx.de>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/devices/m25p80.c  | 5 ++++-
 drivers/mtd/spi-nor/spi-nor.c | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index ed827cf..5d44825 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -128,9 +128,12 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 	struct spi_device *spi = flash->spi;
 	struct spi_transfer t[2];
 	struct spi_message m;
-	int dummy = nor->read_dummy;
+	unsigned int dummy = nor->read_dummy;
 	int ret;
 
+	/* convert the dummy cycles to the number of bytes */
+	dummy /= 8;
+
 	/* Wait till previous write/erase is done. */
 	ret = nor->wait_till_ready(nor);
 	if (ret)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index a98c134..ea6516d 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -98,7 +98,7 @@ static inline int spi_nor_read_dummy_cycles(struct spi_nor *nor)
 	case SPI_NOR_FAST:
 	case SPI_NOR_DUAL:
 	case SPI_NOR_QUAD:
-		return 1;
+		return 8;
 	case SPI_NOR_NORMAL:
 		return 0;
 	}



More information about the linux-mtd-cvs mailing list