aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/patches-3.18
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-02-19 14:04:47 +0000
committerJohn Crispin <blogic@openwrt.org>2015-02-19 14:04:47 +0000
commit0b743d302b4a559c08803878eb3b6fb0f43488d3 (patch)
tree94adc48de3b71c691d29eee3e33220c41a98c080 /target/linux/ramips/patches-3.18
parentca5bbee2474a154b522cc8a721a21f63cf6c9d77 (diff)
downloadmaster-187ad058-0b743d302b4a559c08803878eb3b6fb0f43488d3.tar.gz
master-187ad058-0b743d302b4a559c08803878eb3b6fb0f43488d3.tar.bz2
master-187ad058-0b743d302b4a559c08803878eb3b6fb0f43488d3.zip
ralink: bump to v3.18
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44495 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ramips/patches-3.18')
-rw-r--r--target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch100
1 files changed, 100 insertions, 0 deletions
diff --git a/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch
new file mode 100644
index 0000000000..b014c3e847
--- /dev/null
+++ b/target/linux/ramips/patches-3.18/0044-mtd-add-chunked-read-io-to-m25p80.patch
@@ -0,0 +1,100 @@
+--- a/drivers/mtd/devices/m25p80.c
++++ b/drivers/mtd/devices/m25p80.c
+@@ -19,6 +19,7 @@
+ #include <linux/errno.h>
+ #include <linux/module.h>
+ #include <linux/device.h>
++#include <linux/of.h>
+
+ #include <linux/mtd/mtd.h>
+ #include <linux/mtd/partitions.h>
+@@ -32,6 +33,7 @@
+ struct spi_device *spi;
+ struct spi_nor spi_nor;
+ struct mtd_info mtd;
++ u16 chunk_size;
+ u8 command[MAX_CMD_SIZE];
+ };
+
+@@ -157,6 +159,58 @@
+ return 0;
+ }
+
++static void m25p80_chunked_write(struct spi_nor *nor, loff_t _from, size_t _len,
++ size_t *_retlen, const u_char *_buf)
++{
++ struct m25p *flash = nor->priv;
++ int chunk_size;
++ int retlen = 0;
++
++ chunk_size = flash->chunk_size;
++ if (!chunk_size)
++ chunk_size = _len;
++
++ while (retlen < _len) {
++ size_t len = min_t(int, chunk_size, _len - retlen);
++ const u_char *buf = _buf + retlen;
++ loff_t from = _from + retlen;
++
++ nor->wait_till_ready(nor);
++ nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0);
++
++ m25p80_write(nor, from, len, &retlen, buf);
++ }
++ *_retlen += retlen;
++}
++
++static int m25p80_chunked_read(struct spi_nor *nor, loff_t _from, size_t _len,
++ size_t *_retlen, u_char *_buf)
++{
++ struct m25p *flash = nor->priv;
++ int chunk_size;
++
++ chunk_size = flash->chunk_size;
++ if (!chunk_size)
++ chunk_size = _len;
++
++ *_retlen = 0;
++
++ while (*_retlen < _len) {
++ size_t len = min_t(int, chunk_size, _len - *_retlen);
++ u_char *buf = _buf + *_retlen;
++ loff_t from = _from + *_retlen;
++ int retlen = 0;
++ int ret = m25p80_read(nor, from, len, &retlen, buf);
++
++ if (ret)
++ return ret;
++
++ *_retlen += retlen;
++ }
++
++ return 0;
++}
++
+ static int m25p80_erase(struct spi_nor *nor, loff_t offset)
+ {
+ struct m25p *flash = nor->priv;
+@@ -197,6 +251,7 @@
+ struct spi_nor *nor;
+ enum read_mode mode = SPI_NOR_NORMAL;
+ char *flash_name = NULL;
++ u32 val;
+ int ret;
+
+ data = dev_get_platdata(&spi->dev);
+@@ -244,6 +299,14 @@
+ if (ret)
+ return ret;
+
++ if (spi->dev.of_node &&
++ !of_property_read_u32(spi->dev.of_node, "m25p,chunked-io", &val)) {
++ dev_warn(&spi->dev, "using chunked io\n");
++ nor->read = m25p80_chunked_read;
++ nor->write = m25p80_chunked_write;
++ flash->chunk_size = val;
++ }
++
+ ppdata.of_node = spi->dev.of_node;
+
+ return mtd_device_parse_register(&flash->mtd, NULL, &ppdata,