Skip to content

Commit c83a9ef

Browse files
ExaltZephyrerwango
authored andcommitted
stm32cube: stm32n6: sdio: fix SDIO_Init failure
when skipping card identification sequence. This commit fixes an issue in the STM32N6 SDIO driver where HAL_SDIO_Init() fails if the card identification sequence is skipped. Signed-off-by: Sara Touqan <zephyr@exalt.ps>
1 parent 3f8ac8f commit c83a9ef

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

stm32cube/stm32n6xx/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,10 @@ Patch List:
5353
Impacted files:
5454
-soc/system_stm32n6xx_fsbl.c
5555

56+
*Fix SDIO initialization failure when skipping card identification sequence
57+
Fixes an issue in the STM32HN6 SDIO driver where HAL_SDIO_Init() fails if
58+
the card identification sequence is skipped.
59+
Impacted files:
60+
stm32cube/stm32n6xx/drivers/src/stm32n6xx_hal_sdio.c
61+
5662
See release_note.html from STM32Cube

stm32cube/stm32n6xx/drivers/src/stm32n6xx_hal_sdio.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ HAL_StatusTypeDef HAL_SDIO_Init(SDIO_HandleTypeDef *hsdio)
314314
{
315315
SDIO_InitTypeDef Init;
316316
uint32_t sdmmc_clk;
317-
uint8_t data;
318317

319318
/* Check the parameters */
320319
assert_param(hsdio != NULL);
@@ -398,12 +397,6 @@ HAL_StatusTypeDef HAL_SDIO_Init(SDIO_HandleTypeDef *hsdio)
398397
Init.ClockDiv = hsdio->Init.ClockDiv;
399398
(void)SDMMC_Init(hsdio->Instance, Init);
400399

401-
data = (hsdio->Init.BusWide == HAL_SDIO_4_WIRES_MODE) ? 2U : 0U;
402-
if (SDIO_WriteDirect(hsdio, SDMMC_SDIO_CCCR4_SD_BYTE3, HAL_SDIO_WRITE_ONLY, SDIO_FUNCTION_0, &data) != HAL_OK)
403-
{
404-
return HAL_ERROR;
405-
}
406-
407400
hsdio->Context = SDIO_CONTEXT_NONE;
408401
hsdio->State = HAL_SDIO_STATE_READY;
409402

@@ -2486,6 +2479,7 @@ HAL_StatusTypeDef HAL_SDIO_RegisterIOFunctionCallback(SDIO_HandleTypeDef *hsdio,
24862479
*/
24872480
static HAL_StatusTypeDef SDIO_InitCard(SDIO_HandleTypeDef *hsdio)
24882481
{
2482+
uint8_t data;
24892483
uint32_t errorstate;
24902484
uint32_t timeout = 0U;
24912485
uint16_t sdio_rca = 1U;
@@ -2560,6 +2554,12 @@ static HAL_StatusTypeDef SDIO_InitCard(SDIO_HandleTypeDef *hsdio)
25602554
return HAL_ERROR;
25612555
}
25622556

2557+
data = (hsdio->Init.BusWide == HAL_SDIO_4_WIRES_MODE) ? 2U : 0U;
2558+
if (SDIO_WriteDirect(hsdio, SDMMC_SDIO_CCCR4_SD_BYTE3, HAL_SDIO_WRITE_ONLY, SDIO_FUNCTION_0, &data) != HAL_OK)
2559+
{
2560+
return HAL_ERROR;
2561+
}
2562+
25632563
return HAL_OK;
25642564
}
25652565

0 commit comments

Comments
 (0)