Commit 8c964df0 authored by Ludovic Desroches's avatar Ludovic Desroches Committed by Chris Ball

mmc: atmel-mci: convert to dma_request_slave_channel_compat()

Use generic DMA DT helper. Platforms booting with or without DT populated
are both supported.
Signed-off-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
Acked-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 361b8482
...@@ -2230,10 +2230,15 @@ static void __exit atmci_cleanup_slot(struct atmel_mci_slot *slot, ...@@ -2230,10 +2230,15 @@ static void __exit atmci_cleanup_slot(struct atmel_mci_slot *slot,
mmc_free_host(slot->mmc); mmc_free_host(slot->mmc);
} }
static bool atmci_filter(struct dma_chan *chan, void *slave) static bool atmci_filter(struct dma_chan *chan, void *pdata)
{ {
struct mci_dma_data *sl = slave; struct mci_platform_data *sl_pdata = pdata;
struct mci_dma_data *sl;
if (!sl_pdata)
return false;
sl = sl_pdata->dma_slave;
if (sl && find_slave_dev(sl) == chan->device->dev) { if (sl && find_slave_dev(sl) == chan->device->dev) {
chan->private = slave_data_ptr(sl); chan->private = slave_data_ptr(sl);
return true; return true;
...@@ -2245,24 +2250,18 @@ static bool atmci_filter(struct dma_chan *chan, void *slave) ...@@ -2245,24 +2250,18 @@ static bool atmci_filter(struct dma_chan *chan, void *slave)
static bool atmci_configure_dma(struct atmel_mci *host) static bool atmci_configure_dma(struct atmel_mci *host)
{ {
struct mci_platform_data *pdata; struct mci_platform_data *pdata;
dma_cap_mask_t mask;
if (host == NULL) if (host == NULL)
return false; return false;
pdata = host->pdev->dev.platform_data; pdata = host->pdev->dev.platform_data;
if (!pdata) dma_cap_zero(mask);
return false; dma_cap_set(DMA_SLAVE, mask);
if (pdata->dma_slave && find_slave_dev(pdata->dma_slave)) { host->dma.chan = dma_request_slave_channel_compat(mask, atmci_filter, pdata,
dma_cap_mask_t mask; &host->pdev->dev, "rxtx");
/* Try to grab a DMA channel */
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
host->dma.chan =
dma_request_channel(mask, atmci_filter, pdata->dma_slave);
}
if (!host->dma.chan) { if (!host->dma.chan) {
dev_warn(&host->pdev->dev, "no DMA channel available\n"); dev_warn(&host->pdev->dev, "no DMA channel available\n");
return false; return false;
......
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