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

stm32cube: stm32n6: 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 29fd0be8
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ Patch List:
    -soc/system_stm32n6xx_s.c

   *Fix SDIO initialization failure when skipping card identification sequence
     Fixes an issue in the STM32HN6 SDIO driver where HAL_SDIO_Init() fails if
     Fixes an issue in the STM32N6 SDIO driver where HAL_SDIO_Init() fails if
     the card identification sequence is skipped.
     Impacted files:
      stm32cube/stm32n6xx/drivers/src/stm32n6xx_hal_sdio.c
@@ -67,4 +67,9 @@ Patch List:
      stm32cube/stm32n6xx/drivers/src/stm32n6xx_hal_xspi.c
    Internal reference: 212765

   See release_note.html from STM32Cube
   *Fix SDIO polling mode data transfer issues
     Fixes two related issues in the STM32N6 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/stm32n6xx/drivers/src/stm32n6xx_hal_sdio.c   
+3 −3
Original line number Diff line number Diff line
@@ -1002,7 +1002,7 @@ HAL_StatusTypeDef HAL_SDIO_ReadExtended(SDIO_HandleTypeDef *hsdio, HAL_SDIO_Exte
    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)
    {
@@ -1147,7 +1147,7 @@ HAL_StatusTypeDef HAL_SDIO_WriteExtended(SDIO_HandleTypeDef *hsdio, HAL_SDIO_Ext
  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 */
@@ -1207,7 +1207,7 @@ HAL_StatusTypeDef HAL_SDIO_WriteExtended(SDIO_HandleTypeDef *hsdio, HAL_SDIO_Ext
    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)
    {