Commit ad7b8918 authored by Ludovic Barre's avatar Ludovic Barre Committed by Ulf Hansson

mmc: mmci: merge prepare data functions

This patch merges the prepare data functions.
This allows to define a single access to prepare data service.
This prepares integration for mmci host ops.
Signed-off-by: default avatarLudovic Barre <ludovic.barre@st.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent a813f2a2
...@@ -683,10 +683,14 @@ static int __mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data, ...@@ -683,10 +683,14 @@ static int __mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
} }
static inline int mmci_dma_prep_data(struct mmci_host *host, static inline int mmci_dma_prep_data(struct mmci_host *host,
struct mmc_data *data) struct mmc_data *data,
bool next)
{ {
struct mmci_dmae_priv *dmae = host->dma_priv; struct mmci_dmae_priv *dmae = host->dma_priv;
struct mmci_dmae_next *nd = &dmae->next_data;
if (next)
return __mmci_dma_prep_data(host, data, &nd->chan, &nd->desc);
/* Check if next job is already prepared. */ /* Check if next job is already prepared. */
if (dmae->cur && dmae->desc_current) if (dmae->cur && dmae->desc_current)
return 0; return 0;
...@@ -696,15 +700,6 @@ static inline int mmci_dma_prep_data(struct mmci_host *host, ...@@ -696,15 +700,6 @@ static inline int mmci_dma_prep_data(struct mmci_host *host,
&dmae->desc_current); &dmae->desc_current);
} }
static inline int mmci_dma_prep_next(struct mmci_host *host,
struct mmc_data *data)
{
struct mmci_dmae_priv *dmae = host->dma_priv;
struct mmci_dmae_next *nd = &dmae->next_data;
return __mmci_dma_prep_data(host, data, &nd->chan, &nd->desc);
}
static int mmci_dma_start_data(struct mmci_host *host, unsigned int datactrl) static int mmci_dma_start_data(struct mmci_host *host, unsigned int datactrl)
{ {
int ret; int ret;
...@@ -714,7 +709,7 @@ static int mmci_dma_start_data(struct mmci_host *host, unsigned int datactrl) ...@@ -714,7 +709,7 @@ static int mmci_dma_start_data(struct mmci_host *host, unsigned int datactrl)
if (!host->use_dma) if (!host->use_dma)
return -EINVAL; return -EINVAL;
ret = mmci_dma_prep_data(host, host->data); ret = mmci_dma_prep_data(host, host->data, false);
if (ret) if (ret)
return ret; return ret;
...@@ -774,7 +769,7 @@ static void mmci_pre_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -774,7 +769,7 @@ static void mmci_pre_request(struct mmc_host *mmc, struct mmc_request *mrq)
if (mmci_validate_data(host, data)) if (mmci_validate_data(host, data))
return; return;
if (!mmci_dma_prep_next(host, data)) if (!mmci_dma_prep_data(host, data, true))
data->host_cookie = ++host->next_cookie < 0 ? data->host_cookie = ++host->next_cookie < 0 ?
1 : host->next_cookie; 1 : host->next_cookie;
} }
......
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