linux-stable/drivers/mtd/spi-nor
Linus Walleij 7c6ba20a0b mtd: spi-nor: Correct flags for Winbond w25q128
commit 83e824a4a5 upstream.

The Winbond "w25q128" (actual vendor name W25Q128JV) has
exactly the same flags as the sibling device "w25q128jv".
The devices both require unlocking to enable write access.

The actual product naming between devices vs the Linux
strings in winbond.c:

0xef4018: "w25q128"   W25Q128JV-IN/IQ/JQ
0xef7018: "w25q128jv" W25Q128JV-IM/JM

The latter device, "w25q128jv" supports features named DTQ
and QPI, otherwise it is the same.

Not having the right flags has the annoying side effect
that write access does not work.

After this patch I can write to the flash on the Inteno
XG6846 router.

The flash memory also supports dual and quad SPI modes.
This does not currently manifest, but by turning on SFDP
parsing, the right SPI modes are emitted in
/sys/kernel/debug/spi-nor/spi1.0/capabilities
for this chip, so we also turn on this.

Since we now have determined that SFDP parsing works on
the device, we also detect the geometry using SFDP.

After this dmesg and sysfs says:
[    1.062401] spi-nor spi1.0: w25q128 (16384 Kbytes)
cat erasesize
65536
(16384*1024)/65536 = 256 sectors

spi-nor sysfs:
cat jedec_id
ef4018
cat manufacturer
winbond
cat partname
w25q128
hexdump -v -C sfdp
00000000  53 46 44 50 05 01 00 ff  00 05 01 10 80 00 00 ff
00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
00000030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
00000050  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
00000060  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
00000080  e5 20 f9 ff ff ff ff 07  44 eb 08 6b 08 3b 42 bb
00000090  fe ff ff ff ff ff 00 00  ff ff 40 eb 0c 20 0f 52
000000a0  10 d8 00 00 36 02 a6 00  82 ea 14 c9 e9 63 76 33
000000b0  7a 75 7a 75 f7 a2 d5 5c  19 f7 4d ff e9 30 f8 80

Cc: stable@vger.kernel.org
Suggested-by: Michael Walle <michael@walle.cc>
Reviewed-by: Michael Walle <michael@walle.cc>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230718-spi-nor-winbond-w25q128-v5-1-a73653ee46c3@linaro.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-09-19 12:28:06 +02:00
..
controllers
Kconfig
Makefile
atmel.c
catalyst.c
core.c mtd: spi-nor: Check bus width while setting QE bit 2023-09-13 09:42:58 +02:00
core.h mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon s28hx SEMPER flash 2023-05-17 11:53:28 +02:00
debugfs.c mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon s28hx SEMPER flash 2023-05-17 11:53:28 +02:00
eon.c
esmt.c
everspin.c
fujitsu.c
gigadevice.c mtd: spi-nor: gigadevice: gd25q256: replace gd25q256_default_init with gd25q256_post_bfpt 2023-01-07 11:11:52 +01:00
intel.c
issi.c mtd: spi-nor: add SFDP fixups for Quad Page Program 2023-05-17 11:53:28 +02:00
macronix.c
micron-st.c
otp.c
sfdp.c mtd: spi-nor: Fix shift-out-of-bounds in spi_nor_set_erase_type 2023-03-10 09:34:21 +01:00
sfdp.h
spansion.c mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon s25hx SEMPER flash 2023-05-17 11:53:29 +02:00
sst.c
swp.c
sysfs.c
winbond.c mtd: spi-nor: Correct flags for Winbond w25q128 2023-09-19 12:28:06 +02:00
xilinx.c
xmc.c