
read_dummy refered as dummy cycles and dummy bytes will findout during read operations.
Cc: Simon Glass sjg@chromium.org Cc: Bin Meng bmeng.cn@gmail.com Cc: Mugunthan V N mugunthanvnm@ti.com Cc: Michal Simek michal.simek@xilinx.com Cc: Siva Durga Prasad Paladugu sivadur@xilinx.com Signed-off-by: Jagan Teki jteki@openedev.com --- drivers/mtd/spi-nor/m25p80.c | 9 ++++++--- drivers/mtd/spi-nor/spi-nor.c | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/spi-nor/m25p80.c b/drivers/mtd/spi-nor/m25p80.c index 42c5a96..c65534c 100644 --- a/drivers/mtd/spi-nor/m25p80.c +++ b/drivers/mtd/spi-nor/m25p80.c @@ -133,6 +133,7 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len, { struct m25p *flash = nor->priv; struct spi_slave *spi = flash->spi; + unsigned int dummy = nor->read_dummy; int ret;
ret = spi_claim_bus(spi); @@ -141,15 +142,17 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len, return ret; }
+ /* convert the dummy cycles to the number of bytes */ + dummy /= 8; + flash->command[0] = nor->read_opcode; m25p_addr2cmd(nor, from, flash->command);
if (nor->flags & SNOR_F_U_PAGE) spi->flags |= SPI_XFER_U_PAGE;
- ret = spi_write_then_read(spi, flash->command, - m25p_cmdsz(nor) + nor->read_dummy, NULL, - buf, len); + ret = spi_write_then_read(spi, flash->command, m25p_cmdsz(nor) + dummy, + NULL, buf, len); if (ret < 0) { debug("m25p80: error %d reading %x\n", ret, flash->command[0]); return ret; diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 0b3140d..fb7fb1c 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -1047,13 +1047,13 @@ int spi_nor_scan(struct spi_nor *nor) */ switch (nor->read_opcode) { case SNOR_OP_READ_1_1_4_IO: - nor->read_dummy = 2; + nor->read_dummy = 16; break; case SNOR_OP_READ: nor->read_dummy = 0; break; default: - nor->read_dummy = 1; + nor->read_dummy = 8; }
/* Configure the BAR - discover bank cmds and read current bank */