Commit 2aa79063 authored by Erwan Gouriou's avatar Erwan Gouriou
Browse files

stm32cube: n6: Fix XSPIM initialization



XSPIM initialization should not kill XSPI2 in flight.

Take into account calling instance when initializing XSPIM in order
to avoid cutting other instances clocks.

Signed-off-by: default avatarErwan Gouriou <erwan.gouriou@st.com>
parent 15c2b2a5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -60,4 +60,11 @@ Patch List:
     Impacted files:
      stm32cube/stm32n6xx/drivers/src/stm32n6xx_hal_sdio.c

   *Fix XSPIM initialization sequence
     Don't cut XSPI2(ext NOR) clock when initializing XSPI1(PSRAM) which doesn't work
     when application is running in XIP on external NOR
    Impacted files:
      stm32cube/stm32n6xx/drivers/src/stm32n6xx_hal_xspi.c
    Internal reference: 212765

   See release_note.html from STM32Cube
+4 −4
Original line number Diff line number Diff line
@@ -2805,7 +2805,7 @@ HAL_StatusTypeDef HAL_XSPIM_Config(XSPI_HandleTypeDef *const hxspi, XSPIM_CfgTyp
  }

  /********** Disable all XSPI to configure XSPI IO Manager **********/
  if (__HAL_RCC_XSPI1_IS_CLK_ENABLED() != 0U)
  if ((__HAL_RCC_XSPI1_IS_CLK_ENABLED() != 0U) && (hxspi->Instance == XSPI1))
  {
    if ((XSPI1->CR & XSPI_CR_EN) != 0U)
    {
@@ -2813,7 +2813,7 @@ HAL_StatusTypeDef HAL_XSPIM_Config(XSPI_HandleTypeDef *const hxspi, XSPIM_CfgTyp
      xspi_enabled |= 0x1U;
    }
  }
  if (__HAL_RCC_XSPI2_IS_CLK_ENABLED() != 0U)
  if ((__HAL_RCC_XSPI2_IS_CLK_ENABLED() != 0U) && (hxspi->Instance == XSPI2))
  {
    if ((XSPI2->CR & XSPI_CR_EN) != 0U)
    {
@@ -2821,11 +2821,11 @@ HAL_StatusTypeDef HAL_XSPIM_Config(XSPI_HandleTypeDef *const hxspi, XSPIM_CfgTyp
      xspi_enabled |= 0x2U;
    }
  }
  if (__HAL_RCC_XSPI3_IS_CLK_ENABLED() != 0U)
  if ((__HAL_RCC_XSPI3_IS_CLK_ENABLED() != 0U) && (hxspi->Instance == XSPI3))
  {
    if ((XSPI3->CR & XSPI_CR_EN) != 0U)
    {
      CLEAR_BIT(XSPI2->CR, XSPI_CR_EN);
      CLEAR_BIT(XSPI3->CR, XSPI_CR_EN);
      xspi_enabled |= 0x4U;
    }
  }