Skip to content

Commit 78d0b0b

Browse files
committed
stm32cube: stm32u5: sdio: fix SDIO_Init failure
when skipping card identification sequence. Fixes an issue in the STM32U5 SDIO driver where HAL_SDIO_Init() fails if the card identification sequence is skipped. Signed-off-by: Sara Touqan <zephyr@exalt.ps>
1 parent c7457a9 commit 78d0b0b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

stm32cube/stm32u5xx/drivers/src/stm32u5xx_hal_sdio.c

Lines changed: 6 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

@@ -2560,6 +2553,12 @@ static HAL_StatusTypeDef SDIO_InitCard(SDIO_HandleTypeDef *hsdio)
25602553
return HAL_ERROR;
25612554
}
25622555

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

0 commit comments

Comments
 (0)