Skip to content

Commit 2aa7906

Browse files
committed
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: Erwan Gouriou <[email protected]>
1 parent 15c2b2a commit 2aa7906

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

stm32cube/stm32n6xx/README

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,11 @@ Patch List:
6060
Impacted files:
6161
stm32cube/stm32n6xx/drivers/src/stm32n6xx_hal_sdio.c
6262

63+
*Fix XSPIM initialization sequence
64+
Don't cut XSPI2(ext NOR) clock when initializing XSPI1(PSRAM) which doesn't work
65+
when application is running in XIP on external NOR
66+
Impacted files:
67+
stm32cube/stm32n6xx/drivers/src/stm32n6xx_hal_xspi.c
68+
Internal reference: 212765
69+
6370
See release_note.html from STM32Cube

stm32cube/stm32n6xx/drivers/src/stm32n6xx_hal_xspi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,27 +2805,27 @@ HAL_StatusTypeDef HAL_XSPIM_Config(XSPI_HandleTypeDef *const hxspi, XSPIM_CfgTyp
28052805
}
28062806

28072807
/********** Disable all XSPI to configure XSPI IO Manager **********/
2808-
if (__HAL_RCC_XSPI1_IS_CLK_ENABLED() != 0U)
2808+
if ((__HAL_RCC_XSPI1_IS_CLK_ENABLED() != 0U) && (hxspi->Instance == XSPI1))
28092809
{
28102810
if ((XSPI1->CR & XSPI_CR_EN) != 0U)
28112811
{
28122812
CLEAR_BIT(XSPI1->CR, XSPI_CR_EN);
28132813
xspi_enabled |= 0x1U;
28142814
}
28152815
}
2816-
if (__HAL_RCC_XSPI2_IS_CLK_ENABLED() != 0U)
2816+
if ((__HAL_RCC_XSPI2_IS_CLK_ENABLED() != 0U) && (hxspi->Instance == XSPI2))
28172817
{
28182818
if ((XSPI2->CR & XSPI_CR_EN) != 0U)
28192819
{
28202820
CLEAR_BIT(XSPI2->CR, XSPI_CR_EN);
28212821
xspi_enabled |= 0x2U;
28222822
}
28232823
}
2824-
if (__HAL_RCC_XSPI3_IS_CLK_ENABLED() != 0U)
2824+
if ((__HAL_RCC_XSPI3_IS_CLK_ENABLED() != 0U) && (hxspi->Instance == XSPI3))
28252825
{
28262826
if ((XSPI3->CR & XSPI_CR_EN) != 0U)
28272827
{
2828-
CLEAR_BIT(XSPI2->CR, XSPI_CR_EN);
2828+
CLEAR_BIT(XSPI3->CR, XSPI_CR_EN);
28292829
xspi_enabled |= 0x4U;
28302830
}
28312831
}

0 commit comments

Comments
 (0)