summaryrefslogtreecommitdiff
path: root/target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch')
-rw-r--r--target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch19
1 files changed, 10 insertions, 9 deletions
diff --git a/target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch
index 40994fb..7f88ec5 100644
--- a/target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch
+++ b/target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch
@@ -1,6 +1,6 @@
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1381,6 +1381,66 @@ write_err:
+@@ -1453,6 +1453,67 @@ write_err:
return ret;
}
@@ -8,6 +8,7 @@
+ size_t *_retlen, const u_char *_buf)
+{
+ struct spi_nor *nor = mtd_to_spi_nor(mtd);
++ u32 addr_width = nor->addr_width + !!(nor->flags & SNOR_F_4B_EXT_ADDR);
+ int chunk_size;
+ int retlen = 0;
+ int ret;
@@ -16,8 +17,8 @@
+ if (!chunk_size)
+ chunk_size = _len;
+
-+ if (nor->addr_width > 3)
-+ chunk_size -= nor->addr_width - 3;
++ if (addr_width > 3)
++ chunk_size -= addr_width - 3;
+
+ while (retlen < _len) {
+ size_t len = min_t(int, chunk_size, _len - retlen);
@@ -67,7 +68,7 @@
static int macronix_quad_enable(struct spi_nor *nor)
{
int ret, val;
-@@ -1630,10 +1690,12 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1702,10 +1763,12 @@ int spi_nor_scan(struct spi_nor *nor, co
}
/* sst nor chips use AAI word program */
@@ -82,7 +83,7 @@
if (info->flags & USE_FSR)
nor->flags |= SNOR_F_USE_FSR;
-@@ -1663,11 +1725,20 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1735,11 +1798,20 @@ int spi_nor_scan(struct spi_nor *nor, co
mtd->writebufsize = nor->page_size;
if (np) {
@@ -105,15 +106,15 @@
nor->flash_read = SPI_NOR_FAST;
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
-@@ -141,6 +141,7 @@ enum spi_nor_option_flags {
- SNOR_F_NO_OP_CHIP_ERASE = BIT(2),
+@@ -143,6 +143,7 @@ enum spi_nor_option_flags {
SNOR_F_S3AN_ADDR_DEFAULT = BIT(3),
SNOR_F_READY_XSR_RDY = BIT(4),
-+ SNOR_F_SST = BIT(5),
+ SNOR_F_4B_EXT_ADDR = BIT(5),
++ SNOR_F_SST = BIT(6),
};
/**
-@@ -180,6 +181,7 @@ struct spi_nor {
+@@ -182,6 +183,7 @@ struct spi_nor {
struct mutex lock;
struct device *dev;
u32 page_size;