Commit cd094edc authored by ExaltZephyr's avatar ExaltZephyr Committed by Erwan Gouriou
Browse files

stm32cube: stm32h7rs: sdio: fix SDIO polling mode


transfer issues

this commit fixes two issues in SDIO driver:
incorrect block count calculation and improper
buffer size handling.

Signed-off-by: default avatarSarah Younis <zephyr@exalt.ps>
parent a03834cd
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -54,4 +54,11 @@ Patch List:
     Impacted files:
      stm32cube/stm32h7rsxx/drivers/src/stm32h7rsxx_hal_sdio.c
    
   *Fix SDIO polling mode data transfer issues
     Fixes two related issues in the STM32H7RS SDIO driver: incorrect block count calculation 
     that caused the card to hang, and improper buffer size handling that led to misaligned FIFO writes. 
     Together, these changes ensure correct and stable data transfer in polling mode.
     Impacted file: 
      stm32cube/stm32h7rsxx/drivers/src/stm32h7rsxx_hal_sdio.c    

   See release_note.html from STM32Cube
+3 −3
Original line number Diff line number Diff line
@@ -1011,7 +1011,7 @@ HAL_StatusTypeDef HAL_SDIO_ReadExtended(SDIO_HandleTypeDef *hsdio, const HAL_SDI
    cmd |= Argument->Block_Mode << 27U;
    cmd |= Argument->OpCode << 26U;
    cmd |= (Argument->Reg_Addr & 0x1FFFFU) << 9U;
    cmd |= (Size_byte & 0x1FFU);
    cmd |= ((nbr_of_block == 0U)? Size_byte : nbr_of_block)& 0x1FFU;
    errorstate = SDMMC_SDIO_CmdReadWriteExtended(hsdio->Instance, cmd);
    if (errorstate != HAL_SDIO_ERROR_NONE)
    {
@@ -1156,7 +1156,7 @@ HAL_StatusTypeDef HAL_SDIO_WriteExtended(SDIO_HandleTypeDef *hsdio, const HAL_SD
  uint8_t byteCount;
  uint32_t data;
  uint32_t dataremaining;
  uint8_t *u32tempbuff = pData;
  uint32_t *u32tempbuff = (uint32_t *) pData;
  uint32_t nbr_of_block;

  /* Check the parameters */
@@ -1216,7 +1216,7 @@ HAL_StatusTypeDef HAL_SDIO_WriteExtended(SDIO_HandleTypeDef *hsdio, const HAL_SD
    cmd |= Argument->Block_Mode << 27U;
    cmd |= Argument->OpCode << 26U;
    cmd |= (Argument->Reg_Addr & 0x1FFFFU) << 9U;
    cmd |= (Size_byte & 0x1FFU);
    cmd |= ((nbr_of_block == 0U)? Size_byte : nbr_of_block)& 0x1FFU;
    errorstate = SDMMC_SDIO_CmdReadWriteExtended(hsdio->Instance, cmd);
    if (errorstate != HAL_SDIO_ERROR_NONE)
    {