Commit 5a9f10c3 authored by Ludovic Barre's avatar Ludovic Barre Committed by Ulf Hansson

mmc: mmci: add dma_finalize callback

This patch adds dma_finalize callback at mmci_host_ops
to allow to call specific variant.
Signed-off-by: default avatarLudovic Barre <ludovic.barre@st.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 135ea30e
...@@ -460,6 +460,15 @@ int mmci_dma_start(struct mmci_host *host, unsigned int datactrl) ...@@ -460,6 +460,15 @@ int mmci_dma_start(struct mmci_host *host, unsigned int datactrl)
return 0; return 0;
} }
void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data)
{
if (!host->use_dma)
return;
if (host->ops && host->ops->dma_finalize)
host->ops->dma_finalize(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)
{ {
...@@ -641,13 +650,13 @@ static void mmci_dma_data_error(struct mmci_host *host) ...@@ -641,13 +650,13 @@ static void mmci_dma_data_error(struct mmci_host *host)
mmci_dma_unmap(host, host->data); mmci_dma_unmap(host, host->data);
} }
static void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data) void mmci_dmae_finalize(struct mmci_host *host, struct mmc_data *data)
{ {
struct mmci_dmae_priv *dmae = host->dma_priv; struct mmci_dmae_priv *dmae = host->dma_priv;
u32 status; u32 status;
int i; int i;
if (!host->use_dma || !dma_inprogress(host)) if (!dma_inprogress(host))
return; return;
/* Wait up to 1ms for the DMA to complete */ /* Wait up to 1ms for the DMA to complete */
...@@ -844,6 +853,7 @@ static struct mmci_host_ops mmci_variant_ops = { ...@@ -844,6 +853,7 @@ static struct mmci_host_ops mmci_variant_ops = {
.dma_setup = mmci_dmae_setup, .dma_setup = mmci_dmae_setup,
.dma_release = mmci_dmae_release, .dma_release = mmci_dmae_release,
.dma_start = mmci_dmae_start, .dma_start = mmci_dmae_start,
.dma_finalize = mmci_dmae_finalize,
}; };
void mmci_variant_init(struct mmci_host *host) void mmci_variant_init(struct mmci_host *host)
...@@ -852,11 +862,6 @@ void mmci_variant_init(struct mmci_host *host) ...@@ -852,11 +862,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 inline void mmci_dma_finalize(struct mmci_host *host,
struct mmc_data *data)
{
}
static inline void mmci_dma_data_error(struct mmci_host *host) static inline void mmci_dma_data_error(struct mmci_host *host)
{ {
} }
......
...@@ -281,6 +281,7 @@ struct mmci_host_ops { ...@@ -281,6 +281,7 @@ struct mmci_host_ops {
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);
int (*dma_start)(struct mmci_host *host, unsigned int *datactrl); int (*dma_start)(struct mmci_host *host, unsigned int *datactrl);
void (*dma_finalize)(struct mmci_host *host, struct mmc_data *data);
}; };
struct mmci_host { struct mmci_host {
...@@ -341,4 +342,4 @@ void mmci_dmae_get_next_data(struct mmci_host *host, struct mmc_data *data); ...@@ -341,4 +342,4 @@ 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);
int mmci_dmae_start(struct mmci_host *host, unsigned int *datactrl); int mmci_dmae_start(struct mmci_host *host, unsigned int *datactrl);
void mmci_dmae_finalize(struct mmci_host *host, struct mmc_data *data);
...@@ -190,6 +190,7 @@ static struct mmci_host_ops qcom_variant_ops = { ...@@ -190,6 +190,7 @@ static struct mmci_host_ops qcom_variant_ops = {
.dma_setup = qcom_dma_setup, .dma_setup = qcom_dma_setup,
.dma_release = mmci_dmae_release, .dma_release = mmci_dmae_release,
.dma_start = mmci_dmae_start, .dma_start = mmci_dmae_start,
.dma_finalize = mmci_dmae_finalize,
}; };
void qcom_variant_init(struct mmci_host *host) void qcom_variant_init(struct mmci_host *host)
......
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