@@ -8,6 +8,7 @@
#include <linux/delay.h>
#include <linux/device.h>
+#include <linux/dma-mapping.h>
#include <linux/mmc/host.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -38,6 +39,7 @@ static struct sdhci_pltfm_data sdhci_sirf_pdata = {
SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
SDHCI_QUIRK_DELAY_AFTER_POWER,
+ .quirks2 = SDHCI_QUIRK2_SG_LIST_COMBINED_DMA_BUFFER,
};
static int sdhci_sirf_probe(struct platform_device *pdev)
@@ -75,6 +77,11 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
if (ret)
goto err_clk_prepare;
+ host->combined_dma_buffer = dma_alloc_coherent(&pdev->dev,
+ SZ_1M, &host->combined_dma_addr, GFP_KERNEL | GFP_DMA);
+ if (!host->combined_dma_buffer)
+ goto err_request_dma;
+
ret = sdhci_add_host(host);
if (ret)
goto err_sdhci_add;
@@ -97,6 +104,9 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
err_request_cd:
sdhci_remove_host(host, 0);
err_sdhci_add:
+ dma_free_coherent(&pdev->dev, SZ_1M, host->combined_dma_buffer,
+ host->combined_dma_addr);
+err_request_dma:
clk_disable_unprepare(priv->clk);
err_clk_prepare:
sdhci_pltfm_free(pdev);
@@ -114,6 +124,9 @@ static int sdhci_sirf_remove(struct platform_device *pdev)
if (gpio_is_valid(priv->gpio_cd))
mmc_gpio_free_cd(host->mmc);
+ dma_free_coherent(&pdev->dev, SZ_1M, host->combined_dma_buffer,
+ host->combined_dma_addr);
+
clk_disable_unprepare(priv->clk);
return 0;
}