From: 21cnbao@gmail.com (Barry Song)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] mmc: sirf: enable combined dma buffer
Date: Mon, 23 Dec 2013 21:22:04 +0800 [thread overview]
Message-ID: <1387804924-3372-2-git-send-email-21cnbao@gmail.com> (raw)
In-Reply-To: <1387804924-3372-1-git-send-email-21cnbao@gmail.com>
From: Bin Shi <Bin.Shi@csr.com>
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@csr.com>
Signed-off-by: Barry Song <Barry.Song@csr.com>
---
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
prev parent reply other threads:[~2013-12-23 13:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-23 13:22 [PATCH 1/2] mmc: sdhci: combined dma buffer support for sdma Barry Song
2013-12-23 13:22 ` Barry Song [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1387804924-3372-2-git-send-email-21cnbao@gmail.com \
--to=21cnbao@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).