Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1279568
| From | Vignesh R <vigneshr@ti.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v4 3/5] mtd: devices: m25p80: add support for mmap read request |
| Date | 2015-11-30 06:20 +0100 |
| Message-ID | <qAp2x-7JK-13@gated-at.bofh.it> (permalink) |
| References | <qAp2x-7JK-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Certain spi controllers may provide accelerated interface to read from
m25p80 type flash devices. This interface provides better read
performance than regular SPI interface.
Call spi_flash_read(), if supported, to make use of such interface.
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
v4:
* Use spi_flash_read_message struct to pass args.
* support passing of opcode/addr/data nbits.
drivers/mtd/devices/m25p80.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index fe9ceb7b5405..00094a668c62 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -131,6 +131,26 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
/* convert the dummy cycles to the number of bytes */
dummy /= 8;
+ if (spi_flash_read_supported(spi)) {
+ struct spi_flash_read_message msg;
+ int ret;
+
+ msg.buf = buf;
+ msg.from = from;
+ msg.len = len;
+ msg.read_opcode = nor->read_opcode;
+ msg.addr_width = nor->addr_width;
+ msg.dummy_bytes = dummy;
+ /* TODO: Support other combinations */
+ msg.opcode_nbits = SPI_NBITS_SINGLE;
+ msg.addr_nbits = SPI_NBITS_SINGLE;
+ msg.data_nbits = m25p80_rx_nbits(nor);
+
+ ret = spi_flash_read(spi, &msg);
+ *retlen = msg.retlen;
+ return ret;
+ }
+
spi_message_init(&m);
memset(t, 0, (sizeof t));
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 0/5] Add memory mapped read support for ti-qspi Vignesh R <vigneshr@ti.com> - 2015-11-30 06:20 +0100
[PATCH v4 5/5] ARM: dts: AM4372: add entry for qspi mmap region Vignesh R <vigneshr@ti.com> - 2015-11-30 06:20 +0100
[PATCH v4 3/5] mtd: devices: m25p80: add support for mmap read request Vignesh R <vigneshr@ti.com> - 2015-11-30 06:20 +0100
Re: [PATCH v4 3/5] mtd: devices: m25p80: add support for mmap read request Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2015-12-03 10:50 +0100
Re: [PATCH v4 3/5] mtd: devices: m25p80: add support for mmap read request Vignesh R <vigneshr@ti.com> - 2015-12-03 12:30 +0100
[PATCH v4 2/5] spi: spi-ti-qspi: add mmap mode read support Vignesh R <vigneshr@ti.com> - 2015-11-30 06:20 +0100
Re: [PATCH v4 2/5] spi: spi-ti-qspi: add mmap mode read support Felipe Balbi <balbi@ti.com> - 2015-11-30 23:40 +0100
Re: [PATCH v4 2/5] spi: spi-ti-qspi: add mmap mode read support Vignesh R <vigneshr@ti.com> - 2015-12-01 08:50 +0100
csiph-web