mmc: mmci: add get_next_data callback

This patch adds get_next_data callback to mmci_host_ops.
Generic mmci_get_next_data factorizes next_cookie check and
the host ops call.

Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Ludovic Barre 2018-10-08 14:08:37 +02:00 committed by Ulf Hansson
parent 4798351018
commit 02769968d9
3 changed files with 13 additions and 6 deletions

View File

@ -417,6 +417,14 @@ void mmci_unprep_data(struct mmci_host *host, struct mmc_data *data,
data->host_cookie = 0; data->host_cookie = 0;
} }
void mmci_get_next_data(struct mmci_host *host, struct mmc_data *data)
{
WARN_ON(data->host_cookie && data->host_cookie != host->next_cookie);
if (host->ops && host->ops->get_next_data)
host->ops->get_next_data(host, data);
}
static void static void
mmci_request_end(struct mmci_host *host, struct mmc_request *mrq) mmci_request_end(struct mmci_host *host, struct mmc_request *mrq)
{ {
@ -767,7 +775,7 @@ static int mmci_dma_start_data(struct mmci_host *host, unsigned int datactrl)
return 0; return 0;
} }
static void mmci_get_next_data(struct mmci_host *host, struct mmc_data *data) void mmci_dmae_get_next_data(struct mmci_host *host, struct mmc_data *data)
{ {
struct mmci_dmae_priv *dmae = host->dma_priv; struct mmci_dmae_priv *dmae = host->dma_priv;
struct mmci_dmae_next *next = &dmae->next_data; struct mmci_dmae_next *next = &dmae->next_data;
@ -775,7 +783,6 @@ static void mmci_get_next_data(struct mmci_host *host, struct mmc_data *data)
if (!host->use_dma) if (!host->use_dma)
return; return;
WARN_ON(data->host_cookie && data->host_cookie != host->next_cookie);
WARN_ON(!data->host_cookie && (next->desc || next->chan)); WARN_ON(!data->host_cookie && (next->desc || next->chan));
dmae->desc_current = next->desc; dmae->desc_current = next->desc;
@ -820,6 +827,7 @@ void mmci_dmae_unprep_data(struct mmci_host *host,
static struct mmci_host_ops mmci_variant_ops = { static struct mmci_host_ops mmci_variant_ops = {
.prep_data = mmci_dmae_prep_data, .prep_data = mmci_dmae_prep_data,
.unprep_data = mmci_dmae_unprep_data, .unprep_data = mmci_dmae_unprep_data,
.get_next_data = mmci_dmae_get_next_data,
.dma_setup = mmci_dmae_setup, .dma_setup = mmci_dmae_setup,
.dma_release = mmci_dmae_release, .dma_release = mmci_dmae_release,
}; };
@ -830,10 +838,6 @@ void mmci_variant_init(struct mmci_host *host)
} }
#else #else
/* Blank functions if the DMA engine is not available */ /* Blank functions if the DMA engine is not available */
static void mmci_get_next_data(struct mmci_host *host, struct mmc_data *data)
{
}
static inline void mmci_dma_finalize(struct mmci_host *host, static inline void mmci_dma_finalize(struct mmci_host *host,
struct mmc_data *data) struct mmc_data *data)
{ {

View File

@ -277,6 +277,7 @@ struct mmci_host_ops {
bool next); bool next);
void (*unprep_data)(struct mmci_host *host, struct mmc_data *data, void (*unprep_data)(struct mmci_host *host, struct mmc_data *data,
int err); int err);
void (*get_next_data)(struct mmci_host *host, struct mmc_data *data);
int (*dma_setup)(struct mmci_host *host); int (*dma_setup)(struct mmci_host *host);
void (*dma_release)(struct mmci_host *host); void (*dma_release)(struct mmci_host *host);
}; };
@ -335,6 +336,7 @@ int mmci_dmae_prep_data(struct mmci_host *host, struct mmc_data *data,
bool next); bool next);
void mmci_dmae_unprep_data(struct mmci_host *host, struct mmc_data *data, void mmci_dmae_unprep_data(struct mmci_host *host, struct mmc_data *data,
int err); int err);
void mmci_dmae_get_next_data(struct mmci_host *host, struct mmc_data *data);
int mmci_dmae_setup(struct mmci_host *host); int mmci_dmae_setup(struct mmci_host *host);
void mmci_dmae_release(struct mmci_host *host); void mmci_dmae_release(struct mmci_host *host);

View File

@ -186,6 +186,7 @@ static int qcom_dma_setup(struct mmci_host *host)
static struct mmci_host_ops qcom_variant_ops = { static struct mmci_host_ops qcom_variant_ops = {
.prep_data = mmci_dmae_prep_data, .prep_data = mmci_dmae_prep_data,
.unprep_data = mmci_dmae_unprep_data, .unprep_data = mmci_dmae_unprep_data,
.get_next_data = mmci_dmae_get_next_data,
.dma_setup = qcom_dma_setup, .dma_setup = qcom_dma_setup,
.dma_release = mmci_dmae_release, .dma_release = mmci_dmae_release,
}; };