X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=blobdiff_plain;f=target%2Flinux%2Framips%2Fpatches-4.9%2F0054-mtd-add-chunked-read-io-to-m25p80.patch;h=d6133e15965e707a928cf3c35a2e6d9ea0427d37;hp=ffea0b45db171c613e53d9ebbd4809ff0ca1ac4a;hb=d8565a06dc01b55ed1018d571e655c122b9d2a33;hpb=9c2422709075196022fcbc2d0f5f83e01d02b951 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 ffea0b45db..d6133e1596 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; -@@ -1623,10 +1683,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1704,10 +1765,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; -@@ -1656,11 +1718,20 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1739,11 +1802,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;