]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
mmc: st: clear some flags before sending a command
authorYann Gautier <yann.gautier@st.com>
Fri, 12 Jun 2020 12:14:26 +0000 (14:14 +0200)
committerYann Gautier <yann.gautier@st.com>
Thu, 24 Sep 2020 07:32:23 +0000 (09:32 +0200)
The ICR static flags are cleared before sending a command.
The SDMMC_DCTRLR register is set to 0 if no data is expected on a given
command or on the next command in case of CMD55.

Change-Id: I5ae172a484218f53160e98b3684967c6960475a6
Signed-off-by: Yann Gautier <yann.gautier@st.com>
drivers/st/mmc/stm32_sdmmc2.c

index 2a8a4afc6e1c0560dc133e0a20ea24f2dbbc7fe9..cff3a344f7ec62733bf9908882e0bf4e68bf2507 100644 (file)
@@ -258,6 +258,18 @@ static int stm32_sdmmc2_send_cmd_req(struct mmc_cmd *cmd)
                break;
        }
 
+       mmio_write_32(base + SDMMC_ICR, SDMMC_STATIC_FLAGS);
+
+       /*
+        * Clear the SDMMC_DCTRLR if the command does not await data.
+        * Skip CMD55 as the next command could be data related, and
+        * the register could have been set in prepare function.
+        */
+       if (((cmd_reg & SDMMC_CMDR_CMDTRANS) == 0U) &&
+           (cmd->cmd_idx != MMC_CMD(55))) {
+               mmio_write_32(base + SDMMC_DCTRLR, 0U);
+       }
+
        if ((cmd->resp_type & MMC_RSP_BUSY) != 0U) {
                mmio_write_32(base + SDMMC_DTIMER, UINT32_MAX);
        }