diff options
author | Felix Fietkau <nbd@nbd.name> | 2018-02-22 10:09:30 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-02-24 16:05:28 +0100 |
commit | bcf4a5f474d1899af65f0974914f737bf9a8d9dd (patch) | |
tree | c83ce8309a4820e71d80ab250280042f5725bae5 /target/linux/ramips/patches-4.14/0054-mtd-add-chunked-read-io-to-m25p80.patch | |
parent | 46c49d83815a84225c1bfcb54fd96b9f73c7c2cb (diff) | |
download | upstream-bcf4a5f474d1899af65f0974914f737bf9a8d9dd.tar.gz upstream-bcf4a5f474d1899af65f0974914f737bf9a8d9dd.tar.bz2 upstream-bcf4a5f474d1899af65f0974914f737bf9a8d9dd.zip |
ramips: remove chunked-io patch and set spi->max_transfer_size instead
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/ramips/patches-4.14/0054-mtd-add-chunked-read-io-to-m25p80.patch')
-rw-r--r-- | target/linux/ramips/patches-4.14/0054-mtd-add-chunked-read-io-to-m25p80.patch | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/target/linux/ramips/patches-4.14/0054-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-4.14/0054-mtd-add-chunked-read-io-to-m25p80.patch deleted file mode 100644 index b20f081afe..0000000000 --- a/target/linux/ramips/patches-4.14/0054-mtd-add-chunked-read-io-to-m25p80.patch +++ /dev/null @@ -1,124 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1468,6 +1468,67 @@ write_err: - return ret; - } - -+static int spi_nor_chunked_write(struct mtd_info *mtd, loff_t _to, size_t _len, -+ 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; -+ -+ chunk_size = nor->chunk_size; -+ if (!chunk_size) -+ chunk_size = _len; -+ -+ if (addr_width > 3) -+ chunk_size -= addr_width - 3; -+ -+ while (retlen < _len) { -+ size_t len = min_t(int, chunk_size, _len - retlen); -+ const u_char *buf = _buf + retlen; -+ loff_t to = _to + retlen; -+ -+ if (nor->flags & SNOR_F_SST) -+ ret = sst_write(mtd, to, len, &retlen, buf); -+ else -+ ret = spi_nor_write(mtd, to, len, &retlen, buf); -+ if (ret) -+ return ret; -+ } -+ -+ *_retlen += retlen; -+ return 0; -+} -+ -+static int spi_nor_chunked_read(struct mtd_info *mtd, loff_t _from, size_t _len, -+ size_t *_retlen, u_char *_buf) -+{ -+ struct spi_nor *nor = mtd_to_spi_nor(mtd); -+ int chunk_size; -+ int ret; -+ -+ chunk_size = nor->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; -+ -+ ret = spi_nor_read(mtd, from, len, &retlen, buf); -+ if (ret) -+ return ret; -+ -+ *_retlen += retlen; -+ } -+ -+ return 0; -+} -+ - /** - * macronix_quad_enable() - set QE bit in Status Register. - * @nor: pointer to a 'struct spi_nor' -@@ -2826,10 +2887,12 @@ int spi_nor_scan(struct spi_nor *nor, co - } - - /* sst nor chips use AAI word program */ -- if (info->flags & SST_WRITE) -+ if (info->flags & SST_WRITE) { - mtd->_write = sst_write; -- else -+ nor->flags |= SNOR_F_SST; -+ } else { - mtd->_write = spi_nor_write; -+ } - - if (info->flags & USE_FSR) - nor->flags |= SNOR_F_USE_FSR; -@@ -2848,11 +2911,20 @@ int spi_nor_scan(struct spi_nor *nor, co - mtd->writebufsize = nor->page_size; - - if (np) { -+ u32 val; -+ - /* If we were instantiated by DT, use it */ - if (of_property_read_bool(np, "m25p,fast-read")) - params.hwcaps.mask |= SNOR_HWCAPS_READ_FAST; - else - params.hwcaps.mask &= ~SNOR_HWCAPS_READ_FAST; -+ -+ if (!of_property_read_u32(np, "m25p,chunked-io", &val)) { -+ dev_info(dev, "using chunked io (size=%d)\n", val); -+ mtd->_read = spi_nor_chunked_read; -+ mtd->_write = spi_nor_chunked_write; -+ nor->chunk_size = val; -+ } - } else { - /* If we weren't instantiated by DT, default to fast-read */ - params.hwcaps.mask |= SNOR_HWCAPS_READ_FAST; ---- a/include/linux/mtd/spi-nor.h -+++ b/include/linux/mtd/spi-nor.h -@@ -231,6 +231,7 @@ enum spi_nor_option_flags { - SNOR_F_READY_XSR_RDY = BIT(4), - SNOR_F_USE_CLSR = BIT(5), - SNOR_F_4B_EXT_ADDR = BIT(6), -+ SNOR_F_SST = BIT(7), - }; - - /** -@@ -272,6 +273,7 @@ struct spi_nor { - struct mutex lock; - struct device *dev; - u32 page_size; -+ size_t chunk_size; - u8 addr_width; - u8 erase_opcode; - u8 read_opcode; |