Skip to content

Commit 7fde9be

Browse files
Fix initializing Macronix QSPI flashes with only 2 status registers
1 parent 7d6a1fe commit 7fde9be

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

storage/blockdevice/COMPONENT_QSPIF/source/QSPIFBlockDevice.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,12 +1113,14 @@ int QSPIFBlockDevice::_handle_vendor_quirks()
11131113
case 0xc2:
11141114
// Macronix devices have several quirks:
11151115
// 1. Have one status register and several config registers, with a nonstandard instruction for reading the config registers
1116-
// 2. Require setting a "fast mode" bit in config register 2 to operate at higher clock rates
1116+
// 2. Require setting a "fast mode" bit in config register 2 to operate at higher clock rates (if config register 2 exists)
11171117
// 3. Should never attempt to enable 4-byte addressing (it causes reads and writes to fail)
11181118
tr_debug("Applying quirks for macronix");
1119-
_needs_fast_mode = true;
11201119
_num_status_registers = MBED_CONF_QSPI_MACRONIX_NUM_STATUS_REGISTER;
11211120
_read_status_reg_2_inst = QSPIF_INST_RDCR;
1121+
if(MBED_CONF_QSPI_MACRONIX_NUM_STATUS_REGISTER >= 3) {
1122+
_needs_fast_mode = true;
1123+
}
11221124
break;
11231125
case 0x9d:
11241126
// ISSI devices have only one status register

0 commit comments

Comments
 (0)