{"id":2197795,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2197795/?format=json","project":{"id":3,"url":"http://patchwork.ozlabs.org/api/1.0/projects/3/?format=json","name":"Linux MTD development","link_name":"linux-mtd","list_id":"linux-mtd.lists.infradead.org","list_email":"linux-mtd@lists.infradead.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260218143523.17467-2-farbere@amazon.com>","date":"2026-02-18T14:35:21","name":"[v2,1/3] mtd: spi-nor: winbond: Fix locking support for w25q256jwm","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"d79338e98938e243f9468e02c1f7b8e0a5adc1f7","submitter":{"id":84667,"url":"http://patchwork.ozlabs.org/api/1.0/people/84667/?format=json","name":"Farber, Eliav","email":"farbere@amazon.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-mtd/patch/20260218143523.17467-2-farbere@amazon.com/mbox/","series":[{"id":492562,"url":"http://patchwork.ozlabs.org/api/1.0/series/492562/?format=json","date":"2026-02-18T14:35:20","name":"mtd: spi-nor: winbond: Fix protection handling","version":2,"mbox":"http://patchwork.ozlabs.org/series/492562/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2197795/checks/","tags":{},"headers":{"Return-Path":"\n <linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Csca2QAx;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=amazon.com header.i=@amazon.com header.a=rsa-sha256\n header.s=amazoncorp2 header.b=OOGpA0sG;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fGJwF6K4lz1xyD\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 19 Feb 2026 01:35:54 +1100 (AEDT)","from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1vsieT-00000009xT5-1sCM;\n\tWed, 18 Feb 2026 14:35:41 +0000","from pdx-out-005.esa.us-west-2.outbound.mail-perimeter.amazon.com\n ([52.13.214.179])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1vsieP-00000009xRc-46Bn\n\tfor linux-mtd@lists.infradead.org;\n\tWed, 18 Feb 2026 14:35:39 +0000","from ip-10-5-0-115.us-west-2.compute.internal (HELO\n smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.0.115])\n  by internal-pdx-out-005.esa.us-west-2.outbound.mail-perimeter.amazon.com\n with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2026 14:35:31 +0000","from EX19MTAUWB002.ant.amazon.com [205.251.233.48:8957]\n by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.39.194:2525]\n with esmtp (Farcaster)\n id 00709b63-fb83-4df5-a64e-073fb2d7c1fb;\n Wed, 18 Feb 2026 14:35:31 +0000 (UTC)","from EX19D001UWA001.ant.amazon.com (10.13.138.214) by\n EX19MTAUWB002.ant.amazon.com (10.250.64.231) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35;\n Wed, 18 Feb 2026 14:35:31 +0000","from dev-dsk-farbere-1a-46ecabed.eu-west-1.amazon.com\n (172.19.116.181) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 18 Feb 2026\n 14:35:29 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=30PWhZVYb0HBavOwNK5oPLfKC7d+5Vfj3Fqwea2PyWo=; b=Csca2QAxuQWSyP\n\tlsusZdh8Vrx+4/TMSxYqqkwCMkbtSuiZUqA7x4FwnYFn1DBUqVmFu04CldBAGNaJXnOLpq8vX0J+i\n\tOnLfw3SS/6GAMTjp6pbxUadPHlTHL5YuBRuuhuVE63Pnrk1Kppb9suc0JDi23YC0RDcCrMansqMHr\n\tKDkcHVlgitTik8RGKMHGRlEeaWE4zkJ5pnf23OxyBW2u12vpfZO0+AqzlKfbuH7VbyGQtLGTVSS9o\n\taJ0YfhTmdxHJE9pUR29yFslTRBFlMEUqxDccdfotbCBfmSE6h2kOnqcG1zm6iNdExc4EFLP8q/Xfi\n\tzHXmCUBXZWEMaZGUtUGQ==;","v=1; a=rsa-sha256; c=relaxed/relaxed;\n  d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2;\n  t=1771425337; x=1802961337;\n  h=from:to:cc:subject:date:message-id:in-reply-to:\n   references:mime-version:content-transfer-encoding;\n  bh=b4nAwwP9kKL9flULqfozPlWT1GSVAHqt8b0l1p7ovGQ=;\n  b=OOGpA0sGZEx0YTJ38q4DMBhIEBpcIUh3xYJZT4flg8W8pC1rFnaCWeA1\n   rIc8LDlv9FYC2fk0/+xjcvC4ArxcqpLYcg6YO7Pv3eMkOPyk+kQocds3X\n   JaKhFTsrLcBZV9XQaFgCRHp284yMxyw9QwRhx1tGmDdwTiU9GU30/7+hd\n   ZjF5VMEPQ7Vgtq6IzRsqLFVnsIvTHEOkXB4UuW1aHqQRg+6+6dbdDroyJ\n   2A35GlKkkWIWuImE5t72v4jJEX83tn6ZFK3fIOnDJCQFXkciB57oXjhl+\n   ixal5ac9ibyutSY+Pm9fasYrBrur/khwdTH+LH7YeRYZNpbg4DmQEqvHN\n   w==;"],"X-CSE-ConnectionGUID":"RQP3LO31SpiU+o41FX21fw==","X-CSE-MsgGUID":"U8LcRvs4TA6klofjpwj24g==","X-IronPort-AV":"E=Sophos;i=\"6.21,298,1763424000\";\n   d=\"scan'208\";a=\"13290663\"","X-Farcaster-Flow-ID":"00709b63-fb83-4df5-a64e-073fb2d7c1fb","From":"Eliav Farber <farbere@amazon.com>","To":"<tudor.ambarus@linaro.org>, <pratyush@kernel.org>, <mwalle@kernel.org>,\n\t<miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,\n\t<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>","CC":"<farbere@amazon.com>","Subject":"[PATCH v2 1/3] mtd: spi-nor: winbond: Fix locking support for\n w25q256jwm","Date":"Wed, 18 Feb 2026 14:35:21 +0000","Message-ID":"<20260218143523.17467-2-farbere@amazon.com>","X-Mailer":"git-send-email 2.47.3","In-Reply-To":"<20260218143523.17467-1-farbere@amazon.com>","References":"<20260218143523.17467-1-farbere@amazon.com>","MIME-Version":"1.0","X-Originating-IP":"[172.19.116.181]","X-ClientProxiedBy":"EX19D042UWA002.ant.amazon.com (10.13.139.17) To\n EX19D001UWA001.ant.amazon.com (10.13.138.214)","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20260218_063538_065661_FE714717 ","X-CRM114-Status":"GOOD (  14.25  )","X-Spam-Score":"-9.6 (---------)","X-Spam-Report":"Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam.  The original\n message has been attached to this so you can view it or label\n similar future email.  If you have any questions, see\n the administrator of that system for details.\n Content preview:  The Winbond w25q256jwm device supports four Block Protect\n   (BP) bits and uses Status Register bit 6 as the Top/Bottom (TB) protect\n bit.\n    Update the flash parameters by enabling SPI_NOR_4BIT_BP and\n SPI_NOR_TB_SR_BIT6.\n    Without these flags, the locking configuration is incorrect.\n Content analysis details:   (-9.6 points, 5.0 required)\n  pts rule name              description\n ---- ----------------------\n --------------------------------------------------\n -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/, no\n                             trust\n                             [52.13.214.179 listed in list.dnswl.org]\n -7.5 USER_IN_DEF_SPF_WL     From: address is in the default SPF welcome-list\n -0.0 SPF_PASS               SPF: sender matches SPF record\n  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record\n -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from\n author's\n                             domain\n -0.1 DKIM_VALID             Message has at least one valid DKIM or DK\n signature\n  0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n not necessarily valid\n -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from\n                             envelope-from domain\n -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n                             [score: 0.0000]\n  0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The\n                             query to Validity was blocked.  See\n                             https://knowledge.validity.com/hc/en-us/articles/20961730681243\n                              for more information.\n                          [52.13.214.179 listed in\n sa-trusted.bondedsender.org]\n  0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to\n                              Validity was blocked.  See\n                             https://knowledge.validity.com/hc/en-us/articles/20961730681243\n                              for more information.\n                             [52.13.214.179 listed in sa-accredit.habeas.com]\n  0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to\n                              Validity was blocked.  See\n                             https://knowledge.validity.com/hc/en-us/articles/20961730681243\n                              for more information.\n                             [52.13.214.179 listed in\n bl.score.senderscore.com]\n  0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay\n lines\n -0.0 DKIMWL_WL_HIGH         DKIMwl.org - High trust sender","X-BeenThere":"linux-mtd@lists.infradead.org","X-Mailman-Version":"2.1.34","Precedence":"list","List-Id":"Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-mtd>,\n <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-mtd/>","List-Post":"<mailto:linux-mtd@lists.infradead.org>","List-Help":"<mailto:linux-mtd-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"},"content":"The Winbond w25q256jwm device supports four Block Protect (BP) bits and\nuses Status Register bit 6 as the Top/Bottom (TB) protect bit.\n\nUpdate the flash parameters by enabling SPI_NOR_4BIT_BP and\nSPI_NOR_TB_SR_BIT6. Without these flags, the locking configuration is\nincorrect.\n\nReference:\nhttps://www.winbond.com/hq/support/documentation/levelOne.jsp?__locale=en&DocNo=DA00-W25Q256JW.1\n\nSigned-off-by: Eliav Farber <farbere@amazon.com>\n---\nThis flash is populated on the al11_k2v6_jrd10 board and was tested at\n35700000 frequency using the amazon,alpine-dw-apb-ssi SPI controller.\n\nroot@alpine:~# cat /sys/bus/spi/devices/spi3.0/spi-nor/partname\nw25q256jwm\nroot@alpine:~# cat /sys/bus/spi/devices/spi3.0/spi-nor/jedec_id \nef8019\nroot@alpine:~# cat /sys/bus/spi/devices/spi3.0/spi-nor/manufacturer \nwinbond\n\nroot@alpine:~# xxd -p /sys/bus/spi/devices/spi3.0/spi-nor/sfdp \n53464450060101ff00060110800000ff84000102d00000ffffffffffffff\nffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\nffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\nffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\nffffffffffffffffe520fbffffffff0f44eb086b083b42bbfeffffffffff\n0000ffff40eb0c200f5210d800003602a60082ea14d3e96376337a757a75\nf7bdd55c19f75dffe970f9a5ffffffffffffffffffffffffffffffffff0a\nf0ff21ffdcff \n\nroot@alpine:~# cat /sys/kernel/debug/spi-nor/spi3.0/capabilities\nSupported read modes by the flash\n 1S-1S-1S\n  opcode        0x13\n  mode cycles   0\n  dummy cycles  0\n 1S-1S-2S\n  opcode        0x3c\n  mode cycles   0\n  dummy cycles  8\n 1S-2S-2S\n  opcode        0xbc\n  mode cycles   2\n  dummy cycles  2\n 1S-1S-4S\n  opcode        0x6c\n  mode cycles   0\n  dummy cycles  8\n 1S-4S-4S\n  opcode        0xec\n  mode cycles   2\n  dummy cycles  4\n 4S-4S-4S\n  opcode        0xec\n  mode cycles   2\n  dummy cycles  0\n\nSupported page program modes by the flash\n 1S-1S-1S\n  opcode        0x12\n 1S-1S-4S\n  opcode        0x34\n\nroot@alpine:~# cat /sys/kernel/debug/spi-nor/spi3.0/params\nname            w25q256jwm\nid              ef 80 19 00 00 00\nsize            32.0 MiB\nwrite size      1\npage size       256\naddress nbytes  4\nflags           HAS_SR_TB | 4B_OPCODES | HAS_4BAIT | HAS_LOCK | HAS_16BIT_SR | HAS_SR_TB_BIT6 | HAS_4BIT_BP | SOFT_RESET\n\nopcodes\n read           0x13\n  dummy cycles  0\n erase          0x21\n program        0x12\n 8D extension   none\n\nprotocols\n read           1S-1S-1S\n write          1S-1S-1S\n register       1S-1S-1S\n\nerase commands\n 21 (4.00 KiB) [1]\n dc (64.0 KiB) [3]\n c7 (32.0 MiB)\n\nsector map\n region (in hex)   | erase mask | overlaid\n ------------------+------------+----------\n 00000000-01ffffff |     [ 1  ] | no\n\nroot@alpine:~# dd if=/dev/urandom of=./spi_test bs=65536 count=1\n1+0 records in\n1+0 records out\n65536 bytes (66 kB, 64 KiB) copied, 0.0002316 s, 283 MB/s\n\nroot@alpine:~# mtd_debug erase /dev/mtd22 0 65536\nErased 65536 bytes from address 0x00000000 in flash\n\nroot@alpine:~# mtd_debug read /dev/mtd22 0 65536 spi_read\nCopied 65536 bytes from address 0x00000000 in flash to spi_read\n\nroot@alpine:~# hexdump spi_read\n0000000 ffff ffff ffff ffff ffff ffff ffff ffff\n*\n0010000\n\nroot@alpine:~# sha256sum spi_read\n71189f7fb6aed638640078fba3a35fda6c39c8962e74dcc75935aac948da9063  spi_read\n\nroot@alpine:~# mtd_debug write /dev/mtd22 0 65536 spi_test\nCopied 65536 bytes from spi_test to address 0x00000000 in flash\n\nroot@alpine:~# mtd_debug read /dev/mtd22 0 65536 spi_read\nCopied 65536 bytes from address 0x00000000 in flash to spi_read\t\n\nroot@alpine:~# sha256sum spi*\nb16b45f0cb74ba65d81766e9007d8cd1fbd3ac7ca7fbbd76fa4d181c3c1d52c0  spi_read\nb16b45f0cb74ba65d81766e9007d8cd1fbd3ac7ca7fbbd76fa4d181c3c1d52c0  spi_test\n\nroot@alpine:~# mtd_debug erase /dev/mtd22 0 65536\nErased 65536 bytes from address 0x00000000 in flash\n\nroot@alpine:~# mtd_debug read /dev/mtd22 0 65536 spi_read\nCopied 65536 bytes from address 0x00000000 in flash to spi_read\n\nroot@alpine:~# sha256sum spi*\n71189f7fb6aed638640078fba3a35fda6c39c8962e74dcc75935aac948da9063  spi_read\nb16b45f0cb74ba65d81766e9007d8cd1fbd3ac7ca7fbbd76fa4d181c3c1d52c0  spi_test\n\nroot@alpine:~# mtd_debug info /dev/mtd22\nmtd.type = MTD_NORFLASH\nmtd.flags = MTD_CAP_NORFLASH\nmtd.size = 65536 (64K)\nmtd.erasesize = 4096 (4K)\nmtd.writesize = 1 \nmtd.oobsize = 0 \nregions = 0\n\n drivers/mtd/spi-nor/winbond.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c\nindex fb855fe44733..55f1209936d5 100644\n--- a/drivers/mtd/spi-nor/winbond.c\n+++ b/drivers/mtd/spi-nor/winbond.c\n@@ -337,7 +337,7 @@ static const struct flash_info winbond_nor_parts[] = {\n \t\t.id = SNOR_ID(0xef, 0x80, 0x19),\n \t\t.name = \"w25q256jwm\",\n \t\t.size = SZ_32M,\n-\t\t.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,\n+\t\t.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6 | SPI_NOR_4BIT_BP,\n \t\t.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,\n \t}, {\n \t\t.id = SNOR_ID(0xef, 0x80, 0x20),\n","prefixes":["v2","1/3"]}