]> git.hungrycats.org Git - linux/commit
mtd: spi-nor: Create a local SR cache
authorMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 26 May 2026 14:56:41 +0000 (16:56 +0200)
committerPratyush Yadav <pratyush@kernel.org>
Tue, 26 May 2026 15:21:05 +0000 (17:21 +0200)
commitb7b63475903cc9967ae53c579bc1ad9ed2519080
tree1a547fcbeb117da9586fe27e411398bc25d46cb0
parent0e005045292dde634ed3973b5070eb2de62dc1df
mtd: spi-nor: Create a local SR cache

In order to be able to generate debugfs output without having to
actually reach the flash, create a SPI NOR local cache of the status
registers. What matters in our case are all the bits related to sector
locking. As such, in order to make it clear that this cache is not
intended to be used anywhere else, we zero the irrelevant bits.

The cache is initialized once during the early init, and then maintained
every time the write protection scheme is updated.

Suggested-by: Michael Walle <mwalle@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
drivers/mtd/spi-nor/core.c
drivers/mtd/spi-nor/core.h
drivers/mtd/spi-nor/swp.c
include/linux/mtd/spi-nor.h