1 From 08922f644878c9163ada8df3ef9def89be1d5e90 Mon Sep 17 00:00:00 2001
2 From: Vignesh R <vigneshr@ti.com>
3 Date: Tue, 29 Mar 2016 11:16:17 +0530
4 Subject: [PATCH] mtd: devices: m25p80: add support for mmap read request
6 Certain SPI controllers may provide accelerated hardware interface to
7 read from m25p80 type flash devices in order to provide better read
8 performance. SPI core supports such devices with spi_flash_read() API.
9 Call spi_flash_read(), if supported, to make use of such interface.
11 Signed-off-by: Vignesh R <vigneshr@ti.com>
13 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
16 --- a/drivers/mtd/devices/m25p80.c
17 +++ b/drivers/mtd/devices/m25p80.c
18 @@ -131,6 +131,28 @@ static int m25p80_read(struct spi_nor *n
19 /* convert the dummy cycles to the number of bytes */
22 + if (spi_flash_read_supported(spi)) {
23 + struct spi_flash_read_message msg;
26 + memset(&msg, 0, sizeof(msg));
31 + msg.read_opcode = nor->read_opcode;
32 + msg.addr_width = nor->addr_width;
33 + msg.dummy_bytes = dummy;
34 + /* TODO: Support other combinations */
35 + msg.opcode_nbits = SPI_NBITS_SINGLE;
36 + msg.addr_nbits = SPI_NBITS_SINGLE;
37 + msg.data_nbits = m25p80_rx_nbits(nor);
39 + ret = spi_flash_read(spi, &msg);
40 + *retlen = msg.retlen;
45 memset(t, 0, (sizeof t));