Skip to content

Commit 3f8ac8f

Browse files
ExaltZephyrerwango
authored andcommitted
stm32cube: stm32h7rs: sdio: fix SDIO_Init failure
when skipping card identification sequence. This commit fixes an issue in the STM32H7RS SDIO driver where HAL_SDIO_Init() fails if the card identification sequence is skipped. Signed-off-by: Sara Touqan <[email protected]>
1 parent 9f57a33 commit 3f8ac8f

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

stm32cube/stm32h7rsxx/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,10 @@ Patch List:
4848
Impacted files:
4949
drivers/include/Legacy/stm32_hal_legacy.h
5050

51+
*Fix SDIO initialization failure when skipping card identification sequence
52+
Fixes an issue in the STM32H7RS SDIO driver where HAL_SDIO_Init() fails if
53+
the card identification sequence is skipped.
54+
Impacted files:
55+
stm32cube/stm32h7rsxx/drivers/src/stm32h7rsxx_hal_sdio.c
56+
5157
See release_note.html from STM32Cube

stm32cube/stm32h7rsxx/drivers/src/stm32h7rsxx_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 = {0U};
316316
uint32_t sdmmc_clk;
317-
uint8_t data;
318317

319318
/* Check the parameters */
320319
assert_param(hsdio != NULL);
@@ -405,12 +404,6 @@ HAL_StatusTypeDef HAL_SDIO_Init(SDIO_HandleTypeDef *hsdio)
405404
Init.ClockDiv = hsdio->Init.ClockDiv;
406405
(void)SDMMC_Init(hsdio->Instance, Init);
407406

408-
data = (hsdio->Init.BusWide == HAL_SDIO_4_WIRES_MODE) ? 2U : 0U;
409-
if (SDIO_WriteDirect(hsdio, SDMMC_SDIO_CCCR4_SD_BYTE3, HAL_SDIO_WRITE_ONLY, SDIO_FUNCTION_0, &data) != HAL_OK)
410-
{
411-
return HAL_ERROR;
412-
}
413-
414407
hsdio->Context = SDIO_CONTEXT_NONE;
415408
hsdio->State = HAL_SDIO_STATE_READY;
416409

@@ -2494,6 +2487,7 @@ HAL_StatusTypeDef HAL_SDIO_RegisterIOFunctionCallback(SDIO_HandleTypeDef *hsdio,
24942487
*/
24952488
static HAL_StatusTypeDef SDIO_InitCard(SDIO_HandleTypeDef *hsdio)
24962489
{
2490+
uint8_t data;
24972491
uint32_t errorstate;
24982492
uint32_t timeout = 0U;
24992493
uint16_t sdio_rca = 1U;
@@ -2568,6 +2562,12 @@ static HAL_StatusTypeDef SDIO_InitCard(SDIO_HandleTypeDef *hsdio)
25682562
return HAL_ERROR;
25692563
}
25702564

2565+
data = (hsdio->Init.BusWide == HAL_SDIO_4_WIRES_MODE) ? 2U : 0U;
2566+
if (SDIO_WriteDirect(hsdio, SDMMC_SDIO_CCCR4_SD_BYTE3, HAL_SDIO_WRITE_ONLY, SDIO_FUNCTION_0, &data) != HAL_OK)
2567+
{
2568+
return HAL_ERROR;
2569+
}
2570+
25712571
return HAL_OK;
25722572
}
25732573

0 commit comments

Comments
 (0)