-
Notifications
You must be signed in to change notification settings - Fork 716
[nrf fromlist] drivers: flash_mspi_nor: Apply a few improvements #3091
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
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.
Could the part not specific to mspi be moved to jesd216.h? Some defines used here are already in that header.
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 removed BFP_DW1_ADDR_* symbols and used instead corresponding ones from jesd216.h, but I don't think there's a point in adding some definitions in this file now. It's better to do it when implementing runtime SFDP processing, as probably some new decoding functions will be also added there.
drivers/flash/flash_mspi_nor.c
Outdated
| set_up_xfer(dev, MSPI_TX); | ||
| rc = perform_xfer(dev, 0xE7, false); | ||
| if (rc < 0) { | ||
| LOG_ERR("Command 0xE7 failed: %d", rc); |
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.
__function__? 0xE7 seems cryptic.
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.
Oops, it should be 0xB7, actually...
But the spec says "issue write enable instruction 06h, then issue instruction B7h", so I'm not sure if it's worth defining a symbol for it.
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 the command code
| /* Wait for previous write to finish */ | ||
| rc = wait_until_ready(dev, K_USEC(1)); | ||
| if (rc < 0) { | ||
| return rc; | ||
| } | ||
|
|
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.
Wrong commit? This change is not mentioned in the commit description.
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 waiting here is not needed because quad_enable_set() waits after writing the status register. But I can mention this in the commit message so there's no doubt.
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.
Added explanation of the change in the commit message.
edbb020 to
cb4926c
Compare
…rable Although the value currently hard-coded in the driver (10 ms) is quite high, it may turn out to be insufficient when there is a need to use some very low SCK frequency, like 250 kHz. Make the timeout value configurable per-instance, via devicetree. Signed-off-by: Andrzej Głąbek <[email protected]> (cherry picked from commit 7efa5c8)
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. Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek <[email protected]>
- 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 Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek <[email protected]>
… handling of OER 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(). Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek <[email protected]>
Add implementation of the most common Soft Reset routine (sequence of reset enable instruction 0x66 and reset instruction 0x99). Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek <[email protected]>
…ad disabling 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. Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek <[email protected]>
…" property 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. Upstream PR #: 93093 Signed-off-by: Andrzej Głąbek <[email protected]>
cb4926c to
646c849
Compare
|
Rebased. |
Cherry-pick commits from zephyrproject-rtos/zephyr#93093.