-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
@davidsaada - can you please review - thanks. |
QSPIFBlockDevice.cpp
Outdated
if (QSPI_STATUS_OK != _qsp_set_frequency(freq)) { | ||
tr_error("ERROR: QSPI Set Frequency Failed"); | ||
|
||
_unique_device_status = add_new_csel_instance(csel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to move all initialization code from the constructor to init function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, other than unique csel verification, I moved everything to init()
if (!_is_initialized) { | ||
_init_ref_count = 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to change. This is probably the best reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case the mutex is protecting it, so its good
/********************************/ | ||
/* Different Device Csel Mgmt */ | ||
/********************************/ | ||
static PinName *generate_initialized_active_qspif_csel_arr() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If max number of devices is static, we can have a static array (initialized with NCs) without the need for this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NC value is not 0. so I can't initialize the array with {0} , only with a long list of {NC,NC,..}
This way I can just use a loop as long as the MACRO defined to initialize
@@ -732,7 +852,8 @@ int QSPIFBlockDevice::_sfdp_set_quad_enabled(uint8_t *basic_param_table_ptr) | |||
} | |||
|
|||
// Read Status Register | |||
if (QSPI_STATUS_OK == _qspi_send_general_command(read_register_inst, -1, NULL, 0, (char *)status_reg, | |||
if (QSPI_STATUS_OK == _qspi_send_general_command(read_register_inst, QSPI_NO_ADDRESS_COMMAND, NULL, 0, | |||
(char *)status_reg, | |||
sr_read_size) ) { // store received values in status_value | |||
tr_debug("DEBUG: Reading Status Register Success: value = 0x%x\n", (int)status_reg[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you check here that setting the QE bit actually succeeded, and either retry or abandon using 4x mode if the flash failed to enter QE mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stevew817 - hmm.. I think if we fail here its a major problem. I dont want to implement a retry logic here - it will complicate things and most likely won't help. I also wouldn't want to fallback to 1x mode on failure, because if we got so far the device actually supports modes faster than 1x.
I'm thinking maybe to return -1 and fail init all together , what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. Thanks.
6f3807a
to
d718bbf
Compare
No description provided.