X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=blobdiff_plain;f=target%2Flinux%2Fbrcm63xx%2Fpatches-3.18%2F203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch;fp=target%2Flinux%2Fbrcm63xx%2Fpatches-3.18%2F203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch;h=0000000000000000000000000000000000000000;hp=740fb2dafc4ece9e0c88630a1ad2b800f763ed59;hb=9fdac9b579e6f5dc989e020990a065599434d134;hpb=9a2c2d63e8159543004a8a757ea97325a75e0bc4 diff --git a/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch b/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch deleted file mode 100644 index 740fb2dafc..0000000000 --- a/target/linux/brcm63xx/patches-3.18/203-MTD-DEVICES-m25p80-add-support-for-limiting-reads.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 5fb4e8d7287ac8fcb33aae8b1e9e22c5a3c392bd Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 10 Nov 2011 17:33:40 +0100 -Subject: [PATCH 51/79] MTD: DEVICES: m25p80: add support for limiting reads - -Signed-off-by: Jonas Gorski ---- - drivers/mtd/devices/m25p80.c | 29 +++++++++++++++++++++++++++-- - include/linux/spi/flash.h | 4 ++++ - 2 files changed, 31 insertions(+), 2 deletions(-) - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -32,6 +32,7 @@ struct m25p { - struct spi_device *spi; - struct spi_nor spi_nor; - struct mtd_info mtd; -+ int max_transfer_len; - u8 command[MAX_CMD_SIZE]; - }; - -@@ -121,7 +122,7 @@ static inline unsigned int m25p80_rx_nbi - * Read an address range from the nor chip. The address range - * may be any size provided it is within the physical boundaries. - */ --static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len, -+static int __m25p80_read(struct spi_nor *nor, loff_t from, size_t len, - size_t *retlen, u_char *buf) - { - struct m25p *flash = nor->priv; -@@ -157,6 +158,29 @@ static int m25p80_read(struct spi_nor *n - return 0; - } - -+static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len, -+ size_t *retlen, u_char *buf) -+{ -+ struct m25p *flash = nor->priv; -+ size_t off; -+ size_t read_len = flash->max_transfer_len; -+ size_t part_len; -+ int ret = 0; -+ -+ if (!read_len) -+ return __m25p80_read(nor, from, len, retlen, buf); -+ -+ *retlen = 0; -+ -+ for (off = 0; off < len && !ret; off += read_len) { -+ ret = __m25p80_read(nor, from + off, min(len - off, read_len), -+ &part_len, buf + off); -+ *retlen += part_len; -+ } -+ -+ return ret; -+} -+ - static int m25p80_erase(struct spi_nor *nor, loff_t offset) - { - struct m25p *flash = nor->priv; -@@ -240,6 +264,9 @@ static int m25p_probe(struct spi_device - else - flash_name = spi->modalias; - -+ if (data) -+ flash->max_transfer_len = data->max_transfer_len; -+ - ret = spi_nor_scan(nor, flash_name, mode); - if (ret) - return ret; ---- a/include/linux/spi/flash.h -+++ b/include/linux/spi/flash.h -@@ -13,6 +13,8 @@ struct mtd_part_parser_data; - * @part_probe_types: optional list of MTD parser names to use for - * partitioning - * -+ * @max_transfer_len: option maximum read/write length limitation for -+ * SPI controllers not able to transfer any length commands. - * Board init code (in arch/.../mach-xxx/board-yyy.c files) can - * provide information about SPI flash parts (such as DataFlash) to - * help set up the device and its appropriate default partitioning. -@@ -28,6 +30,8 @@ struct flash_platform_data { - char *type; - - const char **part_probe_types; -+ -+ unsigned int max_transfer_len; - /* we'll likely add more ... use JEDEC IDs, etc */ - }; -