[PATCH 2/2] mmc: sirf: enable combined dma buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Bin Shi <Bin.Shi@xxxxxxx>

To take advantage of combined dma buffer, enable
SDHCI_QUIRK2_SG_LIST_COMBINED_DMA_BUFFER to lift
read/write performance.

Signed-off-by: Bin Shi <Bin.Shi@xxxxxxx>
Signed-off-by: Barry Song <Barry.Song@xxxxxxx>
---
 drivers/mmc/host/sdhci-sirf.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
index 696122c..2933ae4 100644
--- a/drivers/mmc/host/sdhci-sirf.c
+++ b/drivers/mmc/host/sdhci-sirf.c
@@ -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;
 }
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux