Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5115934ybi; Tue, 4 Jun 2019 01:18:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwe1CtxX2MxYRQz426EM2Wvb82UaUv62HbpvhPRLuvmg4ALK5S/ttqzGeWV6ZS4kT/eYwQr X-Received: by 2002:a17:90a:9dc5:: with SMTP id x5mr21028468pjv.110.1559636305088; Tue, 04 Jun 2019 01:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559636305; cv=none; d=google.com; s=arc-20160816; b=zvAQMiG6g8Yc49IEZL2rIbqLi9p5LNUGqqF8BQkCEqcdRJJLelhOIYcJ0Vd4SnibiK U/mZjXByltCyAmrnsnLbww24yTepoFh9PuhwJ7yO5cCv2htOVchnXtk4dwtgnYGkm77K g6lKYijjL9QmFCd1i8bvrtk/2AFLCApBjIC78WH5T9rWO5slfk+Y8PPHKfko5gc/03K7 c8uoFkVknuRdXR/5PJoGlAGs8LQkaEzz7681R8Tl4YUrSRe1zQ/jpVtbCwnModBhDc/m oxa4f7crD+6Wbgg3zFUZL9CtN0hQ4C4aK8PsoNYtqki4M5qdZoTsbcgrhOl7+Ijf015J qUiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=1vxV7xw/5L8i8m4bOyu5pRBcqwZ6n7yFKBRMfko8eAg=; b=G50iYUYcodw+xHlT8lEKQdMfp5GYLNIc79BwdapXWP0Ne2MPKPfI5AZp2gio1/maW4 GwP74a8FpntoGaNNelR6lsVCv3m6B2XVD3MrOJ6D33AHR4FH9US+N9h1mYJdj6SNPL9X SXTxs5UvzPeD9lKFwpYthXx+2Ka110xvaXVZdgsZoOcCiFol2ZK3oXCCYuPPfLMlrVEM CjLighzm6AsgAme+qZPQ4rudeH7KKUVKTscGTdqYdH+cNXFdvIaEIP2LnHrJY+YHw0Cz P7PJGbEs9fr8lbu3N3V1TKS6D2F9OWh8ba4TG8lrzAtXbC/aPJk4XxQxs3t9qWT6+v2I vvVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yF/IS8w7"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si21508128pgk.240.2019.06.04.01.18.08; Tue, 04 Jun 2019 01:18:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yF/IS8w7"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727139AbfFDIPQ (ORCPT + 99 others); Tue, 4 Jun 2019 04:15:16 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:36932 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727118AbfFDIPM (ORCPT ); Tue, 4 Jun 2019 04:15:12 -0400 Received: by mail-pl1-f193.google.com with SMTP id bh12so1960072plb.4 for ; Tue, 04 Jun 2019 01:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=1vxV7xw/5L8i8m4bOyu5pRBcqwZ6n7yFKBRMfko8eAg=; b=yF/IS8w7PJss7KY8M0Wgdbhr4VXw0eZdXylHTkYXpnzppT6cn89MSsaQKKrjC+DtQN 1GtV+NlutX5shDQlf1LrHQXLzThmo4n0NLbMGxqY8RmRnIiR6hfvu8BJoPrg/+oUZHxB +S7jPtfHSDhI+jm1xYZlszQMW6y3F3wkCVj1Hun96siKj9lKc/AhwLiKhSEEM/la8VKX /dexH7LLGORAMf8idnkuxH74+l9ygl2Kvoz/7surXaj1r61Kubiw+dqSgEGF2t3/gI7E zvccHnVXEs90BwkkWUltHssENapZM1r1qHYnT69sGzuHWmyUp9oo0FJhRwKFmJ0zJhcL 3ifQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=1vxV7xw/5L8i8m4bOyu5pRBcqwZ6n7yFKBRMfko8eAg=; b=jlum6xNXmL8HfDRm3wqKUt5ffQiWf02Nov87n2Z4QytAfAMVVYPZ+tgi6VpaP7c0CD SHkL+Lqihrqv3JEg0ECoRAxxNXqeArhxSnaUh6AmlYOl7ipQdxtIGvuq3uwzWGiq55HF ye+AXheVOfKxArjr0pR5vAo+vitZpmRfnfpKDt3g1ASjZEAEvixjhZ9ocFYHNqQUMBdj FvX49hvvGkarAreQwbhemcLn23qRQ/D7O82fBxMGBr50DV1LBjfnOkGEdyQPZcDITRLn JabCSfn7i5FMPZ+3xrdhXJ5IPI0Y9/XMpuKRabdspuI+XDGv5/2HAr3VIH5lmcemLTpg tYOg== X-Gm-Message-State: APjAAAWqRVua9Eu7yaC6q5FW6lbR/nG7ghPTR5DeJDGLCvlNfi/CJaLs 7GxXDMqVanMUx1echr3XllJUYQ== X-Received: by 2002:a17:902:aa0a:: with SMTP id be10mr27683709plb.27.1559636112034; Tue, 04 Jun 2019 01:15:12 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id j4sm14818804pgc.56.2019.06.04.01.15.07 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Jun 2019 01:15:11 -0700 (PDT) From: Baolin Wang To: adrian.hunter@intel.com, ulf.hansson@linaro.org, zhang.lyra@gmail.com, orsonzhai@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, arnd@arndb.de, olof@lixom.net Cc: baolin.wang@linaro.org, vincent.guittot@linaro.org, arm@kernel.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 5/9] mmc: sdhci-sprd: Add HS400 enhanced strobe mode Date: Tue, 4 Jun 2019 16:14:25 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add HS400 enhanced strobe mode support for Spreadtrum SD host controller. Signed-off-by: Baolin Wang Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-sprd.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c index d91281d..edec197 100644 --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -41,6 +41,7 @@ /* SDHCI_HOST_CONTROL2 */ #define SDHCI_SPRD_CTRL_HS200 0x0005 #define SDHCI_SPRD_CTRL_HS400 0x0006 +#define SDHCI_SPRD_CTRL_HS400ES 0x0007 /* * According to the standard specification, BIT(3) of SDHCI_SOFTWARE_RESET is @@ -132,6 +133,15 @@ static inline void sdhci_sprd_sd_clk_off(struct sdhci_host *host) sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); } +static inline void sdhci_sprd_sd_clk_on(struct sdhci_host *host) +{ + u16 ctrl; + + ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL); + ctrl |= SDHCI_CLOCK_CARD_EN; + sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); +} + static inline void sdhci_sprd_set_dll_invert(struct sdhci_host *host, u32 mask, bool en) { @@ -325,6 +335,26 @@ static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) sdhci_request(mmc, mrq); } +static void sdhci_sprd_hs400_enhanced_strobe(struct mmc_host *mmc, + struct mmc_ios *ios) +{ + struct sdhci_host *host = mmc_priv(mmc); + u16 ctrl_2; + + if (!ios->enhanced_strobe) + return; + + sdhci_sprd_sd_clk_off(host); + + /* Set HS400 enhanced strobe mode */ + ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + ctrl_2 &= ~SDHCI_CTRL_UHS_MASK; + ctrl_2 |= SDHCI_SPRD_CTRL_HS400ES; + sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); + + sdhci_sprd_sd_clk_on(host); +} + static const struct sdhci_pltfm_data sdhci_sprd_pdata = { .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK, .quirks2 = SDHCI_QUIRK2_BROKEN_HS200 | @@ -346,6 +376,8 @@ static int sdhci_sprd_probe(struct platform_device *pdev) host->dma_mask = DMA_BIT_MASK(64); pdev->dev.dma_mask = &host->dma_mask; host->mmc_host_ops.request = sdhci_sprd_request; + host->mmc_host_ops.hs400_enhanced_strobe = + sdhci_sprd_hs400_enhanced_strobe; host->mmc->caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_ERASE | MMC_CAP_CMD23; -- 1.7.9.5