diff options
| author | Ludovic Desroches <ludovic.desroches@atmel.com> | 2013-04-19 05:11:22 -0400 |
|---|---|---|
| committer | Chris Ball <cjb@laptop.org> | 2013-05-26 13:32:13 -0400 |
| commit | 8c964df07aaf0e70d1756d204c306f69ca5023b8 (patch) | |
| tree | 247cd1e7e49ce57fcad9ab1107834dbd7b536d09 | |
| parent | 361b8482026c926997b1d3d5a045bc9f5bc02b16 (diff) | |
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: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
| -rw-r--r-- | drivers/mmc/host/atmel-mci.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index e75774f72606..aca59d93d5a9 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
| @@ -2230,10 +2230,15 @@ static void __exit atmci_cleanup_slot(struct atmel_mci_slot *slot, | |||
| 2230 | mmc_free_host(slot->mmc); | 2230 | mmc_free_host(slot->mmc); |
| 2231 | } | 2231 | } |
| 2232 | 2232 | ||
| 2233 | static bool atmci_filter(struct dma_chan *chan, void *slave) | 2233 | static bool atmci_filter(struct dma_chan *chan, void *pdata) |
| 2234 | { | 2234 | { |
| 2235 | struct mci_dma_data *sl = slave; | 2235 | struct mci_platform_data *sl_pdata = pdata; |
| 2236 | struct mci_dma_data *sl; | ||
| 2236 | 2237 | ||
| 2238 | if (!sl_pdata) | ||
| 2239 | return false; | ||
| 2240 | |||
| 2241 | sl = sl_pdata->dma_slave; | ||
| 2237 | if (sl && find_slave_dev(sl) == chan->device->dev) { | 2242 | if (sl && find_slave_dev(sl) == chan->device->dev) { |
| 2238 | chan->private = slave_data_ptr(sl); | 2243 | chan->private = slave_data_ptr(sl); |
| 2239 | return true; | 2244 | return true; |
| @@ -2245,24 +2250,18 @@ static bool atmci_filter(struct dma_chan *chan, void *slave) | |||
| 2245 | static bool atmci_configure_dma(struct atmel_mci *host) | 2250 | static bool atmci_configure_dma(struct atmel_mci *host) |
| 2246 | { | 2251 | { |
| 2247 | struct mci_platform_data *pdata; | 2252 | struct mci_platform_data *pdata; |
| 2253 | dma_cap_mask_t mask; | ||
| 2248 | 2254 | ||
| 2249 | if (host == NULL) | 2255 | if (host == NULL) |
| 2250 | return false; | 2256 | return false; |
| 2251 | 2257 | ||
| 2252 | pdata = host->pdev->dev.platform_data; | 2258 | pdata = host->pdev->dev.platform_data; |
| 2253 | 2259 | ||
| 2254 | if (!pdata) | 2260 | dma_cap_zero(mask); |
| 2255 | return false; | 2261 | dma_cap_set(DMA_SLAVE, mask); |
| 2256 | 2262 | ||
| 2257 | if (pdata->dma_slave && find_slave_dev(pdata->dma_slave)) { | 2263 | host->dma.chan = dma_request_slave_channel_compat(mask, atmci_filter, pdata, |
| 2258 | dma_cap_mask_t mask; | 2264 | &host->pdev->dev, "rxtx"); |
| 2259 | |||
| 2260 | /* Try to grab a DMA channel */ | ||
| 2261 | dma_cap_zero(mask); | ||
| 2262 | dma_cap_set(DMA_SLAVE, mask); | ||
| 2263 | host->dma.chan = | ||
| 2264 | dma_request_channel(mask, atmci_filter, pdata->dma_slave); | ||
| 2265 | } | ||
| 2266 | if (!host->dma.chan) { | 2265 | if (!host->dma.chan) { |
| 2267 | dev_warn(&host->pdev->dev, "no DMA channel available\n"); | 2266 | dev_warn(&host->pdev->dev, "no DMA channel available\n"); |
| 2268 | return false; | 2267 | return false; |
