Skip to content

drivers: flash: fix RWW issues in flash_mcux_flexspi_hyperflash #88469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

danieldegrasse
Copy link
Collaborator

Apply a few fixes to the NXP FlexSPI hyperflash driver to prevent flash read access from the core while programming the flash. These fixes were tested with #85254 on an RT1050-EVK, as this is where I encountered the crashes.

Note that the ICACHE/DCACHE disable step is based on what is done here: https://github.com/nxp-mcuxpresso/mcux-sdk-examples/blob/52b428258efda7d5bd8a2ace2195ca828356743a/evkbimxrt1050/driver_examples/flexspi/hyper_flash/polling_transfer/flexspi_hyper_flash_ops.c#L279

Don't access device pointer from critical sections when programming the
hyperflash, as this could cause a RWW hazard

Signed-off-by: Daniel DeGrasse <[email protected]>
Comment on lines 424 to 425
L1CACHE_DisableICache();
L1CACHE_DisableDCache();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you use the sys_cache_ functions instead? In case the CACHE_MANAGEMENT is turned off completely?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably best to get this conversion done. Changed to use sys_cache* functions in latest push

butok
butok previously approved these changes Apr 14, 2025
@danieldegrasse danieldegrasse changed the title drivers: flash: flash_mcux_flexspi_hyperflash drivers: flash: fix RWW issues in flash_mcux_flexspi_hyperflash Apr 14, 2025
Disable the cache during erase and programming operations, as cache
pre-fetch operations can cause flash access outside of the application's
control

Also, reduce the SCLK frequency used after erase operations to 200MHz.
Without this, the RT1050 appears to hang after flash program operations

Signed-off-by: Daniel DeGrasse <[email protected]>
@de-nordic
Copy link
Collaborator

NXP specific, re-assigned to @mmahadevan108.

@de-nordic de-nordic removed their request for review April 24, 2025 18:26
@danieldegrasse
Copy link
Collaborator Author

@mmahadevan108 can you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Flash platform: NXP Drivers NXP Semiconductors, drivers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants