kernel: backport GD25Q256 support from 4.15
authorKuan-Yi Li <kyli@abysm.org>
Fri, 20 Nov 2020 12:11:23 +0000 (20:11 +0800)
committerHauke Mehrtens <hauke@hauke-m.de>
Tue, 1 Dec 2020 20:59:30 +0000 (21:59 +0100)
Backport below changes for GigaDevice GD25Q256 support from v4.15:

  e27072851bf7 mtd: spi-nor: add a quad_enable callback in struct flash_info
  65153846b18c mtd: spi-nor: add support for GD25Q256

This chip is used on newer Quad-E4G boards.

Before:

[    2.366493] m25p80 spi0.0: unrecognized JEDEC id bytes: c8, 40, 19
[    2.372853] m25p80: probe of spi0.0 failed with error -2

After:

[    2.371722] m25p80 spi0.0: gd25q256 (32768 Kbytes)
[    2.376694] 5 fixed-partitions partitions found on MTD device spi0.0
[    2.383043] Creating 5 MTD partitions on "spi0.0":
[    2.387824] 0x000000000000-0x000000030000 : "u-boot"
[    2.394138] 0x000000030000-0x000000031000 : "u-boot-env"
[    2.400608] 0x000000031000-0x000000040000 : "config"
[    2.406830] 0x000000040000-0x000000050000 : "factory"
[    2.413169] 0x000000050000-0x000002000000 : "firmware"

Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
23 files changed:
target/linux/bcm53xx/patches-4.14/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch
target/linux/generic/backport-4.14/403-v4.15-0001-mtd-spi-nor-add-a-quad_enable-callback-in-struct-fla.patch [new file with mode: 0644]
target/linux/generic/backport-4.14/403-v4.15-0002-mtd-spi-nor-add-support-for-GD25Q256.patch [new file with mode: 0644]
target/linux/generic/pending-4.14/450-mtd-spi-nor-allow-NOR-driver-to-write-fewer-bytes-th.patch
target/linux/generic/pending-4.14/465-m25p80-mx-disable-software-protection.patch
target/linux/generic/pending-4.14/466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch
target/linux/generic/pending-4.14/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch
target/linux/generic/pending-4.14/475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch
target/linux/generic/pending-4.14/476-mtd-spi-nor-add-eon-en25q128.patch
target/linux/generic/pending-4.14/477-mtd-add-spi-nor-add-mx25u3235f.patch
target/linux/generic/pending-4.14/478-mtd-spi-nor-Add-support-for-XM25QH64A-and-XM25QH128A.patch
target/linux/generic/pending-4.14/479-mtd-spi-nor-add-eon-en25qh32.patch
target/linux/generic/pending-4.14/479-mtd-spi-nor-add-eon-en25qh64.patch
target/linux/generic/pending-4.14/481-mtd-spi-nor-add-support-for-Gigadevice-GD25D05.patch
target/linux/ipq40xx/patches-4.14/303-spi-nor-enable-4B-opcodes-for-mx25l25635f.patch
target/linux/ipq806x/patches-4.14/105-mtd-nor-add-mx25l25635f.patch
target/linux/layerscape/patches-4.14/812-flexspi-support-layerscape.patch
target/linux/layerscape/patches-4.14/818-qspi-support-layerscape.patch
target/linux/pistachio/patches-4.14/401-mtd-nor-support-mtd-name-from-device-tree.patch
target/linux/ramips/patches-4.14/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch
target/linux/ramips/patches-4.14/0054-mtd-spi-nor-w25q256-respect-default-mode.patch
target/linux/ramips/patches-4.14/302-spi-nor-add-gd25q512.patch
target/linux/ramips/patches-4.14/304-spi-nor-enable-4B-opcodes-for-mx25l25635f.patch

index f04ada0a47fe6b191a970f016e76c9af74a6f9c9..9fcf33402b3ddd0c6ee685af718c7af207d1e43a 100644 (file)
@@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1227,6 +1227,18 @@ static const struct flash_info *spi_nor_
+@@ -1237,6 +1237,18 @@ static const struct flash_info *spi_nor_
        }
        dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n",
                id[0], id[1], id[2]);
