summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2024-03-04 17:16:05 +0100
committerTom Rini <[email protected]>2024-10-10 08:10:12 -0600
commit215f1d5794c6174ec0413eb6ff7f322ed284cc5b (patch)
tree6f9460b27b82d582ab2d07a2cdbfe3f3b93b0345 /include/linux
parent1ff60b1f0a0973b5acda21232262f6745491e5af (diff)
mtd: spi-nor: Clear Winbond SR3 WPS bit on boot
Some Winbond SPI NORs have special SR3 register which is used among other things to control whether non-standard "Individual Block/Sector Write Protection" (WPS bit) locking scheme is activated. This non-standard locking scheme is not supported by either U-Boot or Linux SPI NOR stack so make sure it is disabled, otherwise the SPI NOR may appear locked for no obvious reason. This SR3 WPS appears e.g. on W25Q16FW which has the same ID as W25Q16DW, but the W25Q16DW does not implement the SR3 WPS bit. Signed-off-by: Marek Vasut <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mtd/spi-nor.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index d5f4faf0a68..047e83e8463 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -48,6 +48,8 @@
#define SPINOR_OP_WRSR 0x01 /* Write status register 1 byte */
#define SPINOR_OP_RDSR2 0x3f /* Read status register 2 */
#define SPINOR_OP_WRSR2 0x3e /* Write status register 2 */
+#define SPINOR_OP_RDSR3 0x15 /* Read status register 3 */
+#define SPINOR_OP_WRSR3 0x11 /* Write status register 3 */
#define SPINOR_OP_READ 0x03 /* Read data bytes (low frequency) */
#define SPINOR_OP_READ_FAST 0x0b /* Read data bytes (high frequency) */
#define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual Output SPI) */
@@ -186,6 +188,9 @@
*/
#define SNOR_FLASH_CNT_MAX 2
+/* Status Register 3 bits. */
+#define SR3_WPS BIT(2)
+
/* For Cypress flash. */
#define SPINOR_OP_RD_ANY_REG 0x65 /* Read any register */
#define SPINOR_OP_WR_ANY_REG 0x71 /* Write any register */