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

mmc: mmci: add dma_error callback

This patch adds dma_error 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 5a9f10c3
...@@ -469,6 +469,15 @@ void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data) ...@@ -469,6 +469,15 @@ void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data)
host->ops->dma_finalize(host, data); host->ops->dma_finalize(host, data);
} }
void mmci_dma_error(struct mmci_host *host)
{
if (!host->use_dma)
return;
if (host->ops && host->ops->dma_error)
host->ops->dma_error(host);
}
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)
{ {
...@@ -633,11 +642,11 @@ static void mmci_dma_unmap(struct mmci_host *host, struct mmc_data *data) ...@@ -633,11 +642,11 @@ static void mmci_dma_unmap(struct mmci_host *host, struct mmc_data *data)
mmc_get_dma_dir(data)); mmc_get_dma_dir(data));
} }
static void mmci_dma_data_error(struct mmci_host *host) void mmci_dmae_error(struct mmci_host *host)
{ {
struct mmci_dmae_priv *dmae = host->dma_priv; struct mmci_dmae_priv *dmae = host->dma_priv;
if (!host->use_dma || !dma_inprogress(host)) if (!dma_inprogress(host))
return; return;
dev_err(mmc_dev(host->mmc), "error during DMA transfer!\n"); dev_err(mmc_dev(host->mmc), "error during DMA transfer!\n");
...@@ -674,7 +683,7 @@ void mmci_dmae_finalize(struct mmci_host *host, struct mmc_data *data) ...@@ -674,7 +683,7 @@ void mmci_dmae_finalize(struct mmci_host *host, struct mmc_data *data)
* contiguous buffers. On TX, we'll get a FIFO underrun error. * contiguous buffers. On TX, we'll get a FIFO underrun error.
*/ */
if (status & MCI_RXDATAAVLBLMASK) { if (status & MCI_RXDATAAVLBLMASK) {
mmci_dma_data_error(host); mmci_dma_error(host);
if (!data->error) if (!data->error)
data->error = -EIO; data->error = -EIO;
} else if (!data->host_cookie) { } else if (!data->host_cookie) {
...@@ -854,18 +863,13 @@ static struct mmci_host_ops mmci_variant_ops = { ...@@ -854,18 +863,13 @@ static struct mmci_host_ops mmci_variant_ops = {
.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, .dma_finalize = mmci_dmae_finalize,
.dma_error = mmci_dmae_error,
}; };
void mmci_variant_init(struct mmci_host *host) void mmci_variant_init(struct mmci_host *host)
{ {
host->ops = &mmci_variant_ops; host->ops = &mmci_variant_ops;
} }
#else
/* Blank functions if the DMA engine is not available */
static inline void mmci_dma_data_error(struct mmci_host *host)
{
}
#endif #endif
static void mmci_pre_request(struct mmc_host *mmc, struct mmc_request *mrq) static void mmci_pre_request(struct mmc_host *mmc, struct mmc_request *mrq)
...@@ -1037,7 +1041,7 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, ...@@ -1037,7 +1041,7 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
u32 remain, success; u32 remain, success;
/* Terminate the DMA transfer */ /* Terminate the DMA transfer */
mmci_dma_data_error(host); mmci_dma_error(host);
/* /*
* Calculate how far we are into the transfer. Note that * Calculate how far we are into the transfer. Note that
...@@ -1183,7 +1187,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, ...@@ -1183,7 +1187,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,
if ((!sbc && !cmd->data) || cmd->error) { if ((!sbc && !cmd->data) || cmd->error) {
if (host->data) { if (host->data) {
/* Terminate the DMA transfer */ /* Terminate the DMA transfer */
mmci_dma_data_error(host); mmci_dma_error(host);
mmci_stop_data(host); mmci_stop_data(host);
} }
......
...@@ -282,6 +282,7 @@ struct mmci_host_ops { ...@@ -282,6 +282,7 @@ struct mmci_host_ops {
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); void (*dma_finalize)(struct mmci_host *host, struct mmc_data *data);
void (*dma_error)(struct mmci_host *host);
}; };
struct mmci_host { struct mmci_host {
...@@ -343,3 +344,4 @@ int mmci_dmae_setup(struct mmci_host *host); ...@@ -343,3 +344,4 @@ 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); void mmci_dmae_finalize(struct mmci_host *host, struct mmc_data *data);
void mmci_dmae_error(struct mmci_host *host);
...@@ -191,6 +191,7 @@ static struct mmci_host_ops qcom_variant_ops = { ...@@ -191,6 +191,7 @@ static struct mmci_host_ops qcom_variant_ops = {
.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, .dma_finalize = mmci_dmae_finalize,
.dma_error = mmci_dmae_error,
}; };
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