aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/patches-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2016-04-26 09:23:12 +0000
committerRafał Miłecki <zajec5@gmail.com>2016-04-26 09:23:12 +0000
commit08fe019a4c3dee78a885f0d92287c94e8ec9f6a1 (patch)
treea428bde19f647a9ce72ca00249dbbda1bb1b6103 /target/linux/generic/patches-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch
parent3f91c5fd81050fddcb205762afd9635ae7d09953 (diff)
downloadmaster-187ad058-08fe019a4c3dee78a885f0d92287c94e8ec9f6a1.tar.gz
master-187ad058-08fe019a4c3dee78a885f0d92287c94e8ec9f6a1.tar.bz2
master-187ad058-08fe019a4c3dee78a885f0d92287c94e8ec9f6a1.zip
kernel: backport support for accelerated SPI flash read
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@49233 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/patches-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch')
-rw-r--r--target/linux/generic/patches-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch46
1 files changed, 46 insertions, 0 deletions
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 <vigneshr@ti.com>
+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 <vigneshr@ti.com>
+[Brian: add memset()]
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+---
+
+--- 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));
+