Skip to content

Commit 5b3b147

Browse files
author
Kyle Kearney
committed
Reuse existing error for _qspi_configure_format
Use QSPIF_BD_ERROR_DEVICE_ERROR instead of introducing a new error code. Add tr_error calls whenever _qspi_configure_format fails to aid in debugging.
1 parent 2037668 commit 5b3b147

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ int QSPIFBlockDevice::init()
248248
// Configure BUS Mode to 1_1_1 for all commands other than Read
249249
if (QSPI_STATUS_OK != _qspi_configure_format(QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
250250
QSPI_CFG_ALT_SIZE_8, QSPI_CFG_BUS_SINGLE, 0)) {
251-
status = QSPIF_BD_ERROR_CONF_FORMAT_FAILED;
251+
tr_error("_qspi_configure_format failed");
252+
status = QSPIF_BD_ERROR_DEVICE_ERROR;
252253
goto exit_point;
253254
}
254255

@@ -307,7 +308,8 @@ int QSPIFBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
307308
// Configure Bus for Reading
308309
if (QSPI_STATUS_OK != _qspi_configure_format(_inst_width, _address_width, _address_size, QSPI_CFG_BUS_SINGLE,
309310
QSPI_CFG_ALT_SIZE_8, _data_width, _dummy_and_mode_cycles)) {
310-
return QSPIF_BD_ERROR_CONF_FORMAT_FAILED;
311+
tr_error("_qspi_configure_format failed");
312+
return QSPIF_BD_ERROR_DEVICE_ERROR;
311313
}
312314

313315
if (QSPI_STATUS_OK != _qspi_send_read_command(_read_instruction, buffer, addr, size)) {
@@ -318,7 +320,8 @@ int QSPIFBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
318320
// All commands other than Read use default 1-1-1 Bus mode (Program/Erase are constrained by flash memory performance less than that of the bus)
319321
if (QSPI_STATUS_OK != _qspi_configure_format(QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
320322
QSPI_CFG_ALT_SIZE_8, QSPI_CFG_BUS_SINGLE, 0)) {
321-
return QSPIF_BD_ERROR_CONF_FORMAT_FAILED;
323+
tr_error("_qspi_configure_format failed");
324+
return QSPIF_BD_ERROR_DEVICE_ERROR;
322325
}
323326

324327
_mutex.unlock();
@@ -726,6 +729,7 @@ int QSPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_
726729
// Set 1-1-1 bus mode for SFDP header parsing
727730
if (QSPI_STATUS_OK != _qspi_configure_format(QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
728731
QSPI_CFG_ALT_SIZE_8, QSPI_CFG_BUS_SINGLE, 8)) {
732+
tr_error("_qspi_configure_format failed");
729733
return -1;
730734
}
731735

@@ -895,6 +899,7 @@ int QSPIFBlockDevice::_sfdp_set_quad_enabled(uint8_t *basic_param_table_ptr)
895899
// Configure BUS Mode to 1_1_1 for all commands other than Read
896900
if (QSPI_STATUS_OK != _qspi_configure_format(QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
897901
QSPI_CFG_ALT_SIZE_8, QSPI_CFG_BUS_SINGLE, 0)) {
902+
tr_error("_qspi_configure_format failed");
898903
return -1;
899904
}
900905

@@ -1219,7 +1224,7 @@ int QSPIFBlockDevice::_enable_fast_mdoe()
12191224
if (QSPI_STATUS_OK != _qspi_configure_format(QSPI_CFG_BUS_SINGLE, QSPI_CFG_BUS_SINGLE, QSPI_CFG_ADDR_SIZE_24, QSPI_CFG_BUS_SINGLE,
12201225
QSPI_CFG_ALT_SIZE_8, QSPI_CFG_BUS_SINGLE, 0)) {
12211226
tr_error("_qspi_configure_format failed");
1222-
return QSPIF_BD_ERROR_CONF_FORMAT_FAILED;
1227+
return QSPIF_BD_ERROR_DEVICE_ERROR;
12231228
}
12241229

12251230
// Read Status Register

components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ enum qspif_bd_error {
2929
QSPIF_BD_ERROR_PARSING_FAILED = -4002, /* SFDP Parsing failed */
3030
QSPIF_BD_ERROR_READY_FAILED = -4003, /* Wait for Mem Ready failed */
3131
QSPIF_BD_ERROR_WREN_FAILED = -4004, /* Write Enable Failed */
32-
QSPIF_BD_ERROR_CONF_FORMAT_FAILED = -4005, /* Configure format failed */
33-
QSPIF_BD_ERROR_INVALID_ERASE_PARAMS = -4006, /* Erase command not on sector aligned addresses or exceeds device size */
34-
QSPIF_BD_ERROR_DEVICE_NOT_UNIQE = -4007, /* Only one instance per csel is allowed */
35-
QSPIF_BD_ERROR_DEVICE_MAX_EXCEED = -4008 /* Max active QSPIF devices exceeded */
32+
QSPIF_BD_ERROR_INVALID_ERASE_PARAMS = -4005, /* Erase command not on sector aligned addresses or exceeds device size */
33+
QSPIF_BD_ERROR_DEVICE_NOT_UNIQE = -4006, /* Only one instance per csel is allowed */
34+
QSPIF_BD_ERROR_DEVICE_MAX_EXCEED = -4007 /* Max active QSPIF devices exceeded */
3635
};
3736

3837
/** Enum qspif polarity mode

0 commit comments

Comments
 (0)