-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Convert STM32 drivers to DT_INST #23285
Conversation
All checks passed. checkpatch (informational only, not a failure)
Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
056abc2
to
59b9b31
Compare
59b9b31
to
bf3cdef
Compare
Following test is failed: |
86b7591
to
b3dc346
Compare
Failing test: |
Convert driver to use DT_INST_ defines. Signed-off-by: Kumar Gala <kumar.gala@linaro.org> Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Convert driver to use DT_INST_ defines. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Convert driver to use DT_INST_ defines. Removed DT_RTC_0 fixup macros but keep DT_RTC_NAME_0 as it is still in use across RTC users. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Convert driver to use DT_INST_ defines. Removed DT_FLASH_DEV fixup macros, except DT_FLASH_DEV_NAME used in applications. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Convert driver to use DT_INST_ defines. Removed DT_FLASH_DEV fixup macros. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
On stm32 spi devices, there are 2 main IP variants, with and w/o fifo. Fifo is not really used today, but still there is some additional code handling fifo. Today this code is protected under Kconfig symbol SPI_STM32_HAS_FIFO. This code carries redundant information vs dedicated compatible "st,stm32-spi-fifo", which is provided as unique driver compatible for devices supporting this IP as opposed to use of "st,stm32-spi" when fifo is not supported. Having these 2 compatibles defined exclusively is not convenient for migration to DT_INST as DT_INST macros contain compatible string and hence it cannot be used to provide common compatible code for devices defining different compatibles. Based on these observations, review stm32 spi devices compatible declarations. Devices supporting fifo will now declare both compatibles, as proposed by dt spec: "[compatible] property value consists of a concatenated list of null terminated strings, from most specific to most general". Hence field will now be: "st,stm32-spi-fifo", "st,stm32-spi" This way, fifo enabled stm32 spi devices will generate both: DT_INST_STM32_SPI_FOO and DT_INST_STM32_SPI_FIFO_FOO As well as: DT_COMPAT_ST_STM32_SPI and DT_COMPAT_ST_STM32_SPI_FIFO So, DT_INST_STM32_SPI_FOO could be used for device initialization. Also DT_COMPAT_ST_STM32_SPI_FIFO could be used for FIFO handling code inside driver. Hence use it to replace Kconfig symbol SPI_STM32_HAS_FIFO. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Convert driver to use DT_INST_ defines. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Convert driver to use DT_INST_ defines. In the process, we've removed all UART/USART/LPUART code in device instanciation code which had no impact. Since all uart/usart/lpuart nodes declare compatibility with st,stm32uart, DT_INST_X_ST_STM32_UART_FOO could be used. Removed DT_UART fixup macros. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
b3dc346
to
a570e84
Compare
{STM32_PIN_PA11, STM32F4_PINMUX_FUNC_PA11_OTG_FS_DM}, | ||
{STM32_PIN_PA12, STM32F4_PINMUX_FUNC_PA12_OTG_FS_DP}, | ||
#endif /* DT_USB_BASE_ADDRESS */ | ||
#ifdef DT_USB_HS_BASE_ADDRESS | ||
#endif /* DT_COMPAT_ST_STM32_OTGFS */ |
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.
endif comment doesn't match ifdef
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.
Done, txs
{STM32_PIN_PB14, STM32F4_PINMUX_FUNC_PB14_OTG_HS_DM}, | ||
{STM32_PIN_PB15, STM32F4_PINMUX_FUNC_PB15_OTG_HS_DP}, | ||
#endif /* DT_USB_HS_BASE_ADDRESS */ | ||
#endif /* CONFIG_USB_DC_STM32 */ | ||
#endif /* DT_COMPAT_ST_STM32_OTGHS */ |
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.
endif comment doesn't match ifdef
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.
Done, txs
Convert usb_stm32 driver to use of DT_INST macros. Since driver is compatible with 3 different dt compatibles and compatible string is included in DT_INST macros, I've kept the DT_USB_ compatible agnostic macros based on DT_INST ones, which allowed to remove fixup definitions. Use of DT_USB symbols is now limited to usb_dc_stm32. Additionally, compatible "st,stm32-otgfs" is removed from list of compatibles for usbotg_hs ips. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
stm32f3_disco default configuration was enabling I2C and SPI. Fix this. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Various kconfig symbols where defined specifically for board nucleo_l432kc. Though, most are generic to the sample so should moved directly to sample prj.conf Some others parts of boards default configuration so could be removed as well. Last remove CONFIG_OPENOCD_SUPPORT as sample has no dependency with this symbol. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
a570e84
to
842bf3b
Compare
soc/arm/st_stm32/stm32f4/dts_fixup.h
Outdated
@@ -271,30 +271,6 @@ | |||
#define DT_I2S_6_DMA_FEATURES_RX \ | |||
DT_ST_STM32_I2S_40015400_RX_DMAS_FEATURES | |||
|
|||
#define DT_FLASH_DEV_NAME DT_INST_0_ST_STM32F4_FLASH_CONTROLLER_LABEL |
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.
The DT_FLASH_DEV_NAME
was accidentally removed by "drivers/usb: usb_dc_stm32: Convert to DT_INST" commit a778bcd. We need a follow up patch. Some applications, e.g. MCUBoot fail to compile.
@@ -119,8 +119,7 @@ | |||
#define DT_CAN_1_CLOCK_BUS DT_ST_STM32_CAN_40006400_CLOCK_BUS | |||
#define DT_CAN_1_CLOCK_BITS DT_ST_STM32_CAN_40006400_CLOCK_BITS | |||
|
|||
#define DT_FLASH_DEV_BASE_ADDRESS DT_ST_STM32F0_FLASH_CONTROLLER_40022000_BASE_ADDRESS | |||
#define DT_FLASH_DEV_NAME DT_ST_STM32F0_FLASH_CONTROLLER_40022000_LABEL | |||
#define DT_FLASH_DEV_NAME DT_INST_0_ST_STM32F0_FLASH_CONTROLLER_LABEL |
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.
The flash_stm32.c
driver is using DT_INST_0_SOC_NV_FLASH_LABEL
as a flash name
DT_INST_0_SOC_NV_FLASH_LABEL="FLASH_STM32"
however the DT_FLASH_DEV_NAME
is mapped to the flash controller name
DT_INST_0_ST_STM32F0_FLASH_CONTROLLER_LABEL="FLASH_CTRL"
The two don't match. This is causing run time error in MCUBoot.
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.
@mnkp, thanks for reporting. I'm fixing it.
Superseeds #22807
DT_DTCM_BASE_ADDRESS
. To be removed?)DT_FLASH_SIZE
. To be removed ?)DT_FLASH_SIZE
. be removed ?)Conversion of some drivers to DT_INST not possible yet, cf #22807 (comment)