[PATCH v3 1/3] mtd: micron-st: enable lock/unlock for mt25qu512a

Mamta Shukla mamta.shukla at leica-geosystems.com
Tue Oct 10 01:43:21 PDT 2023


mt25qu512a[1] supports locking/unlocking through BP bits in SR.

Tested using mtd-utils- flash_lock/flash_unlock for MT25QU512ABB8E12.

Link: https://media-www.micron.com/-/media/client/global/documents/products/data-sheet/nor-flash/serial-nor/mt25q/die-rev-b/mt25q_qlkt_u_512_abb_0.pdf?rev=b259aadc3bea49ea8210a41c9ad58211
Signed-off-by: Mamta Shukla <mamta.shukla at leica-geosystems.com>
---
Changes in v2:
 - add Link tag
 - fix chip part number mt25ql512a->mt25qu512a

Changes in v3:
 - sync with spi-nor/next:8f407eda173f to align with new FLASH_INFO format
 - new patch in series for parsing SFDP table
 - new patch in series to add post bfpt fixup

Lock/Unlock Verification:
[   72.584003] spi-nor spi-PRP0001:00: mt25qu512a (65536 Kbytes)

# flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 0x4000000
Lock status: unlocked
Return code: 0
# flash_lock -l /dev/mtd0
# flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 0x4000000
Lock status: locked
Return code: 1

# mtd_debug erase /dev/mtd0 0 1048576
[  203.419693] spi-nor spi-PRP0001:00: at 0x0, len 1048576
[  203.438616] spi-nor spi-PRP0001:00: Erase operation failed.
[  203.444283] spi-nor spi-PRP0001:00: Attempted to modify a protected sector.
MEMERASE: Input/output error

# flash_lock -u /dev/mtd0
# flash_lock -i /dev/mtd0
Device: /dev/mtd0
Start: 0
Len: 0x4000000
Lock status: unlocked
Return code: 0

# mtd_debug erase /dev/mtd0 0 1048576
[  215.585620] spi-nor spi-PRP0001:00: at 0x0, len 1048576
Erased 1048576 bytes from address 0x00000000 in flash


drivers/mtd/spi-nor/micron-st.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c
index 4afcfc57c896..6c8cabbead2e 100644
--- a/drivers/mtd/spi-nor/micron-st.c
+++ b/drivers/mtd/spi-nor/micron-st.c
@@ -405,6 +405,8 @@ static const struct flash_info st_nor_parts[] = {
 	}, {
 		.id = SNOR_ID(0x20, 0xbb, 0x20, 0x10, 0x44, 0x00),
 		.name = "mt25qu512a",
+		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP |
+			SPI_NOR_BP3_SR_BIT6,
 		.size = SZ_64M,
 		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
 		.fixup_flags = SPI_NOR_4B_OPCODES,
-- 
2.34.1




More information about the linux-mtd mailing list