Commit bc169ad2 authored by Linus Walleij's avatar Linus Walleij Committed by Ulf Hansson

mmc: moxart-mmc: Factor out moxart_use_dma() helper

The same code is in two places and we will add a third place.
Break this out into its own function.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240127-mmc-proper-kmap-v2-2-d8e732aa97d1@linaro.orgSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent ed01d210
...@@ -254,6 +254,11 @@ static void moxart_dma_complete(void *param) ...@@ -254,6 +254,11 @@ static void moxart_dma_complete(void *param)
complete(&host->dma_complete); complete(&host->dma_complete);
} }
static bool moxart_use_dma(struct moxart_host *host)
{
return (host->data_len > host->fifo_width) && host->have_dma;
}
static void moxart_transfer_dma(struct mmc_data *data, struct moxart_host *host) static void moxart_transfer_dma(struct mmc_data *data, struct moxart_host *host)
{ {
u32 len, dir_slave; u32 len, dir_slave;
...@@ -375,7 +380,7 @@ static void moxart_prepare_data(struct moxart_host *host) ...@@ -375,7 +380,7 @@ static void moxart_prepare_data(struct moxart_host *host)
if (data->flags & MMC_DATA_WRITE) if (data->flags & MMC_DATA_WRITE)
datactrl |= DCR_DATA_WRITE; datactrl |= DCR_DATA_WRITE;
if ((host->data_len > host->fifo_width) && host->have_dma) if (moxart_use_dma(host))
datactrl |= DCR_DMA_EN; datactrl |= DCR_DMA_EN;
writel(DCR_DATA_FIFO_RESET, host->base + REG_DATA_CONTROL); writel(DCR_DATA_FIFO_RESET, host->base + REG_DATA_CONTROL);
...@@ -407,7 +412,7 @@ static void moxart_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -407,7 +412,7 @@ static void moxart_request(struct mmc_host *mmc, struct mmc_request *mrq)
moxart_send_command(host, host->mrq->cmd); moxart_send_command(host, host->mrq->cmd);
if (mrq->cmd->data) { if (mrq->cmd->data) {
if ((host->data_len > host->fifo_width) && host->have_dma) { if (moxart_use_dma(host)) {
writel(CARD_CHANGE, host->base + REG_INTERRUPT_MASK); writel(CARD_CHANGE, host->base + REG_INTERRUPT_MASK);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment