diff options
author | Ludovic Barre <ludovic.barre@st.com> | 2018-12-06 10:13:31 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2018-12-17 02:26:24 -0500 |
commit | c8073e52851477514e98a032ae70f2dc8be19d32 (patch) | |
tree | 9b75d1c25698f21025779b3fed2768003e9c0304 | |
parent | 9e89a1526a9c23ce81584a0b612174342c611e47 (diff) |
mmc: mmci: add variant property to set command stop bit
On cmd12 (STOP_TRANSMISSION), STM32 sdmmc variant needs to set
cmdstop bit in command register. The CPSM ("Command Path State Machine")
treats the command as a Stop Transmission command and signals
abort to the DPSM ("Data Path State Machine").
Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/host/mmci.c | 6 | ||||
-rw-r--r-- | drivers/mmc/host/mmci.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 13fa640d86d6..e352f5ad5801 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
22 | #include <linux/highmem.h> | 22 | #include <linux/highmem.h> |
23 | #include <linux/log2.h> | 23 | #include <linux/log2.h> |
24 | #include <linux/mmc/mmc.h> | ||
24 | #include <linux/mmc/pm.h> | 25 | #include <linux/mmc/pm.h> |
25 | #include <linux/mmc/host.h> | 26 | #include <linux/mmc/host.h> |
26 | #include <linux/mmc/card.h> | 27 | #include <linux/mmc/card.h> |
@@ -274,6 +275,7 @@ static struct variant_data variant_stm32_sdmmc = { | |||
274 | .cmdreg_lrsp_crc = MCI_CPSM_STM32_LRSP_CRC, | 275 | .cmdreg_lrsp_crc = MCI_CPSM_STM32_LRSP_CRC, |
275 | .cmdreg_srsp_crc = MCI_CPSM_STM32_SRSP_CRC, | 276 | .cmdreg_srsp_crc = MCI_CPSM_STM32_SRSP_CRC, |
276 | .cmdreg_srsp = MCI_CPSM_STM32_SRSP, | 277 | .cmdreg_srsp = MCI_CPSM_STM32_SRSP, |
278 | .cmdreg_stop = MCI_CPSM_STM32_CMDSTOP, | ||
277 | .data_cmd_enable = MCI_CPSM_STM32_CMDTRANS, | 279 | .data_cmd_enable = MCI_CPSM_STM32_CMDTRANS, |
278 | .irq_pio_mask = MCI_IRQ_PIO_STM32_MASK, | 280 | .irq_pio_mask = MCI_IRQ_PIO_STM32_MASK, |
279 | .datactrl_first = true, | 281 | .datactrl_first = true, |
@@ -1100,6 +1102,10 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c) | |||
1100 | mmci_reg_delay(host); | 1102 | mmci_reg_delay(host); |
1101 | } | 1103 | } |
1102 | 1104 | ||
1105 | if (host->variant->cmdreg_stop && | ||
1106 | cmd->opcode == MMC_STOP_TRANSMISSION) | ||
1107 | c |= host->variant->cmdreg_stop; | ||
1108 | |||
1103 | c |= cmd->opcode | host->variant->cmdreg_cpsm_enable; | 1109 | c |= cmd->opcode | host->variant->cmdreg_cpsm_enable; |
1104 | if (cmd->flags & MMC_RSP_PRESENT) { | 1110 | if (cmd->flags & MMC_RSP_PRESENT) { |
1105 | if (cmd->flags & MMC_RSP_136) | 1111 | if (cmd->flags & MMC_RSP_136) |
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 550dd3914461..24229097d05c 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h | |||
@@ -264,6 +264,7 @@ struct mmci_host; | |||
264 | * @cmdreg_lrsp_crc: enable value for long response with crc | 264 | * @cmdreg_lrsp_crc: enable value for long response with crc |
265 | * @cmdreg_srsp_crc: enable value for short response with crc | 265 | * @cmdreg_srsp_crc: enable value for short response with crc |
266 | * @cmdreg_srsp: enable value for short response without crc | 266 | * @cmdreg_srsp: enable value for short response without crc |
267 | * @cmdreg_stop: enable value for stop and abort transmission | ||
267 | * @datalength_bits: number of bits in the MMCIDATALENGTH register | 268 | * @datalength_bits: number of bits in the MMCIDATALENGTH register |
268 | * @fifosize: number of bytes that can be written when MMCI_TXFIFOEMPTY | 269 | * @fifosize: number of bytes that can be written when MMCI_TXFIFOEMPTY |
269 | * is asserted (likewise for RX) | 270 | * is asserted (likewise for RX) |
@@ -316,6 +317,7 @@ struct variant_data { | |||
316 | unsigned int cmdreg_lrsp_crc; | 317 | unsigned int cmdreg_lrsp_crc; |
317 | unsigned int cmdreg_srsp_crc; | 318 | unsigned int cmdreg_srsp_crc; |
318 | unsigned int cmdreg_srsp; | 319 | unsigned int cmdreg_srsp; |
320 | unsigned int cmdreg_stop; | ||
319 | unsigned int datalength_bits; | 321 | unsigned int datalength_bits; |
320 | unsigned int fifosize; | 322 | unsigned int fifosize; |
321 | unsigned int fifohalfsize; | 323 | unsigned int fifohalfsize; |