1 This hack can be dropped after the next stable release from
4 The problem was fixed upstream by
6 commit 2bffa65da43e ("mtd: spi-nor: Add a post BFPT fixup for MX25L25635E")
9 <https://github.com/openwrt/openwrt/pull/1743>
11 --- a/drivers/mtd/spi-nor/spi-nor.c
12 +++ b/drivers/mtd/spi-nor/spi-nor.c
13 @@ -1098,6 +1098,7 @@ static const struct flash_info spi_nor_i
14 { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
15 { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
16 { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
17 + { "mx25l25635f", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
18 { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) },
19 { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
20 { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },
21 @@ -1271,11 +1272,12 @@ static const struct flash_info spi_nor_i
25 -static const struct flash_info *spi_nor_read_id(struct spi_nor *nor)
26 +static const struct flash_info *spi_nor_read_id(struct spi_nor *nor,
30 u8 id[SPI_NOR_MAX_ID_LEN];
31 - const struct flash_info *info;
32 + const struct flash_info *info, *first_match = NULL;
34 tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
36 @@ -1286,10 +1288,16 @@ static const struct flash_info *spi_nor_
37 for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_ids) - 1; tmp++) {
38 info = &spi_nor_ids[tmp];
40 - if (!memcmp(info->id, id, info->id_len))
41 - return &spi_nor_ids[tmp];
42 + if (!memcmp(info->id, id, info->id_len)) {
43 + if (!name || !strcmp(name, info->name))
52 dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n",
54 return ERR_PTR(-ENODEV);
55 @@ -2769,7 +2777,7 @@ int spi_nor_scan(struct spi_nor *nor, co
56 info = spi_nor_match_id(name);
57 /* Try to auto-detect if chip name wasn't specified or not found */
59 - info = spi_nor_read_id(nor);
60 + info = spi_nor_read_id(nor, NULL);
61 if (IS_ERR_OR_NULL(info))
64 @@ -2780,7 +2788,7 @@ int spi_nor_scan(struct spi_nor *nor, co
65 if (name && info->id_len) {
66 const struct flash_info *jinfo;
68 - jinfo = spi_nor_read_id(nor);
69 + jinfo = spi_nor_read_id(nor, name);
71 return PTR_ERR(jinfo);
72 } else if (jinfo != info) {