Skip to content

Commit 96cfc73

Browse files
author
Kyle Kearney
committed
Disable attempted 4-byte addressing for some boards
4-byte addressing has been seen to cause failures on NORDIC boards and with Macronix memories. Suppress the attempt to enable it on that hardware (via vendor quirks and a target check) until either the failure cause can be fixed or a more robust suppression mechanism is implemented.
1 parent 2526b9f commit 96cfc73

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ QSPIFBlockDevice::QSPIFBlockDevice(PinName io0, PinName io1, PinName io2, PinNam
187187
_clear_protection_method = QSPIF_BP_CLEAR_SR;
188188

189189
// Set default 4-byte addressing extension register write instruction
190+
_attempt_4_byte_addressing = true;
190191
_4byte_msb_reg_write_inst = QSPIF_INST_4BYTE_REG_WRITE_DEFAULT;
191192
}
192193

@@ -750,10 +751,15 @@ int QSPIFBlockDevice::_sfdp_parse_basic_param_table(uint32_t basic_table_addr, s
750751
}
751752
}
752753

753-
if (_sfdp_detect_and_enable_4byte_addressing(param_table, basic_table_size) != QSPIF_BD_ERROR_OK) {
754-
tr_error("Init - Detecting/enabling 4-byte addressing failed");
755-
return -1;
754+
#ifndef TARGET_NORDIC
755+
// 4 byte addressing is not currently supported with the Nordic QSPI controller
756+
if (_attempt_4_byte_addressing) {
757+
if (_sfdp_detect_and_enable_4byte_addressing(param_table, basic_table_size) != QSPIF_BD_ERROR_OK) {
758+
tr_error("Init - Detecting/enabling 4-byte addressing failed");
759+
return -1;
760+
}
756761
}
762+
#endif
757763

758764
if (false == _is_mem_ready()) {
759765
tr_error("Init - _is_mem_ready Failed");
@@ -1242,13 +1248,15 @@ int QSPIFBlockDevice::_handle_vendor_quirks()
12421248
_clear_protection_method = QSPIF_BP_ULBPR;
12431249
break;
12441250
case 0xc2:
1245-
// Macronix devices have two quirks:
1251+
// Macronix devices have several quirks:
12461252
// 1. Have one status register and 2 config registers, with a nonstandard instruction for reading the config registers
12471253
// 2. Require setting a "fast mode" bit in config register 2 to operate at higher clock rates
1254+
// 3. Should never attempt to enable 4-byte addressing (it causes reads and writes to fail)
12481255
tr_debug("Applying quirks for macronix");
12491256
_needs_fast_mode = true;
12501257
_num_status_registers = 3;
12511258
_read_status_reg_2_inst = QSPIF_INST_RDCR;
1259+
_attempt_4_byte_addressing = false;
12521260
break;
12531261
}
12541262

components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
358358
mbed::qspi_inst_t _write_status_reg_2_inst;
359359
mbed::qspi_inst_t _read_status_reg_2_inst; // If three registers, this instruction reads the latter two
360360

361+
// Attempt to enable 4-byte addressing. True by default, but may be disabled for some vendors
362+
bool _attempt_4_byte_addressing;
361363
// 4-byte addressing extension register write instruction
362364
mbed::qspi_inst_t _4byte_msb_reg_write_inst;
363365

0 commit comments

Comments
 (0)