@@ -52,6 +52,11 @@ LOG_MODULE_REGISTER(flash_stm32_xspi, CONFIG_FLASH_LOG_LEVEL);
5252#include <stm32_ll_dma.h>
5353#endif /* STM32_XSPI_USE_DMA */
5454
55+ #if defined(CONFIG_SOC_SERIES_STM32H7RSX )
56+ #include <stm32_ll_pwr.h>
57+ #include <stm32_ll_system.h>
58+ #endif /* CONFIG_SOC_SERIES_STM32H7RSX */
59+
5560#include "flash_stm32_xspi.h"
5661
5762static inline void xspi_lock_thread (const struct device * dev )
@@ -2047,6 +2052,11 @@ static int flash_stm32_xspi_init(const struct device *dev)
20472052 LOG_ERR ("XSPI mode SPI|DUAL|QUAD/DTR is not valid" );
20482053 return - ENOTSUP ;
20492054 }
2055+ #if defined(CONFIG_SOC_SERIES_STM32H7RSX )
2056+ LL_PWR_EnableXSPIM2 ();
2057+ __HAL_RCC_SBS_CLK_ENABLE ();
2058+ LL_SBS_EnableXSPI2SpeedOptim ();
2059+ #endif /* CONFIG_SOC_SERIES_STM32H7RSX */
20502060
20512061 /* Signals configuration */
20522062 ret = pinctrl_apply_state (dev_cfg -> pcfg , PINCTRL_STATE_DEFAULT );
@@ -2124,17 +2134,17 @@ static int flash_stm32_xspi_init(const struct device *dev)
21242134 if (dev_cfg -> data_rate == XSPI_DTR_TRANSFER ) {
21252135 dev_data -> hxspi .Init .MemoryType = HAL_XSPI_MEMTYPE_MACRONIX ;
21262136 dev_data -> hxspi .Init .DelayHoldQuarterCycle = HAL_XSPI_DHQC_ENABLE ;
2127- } else {
2128-
21292137 }
21302138#if defined(XSPI_DCR1_DLYBYP )
21312139#if STM32_XSPI_DLYB_BYPASSED
21322140 dev_data -> hxspi .Init .DelayBlockBypass = HAL_XSPI_DELAY_BLOCK_BYPASS ;
2133- #else
2134- dev_data -> hxspi .Init .DelayBlockBypass = HAL_XSPI_DELAY_BLOCK_ON ;
21352141#endif /* STM32_XSPI_DLYB_BYPASSED */
21362142#endif /* XSPI_DCR1_DLYBYP */
21372143
2144+ #if defined(CONFIG_SOC_SERIES_STM32H7RSX )
2145+ dev_data -> hxspi .Init .MaxTran = 0 ;
2146+ dev_data -> hxspi .Init .MemorySelect = HAL_XSPI_CSSEL_NCS1 ;
2147+ #endif /* CONFIG_SOC_SERIES_STM32H7RSX */
21382148
21392149 if (HAL_XSPI_Init (& dev_data -> hxspi ) != HAL_OK ) {
21402150 LOG_ERR ("XSPI Init failed" );
@@ -2143,7 +2153,8 @@ static int flash_stm32_xspi_init(const struct device *dev)
21432153
21442154 LOG_DBG ("XSPI Init'd" );
21452155
2146- #if defined(HAL_XSPIM_IOPORT_1 ) || defined(HAL_XSPIM_IOPORT_2 )
2156+ #if defined(HAL_XSPIM_IOPORT_1 ) || defined(HAL_XSPIM_IOPORT_2 ) || \
2157+ defined(XSPIM ) || defined(XSPIM1 ) || defined(XSPIM2 )
21472158 /* XSPI I/O manager init Function */
21482159 XSPIM_CfgTypeDef xspi_mgr_cfg ;
21492160
@@ -2163,7 +2174,10 @@ static int flash_stm32_xspi_init(const struct device *dev)
21632174
21642175#endif /* XSPIM */
21652176
2166- #if defined(DLYB_XSPI1 ) || defined(DLYB_XSPI2 ) || defined(DLYB_OCTOSPI1 ) || defined(DLYB_OCTOSPI2 )
2177+ #if !defined(CONFIG_SOC_SERIES_STM32H7RSX ) && \
2178+ (defined(DLYB_XSPI1 ) || defined(DLYB_XSPI2 ) || \
2179+ defined(DLYB_OCTOSPI1 ) || defined(DLYB_OCTOSPI2 ))
2180+
21672181 /* XSPI delay block init Function */
21682182 HAL_XSPI_DLYB_CfgTypeDef xspi_delay_block_cfg = {0 };
21692183
0 commit comments