-
Notifications
You must be signed in to change notification settings - Fork 8.1k
drivers: flash_mspi_nor: Apply a few improvements #93093
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
drivers: flash_mspi_nor: Apply a few improvements #93093
Conversation
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.
I'm not specifically opposed to using SFDP for this driver, but I honestly doubt we are going to get the best performance out of most flash devices with this method. My primary concern is that not all flash devices actually implement SFDP discoverability, particularly for octal or quad settings (as least as far as I've seen)
Do you have any thoughts on the approach I took in #88920? I think these methods can coexist if they need to, but I personally feel like we may just be better off using compatibles for flash settings at build time, and JEDEC ID to select flash settings at runtime.
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 reminds me of the attempt I took adding mspi_nor... The global storage needed by SFDP would explode flash_data as we continue to add more DWORDS.
Therefore, IMO, it would better the SFDP can have its own data struct and separate .c file and then we could have it enabled through Kconfig.
The SFDP should be used for generic flash that does support it and enable through a Kconfig and dts property. With SFDP, it should load cmd and other properties through DWORDS instead of using the generic or the vendor table. It is essentially a different way of runtime probing, so I think it could coexist well provided that it doesn't get in and mess up the core all over the place. |
64f66e8 to
4704353
Compare
|
Rebased. |
fe6dcee to
548d3b3
Compare
|
@danieldegrasse @swift-tk I moved almost all processing of SFDP to a separate file ( |
548d3b3 to
57a8256
Compare
|
Rebased on #93724, added support for |
57a8256 to
99a49ae
Compare
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.
99a49ae to
e30312d
Compare
|
Rebased. |
6af1921 to
d531e90
Compare
|
|
||
| #define DEFAULT_SWITCH_INFO(inst) { \ | ||
| .quad_enable_req = DT_INST_ENUM_IDX(inst, quad_enable_requirements), \ | ||
| .octal_enable_req = OCTAL_ENABLE_REQ_NONE, \ |
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.
I think both should be added, otherwise it is SFDP only and should be wrapped with CONFIG_FLASH_MSPI_NOR_USE_SFDP or JESD216 kconfig.
Get parameters for used flash commands and requirements for enabling Quad and Octal modes from dts uint8-arrays containing data read from SFDP tables for particular flash chips. Also introduce `pre_init` quirk that allows alteration of the above parameters or complementation of them in a specific way for particular flash chip families. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
- Use standard operation codes and parameters from SFDP for handling the used flash commands (allow to override some of them through dts with the `read-command`, `write-command`, and `rx-dummy` properties) - Use all available erase types as specified by SFDP - Allow using all IO modes - Add support for switching to 4-byte addressing mode - Use common functions for reading and writing of status registers and for enabling write operations - Switch IO mode (between the target one and Single IO) in a common function that performs transfers and do it only when required for a given command - Make checking of JEDEC ID at initialization optional Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Complete implementation of quad_enable_set() by adding support for all possible Quad Enable Requirements (QER) as specified by the SFDP JEDEC standard (JESD216). Add also corresponding octal_enable_set() to handle Octal Enable Requirements. Also remove initial waiting from mxicy_mx25r_post_switch_mode() which became unneeded, as now such waiting is done in cmd_wrsr() which is called at the end of quad_enable_set(). Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Add implementation of the most common Soft Reset routine (sequence of reset enable instruction 0x66 and reset instruction 0x99). Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Using a GPIO reset for a flash chip that has a dual function pin (RESET# or SIO3) and is to be used in Quad mode is rather a bad idea and so is clearing of the Quad Enable bit at every initialization of the flash driver, since this bit is usually non-volatile, so such operation means unnecessary wearing of the flash chip. Soft Reset should be use instead in such case. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Add support for supplying power to the flash chip by activation of a GPIO specified through the "supply-gpios" property. Implementation of gpio_reset() is also slightly modified so that it is consistent with soft_reset() and the new power_supply() and so that all these functions can use a common routine that performs a reset recovery delay. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
When Octal IO mode is to be used with DDR in mx25u family chips, bit 1 instead of 0 must be set in the Configuration Register 2 at address 0. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
It is no longer needed to specify the read command parameters in dts, as the flash driver is capable of obtaining those from SFDP structures, so the redundant properties are removed. After commit 612fd94 got merged, both the EXMIF and flash nodes in dts are not enabled by default so this needs to be done in the overlay. Although nrfutil is still not capable of programming the external flash on nRF54H20 DK, thus `west flash` will not work in this case, `nrf54h20dk/nrf54h20/cpuapp` is added as an allowed platform so that the sample is at least built in CI for it. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
d531e90 to
b293310
Compare
|
|
@anangl Hi Also, I noticed that you added cmd_extension only for Octal DTR mode.
|
Yes, the following samples/tests work fine for the Also
For that flash mentioned above, it is also required to use commands with extension in SDR mode. Thus, the |




Apply a few improvements in the flash_mspi_nor driver, most notably:
read-command,write-command, andrx-dummyproperties)See the individual commit messages for details.