diff --git a/target/linux/generic/backport-4.14/403-v4.15-0001-mtd-spi-nor-add-a-quad_enable-callback-in-struct-fla.patch b/target/linux/generic/backport-4.14/403-v4.15-0001-mtd-spi-nor-add-a-quad_enable-callback-in-struct-fla.patch
new file mode 100644 (file)
index 0000000..6cc7b44
--- /dev/null
@@ -0,0 +1,47 @@
+From e27072851bf7d706c592fc528549b52023b17a09 Mon Sep 17 00:00:00 2001
+From: Andy Yan <andy.yan@rock-chips.com>
+Date: Mon, 28 Aug 2017 09:58:29 +0800
+Subject: [PATCH 1/2] mtd: spi-nor: add a quad_enable callback in struct
+ flash_info
+
+Some manufacturers may use different bit to set QE on different
+memories.
+
+The GD25Q256 from GigaDevice is an example, which uses S6(bit 6
+of the Status Register-1) to set QE, which is different with
+other supported memories from GigaDevice that use S9(bit 1 of
+the Status Register-2). This makes it is impossible to select
+the quad enable method by distinguishing the MFR. This patch
+introduce a quad_enable function which can be set per memory
+in the flash_info list table.
+
+Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
+Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
+
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -89,6 +89,8 @@ struct flash_info {
+ #define NO_CHIP_ERASE         BIT(12) /* Chip does not support chip erase */
+ #define SPI_NOR_SKIP_SFDP     BIT(13) /* Skip parsing of SFDP tables */
+ #define USE_CLSR              BIT(14) /* use CLSR command */
++
++      int     (*quad_enable)(struct spi_nor *nor);
+ };
+ #define JEDEC_MFR(info)       ((info)->id[0])
+@@ -2433,6 +2435,15 @@ static int spi_nor_init_params(struct sp
+                       params->quad_enable = spansion_quad_enable;
+                       break;
+               }
++
++              /*
++               * Some manufacturer like GigaDevice may use different
++               * bit to set QE on different memories, so the MFR can't
++               * indicate the quad_enable method for this case, we need
++               * set it in flash info list.
++               */
++              if (info->quad_enable)
++                      params->quad_enable = info->quad_enable;
+       }
+       /* Override the parameters with data read from SFDP tables. */
diff --git a/target/linux/generic/backport-4.14/403-v4.15-0002-mtd-spi-nor-add-support-for-GD25Q256.patch b/target/linux/generic/backport-4.14/403-v4.15-0002-mtd-spi-nor-add-support-for-GD25Q256.patch
new file mode 100644 (file)
index 0000000..c19a821
--- /dev/null
@@ -0,0 +1,35 @@
+From 65153846b18c486ce3c90477c467d53915114e3f Mon Sep 17 00:00:00 2001
+From: Andy Yan <andy.yan@rock-chips.com>
+Date: Mon, 28 Aug 2017 10:00:46 +0800
+Subject: [PATCH 2/2] mtd: spi-nor: add support for GD25Q256
+
+Add support for GD25Q256, a 32MiB SPI Nor flash
+from GigaDevice.
+
+Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
+Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
+
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -872,6 +872,8 @@ static int spi_nor_is_locked(struct mtd_
+       return ret;
+ }
++static int macronix_quad_enable(struct spi_nor *nor);
++
+ /* Used when the "_ext_id" is two bytes at most */
+ #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)    \
+               .id = {                                                 \
+@@ -999,6 +1001,12 @@ static const struct flash_info spi_nor_i
+                       SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
+                       SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+       },
++      {
++              "gd25q256", INFO(0xc84019, 0, 64 * 1024, 512,
++                      SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
++                      SPI_NOR_4B_OPCODES | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
++                      .quad_enable = macronix_quad_enable,
++      },
+       /* Intel/Numonyx -- xxxs33b */
+       { "160s33b",  INFO(0x898911, 0, 64 * 1024,  32, 0) },
index 571c9b885f3e6cb5ee4361a420071f1fb5c49a1a..cfd6c280ecdf13d116446093abe2bd1bc6f5a921 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
-@@ -1377,7 +1377,7 @@ static int spi_nor_write(struct mtd_info
+@@ -1387,7 +1387,7 @@ static int spi_nor_write(struct mtd_info
  
                write_enable(nor);
                ret = nor->write(nor, addr, page_remain, buf + i);
@@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
                        goto write_err;
                written = ret;
  
-@@ -1386,13 +1386,6 @@ static int spi_nor_write(struct mtd_info
+@@ -1396,13 +1396,6 @@ static int spi_nor_write(struct mtd_info
                        goto write_err;
                *retlen += written;
                i += written;
index b41710276fff4049d9cd910b784e7c69d1c14f47..36305b20b1e6544020a3e104d852915e195462ac 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
-@@ -2714,6 +2714,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2733,6 +2733,7 @@ int spi_nor_scan(struct spi_nor *nor, co
  
        if (JEDEC_MFR(info) == SNOR_MFR_ATMEL ||
            JEDEC_MFR(info) == SNOR_MFR_INTEL ||
index 55d9709761c7c6d3e2bb722256db9e3f18871f17..f599cead97e61aedb03e17290bcc62debf6d6a89 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
-@@ -2716,6 +2716,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2735,6 +2735,7 @@ int spi_nor_scan(struct spi_nor *nor, co
            JEDEC_MFR(info) == SNOR_MFR_INTEL ||
            JEDEC_MFR(info) == SNOR_MFR_MACRONIX ||
            JEDEC_MFR(info) == SNOR_MFR_SST ||
@@ -25,7 +25,7 @@ Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
            info->flags & SPI_NOR_HAS_LOCK) {
                write_enable(nor);
                write_sr(nor, 0);
-@@ -2734,7 +2735,8 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2753,7 +2754,8 @@ int spi_nor_scan(struct spi_nor *nor, co
  
        /* NOR protection support for STmicro/Micron chips and similar */
        if (JEDEC_MFR(info) == SNOR_MFR_MICRON ||
index 0f4ea32688b73f45d99e25903526d6f5b53c437a..5790848cac127d6ed2a36f68e9bcebcb7cd927c5 100644 (file)
@@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        depends on ARCH_AT91 || (ARM && COMPILE_TEST && !ARCH_EBSA110)
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -2561,10 +2561,12 @@ static int spi_nor_select_erase(struct s
+@@ -2580,10 +2580,12 @@ static int spi_nor_select_erase(struct s
  
  #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
        /* prefer "small sector" erase if possible */
index f751bfd3b2488a901233028e627873a2ef7c26bb..e78f3576ac68f3c2ab0938e439b86f16eff1ada0 100644 (file)
@@ -20,7 +20,7 @@ Changes in v2:
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1165,6 +1165,11 @@ static const struct flash_info spi_nor_i
+@@ -1175,6 +1175,11 @@ static const struct flash_info spi_nor_i
                        SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
                        SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
        },
index ac1fda51593af87fe9bd5a5a3bb433e1f098a740..f50daddd6b03a8479770ca648dc2e6d7cef9627f 100644 (file)
@@ -8,7 +8,7 @@ Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -954,6 +954,7 @@ static const struct flash_info spi_nor_i
+@@ -958,6 +958,7 @@ static const struct flash_info spi_nor_i
        { "en25q32b",   INFO(0x1c3016, 0, 64 * 1024,   64, 0) },
        { "en25p64",    INFO(0x1c2017, 0, 64 * 1024,  128, 0) },
        { "en25q64",    INFO(0x1c3017, 0, 64 * 1024,  128, SECT_4K) },
index 2d94959c5c0f22edd90696b87bd19623be9baa90..6c7a5d93433d3f30f30f104585e93936aadca64f 100644 (file)
@@ -8,7 +8,7 @@ Signed-off-by: André Valentin <avalentin@marcant.net>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1022,6 +1022,7 @@ static const struct flash_info spi_nor_i
+@@ -1032,6 +1032,7 @@ static const struct flash_info spi_nor_i
        { "mx25l3205d",  INFO(0xc22016, 0, 64 * 1024,  64, SECT_4K) },
        { "mx25l3255e",  INFO(0xc29e16, 0, 64 * 1024,  64, SECT_4K) },
        { "mx25l6405d",  INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) },
index 4ecf53621d3084bdae7f0b8a2e6ca9289f3184d3..7d3ca56c1e9f1e30dfb22b0b6c03629c7086a4f6 100644 (file)
@@ -17,7 +17,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1192,6 +1192,10 @@ static const struct flash_info spi_nor_i
+@@ -1202,6 +1202,10 @@ static const struct flash_info spi_nor_i
        { "3S400AN", S3AN_INFO(0x1f2400, 256, 264) },
        { "3S700AN", S3AN_INFO(0x1f2500, 512, 264) },
        { "3S1400AN", S3AN_INFO(0x1f2600, 512, 528) },
index b8d51015149ef89c0562bd33085e42096945774a..c88bd6a4222bc7e8ffca5d84d04d7b46af76ef23 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -955,6 +955,7 @@ static const struct flash_info spi_nor_i
+@@ -959,6 +959,7 @@ static const struct flash_info spi_nor_i
        { "en25p64",    INFO(0x1c2017, 0, 64 * 1024,  128, 0) },
        { "en25q64",    INFO(0x1c3017, 0, 64 * 1024,  128, SECT_4K) },
        { "en25q128",   INFO(0x1c3018, 0, 64 * 1024,  256, SECT_4K) },
index c290a784d045576b6f145d489ed4580477ee7829..8a56d5a1aa5f96b6b6034a2d2977fdda68b690d4 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -956,6 +956,7 @@ static const struct flash_info spi_nor_i
+@@ -960,6 +960,7 @@ static const struct flash_info spi_nor_i
        { "en25q64",    INFO(0x1c3017, 0, 64 * 1024,  128, SECT_4K) },
        { "en25q128",   INFO(0x1c3018, 0, 64 * 1024,  256, SECT_4K) },
        { "en25qh32",   INFO(0x1c7016, 0, 64 * 1024,   64, 0) },
index 4e632b05a07ad16fa2b3fc307e4d464e6ecd4bcc..e347650ae596ef190ecc60cd9c367a5896ebf748 100644 (file)
@@ -10,7 +10,7 @@ Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -976,6 +976,11 @@ static const struct flash_info spi_nor_i
+@@ -980,6 +980,11 @@ static const struct flash_info spi_nor_i
  
        /* GigaDevice */
        {
index f5c0dca019369df2744ebdd41f30bc47060bdc6f..a9c6dcb97c8121818f63a38483eae86ee7c2f742 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1037,6 +1037,7 @@ static const struct flash_info spi_nor_i
+@@ -1047,6 +1047,7 @@ static const struct flash_info spi_nor_i
        { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
        { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
        { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
@@ -8,7 +8,7 @@
        { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) },
        { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
        { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
-@@ -1206,11 +1207,12 @@ static const struct flash_info spi_nor_i
+@@ -1216,11 +1217,12 @@ static const struct flash_info spi_nor_i
        { },
  };
  
@@ -23,7 +23,7 @@
  
        tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
        if (tmp < 0) {
-@@ -1221,10 +1223,16 @@ static const struct flash_info *spi_nor_
+@@ -1231,10 +1233,16 @@ static const struct flash_info *spi_nor_
        for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_ids) - 1; tmp++) {
                info = &spi_nor_ids[tmp];
                if (info->id_len) {
@@ -42,7 +42,7 @@
        dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n",
                id[0], id[1], id[2]);
        return ERR_PTR(-ENODEV);
-@@ -2684,7 +2692,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2703,7 +2711,7 @@ int spi_nor_scan(struct spi_nor *nor, co
                info = spi_nor_match_id(name);
        /* Try to auto-detect if chip name wasn't specified or not found */
        if (!info)
@@ -51,7 +51,7 @@
        if (IS_ERR_OR_NULL(info))
                return -ENOENT;
  
-@@ -2695,7 +2703,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2714,7 +2722,7 @@ int spi_nor_scan(struct spi_nor *nor, co
        if (name && info->id_len) {
                const struct flash_info *jinfo;
  
index 2bd18ffa193e6fe912ce8ea027b99677a39c266f..a92302d2a42184c352c57eb11ec360e3a5ece01a 100644 (file)
@@ -11,7 +11,7 @@ the ubi volume created by the other.
 ---
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1036,7 +1036,7 @@ static const struct flash_info spi_nor_i
+@@ -1046,7 +1046,7 @@ static const struct flash_info spi_nor_i
        { "mx25u6435f",  INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) },
        { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
        { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
index 5b50f11a8b3fe32280be6509d26dcf0de61e00ee..bd8620f09785e6c51c13d44e3b43f23fd4624341 100644 (file)
@@ -1504,7 +1504,7 @@ Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
 +MODULE_LICENSE("GPL v2");
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -269,6 +269,7 @@ static inline int set_4byte(struct spi_n
+@@ -271,6 +271,7 @@ static inline int set_4byte(struct spi_n
        u8 cmd;
  
        switch (JEDEC_MFR(info)) {
@@ -1512,7 +1512,7 @@ Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
        case SNOR_MFR_MICRON:
                /* Some Micron need WREN command; all will accept it */
                need_wren = true;
-@@ -1044,7 +1045,7 @@ static const struct flash_info spi_nor_i
+@@ -1054,7 +1055,7 @@ static const struct flash_info spi_nor_i
        { "mx66l1g45g",  INFO(0xc2201b, 0, 64 * 1024, 2048, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
        { "mx66l1g55g",  INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) },
  
@@ -1521,7 +1521,7 @@ Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
        { "n25q016a",    INFO(0x20bb15, 0, 64 * 1024,   32, SECT_4K | SPI_NOR_QUAD_READ) },
        { "n25q032",     INFO(0x20ba16, 0, 64 * 1024,   64, SPI_NOR_QUAD_READ) },
        { "n25q032a",    INFO(0x20bb16, 0, 64 * 1024,   64, SPI_NOR_QUAD_READ) },
-@@ -1059,6 +1060,12 @@ static const struct flash_info spi_nor_i
+@@ -1069,6 +1070,12 @@ static const struct flash_info spi_nor_i
        { "n25q00",      INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
        { "n25q00a",     INFO(0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) },
  
@@ -1534,7 +1534,7 @@ Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
        /* PMC */
        { "pm25lv512",   INFO(0,        0, 32 * 1024,    2, SECT_4K_PMC) },
        { "pm25lv010",   INFO(0,        0, 32 * 1024,    4, SECT_4K_PMC) },
-@@ -2436,6 +2443,7 @@ static int spi_nor_init_params(struct sp
+@@ -2446,6 +2453,7 @@ static int spi_nor_init_params(struct sp
                        params->quad_enable = macronix_quad_enable;
                        break;
  
@@ -1542,7 +1542,7 @@ Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
                case SNOR_MFR_MICRON:
                        break;
  
-@@ -2754,7 +2762,8 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2773,7 +2781,8 @@ int spi_nor_scan(struct spi_nor *nor, co
        mtd->_read = spi_nor_read;
  
        /* NOR protection support for STmicro/Micron chips and similar */
index 3e482465b4d175590b95a8765e8685e9da9fc3da..b41fd95b07a68aa0f8fbee2189ad07216bdf9a18 100644 (file)
@@ -718,7 +718,7 @@ Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
  
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1159,6 +1159,11 @@ static const struct flash_info spi_nor_i
+@@ -1169,6 +1169,11 @@ static const struct flash_info spi_nor_i
        { "w25x40", INFO(0xef3013, 0, 64 * 1024,  8,  SECT_4K) },
        { "w25x80", INFO(0xef3014, 0, 64 * 1024,  16, SECT_4K) },
        { "w25x16", INFO(0xef3015, 0, 64 * 1024,  32, SECT_4K) },
index 0a1b018f14d47c5a9304f7ae7ddc4e2006fd6bb0..9b443bedfe718d8ef15be7f143dfa51d02ec9f31 100644 (file)
@@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -2668,6 +2668,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2687,6 +2687,7 @@ int spi_nor_scan(struct spi_nor *nor, co
        struct device *dev = nor->dev;
        struct mtd_info *mtd = &nor->mtd;
        struct device_node *np = spi_nor_get_flash_node(nor);
@@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
        int ret;
        int i;
  
-@@ -2743,7 +2744,12 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2762,7 +2763,12 @@ int spi_nor_scan(struct spi_nor *nor, co
                spi_nor_wait_till_ready(nor);
        }
  
index 070eeafe813cfecfb953cf5099a859283f224407..0da49b0ff20d9a65c25937c25e1f1429c466b8e8 100644 (file)
@@ -21,10 +21,10 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +                                       * Like SPI_NOR_4B_OPCODES, but for read
 +                                       * op code only.
 +                                       */
- };
  
- #define JEDEC_MFR(info)       ((info)->id[0])
-@@ -240,6 +244,15 @@ static inline u8 spi_nor_convert_3to4_er
+       int     (*quad_enable)(struct spi_nor *nor);
+ };
+@@ -242,6 +246,15 @@ static inline u8 spi_nor_convert_3to4_er
                                      ARRAY_SIZE(spi_nor_3to4_erase));
  }
  
@@ -40,7 +40,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  static void spi_nor_set_4byte_opcodes(struct spi_nor *nor,
                                      const struct flash_info *info)
  {
-@@ -467,6 +480,36 @@ static int spi_nor_erase_sector(struct s
+@@ -469,6 +482,36 @@ static int spi_nor_erase_sector(struct s
        return nor->write_reg(nor, nor->erase_opcode, buf, nor->addr_width);
  }
  
@@ -77,7 +77,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  /*
   * Erase an address range on the nor chip.  The address range may extend
   * one or more erase sectors.  Return an error is there is a problem erasing.
-@@ -492,6 +535,10 @@ static int spi_nor_erase(struct mtd_info
+@@ -494,6 +537,10 @@ static int spi_nor_erase(struct mtd_info
        if (ret)
                return ret;
  
@@ -88,7 +88,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        /* whole-chip erase? */
        if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) {
                unsigned long timeout;
-@@ -542,6 +589,7 @@ static int spi_nor_erase(struct mtd_info
+@@ -544,6 +591,7 @@ static int spi_nor_erase(struct mtd_info
        write_disable(nor);
  
  erase_err:
@@ -96,7 +96,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE);
  
        instr->state = ret ? MTD_ERASE_FAILED : MTD_ERASE_DONE;
-@@ -834,7 +882,9 @@ static int spi_nor_lock(struct mtd_info
+@@ -836,7 +884,9 @@ static int spi_nor_lock(struct mtd_info
        if (ret)
                return ret;
  
@@ -106,7 +106,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
        spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_UNLOCK);
        return ret;
-@@ -849,7 +899,9 @@ static int spi_nor_unlock(struct mtd_inf
+@@ -851,7 +901,9 @@ static int spi_nor_unlock(struct mtd_inf
        if (ret)
                return ret;
  
@@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
        spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK);
        return ret;
-@@ -1182,7 +1234,7 @@ static const struct flash_info spi_nor_i
+@@ -1192,7 +1244,7 @@ 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) },
@@ -125,7 +125,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        { "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024,
                        SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) },
  
-@@ -1242,6 +1294,9 @@ static int spi_nor_read(struct mtd_info
+@@ -1252,6 +1304,9 @@ static int spi_nor_read(struct mtd_info
        if (ret)
                return ret;
  
@@ -135,7 +135,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        while (len) {
                loff_t addr = from;
  
-@@ -1266,6 +1321,18 @@ static int spi_nor_read(struct mtd_info
+@@ -1276,6 +1331,18 @@ static int spi_nor_read(struct mtd_info
        ret = 0;
  
  read_err:
@@ -154,7 +154,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
        return ret;
  }
-@@ -1367,6 +1434,10 @@ static int spi_nor_write(struct mtd_info
+@@ -1377,6 +1444,10 @@ static int spi_nor_write(struct mtd_info
        if (ret)
                return ret;
  
@@ -165,7 +165,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        for (i = 0; i < len; ) {
                ssize_t written;
                loff_t addr = to + i;
-@@ -1407,6 +1478,7 @@ static int spi_nor_write(struct mtd_info
+@@ -1417,6 +1488,7 @@ static int spi_nor_write(struct mtd_info
        }
  
  write_err:
@@ -173,7 +173,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
        return ret;
  }
-@@ -2823,8 +2895,10 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2842,8 +2914,10 @@ int spi_nor_scan(struct spi_nor *nor, co
        } else if (mtd->size > 0x1000000) {
                /* enable 4-byte addressing if the device exceeds 16MiB */
                nor->addr_width = 4;
index 267d2a9eb87676d57999022b953bab1b2188bc16..419a9719b5b49a6f161cbaee0a22a3282f5a66e0 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -142,20 +142,29 @@ static int read_fsr(struct spi_nor *nor)
+@@ -144,20 +144,29 @@ static int read_fsr(struct spi_nor *nor)
   * location. Return the configuration register value.
   * Returns negative if error occurred.
   */
@@ -33,7 +33,7 @@
  /*
   * Write status register 1 byte
   * Returns negative if error occurred.
-@@ -2895,9 +2904,16 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2914,9 +2923,16 @@ int spi_nor_scan(struct spi_nor *nor, co
        } else if (mtd->size > 0x1000000) {
                /* enable 4-byte addressing if the device exceeds 16MiB */
                nor->addr_width = 4;
index 0a3a65d70a76e02309d2d7d4d61a99d103f12eb9..836eec4f1e88d2a5b3affea776dd645590c803a7 100644 (file)
@@ -1,8 +1,8 @@
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1066,6 +1066,11 @@ static const struct flash_info spi_nor_i
-                       SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
-                       SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+@@ -1076,6 +1076,11 @@ static const struct flash_info spi_nor_i
+                       SPI_NOR_4B_OPCODES | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+                       .quad_enable = macronix_quad_enable,
        },
 +      {
 +              "gd25q512", INFO(0xc84020, 0, 64 * 1024, 1024,
index 021c2857b3d7d088235e70b68c7fdb3a490184e7..bfa25c77e865d832229f79f8e14330031b7a7be6 100644 (file)
@@ -10,7 +10,7 @@ For reference see:
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1103,6 +1103,7 @@ static const struct flash_info spi_nor_i
+@@ -1113,6 +1113,7 @@ static const struct flash_info spi_nor_i
        { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
        { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
        { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
@@ -18,7 +18,7 @@ For reference see:
        { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) },
        { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
        { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
-@@ -1272,11 +1273,12 @@ static const struct flash_info spi_nor_i
+@@ -1282,11 +1283,12 @@ static const struct flash_info spi_nor_i
        { },
  };
  
@@ -33,7 +33,7 @@ For reference see:
  
        tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
        if (tmp < 0) {
-@@ -1287,10 +1289,16 @@ static const struct flash_info *spi_nor_
+@@ -1297,10 +1299,16 @@ static const struct flash_info *spi_nor_
        for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_ids) - 1; tmp++) {
                info = &spi_nor_ids[tmp];
                if (info->id_len) {
@@ -52,7 +52,7 @@ For reference see:
        dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n",
                id[0], id[1], id[2]);
        return ERR_PTR(-ENODEV);
-@@ -2770,7 +2778,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2789,7 +2797,7 @@ int spi_nor_scan(struct spi_nor *nor, co
                info = spi_nor_match_id(name);
        /* Try to auto-detect if chip name wasn't specified or not found */
        if (!info)
@@ -61,7 +61,7 @@ For reference see:
        if (IS_ERR_OR_NULL(info))
                return -ENOENT;
  
-@@ -2781,7 +2789,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -2800,7 +2808,7 @@ int spi_nor_scan(struct spi_nor *nor, co
        if (name && info->id_len) {
                const struct flash_info *jinfo;