[OpenWrt-Devel] [PATCH 05/23] ar71xx: refresh 406-mtd-m25p80-allow-to-specify-max-read-size.patch
Zhao, Gang
gang.zhao.42 at gmail.com
Fri Jul 25 22:48:40 EDT 2014
Signed-off-by: Zhao, Gang <gang.zhao.42 at gmail.com>
---
...mtd-m25p80-allow-to-specify-max-read-size.patch | 27 ++++++++++------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/target/linux/ar71xx/patches-3.14/406-mtd-m25p80-allow-to-specify-max-read-size.patch b/target/linux/ar71xx/patches-3.14/406-mtd-m25p80-allow-to-specify-max-read-size.patch
index ecf8110..5b9fa5b 100644
--- a/target/linux/ar71xx/patches-3.14/406-mtd-m25p80-allow-to-specify-max-read-size.patch
+++ b/target/linux/ar71xx/patches-3.14/406-mtd-m25p80-allow-to-specify-max-read-size.patch
@@ -1,26 +1,27 @@
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
-@@ -93,6 +93,7 @@ struct m25p {
- u8 erase_opcode;
+@@ -115,6 +115,7 @@ struct m25p {
+ u8 program_opcode;
u8 *command;
- bool fast_read;
+ enum read_type flash_read;
+ size_t max_read_len;
};
static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd)
-@@ -344,6 +345,7 @@ static int m25p80_read(struct mtd_info *
- struct spi_transfer t[2];
+@@ -517,6 +518,7 @@ static int m25p80_read(struct mtd_info *
struct spi_message m;
uint8_t opcode;
+ int dummy;
+ loff_t ofs;
pr_debug("%s: %s from 0x%08x, len %zd\n", dev_name(&flash->spi->dev),
__func__, (u32)from, len);
-@@ -359,19 +361,10 @@ static int m25p80_read(struct mtd_info *
- t[0].len = m25p_cmdsz(flash) + (flash->fast_read ? 1 : 0);
+@@ -534,29 +536,51 @@ static int m25p80_read(struct mtd_info *
+ t[0].len = m25p_cmdsz(flash) + dummy;
spi_message_add_tail(&t[0], &m);
- t[1].rx_buf = buf;
+- t[1].rx_nbits = m25p80_rx_nbits(flash);
- t[1].len = len;
spi_message_add_tail(&t[1], &m);
@@ -33,12 +34,8 @@
- return 1;
- }
-
- /* FIXME switch to OPCODE_FAST_READ. It's required for higher
- * clocks; and at this writing, every chip this driver handles
- * supports that opcode.
-@@ -380,13 +373,43 @@ static int m25p80_read(struct mtd_info *
/* Set up the write data buffer. */
- opcode = flash->fast_read ? OPCODE_FAST_READ : OPCODE_NORM_READ;
+ opcode = flash->read_opcode;
flash->command[0] = opcode;
- m25p_addr2cmd(flash, from, flash->command);
+ ofs = 0;
@@ -60,6 +57,7 @@
+ readlen = len;
+
+ t[1].rx_buf = buf + ofs;
++ t[1].rx_nbits = m25p80_rx_nbits(flash);
+ t[1].len = readlen;
+
+ m25p_addr2cmd(flash, from + ofs, flash->command);
@@ -74,8 +72,7 @@
+ return 1;
+ }
-- *retlen = m.actual_length - m25p_cmdsz(flash) -
-- (flash->fast_read ? 1 : 0);
+- *retlen = m.actual_length - m25p_cmdsz(flash) - dummy;
+ ofs += done;
+ len -= done;
+ }
@@ -84,7 +81,7 @@
mutex_unlock(&flash->lock);
return 0;
-@@ -1022,6 +1045,12 @@ static int m25p_probe(struct spi_device
+@@ -1193,6 +1217,12 @@ static int m25p_probe(struct spi_device
flash->mtd._unlock = m25p80_unlock;
}
--
1.9.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list