[PATCH v4 17/27] mtd: spi-nor: debugfs: Add locking support
Miquel Raynal
miquel.raynal at bootlin.com
Mon Apr 27 06:39:27 PDT 2026
Hello SPI NOR foks,
On 10/04/2026 at 04:39:22 GMT, <Takahiro.Kuwano at infineon.com> wrote:
>> The ioctl output may be counter intuitive in some cases. Asking for a
>> "locked status" over a region that is only partially locked will return
>> "unlocked" whereas in practice maybe the biggest part is actually
>> locked.
>>
>> Knowing what is the real software locking state through debugfs would be
>> very convenient for development/debugging purposes, hence this proposal
>> for adding an extra block at the end of the file: a "locked sectors"
>> array which lists every section, if it is locked or not, showing both
>> the address ranges and the sizes in numbers of blocks.
>>
>> Here is an example of output, what is after the "sector map" is new.
>>
>> $ cat /sys/kernel/debug/spi-nor/spi0.0/params
>> name (null)
>> id ef a0 20 00 00 00
>> size 64.0 MiB
>> write size 1
>> page size 256
>> address nbytes 4
>> flags HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | HAS_SR_TB_BIT6 | HAS_4BIT_BP |
>> SOFT_RESET | NO_WP
>>
>> opcodes
>> read 0xec
>> dummy cycles 6
>> erase 0xdc
>> program 0x34
>> 8D extension none
>>
>> protocols
>> read 1S-4S-4S
>> write 1S-1S-4S
>> register 1S-1S-1S
>>
>> erase commands
>> 21 (4.00 KiB) [1]
>> dc (64.0 KiB) [3]
>> c7 (64.0 MiB)
>>
>> sector map
>> region (in hex) | erase mask | overlaid
>> ------------------+------------+---------
>> 00000000-03ffffff | [ 3] | no
>>
>> locked sectors
>> region (in hex) | status | #blocks
>> ------------------+----------+--------
>> 00000000-03ffffff | unlocked | 1024
>>
>> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
I don't want to be too pushy but this series has been pending for a
while, there are real fixes inside, it (IMO) greatly improve the
documentation, adds a testing procedure, gives a friendly interface to
understand what is locked, etc. I am working on clarifying and improving
the Winbond vendor driver even more now and I need these changes to get
in for the cleanup to continue. Can someone bump spi-nor/next on top of
v7.1-rc1 and apply this? Unless there are more changes, of course.
Thanks a lot!
Miquèl
More information about the linux-mtd
mailing list