Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Offir qspif block device #5

Merged
merged 6 commits into from
Aug 26, 2018
Merged

Offir qspif block device #5

merged 6 commits into from
Aug 26, 2018

Conversation

offirko
Copy link
Contributor

@offirko offirko commented Aug 21, 2018

No description provided.

@offirko
Copy link
Contributor Author

offirko commented Aug 22, 2018

@davidsaada - can you please review - thanks.

@offirko offirko requested a review from davidsaada August 22, 2018 09:27
if (QSPI_STATUS_OK != _qsp_set_frequency(freq)) {
tr_error("ERROR: QSPI Set Frequency Failed");

_unique_device_status = add_new_csel_instance(csel);

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.

Copy link
Contributor Author

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;
}

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.

Copy link
Contributor Author

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()

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.

Copy link
Contributor Author

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]);
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link

@davidsaada davidsaada left a 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.

@offirko offirko force-pushed the offir-qspif-block-device branch from 6f3807a to d718bbf Compare August 26, 2018 12:46
@offirko offirko merged commit b8d690e into master Aug 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants