Skip to content

Commit 167a309

Browse files
DBS06Cruz Monrreal II
authored andcommitted
Add SPIF_ULBPR command also to QSPIFBlockDevice and SPIFReducedBlockDevice
1 parent 5f4ff5d commit 167a309

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ enum qspif_default_instructions {
9595
QSPIF_RSTEN = 0x66, // Reset Enable
9696
QSPIF_RST = 0x99, // Reset
9797
QSPIF_RDID = 0x9f, // Read Manufacturer and JDEC Device ID
98+
QSPIF_ULBPR = 0x98, // Clears all write-protection bits in the Block-Protection register
9899
};
99100

100101
// Local Function
@@ -206,7 +207,7 @@ int QSPIFBlockDevice::init()
206207
// SST devices come preset with block protection
207208
// enabled for some regions, issue write disable instruction to clear
208209
_set_write_enable();
209-
_qspi_send_general_command(QSPIF_WRDI, QSPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0);
210+
_qspi_send_general_command(QSPIF_ULBPR, QSPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0);
210211
break;
211212
}
212213

components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ enum ops {
4040
SPIF_WRDI = 0x04, // Write Disable
4141
SPIF_RDSR = 0x05, // Read Status Register
4242
SPIF_RDID = 0x9f, // Read Manufacturer and JDEC Device ID
43+
SPIF_ULBPR = 0x98, // Clears all write-protection bits in the Block-Protection register
4344
};
4445

4546
// Status register from RDSR
@@ -68,7 +69,7 @@ int SPIFReducedBlockDevice::init()
6869
// SST devices come preset with block protection
6970
// enabled for some regions, issue gbpu instruction to clear
7071
_wren();
71-
_cmdwrite(0x98, 0, 0, 0x0, NULL);
72+
_cmdwrite(SPIF_ULBPR, 0, 0, 0x0, NULL);
7273
break;
7374
}
7475

0 commit comments

Comments
 (0)