-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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: spi nor: Add MultiInstance support #55735
drivers: flash: spi nor: Add MultiInstance support #55735
Conversation
7f61a44
to
e2c2ef5
Compare
e2c2ef5
to
83727aa
Compare
@ashiroji, thank you for the proposal. Although I haven't gone trough the complete PR I have two general remarks:
|
83727aa
to
26bef72
Compare
Hi @Laczen,
Can you please expand more?
The modifications I made are inspired by the at45 flash driver without trying to redesign the SPI NOR driver. In the original implementation, there is conditional code that gets compiled (or not) depending the existence of a feature or not (such as dpd). If each driver instance has a fitting structure, the compiler will complain that a data field is missing. |
26bef72
to
06a4e98
Compare
As an example the Kconfig has an option:
Multi-instance support requires supporting a mix of devices that have and don't have a feature, the use of |
I see your point, I did not think about this actually.
The general idea I went with, is if an instance has a field, enable the needed data field for all instances and initialise it with proper value from tree (for those who have) and with 0( for those who don't). This is specifically used for deep power down mode parameters. That way the code that uses these parameters will find a valid value even if the feature is not defined. |
@Laczen , does it make sense to transform the Kconfigs to device tree properties? To have the possibility to choose different values for different instances? |
In general yes, but you might leave some default parameters that are used in case they cannot be derived from the dts. |
I think I can modify the following Kconfigs: zephyr,spi-nor-sfdp: SPI_NOR_CS_WAIT_DELAY, SPI_NOR_FLASH_LAYOUT_PAGE_SIZE can be transformed into an int parameter SPI_NOR_IDLE_IN_DPD into a bool parameter |
@ashiroji, I propose you leave the Kconfig as is, it is not really fit for multi-instance, but it will require so much changes that the PR will grow too much. Regarding the use of the |
Okay.
I'll be waiting for further comments |
@nordicjm , @de-nordic , @nashif can you please review the PR? |
4bd55fe
to
3cc95c2
Compare
I think the current solution with enabling |
83df2eb
to
61d5c14
Compare
Sorry, I guess I did something wrong when I force-pushed the update. |
Happens. |
Modify the SPI Nor driver to be able to have multiple instances at the same time. This patch is heavily inspired by the at45 driver. It was tested on the nRF5340 DK by using the external spi memory two times.