mmc: mmci: Send a CMD12 to clear the DPSM at errors
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 29 Jan 2019 14:35:56 +0000 (15:35 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 25 Feb 2019 07:40:58 +0000 (08:40 +0100)
commite9968c6fa8e7852184135e84116c6c77ebb2987d
tree7395705d6e606227311214b39f4afaf82026b4cc
parente9d6a371cff3bb9bef8ad96fe576d62346c7e104
mmc: mmci: Send a CMD12 to clear the DPSM at errors

The current approach with sending a CMD12 (STOP_TRANSMISSION) to complete a
data transfer request, either because of using the open-ended transmission
type or because of receiving an error during a pre-defined data transfer,
isn't sufficient for the STM32 sdmmc variant. More precisely, this variant
needs to clear the DPSM ("Data Path State Machine") by sending a CMD12, for
all failing ADTC commands.

Support this, by adding a struct mmc_command inside the struct mmci_host
and initialize it to a CMD12 during ->probe(). Let's also add checks for
the new conditions, to enable mmci_data_irq() and mmci_cmd_irq() to
postpone the calls to mmci_request_end(), but instead send the CMD12.

Cc: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Barre <ludovic.barre@st.com>
drivers/mmc/host/mmci.c
drivers/mmc/host/mmci.h