Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753001AbcD2CtC (ORCPT ); Thu, 28 Apr 2016 22:49:02 -0400 Received: from lucky1.263xmail.com ([211.157.147.131]:42748 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752950AbcD2Cs7 (ORCPT ); Thu, 28 Apr 2016 22:48:59 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 X-KSVirus-check: 0 X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: adrian.hunter@intel.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <51660d585e0cc9bf2e53455e45d3e7a4> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Shawn Lin To: Adrian Hunter , Ulf Hansson Cc: Jaehoon Chung , Michal Simek , soren.brinkmann@xilinx.com, Rob Herring , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Doug Anderson , Heiko Stuebner , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Shawn Lin Subject: [PATCH v2 6/6] mmc: sdhci-of-arasan: overwrite enhanced strobe callback Date: Fri, 29 Apr 2016 10:48:34 +0800 Message-Id: <1461898114-29067-1-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1461897751-28810-1-git-send-email-shawn.lin@rock-chips.com> References: <1461897751-28810-1-git-send-email-shawn.lin@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1857 Lines: 64 Currently sdhci-arasan 5.1 can support enhanced strobe function, and we now limit it just for "arasan,sdhci-5.1". Add mmc-hs400-enhanced-strobe in DT to enable the function if we'r sure our controller can support it. Signed-off-by: Shawn Lin --- Changes in v2: None drivers/mmc/host/sdhci-of-arasan.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index 20b859e..a0e4536 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -25,7 +25,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 @@ -73,6 +75,23 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock) phy_power_on(sdhci_arasan->phy); } +static int sdhci_arasan_enhanced_strobe(struct mmc_host *mmc, + bool enable) +{ + u32 vendor; + struct sdhci_host *host = mmc_priv(mmc); + + 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_arasan_set_clock, .get_max_clock = sdhci_pltfm_clk_get_max_clock, @@ -239,6 +258,9 @@ static int sdhci_arasan_probe(struct platform_device *pdev) dev_err(&pdev->dev, "phy_power_on err.\n"); goto err_phy_power; } + + host->mmc_host_ops.prepare_enhanced_strobe = + sdhci_arasan_enhanced_strobe; } ret = sdhci_add_host(host); -- 2.3.7