From nobody Fri Apr 3 08:27:06 2026 Received: from pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com [35.83.148.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B7CC330641 for ; Wed, 18 Feb 2026 14:35:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.83.148.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771425338; cv=none; b=XpHoEqSNUp42kSNBAs+3ZW2AbaYV5wmFxMZQFGDFLKpIlTDGs8m+GnL5aooYU4naqWy0ks+CYTGTlvjVL0F9v5rRoWYjrdmPoYjVgq2RZqAsua2SP5COLJpc2Xs3Fxh221FdcFfsk2Y9NRu4fKhne6BgkASiLnkuP/K3YuEfjno= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771425338; c=relaxed/simple; bh=8ea99xWiAWdopvYHh++rhIoC2+Y3AgjjcR7PAvRa5aY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nf8/84yTuXC5Mypv00c/OJbQYBkpN9PZRTkGEkKELC19yrCUHBGk1b4x6iuZ0RZvvWcZHrvS72BxCLxmVjQkTAmljRhhTHfjuI5z4pe4Le7sUNmPHXzxD7FLXs1IWPwLjWy5Tu0nF57XACqSl7ZaWg3I5toyiGkqoNVOtqGlp8s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=R8UFJg7B; arc=none smtp.client-ip=35.83.148.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="R8UFJg7B" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1771425337; x=1802961337; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KB0yIBc6Y4ZCpbQ8D6+n6Qw1JeejQ9xAVki9iGAlDFw=; b=R8UFJg7BIARZx8k8ygz7yonbSFyPwf8BLddTq4n1sYJvaBjHX2wj2a4C CZLtRh1eYuoKCYR+gkocgXoC2yMiy5+g/O5yE2H1UcgBOBdhdp4Gb5hD2 SGXMc+nFhqsqHSEInowX5TwCvZP3fW+xLIJqjoJq6JPhHjHvB6+3EPTtl ILBB2N2NQQGYbPNvD+ZpTuD5sO3Pegr20QGuV/zOG0fHk9qgY+IcEoP3P oHyuBDXTTsiK2DRK6TDa/sgAn9nDafK9AOC5sc6e0GK2pjdNt7cwmgGDy Ar9AK6shEjD64lzMqa6mGcK5AhZuz1okOCL9C9BjC0wvW3vutD93bgQFJ A==; X-CSE-ConnectionGUID: NJ9+012ARQew5AS26ss9PA== X-CSE-MsgGUID: Berulvv4QNy0msLToLvVyQ== X-IronPort-AV: E=Sophos;i="6.21,298,1763424000"; d="scan'208";a="13068629" Received: from ip-10-5-6-203.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.6.203]) by internal-pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2026 14:35:34 +0000 Received: from EX19MTAUWA002.ant.amazon.com [205.251.233.178:6576] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.54.230:2525] with esmtp (Farcaster) id 5b4211f6-9967-4c43-9e03-3f10d56dcfd0; Wed, 18 Feb 2026 14:35:34 +0000 (UTC) X-Farcaster-Flow-ID: 5b4211f6-9967-4c43-9e03-3f10d56dcfd0 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWA002.ant.amazon.com (10.250.64.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 18 Feb 2026 14:35:34 +0000 Received: from dev-dsk-farbere-1a-46ecabed.eu-west-1.amazon.com (172.19.116.181) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 18 Feb 2026 14:35:32 +0000 From: Eliav Farber To: , , , , , , , CC: Subject: [PATCH v2 3/3] mtd: spi-nor: winbond: Fix locking support for w25q64jvm Date: Wed, 18 Feb 2026 14:35:23 +0000 Message-ID: <20260218143523.17467-4-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EX19D042UWA002.ant.amazon.com (10.13.139.17) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Content-Type: text/plain; charset="utf-8" The Winbond w25q64jvm supports block protection through the Status Register (SR) and provides a Top/Bottom (TB) protection bit. Enable SPI_NOR_HAS_LOCK and SPI_NOR_HAS_TB for this device to properly describe its locking capabilities. The device uses Status Register bit 5 as the TB bit and supports only three Block Protect (BP) bits. Therefore, do not set SPI_NOR_TB_SR_BIT6 or SPI_NOR_4BIT_BP. Reference: https://www.winbond.com/hq/support/documentation/levelOne.jsp?__locale=3Den= &DocNo=3DDA00-W25Q64JV.1 Signed-off-by: Eliav Farber --- This flash is populated on the al10_k2v5_jrd_aio_makalu board and was tested at 35700000 frequency using the amazon,alpine-dw-apb-ssi SPI controller. ~ # cat /sys/bus/spi/devices/spi0.2/spi-nor/partname w25q64jvm ~ # cat /sys/bus/spi/devices/spi0.2/spi-nor/jedec_id ef7017 ~ # cat /sys/bus/spi/devices/spi0.2/spi-nor/manufacturer winbond ~ # xxd -p /sys/bus/spi/devices/spi0.2/spi-nor/sfdp=20 53464450050100ff00050110800000ffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffe520f9ffffffff0344eb086b083b42bbfeffffffffff 0000ffff40eb0c200f5210d800003602a60082ea14c4e96376337a757a75 f7a2d55c19f74dffe930f880 =20 ~ # cat /sys/kernel/debug/spi-nor/spi0.2/capabilities Supported read modes by the flash 1S-1S-1S opcode 0x03 mode cycles 0 dummy cycles 0 1S-1S-2S opcode 0x3b mode cycles 0 dummy cycles 8 1S-2S-2S opcode 0xbb mode cycles 2 dummy cycles 2 1S-1S-4S opcode 0x6b mode cycles 0 dummy cycles 8 1S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 4 4S-4S-4S opcode 0xeb mode cycles 2 dummy cycles 0 Supported page program modes by the flash 1S-1S-1S opcode 0x02 =20 ~ # cat /sys/kernel/debug/spi-nor/spi0.2/params=20 name w25q64jvm id ef 70 17 00 00 00 size 8.00 MiB write size 1 page size 256 address nbytes 3 flags HAS_SR_TB | HAS_LOCK | HAS_16BIT_SR | NO_READ_CR | SOFT_RES= ET opcodes read 0x03 dummy cycles 0 erase 0x20 program 0x02 8D extension none protocols read 1S-1S-1S write 1S-1S-1S register 1S-1S-1S erase commands 20 (4.00 KiB) [1] 52 (32.0 KiB) [2] d8 (64.0 KiB) [3] c7 (8.00 MiB) sector map region (in hex) | erase mask | overlaid ------------------+------------+---------- 00000000-007fffff | [ 1 ] | no /tmp # dd if=3D/dev/urandom of=3D./spi_test bs=3D1M count=3D2 2+0 records in 2+0 records out 2097152 bytes (2.0MB) copied, 0.010381 seconds, 192.7MB/s /tmp # ./mtd_debug erase /dev/mtd2 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash /tmp # ./mtd_debug read /dev/mtd2 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read /tmp # hexdump spi_read 0000000 ffff ffff ffff ffff ffff ffff ffff ffff * 0200000 /tmp # sha256sum spi_read 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read /tmp # mtd_debug write /dev/mtd0 0 2097152 spi_test -sh: mtd_debug: not found /tmp # ./mtd_debug write /dev/mtd2 0 2097152 spi_test Copied 2097152 bytes from spi_test to address 0x00000000 in flash /tmp # ./mtd_debug read /dev/mtd2 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read /tmp # sha256sum spi* 555b3718aa92b1313ff7f93e75306267a8ed0c5f4d92cc63c1eac4366731059b spi_read 555b3718aa92b1313ff7f93e75306267a8ed0c5f4d92cc63c1eac4366731059b spi_test /tmp # ./mtd_debug erase /dev/mtd2 0 2097152 Erased 2097152 bytes from address 0x00000000 in flash /tmp # ./mtd_debug read /dev/mtd2 0 2097152 spi_read Copied 2097152 bytes from address 0x00000000 in flash to spi_read /tmp # sha256sum spi* 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 555b3718aa92b1313ff7f93e75306267a8ed0c5f4d92cc63c1eac4366731059b spi_test /tmp # ./mtd_debug info /dev/mtd2 mtd.type =3D MTD_NORFLASH mtd.flags =3D MTD_CAP_NORFLASH mtd.size =3D 8388608 (8M) mtd.erasesize =3D 4096 (4K) mtd.writesize =3D 1=20 mtd.oobsize =3D 0=20 regions =3D 0 drivers/mtd/spi-nor/winbond.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 6d325da121b4..eaa547d36aad 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -296,6 +296,7 @@ static const struct flash_info winbond_nor_parts[] =3D { .id =3D SNOR_ID(0xef, 0x70, 0x17), .name =3D "w25q64jvm", .size =3D SZ_8M, + .flags =3D SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, .no_sfdp_flags =3D SECT_4K, }, { .id =3D SNOR_ID(0xef, 0x70, 0x18), --=20 2.47.3