@@ -995,18 +995,35 @@ int QSPIFBlockDevice::_sfdp_detect_and_enable_4byte_addressing(uint8_t *basic_pa
995
995
return status;
996
996
}
997
997
998
+ #if MBED_CONF_QSPIF_ENABLE_AND_RESET && MBED_CONF_QSPIF_DIRECT_RESET
999
+ #error "qspif.enable-and-reset and qspif.direct-reset cannot be both true!"
1000
+ #endif
1001
+
1002
+ #define RESET_SEQUENCE_FROM_SFDP ( !MBED_CONF_QSPIF_ENABLE_AND_RESET && !MBED_CONF_QSPIF_DIRECT_RESET )
1003
+
998
1004
int QSPIFBlockDevice::_sfdp_detect_reset_protocol_and_reset (uint8_t *basic_param_table_ptr)
999
1005
{
1000
1006
int status = QSPIF_BD_ERROR_OK;
1007
+
1008
+ #if RESET_SEQUENCE_FROM_SFDP
1001
1009
uint8_t examined_byte = basic_param_table_ptr[QSPIF_BASIC_PARAM_TABLE_SOFT_RESET_BYTE];
1002
1010
1003
1011
// Ignore bit indicating need to exit 0-4-4 mode - should not enter 0-4-4 mode from QSPIFBlockDevice
1004
1012
if (examined_byte & SOFT_RESET_RESET_INST_BITMASK) {
1013
+ #endif
1014
+
1015
+ #if !MBED_CONF_QSPIF_ENABLE_AND_RESET // i.e. direct reset, or determined from SFDP
1005
1016
// Issue instruction 0xF0 to reset the device
1006
1017
qspi_status_t qspi_status = _qspi_send_general_command (0xF0 , QSPI_NO_ADDRESS_COMMAND, // Send reset instruction
1007
1018
NULL , 0 , NULL , 0 );
1008
1019
status = (qspi_status == QSPI_STATUS_OK) ? QSPIF_BD_ERROR_OK : QSPIF_BD_ERROR_PARSING_FAILED;
1020
+ #endif
1021
+
1022
+ #if RESET_SEQUENCE_FROM_SFDP
1009
1023
} else if (examined_byte & SOFT_RESET_ENABLE_AND_RESET_INST_BITMASK) {
1024
+ #endif
1025
+
1026
+ #if !MBED_CONF_QSPIF_DIRECT_RESET // i.e. enable and reset, or determined from SFDP
1010
1027
// Issue instruction 66h to enable resets on the device
1011
1028
// Then issue instruction 99h to reset the device
1012
1029
qspi_status_t qspi_status = _qspi_send_general_command (0x66 , QSPI_NO_ADDRESS_COMMAND, // Send reset enable instruction
@@ -1016,10 +1033,15 @@ int QSPIFBlockDevice::_sfdp_detect_reset_protocol_and_reset(uint8_t *basic_param
1016
1033
NULL , 0 , NULL , 0 );
1017
1034
}
1018
1035
status = (qspi_status == QSPI_STATUS_OK) ? QSPIF_BD_ERROR_OK : QSPIF_BD_ERROR_PARSING_FAILED;
1036
+ #endif
1037
+
1038
+ #if RESET_SEQUENCE_FROM_SFDP
1019
1039
} else {
1020
1040
// Soft reset either is not supported or requires direct control over data lines
1041
+ tr_error (" Failed to determine soft reset sequence. If your device has a legacy SFDP table, please manually set enable-and-reset or direct-reset." );
1021
1042
status = QSPIF_BD_ERROR_PARSING_FAILED;
1022
1043
}
1044
+ #endif
1023
1045
1024
1046
if (status == QSPIF_BD_ERROR_OK) {
1025
1047
if (false == _is_mem_ready ()) {
0 commit comments