From 0b78a2cf2a73b5f32ffda8cde7866ca61ce0e0b7 Mon Sep 17 00:00:00 2001 From: Huang Shijie Date: Mon, 28 Apr 2014 11:53:38 +0800 Subject: 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 Acked-by: Marek Vasut Signed-off-by: Brian Norris --- drivers/mtd/devices/m25p80.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/mtd/devices/m25p80.c') diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index ed827cf894e4..5d4482512e36 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) -- cgit v1.2.3-59-g8ed1b