From: "Michael Walle" <mwalle@kernel.org>
To: "Miquel Raynal" <miquel.raynal@bootlin.com>,
"Pratyush Yadav" <pratyush@kernel.org>,
"Takahiro Kuwano" <takahiro.kuwano@infineon.com>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Steam Lin" <STLin2@winbond.com>, <linux-mtd@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 11/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information
Date: Mon, 06 Jul 2026 16:21:54 +0200 [thread overview]
Message-ID: <DJRK05XL4ONU.MM3VQ61CQJ6I@kernel.org> (raw)
In-Reply-To: <20260529-winbond-v7-1-spi-nor-jv-cleanup-v1-11-87e5d3122244@bootlin.com>
[-- Attachment #1.1: Type: text/plain, Size: 5077 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> The SFDP table does not advertize the locking capabilities of the
> device, flag these capabilities.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> $ alias show_sectors='grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0
> /params'
> $ flash_lock -u /dev/mtd0
> $ flash_lock -i /dev/mtd0
> Device: /dev/mtd0
> Start: 0
> Len: 0x400000
> Lock status: unlocked
> Return code: 0
> $ mtd_debug erase /dev/mtd0 0 2097152
> Erased 2097152 bytes from address 0x00000000 in flash
> $ mtd_debug write /dev/mtd0 0 2097152 spi_test
> Copied 2097152 bytes from spi_test to address 0x00000000 in flash
> $ mtd_debug read /dev/mtd0 0 2097152 spi_read
> Copied 2097152 bytes from address 0x00000000 in flash to spi_read
> $ sha256sum spi*
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_test
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003fffff | unlocked | 64
> $ flash_lock -l /dev/mtd0
> $ flash_lock -i /dev/mtd0
> Device: /dev/mtd0
> Start: 0
> Len: 0x400000
> Lock status: locked
> Return code: 1
> $ mtd_debug erase /dev/mtd0 0 2097152
> Erased 2097152 bytes from address 0x00000000 in flash
> $ mtd_debug read /dev/mtd0 0 2097152 spi_read
> Copied 2097152 bytes from address 0x00000000 in flash to spi_read
> $ sha256sum spi*
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_test
> $ dd if=/dev/urandom of=./spi_test2 bs=1M count=2
> 2+0 records in
> 2+0 records out
> $ mtd_debug write /dev/mtd0 0 2097152 spi_test2
> Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
> $ mtd_debug read /dev/mtd0 0 2097152 spi_read2
> Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
> $ sha256sum spi*
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read2
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_test
> 5b69b16c88c3ae48213c359d2f9fd7f0583e513dabb224b3404bc93a5e173253 spi_test2
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003fffff | locked | 64
> $ flash_lock -u /dev/mtd0
> $ size=$(cat /sys/class/mtd/mtd0/size)
> $ nblocks=$(grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params | sed -e 's/.*
> unlocked | //')
> $
> $ bs=$(($size / $nblocks))
> $ flash_lock -u /dev/mtd0
> $ flash_lock -l /dev/mtd0 $(($size - (2 * $bs))) 2 # last two
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003dffff | unlocked | 62
> 003e0000-003fffff | locked | 2
> $ flash_lock -u /dev/mtd0 $(($size - (2 * $bs))) 1 # last one
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003effff | unlocked | 63
> 003f0000-003fffff | locked | 1
> $ flash_lock -u /dev/mtd0
> $ all_but_one=$((($size / $bs) - 1))
> $ flash_lock -l /dev/mtd0 $bs $all_but_one # all but the first
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-0000ffff | unlocked | 1
> 00010000-003fffff | locked | 63
> $ flash_lock -u /dev/mtd0 $bs 1 # all but the two first
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-0001ffff | unlocked | 2
> 00020000-003fffff | locked | 62
> $ flash_lock -u /dev/mtd0
> $ flash_lock -l /dev/mtd0 0 $all_but_one # same from the other side
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003effff | locked | 63
> 003f0000-003fffff | unlocked | 1
> $ flash_lock -u /dev/mtd0 $(($size - (2 * $bs))) 1 # all but two
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003dffff | locked | 62
> 003e0000-003fffff | unlocked | 2
> ---
> drivers/mtd/spi-nor/winbond.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
> index 07ab66a9e6c0..e6dca2493357 100644
> --- a/drivers/mtd/spi-nor/winbond.c
> +++ b/drivers/mtd/spi-nor/winbond.c
> @@ -200,7 +200,7 @@ static const struct flash_info winbond_nor_parts[] = {
> }, {
> /* W25Q32JV-Q/N */
> .id = SNOR_ID(0xef, 0x40, 0x16),
> - .flags = SPI_NOR_QUAD_PP,
> + .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
The original W25Q32 doesn't have the CMP bit.
-michael
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
[-- Attachment #2: Type: text/plain, Size: 144 bytes --]
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: "Michael Walle" <mwalle@kernel.org>
To: "Miquel Raynal" <miquel.raynal@bootlin.com>,
"Pratyush Yadav" <pratyush@kernel.org>,
"Takahiro Kuwano" <takahiro.kuwano@infineon.com>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Steam Lin" <STLin2@winbond.com>, <linux-mtd@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 11/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information
Date: Mon, 06 Jul 2026 16:21:54 +0200 [thread overview]
Message-ID: <DJRK05XL4ONU.MM3VQ61CQJ6I@kernel.org> (raw)
In-Reply-To: <20260529-winbond-v7-1-spi-nor-jv-cleanup-v1-11-87e5d3122244@bootlin.com>
[-- Attachment #1: Type: text/plain, Size: 5077 bytes --]
On Fri May 29, 2026 at 5:22 PM CEST, Miquel Raynal wrote:
> The SFDP table does not advertize the locking capabilities of the
> device, flag these capabilities.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> $ alias show_sectors='grep -A4 "locked sectors" /sys/kernel/debug/spi-nor/spi0.0
> /params'
> $ flash_lock -u /dev/mtd0
> $ flash_lock -i /dev/mtd0
> Device: /dev/mtd0
> Start: 0
> Len: 0x400000
> Lock status: unlocked
> Return code: 0
> $ mtd_debug erase /dev/mtd0 0 2097152
> Erased 2097152 bytes from address 0x00000000 in flash
> $ mtd_debug write /dev/mtd0 0 2097152 spi_test
> Copied 2097152 bytes from spi_test to address 0x00000000 in flash
> $ mtd_debug read /dev/mtd0 0 2097152 spi_read
> Copied 2097152 bytes from address 0x00000000 in flash to spi_read
> $ sha256sum spi*
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_test
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003fffff | unlocked | 64
> $ flash_lock -l /dev/mtd0
> $ flash_lock -i /dev/mtd0
> Device: /dev/mtd0
> Start: 0
> Len: 0x400000
> Lock status: locked
> Return code: 1
> $ mtd_debug erase /dev/mtd0 0 2097152
> Erased 2097152 bytes from address 0x00000000 in flash
> $ mtd_debug read /dev/mtd0 0 2097152 spi_read
> Copied 2097152 bytes from address 0x00000000 in flash to spi_read
> $ sha256sum spi*
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_test
> $ dd if=/dev/urandom of=./spi_test2 bs=1M count=2
> 2+0 records in
> 2+0 records out
> $ mtd_debug write /dev/mtd0 0 2097152 spi_test2
> Copied 2097152 bytes from spi_test2 to address 0x00000000 in flash
> $ mtd_debug read /dev/mtd0 0 2097152 spi_read2
> Copied 2097152 bytes from address 0x00000000 in flash to spi_read2
> $ sha256sum spi*
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_read2
> 6d7c114421890dfa12e1824aa351d4490815a9c0ceb9c2e7981073106a11fc71 spi_test
> 5b69b16c88c3ae48213c359d2f9fd7f0583e513dabb224b3404bc93a5e173253 spi_test2
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003fffff | locked | 64
> $ flash_lock -u /dev/mtd0
> $ size=$(cat /sys/class/mtd/mtd0/size)
> $ nblocks=$(grep unlocked /sys/kernel/debug/spi-nor/spi0.0/params | sed -e 's/.*
> unlocked | //')
> $
> $ bs=$(($size / $nblocks))
> $ flash_lock -u /dev/mtd0
> $ flash_lock -l /dev/mtd0 $(($size - (2 * $bs))) 2 # last two
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003dffff | unlocked | 62
> 003e0000-003fffff | locked | 2
> $ flash_lock -u /dev/mtd0 $(($size - (2 * $bs))) 1 # last one
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003effff | unlocked | 63
> 003f0000-003fffff | locked | 1
> $ flash_lock -u /dev/mtd0
> $ all_but_one=$((($size / $bs) - 1))
> $ flash_lock -l /dev/mtd0 $bs $all_but_one # all but the first
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-0000ffff | unlocked | 1
> 00010000-003fffff | locked | 63
> $ flash_lock -u /dev/mtd0 $bs 1 # all but the two first
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-0001ffff | unlocked | 2
> 00020000-003fffff | locked | 62
> $ flash_lock -u /dev/mtd0
> $ flash_lock -l /dev/mtd0 0 $all_but_one # same from the other side
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003effff | locked | 63
> 003f0000-003fffff | unlocked | 1
> $ flash_lock -u /dev/mtd0 $(($size - (2 * $bs))) 1 # all but two
> $ show_sectors
> locked sectors
> region (in hex) | status | #sectors
> ------------------+----------+---------
> 00000000-003dffff | locked | 62
> 003e0000-003fffff | unlocked | 2
> ---
> drivers/mtd/spi-nor/winbond.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c
> index 07ab66a9e6c0..e6dca2493357 100644
> --- a/drivers/mtd/spi-nor/winbond.c
> +++ b/drivers/mtd/spi-nor/winbond.c
> @@ -200,7 +200,7 @@ static const struct flash_info winbond_nor_parts[] = {
> }, {
> /* W25Q32JV-Q/N */
> .id = SNOR_ID(0xef, 0x40, 0x16),
> - .flags = SPI_NOR_QUAD_PP,
> + .flags = SPI_NOR_QUAD_PP | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_HAS_CMP,
The original W25Q32 doesn't have the CMP bit.
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
next prev parent reply other threads:[~2026-07-06 14:22 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 15:22 [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 01/30] mtd: spi-nor: winbond: Move W25Q01NW to its right place Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-07-06 13:54 ` Michael Walle
2026-07-06 13:54 ` Michael Walle
2026-05-29 15:22 ` [PATCH 02/30] mtd: spi-nor: winbond: Normalize names Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-07-06 13:57 ` Michael Walle
2026-07-06 13:57 ` Michael Walle
2026-05-29 15:22 ` [PATCH 03/30] mtd: spi-nor: winbond: Stop filling the .name entry Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-07-06 13:59 ` Michael Walle
2026-07-06 13:59 ` Michael Walle
2026-05-29 15:22 ` [PATCH 04/30] mtd: spi-nor: winbond: Make the RDCR fixup Winbond wide Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:11 ` Michael Walle
2026-07-06 14:11 ` Michael Walle
2026-05-29 15:22 ` [PATCH 05/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Drop redundant data Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:13 ` Michael Walle
2026-07-06 14:13 ` Michael Walle
2026-05-29 15:22 ` [PATCH 06/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 07/30] mtd: spi-nor: winbond: W25Q512JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 08/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Add quad page program capability Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:16 ` Michael Walle
2026-07-06 14:16 ` Michael Walle
2026-05-29 15:22 ` [PATCH 09/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 10/30] mtd: spi-nor: winbond: W25Q128JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 11/30] mtd: spi-nor: winbond: W25Q32JV-Q/N: Fill locking information Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:21 ` Michael Walle [this message]
2026-07-06 14:21 ` Michael Walle
2026-05-29 15:22 ` [PATCH 12/30] mtd: spi-nor: winbond: W25Q64JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 13/30] mtd: spi-nor: winbond: W25Q128JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 14/30] mtd: spi-nor: winbond: W25Q512JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 15/30] mtd: spi-nor: winbond: W25Q01JV-Q/N: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 16/30] mtd: spi-nor: winbond: W25Q32JV-M: Drop redundant data Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:23 ` Michael Walle
2026-07-06 14:23 ` Michael Walle
2026-05-29 15:22 ` [PATCH 17/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 18/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 19/30] mtd: spi-nor: winbond: W25Q32JV-M: Add quad page program capability Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 20/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 21/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 22/30] mtd: spi-nor: winbond: W25Q32JV-M: Fill locking information Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 23/30] mtd: spi-nor: winbond: W25Q64JV-M: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 24/30] mtd: spi-nor: winbond: W25Q128JV-M: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 25/30] mtd: spi-nor: winbond: W25Q02JV-M: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 26/30] mtd: spi-nor: winbond: W25Q512JV-M: New chip Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 27/30] mtd: spi-nor: winbond: W25Q01JV-M: " Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 28/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Drop redundant data Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 29/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Add quad page program capability Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-05-29 15:22 ` [PATCH 30/30] mtd: spi-nor: winbond: W25QxxJV-Q/N/M: Fill locking information Miquel Raynal
2026-05-29 15:22 ` Miquel Raynal
2026-07-06 14:27 ` [PATCH 00/30] mtd: spi-nor: Clean Winbond W25QxxJV family Michael Walle
2026-07-06 14:27 ` Michael Walle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DJRK05XL4ONU.MM3VQ61CQJ6I@kernel.org \
--to=mwalle@kernel.org \
--cc=STLin2@winbond.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=takahiro.kuwano@infineon.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.