#include <linux/kernel.h>
#include <linux/clk.h>
+#include <linux/dmaengine.h>
#include <linux/slab.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
mmc_detect_change(dev_get_drvdata(&pdev->dev), msecs_to_jiffies(100));
}
+static bool sh_mobile_sdhi_filter(struct dma_chan *chan, void *arg)
+{
+ dev_dbg(chan->device->dev, "%s: slave data %p\n", __func__, arg);
+ chan->private = arg;
+ return true;
+}
+
static const struct sh_mobile_sdhi_ops sdhi_ops = {
.cd_wakeup = sh_mobile_sdhi_cd_wakeup,
};
priv->dma_priv.chan_priv_tx = &priv->param_tx.shdma_slave;
priv->dma_priv.chan_priv_rx = &priv->param_rx.shdma_slave;
priv->dma_priv.alignment_shift = 1; /* 2-byte alignment */
+ priv->dma_priv.filter = sh_mobile_sdhi_filter;
mmc_data->dma = &priv->dma_priv;
}
}
spin_unlock_irq(&host->lock);
}
-/* It might be necessary to make filter MFD specific */
-static bool tmio_mmc_filter(struct dma_chan *chan, void *arg)
-{
- dev_dbg(chan->device->dev, "%s: slave data %p\n", __func__, arg);
- chan->private = arg;
- return true;
-}
-
void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata)
{
/* We can only either use DMA for both Tx and Rx or not use it at all */
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
- host->chan_tx = dma_request_channel(mask, tmio_mmc_filter,
+ host->chan_tx = dma_request_channel(mask, pdata->dma->filter,
pdata->dma->chan_priv_tx);
dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__,
host->chan_tx);
if (!host->chan_tx)
return;
- host->chan_rx = dma_request_channel(mask, tmio_mmc_filter,
+ host->chan_rx = dma_request_channel(mask, pdata->dma->filter,
pdata->dma->chan_priv_rx);
dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__,
host->chan_rx);
void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
+struct dma_chan;
+
struct tmio_mmc_dma {
void *chan_priv_tx;
void *chan_priv_rx;
int alignment_shift;
+ bool (*filter)(struct dma_chan *chan, void *arg);
};
struct tmio_mmc_host;