From 08fe019a4c3dee78a885f0d92287c94e8ec9f6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 26 Apr 2016 09:23:12 +0000 Subject: kernel: backport support for accelerated SPI flash read MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki git-svn-id: svn://svn.openwrt.org/openwrt/trunk@49233 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...-m25p80-add-support-for-mmap-read-request.patch | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 target/linux/generic/patches-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch (limited to 'target/linux/generic/patches-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch') diff --git a/target/linux/generic/patches-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch b/target/linux/generic/patches-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch new file mode 100644 index 0000000000..ee85f448ff --- /dev/null +++ b/target/linux/generic/patches-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch @@ -0,0 +1,46 @@ +From 08922f644878c9163ada8df3ef9def89be1d5e90 Mon Sep 17 00:00:00 2001 +From: Vignesh R +Date: Tue, 29 Mar 2016 11:16:17 +0530 +Subject: [PATCH] mtd: devices: m25p80: add support for mmap read request + +Certain SPI controllers may provide accelerated hardware interface to +read from m25p80 type flash devices in order to provide better read +performance. SPI core supports such devices with spi_flash_read() API. +Call spi_flash_read(), if supported, to make use of such interface. + +Signed-off-by: Vignesh R +[Brian: add memset()] +Signed-off-by: Brian Norris +--- + +--- a/drivers/mtd/devices/m25p80.c ++++ b/drivers/mtd/devices/m25p80.c +@@ -131,6 +131,28 @@ 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; ++ ++ memset(&msg, 0, sizeof(msg)); ++ ++ 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)); + -- cgit v1.2.3