public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: Michal Simek <michal.simek@xilinx.com>,
	soren.brinkmann@xilinx.com, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Shawn Lin <shawn.lin@rock-chips.com>
Subject: [RFC PATCH 4/4] mmc: sdhci-of-arasan: overwrite enhanced strobe callback
Date: Thu,  3 Mar 2016 10:36:53 +0800	[thread overview]
Message-ID: <1456972613-8159-1-git-send-email-shawn.lin@rock-chips.com> (raw)
In-Reply-To: <1456972557-7994-1-git-send-email-shawn.lin@rock-chips.com>

Currently sdhci-arasan 5.1 can support enhanced strobe function,
but considering the potential requirement in the future for other
version IP, we don't limit it just for "arasan,sdhci-5.1". Add
cap-enhanced-strobe in DT to enable the function if we'r sure our
controller can support it.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/mmc/host/sdhci-of-arasan.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 1e4b5e0..31f3494 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -24,7 +24,9 @@
 #include "sdhci-pltfm.h"
 
 #define SDHCI_ARASAN_CLK_CTRL_OFFSET	0x2c
+#define SDHCI_ARASAN_VENDOR_REGISTER	0x78
 
+#define VENDOR_ENHANCED_STROBE		BIT(0)
 #define CLK_CTRL_TIMEOUT_SHIFT		16
 #define CLK_CTRL_TIMEOUT_MASK		(0xf << CLK_CTRL_TIMEOUT_SHIFT)
 #define CLK_CTRL_TIMEOUT_MIN_EXP	13
@@ -52,6 +54,21 @@ static unsigned int sdhci_arasan_get_timeout_clock(struct sdhci_host *host)
 	return freq;
 }
 
+static int sdhci_arasan_enhanced_strobe(struct sdhci_host *host, bool enable)
+{
+	u32 vendor;
+
+	vendor = readl(host->ioaddr + SDHCI_ARASAN_VENDOR_REGISTER);
+	if (enable)
+		vendor |= VENDOR_ENHANCED_STROBE;
+	else
+		vendor &= (~VENDOR_ENHANCED_STROBE);
+
+	writel(vendor, host->ioaddr + SDHCI_ARASAN_VENDOR_REGISTER);
+
+	return 0;
+}
+
 static struct sdhci_ops sdhci_arasan_ops = {
 	.set_clock = sdhci_set_clock,
 	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
@@ -172,6 +189,9 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	sdhci_get_of_property(pdev);
 	pltfm_host->clk = clk_xin;
 
+	host->mmc_host_ops.prepare_enhanced_strobe =
+					sdhci_arasan_enhanced_strobe;
+
 	ret = mmc_of_parse(host->mmc);
 	if (ret) {
 		dev_err(&pdev->dev, "parsing dt failed (%u)\n", ret);
-- 
2.3.7

  parent reply	other threads:[~2016-03-03  2:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03  2:35 [RFC PATCH 0/4] Add enhanced strobe support for emmc version 5.1 or later Shawn Lin
2016-03-03  2:36 ` [RFC PATCH 1/4] mmc: core: add cap-enhanced-strobe support Shawn Lin
2016-03-03 12:08   ` Jaehoon Chung
2016-03-04  1:39     ` Shawn Lin
2016-03-03  2:36 ` [RFC PATCH 2/4] mmc: core: implement enhanced strobe support Shawn Lin
2016-03-03 13:37   ` Adrian Hunter
2016-03-04  2:00     ` Shawn Lin
2016-03-03  2:36 ` [RFC PATCH 3/4] mmc: sdhci: implement enhanced strobe callback Shawn Lin
2016-03-03  2:36 ` Shawn Lin [this message]
2016-03-03 11:02   ` [RFC PATCH 4/4] mmc: sdhci-of-arasan: overwrite " Michal Simek
2016-03-03 11:37     ` Shawn Lin

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=1456972613-8159-1-git-send-email-shawn.lin@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=adrian.hunter@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=soren.brinkmann@xilinx.com \
    --cc=ulf.hansson@linaro.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