diff options
author | Geert Uytterhoeven <geert+renesas@linux-m68k.org> | 2014-01-21 07:59:17 -0500 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-01-28 00:19:28 -0500 |
commit | 464e906737d6eba2fe63e913e0df4306423b4f61 (patch) | |
tree | e441fb9017937efcc86603098eb433ad68bb829b /drivers/mtd | |
parent | d8d5d10d0f27d1975e71617efff941321a0dc142 (diff) |
mtd: m25p80: Set rx_nbits for Quad SPI transfers
When using the Quad Read opcode, SPI masters still use Single SPI
transfers, as spi_transfer.rx_nbits defaults to SPI_NBITS_SINGLE.
Use SPI_NBITS_QUAD to fix this.
While an earlier version of commit 3487a63955c34ea508bcf4ca5131ddd953876e2d
("drivers: mtd: m25p80: add quad read support") did this correctly, it was
forgotten in the version that got merged.
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/devices/m25p80.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 320c6a308630..ad1913909702 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -489,6 +489,16 @@ static inline int m25p80_dummy_cycles_read(struct m25p *flash) | |||
489 | } | 489 | } |
490 | } | 490 | } |
491 | 491 | ||
492 | static inline unsigned int m25p80_rx_nbits(const struct m25p *flash) | ||
493 | { | ||
494 | switch (flash->flash_read) { | ||
495 | case M25P80_QUAD: | ||
496 | return 4; | ||
497 | default: | ||
498 | return 0; | ||
499 | } | ||
500 | } | ||
501 | |||
492 | /* | 502 | /* |
493 | * Read an address range from the flash chip. The address range | 503 | * Read an address range from the flash chip. The address range |
494 | * may be any size provided it is within the physical boundaries. | 504 | * may be any size provided it is within the physical boundaries. |
@@ -519,6 +529,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
519 | spi_message_add_tail(&t[0], &m); | 529 | spi_message_add_tail(&t[0], &m); |
520 | 530 | ||
521 | t[1].rx_buf = buf; | 531 | t[1].rx_buf = buf; |
532 | t[1].rx_nbits = m25p80_rx_nbits(flash); | ||
522 | t[1].len = len; | 533 | t[1].len = len; |
523 | spi_message_add_tail(&t[1], &m); | 534 | spi_message_add_tail(&t[1], &m); |
524 | 535 | ||