diff options
author | Yann Gautier <yann.gautier@st.com> | 2020-06-12 14:14:26 +0200 |
---|---|---|
committer | Yann Gautier <yann.gautier@st.com> | 2020-09-24 09:32:23 +0200 |
commit | 54019a35b817976793903f0030108148631aaace (patch) | |
tree | ece3e267265eee41100bdbd85e9d34137d4609a7 /drivers | |
parent | 7d8e1218c28ec9c549b05e09210f72059d425012 (diff) | |
download | platform_external_arm-trusted-firmware-54019a35b817976793903f0030108148631aaace.tar.gz platform_external_arm-trusted-firmware-54019a35b817976793903f0030108148631aaace.tar.bz2 platform_external_arm-trusted-firmware-54019a35b817976793903f0030108148631aaace.zip |
mmc: st: clear some flags before sending a command
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/st/mmc/stm32_sdmmc2.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/st/mmc/stm32_sdmmc2.c b/drivers/st/mmc/stm32_sdmmc2.c index 2a8a4afc6..cff3a344f 100644 --- a/drivers/st/mmc/stm32_sdmmc2.c +++ b/drivers/st/mmc/stm32_sdmmc2.c @@ -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); } |