diff options
author | Hein_Tibosch <hein_tibosch@yahoo.es> | 2012-08-30 12:34:38 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-10-03 10:05:22 -0400 |
commit | ccdfe6122f61b40592820d48b4cde021295418a0 (patch) | |
tree | 79863d1a3442cee855f3e693d7d6cc7923b462a2 | |
parent | ac940938df138acd241dc5ae9a933416da036a35 (diff) |
mmc: atmel-mci: DMA can be used with other controllers
After the latest changes to atmel-mci, it could not be used with
DMA on the AVR32 platform. This patch will allow to use DMA again
and it will avoid access to MCI register ATMCI_DMA.
Even if the IP version is lower than v3xx and doesn't have the DMA
configuration register, DMA transfers can be used with a different
controller than the Atmel AHB DMA one. For instance, some AVR chips
use the Synopsys DesignWare AHB DMA controller.
Signed-off-by: Hein Tibosch <hein_tibosch@yahoo.es>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r-- | drivers/mmc/host/atmel-mci.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 8c72828239b2..6823d963376e 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -74,7 +74,7 @@ enum atmci_pdc_buf { | |||
74 | }; | 74 | }; |
75 | 75 | ||
76 | struct atmel_mci_caps { | 76 | struct atmel_mci_caps { |
77 | bool has_dma; | 77 | bool has_dma_conf_reg; |
78 | bool has_pdc; | 78 | bool has_pdc; |
79 | bool has_cfg_reg; | 79 | bool has_cfg_reg; |
80 | bool has_cstor_reg; | 80 | bool has_cstor_reg; |
@@ -421,7 +421,7 @@ static int atmci_regs_show(struct seq_file *s, void *v) | |||
421 | atmci_show_status_reg(s, "SR", buf[ATMCI_SR / 4]); | 421 | atmci_show_status_reg(s, "SR", buf[ATMCI_SR / 4]); |
422 | atmci_show_status_reg(s, "IMR", buf[ATMCI_IMR / 4]); | 422 | atmci_show_status_reg(s, "IMR", buf[ATMCI_IMR / 4]); |
423 | 423 | ||
424 | if (host->caps.has_dma) { | 424 | if (host->caps.has_dma_conf_reg) { |
425 | u32 val; | 425 | u32 val; |
426 | 426 | ||
427 | val = buf[ATMCI_DMA / 4]; | 427 | val = buf[ATMCI_DMA / 4]; |
@@ -841,7 +841,7 @@ static void atmci_dma_complete(void *arg) | |||
841 | 841 | ||
842 | dev_vdbg(&host->pdev->dev, "DMA complete\n"); | 842 | dev_vdbg(&host->pdev->dev, "DMA complete\n"); |
843 | 843 | ||
844 | if (host->caps.has_dma) | 844 | if (host->caps.has_dma_conf_reg) |
845 | /* Disable DMA hardware handshaking on MCI */ | 845 | /* Disable DMA hardware handshaking on MCI */ |
846 | atmci_writel(host, ATMCI_DMA, atmci_readl(host, ATMCI_DMA) & ~ATMCI_DMAEN); | 846 | atmci_writel(host, ATMCI_DMA, atmci_readl(host, ATMCI_DMA) & ~ATMCI_DMAEN); |
847 | 847 | ||
@@ -1028,7 +1028,9 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
1028 | maxburst = atmci_convert_chksize(host->dma_conf.dst_maxburst); | 1028 | maxburst = atmci_convert_chksize(host->dma_conf.dst_maxburst); |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(maxburst) | ATMCI_DMAEN); | 1031 | if (host->caps.has_dma_conf_reg) |
1032 | atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(maxburst) | | ||
1033 | ATMCI_DMAEN); | ||
1032 | 1034 | ||
1033 | sglen = dma_map_sg(chan->device->dev, data->sg, | 1035 | sglen = dma_map_sg(chan->device->dev, data->sg, |
1034 | data->sg_len, direction); | 1036 | data->sg_len, direction); |
@@ -2243,7 +2245,10 @@ static bool atmci_configure_dma(struct atmel_mci *host) | |||
2243 | 2245 | ||
2244 | pdata = host->pdev->dev.platform_data; | 2246 | pdata = host->pdev->dev.platform_data; |
2245 | 2247 | ||
2246 | if (pdata && find_slave_dev(pdata->dma_slave)) { | 2248 | if (!pdata) |
2249 | return false; | ||
2250 | |||
2251 | if (pdata->dma_slave && find_slave_dev(pdata->dma_slave)) { | ||
2247 | dma_cap_mask_t mask; | 2252 | dma_cap_mask_t mask; |
2248 | 2253 | ||
2249 | /* Try to grab a DMA channel */ | 2254 | /* Try to grab a DMA channel */ |
@@ -2284,7 +2289,7 @@ static void __init atmci_get_cap(struct atmel_mci *host) | |||
2284 | dev_info(&host->pdev->dev, | 2289 | dev_info(&host->pdev->dev, |
2285 | "version: 0x%x\n", version); | 2290 | "version: 0x%x\n", version); |
2286 | 2291 | ||
2287 | host->caps.has_dma = 0; | 2292 | host->caps.has_dma_conf_reg = 0; |
2288 | host->caps.has_pdc = 1; | 2293 | host->caps.has_pdc = 1; |
2289 | host->caps.has_cfg_reg = 0; | 2294 | host->caps.has_cfg_reg = 0; |
2290 | host->caps.has_cstor_reg = 0; | 2295 | host->caps.has_cstor_reg = 0; |
@@ -2302,12 +2307,7 @@ static void __init atmci_get_cap(struct atmel_mci *host) | |||
2302 | host->caps.has_odd_clk_div = 1; | 2307 | host->caps.has_odd_clk_div = 1; |
2303 | case 0x400: | 2308 | case 0x400: |
2304 | case 0x300: | 2309 | case 0x300: |
2305 | #ifdef CONFIG_AT_HDMAC | 2310 | host->caps.has_dma_conf_reg = 1; |
2306 | host->caps.has_dma = 1; | ||
2307 | #else | ||
2308 | dev_info(&host->pdev->dev, | ||
2309 | "has dma capability but dma engine is not selected, then use pio\n"); | ||
2310 | #endif | ||
2311 | host->caps.has_pdc = 0; | 2311 | host->caps.has_pdc = 0; |
2312 | host->caps.has_cfg_reg = 1; | 2312 | host->caps.has_cfg_reg = 1; |
2313 | host->caps.has_cstor_reg = 1; | 2313 | host->caps.has_cstor_reg = 1; |
@@ -2388,7 +2388,7 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
2388 | 2388 | ||
2389 | /* Get MCI capabilities and set operations according to it */ | 2389 | /* Get MCI capabilities and set operations according to it */ |
2390 | atmci_get_cap(host); | 2390 | atmci_get_cap(host); |
2391 | if (host->caps.has_dma && atmci_configure_dma(host)) { | 2391 | if (atmci_configure_dma(host)) { |
2392 | host->prepare_data = &atmci_prepare_data_dma; | 2392 | host->prepare_data = &atmci_prepare_data_dma; |
2393 | host->submit_data = &atmci_submit_data_dma; | 2393 | host->submit_data = &atmci_submit_data_dma; |
2394 | host->stop_transfer = &atmci_stop_transfer_dma; | 2394 | host->stop_transfer = &atmci_stop_transfer_dma; |