generic: 5.4: Add 4B_OPCODES flag to w25q256
authorRobert Marko <robimarko@gmail.com>
Tue, 10 Mar 2020 17:20:01 +0000 (18:20 +0100)
committerPetr Štetiar <ynezz@true.cz>
Thu, 12 Mar 2020 11:59:44 +0000 (12:59 +0100)
This patch backports the upstream patch that adds the 4B_OPCODES flag to w25q256 under 5.4 kernel.
This is needed for ipq40xx and ramips.

Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/generic/backport-5.4/464-v5.6-mtd-spi-nor-Add-4B_OPCODES-flag-to-w25q256.patch [new file with mode: 0644]
target/linux/generic/pending-5.4/450-mtd-spi-nor-allow-NOR-driver-to-write-fewer-bytes-th.patch
target/linux/generic/pending-5.4/465-m25p80-mx-disable-software-protection.patch
target/linux/generic/pending-5.4/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch
target/linux/generic/pending-5.4/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch
target/linux/generic/pending-5.4/479-mtd-spi-nor-add-xtx-xt25f128b.patch

diff --git a/target/linux/generic/backport-5.4/464-v5.6-mtd-spi-nor-Add-4B_OPCODES-flag-to-w25q256.patch b/target/linux/generic/backport-5.4/464-v5.6-mtd-spi-nor-Add-4B_OPCODES-flag-to-w25q256.patch
new file mode 100644 (file)
index 0000000..7b7e15a
--- /dev/null
@@ -0,0 +1,27 @@
+From 10050a02f7d508fa88f70fcfceefbacd13488ca7 Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko@gmail.com>
+Date: Mon, 23 Dec 2019 17:05:49 +0200
+Subject: [PATCH] mtd: spi-nor: Add 4B_OPCODES flag to w25q256
+
+The w25q256 supports 4-byte opcodes so lets add the flag.
+Tested on OpenWrt under 4.19.82 kernel on 8devices Habanero.
+
+Signed-off-by: Robert Marko <robimarko@gmail.com>
+Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
+---
+ drivers/mtd/spi-nor/spi-nor.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -2480,7 +2480,9 @@ static const struct flash_info spi_nor_i
+       { "w25q80", INFO(0xef5014, 0, 64 * 1024,  16, SECT_4K) },
+       { "w25q80bl", INFO(0xef4014, 0, 64 * 1024,  16, SECT_4K) },
+       { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
+-      { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
++      { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512,
++                        SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
++                        SPI_NOR_4B_OPCODES) },
+       { "w25q256jvm", INFO(0xef7019, 0, 64 * 1024, 512,
+                            SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
+       { "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024,
index a84af43a298aa186b89a1025cb34406272805a85..fe2d7a6b230878de66a0282bba280f4a2355f1b9 100644 (file)
@@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -2704,7 +2704,7 @@ static int spi_nor_write(struct mtd_info
+@@ -2706,7 +2706,7 @@ static int spi_nor_write(struct mtd_info
  
                write_enable(nor);
                ret = spi_nor_write_data(nor, addr, page_remain, buf + i);
index 24d2d4567d7ba727abd9c11b78d629b613e02bed..a71175f9e3dcc57460abe5a4985ff38e5bbeee49 100644 (file)
@@ -8,7 +8,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -4884,6 +4884,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -4886,6 +4886,7 @@ int spi_nor_scan(struct spi_nor *nor, co
         */
        if (JEDEC_MFR(nor->info) == SNOR_MFR_ATMEL ||
            JEDEC_MFR(nor->info) == SNOR_MFR_INTEL ||
index c5db43b5e632ca9d9b5c4d0550935f8ab2a57a1a..8b8cfd0cec41fe233d5b37442615d0a429fd9579 100644 (file)
@@ -17,7 +17,7 @@ Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -4397,6 +4397,7 @@ static void st_micron_set_default_init(s
+@@ -4399,6 +4399,7 @@ static void st_micron_set_default_init(s
  
  static void winbond_set_default_init(struct spi_nor *nor)
  {
@@ -25,7 +25,7 @@ Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
        nor->params.set_4byte = winbond_set_4byte;
  }
  
-@@ -4886,6 +4887,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -4888,6 +4889,7 @@ int spi_nor_scan(struct spi_nor *nor, co
            JEDEC_MFR(nor->info) == SNOR_MFR_INTEL ||
            JEDEC_MFR(nor->info) == SNOR_MFR_MACRONIX ||
            JEDEC_MFR(nor->info) == SNOR_MFR_SST ||
index d3e587ff97dd5e29ead16eb7c37f5e701c7a2400..e9207bd6aa78db9c5eb3bbc11391f74700f854f3 100644 (file)
@@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        depends on OF && (ARM || ARM64 || COMPILE_TEST)
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -4464,6 +4464,7 @@ static void spi_nor_info_init_params(str
+@@ -4466,6 +4466,7 @@ static void spi_nor_info_init_params(str
        struct spi_nor_erase_map *map = &params->erase_map;
        const struct flash_info *info = nor->info;
        struct device_node *np = spi_nor_get_flash_node(nor);
@@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        u8 i, erase_mask;
  
        /* Initialize legacy flash parameters and settings. */
-@@ -4527,6 +4528,21 @@ static void spi_nor_info_init_params(str
+@@ -4529,6 +4530,21 @@ static void spi_nor_info_init_params(str
         */
        erase_mask = 0;
        i = 0;
@@ -69,7 +69,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (info->flags & SECT_4K_PMC) {
                erase_mask |= BIT(i);
                spi_nor_set_erase_type(&map->erase_type[i], 4096u,
-@@ -4538,6 +4554,7 @@ static void spi_nor_info_init_params(str
+@@ -4540,6 +4556,7 @@ static void spi_nor_info_init_params(str
                                       SPINOR_OP_BE_4K);
                i++;
        }
index 0c58f29d5b1ae4ed262207b830fa57e8b6786e83..39e02604fec3bc167f42c1f3e6ebb0b56f74a0e4 100644 (file)
@@ -30,7 +30,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -2504,6 +2504,9 @@ static const struct flash_info spi_nor_i
+@@ -2506,6 +2506,9 @@ static const struct flash_info spi_nor_i
        /* XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) */
        { "XM25QH64A", INFO(0x207017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
        { "XM25QH128A", INFO(0x207018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },