drivers: mspi: stm32_*: save base address in device configuration#108507
Open
mathieuchopstm wants to merge 1 commit intozephyrproject-rtos:mainfrom
Open
drivers: mspi: stm32_*: save base address in device configuration#108507mathieuchopstm wants to merge 1 commit intozephyrproject-rtos:mainfrom
mathieuchopstm wants to merge 1 commit intozephyrproject-rtos:mainfrom
Conversation
The base address is constant, it's wasteful to store it in device data. `void *` type is used instead of hardware-specific `xxx_TypeDef *` since the structure is shared by all controller drivers (QSPI, OSPI and XSPI). Since this removes the need for a cast, this tangantially fixes a bug in the OSPI driver which used the wrong type when casting device address: `(XSPI_TypeDef *)` instead of `(OCTOSPI_TypeDef *)`. While at it, move a `bool` field at the tail to avoid padding INSIDE the structure (although there's sadly still some, due to struct mspi_cfg...) Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
|
etienne-lms
reviewed
May 5, 2026
| }; \ | ||
| static struct mspi_stm32_data mspi_stm32_dev_data_##index = { \ | ||
| .phys_addr = DT_INST_REG_ADDR(index), \ | ||
| .hmspi.ospi = { \ |
Contributor
There was a problem hiding this comment.
I think you could set the base address straight here:
static struct mspi_stm32_data mspi_stm32_dev_data_##index = { \
- .phys_addr = DT_INST_REG_ADDR(index), \
.hmspi.ospi = { \
+ .Instance = (void *)DT_INST_REG_ADDR(index), \
.Init = { \Ditto in mspi_stm32_xspi.c driver.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The base address is constant, it's wasteful to store it in device data.
void *type is used instead of hardware-specificxxx_TypeDef *since the structure is shared by all controller drivers (QSPI, OSPI and XSPI).Since this removes the need for a cast, this tangantially fixes a bug in the OSPI driver which used the wrong type when casting device address:
(XSPI_TypeDef *)instead of(OCTOSPI_TypeDef *).While at it, move a
boolfield at the tail to avoid padding INSIDE the structure (although there's sadly still some, due to struct mspi_cfg...)cc @djiatsaf-st