[PATCH v2] mtd: spi-nor: allow force unlocking via DT property
Michael Walle
mwalle at kernel.org
Fri Sep 11 00:32:11 PDT 2026
On Thu Aug 6, 2026 at 1:37 PM CEST, Chen Minqiang wrote:
> Some SPI NOR flash chips (such as generic or unlisted chips used in vendor
> devices like Tenda AX12L Pro) have Block Protection (BP) bits set in the
> Status Register by bootloaders or factory settings, locking flash blocks.
>
> Because vendors frequently switch between various generic SPI NOR flash
> chips ("Flash Lottery"), it is impractical to upstream explicit chip ID
> flags (SNOR_F_HAS_LOCK) for every possible generic chip variant.
>
> This patch introduces support for the "linux,force-sr-unlock" Device Tree
> property:
> 1. In spi_nor_init_flags(), set the SNOR_F_HAS_LOCK flag on the flash
> instance if "linux,force-sr-unlock" is present in the flash DT node. This
> allows spi_nor_late_init_params() to automatically populate default
> locking_ops without altering swp.c.
> 2. In spi_nor_init(), trigger spi_nor_try_unlock_all() if "linux,force-sr-unlock"
> is set, invoking Linux kernel's native spi_nor_unlock() mechanism.
>
> Signed-off-by: Chen Minqiang <ptpt52 at gmail.com>
> ---
> v1 -> v2:
> - Set SNOR_F_HAS_LOCK in spi_nor_init_flags() when "linux,force-sr-unlock"
> is present in DT, allowing spi_nor_late_init_params() to set default
> locking_ops automatically without modifying swp.c.
I've given you feedback on the v1, there was no reply, so I'm going
to ignore this.
-michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 297 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20260911/67900dbe/attachment-0001.sig>
More information about the linux-mtd
mailing list