]> git.ipfire.org Git - thirdparty/linux.git/commit
mtd: spi-nor: core: Check read CR support
authorJakub Czapiga <czapiga@google.com>
Fri, 19 Sep 2025 18:15:47 +0000 (18:15 +0000)
committerPratyush Yadav <pratyush@kernel.org>
Tue, 18 Nov 2025 12:33:18 +0000 (13:33 +0100)
commit5008c3ec3f891456e74f8dab882fcd5bc515d327
tree44c4a428948f3b049df53fffb6afb48ad043025f
parent7f77c561e22783387af91cd16f3a4324a99c9a4f
mtd: spi-nor: core: Check read CR support

Some SPI controllers like Intel's one on the PCI bus do not support
opcode 35h. This opcode is used to read the Configuration Register on
SPI-NOR chips that have 16-bit Status Register configured regardless
of the controller support for it. Adding a check call in the setup step
allows disabling use of the 35h opcode and falling back to the manual
Status Registers management.

Before:
openat(AT_FDCWD, "/dev/mtd0", O_RDWR)   = 4
ioctl(4, MIXER_WRITE(6) or MEMUNLOCK, {start=0, length=0x2000000}) = -1
EOPNOTSUPP

After:
openat(AT_FDCWD, "/dev/mtd0", O_RDWR)   = 4
ioctl(4, MIXER_WRITE(6) or MEMUNLOCK, {start=0, length=0x2000000}) = 0
ioctl(4, MIXER_WRITE(5) or MEMLOCK, {start=0x1800000, length=0x800000}) = 0

Suggested-by: Adeel Arshad <adeel.arshad@intel.com>
Signed-off-by: Jakub Czapiga <czapiga@google.com>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
drivers/mtd/spi-nor/core.c