From patchwork Mon May 20 10:11:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 164581 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp93903ili; Mon, 20 May 2019 03:12:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1GbO05vR15HwslVgjRinFPJMYttR1/wq3ZCEOA9XEf4uQ98Pd3cbNboX0jwM7P7Mh5tai X-Received: by 2002:a63:b901:: with SMTP id z1mr63830674pge.102.1558347163672; Mon, 20 May 2019 03:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558347163; cv=none; d=google.com; s=arc-20160816; b=N4wHyM2v3RnunNCiC9Oe0u2hoTp32vOQmvNpKA03pRZ1YY9BLtybpkDXvy1qORHmRY Fu5S8IQ0Bg1ZyOOqvCXbN3h/Sk+jcZFF757h44X2T+KPVjOLBnx5f7uvi+1+4x2sv8K6 8AeRxITU66nUFDDuYVIZW2ZZpY9vr2bf9QTmesvFdYsLkvT9BYyR6oPCQXdyJBjNblnu rCjzUt/u0c7oRPq8EKCNmlQihX6OjUbknlkJUfEQSlJDHfshyeMOUp+8BkaPTlyfK9yk B5kcg7bYVa4bLVD3DWuAKsLwvlOyDpzFxp4gUE6SkzOFJwgSXImHNm4rfpwWZavj030k zS6w== 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=eMFBxEvVv73muoLZwkqzMu7EIBYQwUE2J5IELje2f28=; b=KsUdgLOfGeUikIhcYjoREJwM1i4+FtVxaICPmNihaKk57a1cTSIzw1IS7enu4b68FY AO6+l50zum5K0BLBUKzeZlwo3CGB8mWTJ2Byv9XtmeFN/0Zlq5xEQ1wxR3Z7oBjpOKXH W7Lg8iIj52Pt1LrOh5oex4VYydBv+IhI7AsNYz6eA3LPHpwgKbSauaXT32j85vRStEXM agDv25nqjlSyLv9JZdyzjziJ2H3UkDxOkU7fwViVUpiMkRFlbGjwEHOmlyk2wIZYheNI 6J+c61trpwBj3H+AENTVFHBXcDTyUkRw+ejIAEf7j029oElekNYkkNTIf7xtW9XLGbPm u49g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yhDed4i3; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 n4si17101172pgq.69.2019.05.20.03.12.43; Mon, 20 May 2019 03:12:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-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=yhDed4i3; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 S1732471AbfETKMm (ORCPT + 5 others); Mon, 20 May 2019 06:12:42 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:34503 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732459AbfETKMm (ORCPT ); Mon, 20 May 2019 06:12:42 -0400 Received: by mail-pl1-f196.google.com with SMTP id w7so6519578plz.1 for ; Mon, 20 May 2019 03:12:41 -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=eMFBxEvVv73muoLZwkqzMu7EIBYQwUE2J5IELje2f28=; b=yhDed4i3RBqLUdnBe0hSuSFflewfmbhjRUNIe2b4fdBam6M4LQXIcG30ecgTYWvlC+ 9dU9LfmgcnAP8zsReUaDsEr5Xkmyy+W+pifErnX2xqlkaoUVT84a6aehb3b8pawL92iR tQ54TONm22Ktua4YOvnugQXU4KlKB/1aAcPyvWXSuSW64HljYJCqgd1DWuOatqdmXFRj 6fwiys1x5GW60TDPFElDeyOzqvrhUcpcfeidDVdlaDIaMX7F8nJhoUWFquwJiMN01rG0 u66gGoyroNQY7cRQKDV72UuHYZm6w3oFXuDHMj6WbC0ofrey3hgNjnN5j00zbksct8+W nhvA== 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=eMFBxEvVv73muoLZwkqzMu7EIBYQwUE2J5IELje2f28=; b=ZxO1NZgynTRlzCyXHjTUwo0EC6YB2R89+4gxM6ti6FIcI/8UVTYRT5i/g8nhcVpIr0 tj+q6m71cSfWKpVQzTeZhhKBB0FAhMyJg+WGZhKYEWNcgzEj+8pEi9d44Vcu+jAdQ+7m dSPVIN09JEzQTFTw/4f7UaAmNFNCw9GTxQWNL5zzV5RuuP3Nkn4krBZ/6Edm5K3OMRGW yvMzJRKK3KHRq9aMsh4x6p57SidMazbVudp2E0wvXgA3A9FNGdjHT9Gc9yuFHHu5B1eE 00SNhTC25UZORjaZZda07PUkkheOmiJXkbnuko1aiRGIdr75tQfK+re+ZH5WEpcOeQUH 386Q== X-Gm-Message-State: APjAAAW0hZppNGtt8UgCeQG5thZv+8nJ5HVIqKWhNJCieJTXxMzPrImE 3ZIPpFOqwW6OlpqHwjKCTI9qeA== X-Received: by 2002:a17:902:6ac6:: with SMTP id i6mr75225533plt.336.1558347160980; Mon, 20 May 2019 03:12:40 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id b3sm30098127pfr.146.2019.05.20.03.12.36 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 May 2019 03:12:40 -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 4/9] mmc: sdhci-sprd: Implement the get_max_timeout_count() interface Date: Mon, 20 May 2019 18:11:57 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Implement the get_max_timeout_count() interface to set the Spredtrum SD host controller actual maximum timeout count. Signed-off-by: Baolin Wang --- drivers/mmc/host/sdhci-sprd.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 1.7.9.5 Acked-by: Adrian Hunter diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c index 31ba7d6..d91281d 100644 --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -285,6 +285,12 @@ static void sdhci_sprd_hw_reset(struct sdhci_host *host) usleep_range(300, 500); } +static unsigned int sdhci_sprd_get_max_timeout_count(struct sdhci_host *host) +{ + /* The Spredtrum controller actual maximum timeout count is 1 << 31 */ + return 1 << 31; +} + static struct sdhci_ops sdhci_sprd_ops = { .read_l = sdhci_sprd_readl, .write_l = sdhci_sprd_writel, @@ -296,6 +302,7 @@ static void sdhci_sprd_hw_reset(struct sdhci_host *host) .reset = sdhci_reset, .set_uhs_signaling = sdhci_sprd_set_uhs_signaling, .hw_reset = sdhci_sprd_hw_reset, + .get_max_timeout_count = sdhci_sprd_get_max_timeout_count, }; static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) From patchwork Mon May 20 10:11:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 164583 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp93962ili; Mon, 20 May 2019 03:12:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyscxfMV40HvYT2TsB0AHFs8O/F9nCQmm37L0FAepsNmvGVGvHevjHCHIwS5L60jwoULFsa X-Received: by 2002:aa7:8289:: with SMTP id s9mr78704732pfm.208.1558347167648; Mon, 20 May 2019 03:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558347167; cv=none; d=google.com; s=arc-20160816; b=X/EFScyIfENZJV/KR0bDiXQEJI09kHjF9Hd4rVUcUa8o7PzpyXDEbkgH/tyeIDDkpa cA3mY5GyBaFqblXlYRTFtdTigW67pzN0R3M7W2CdAwqcJUWJRXWhmkjCGaGdsf+pG5CD g67DtKwycIIZj9ZWiTtha2l7OZfq3tfNtENAoebR5cun7WV1ydlN4gjTFvPLmVFHZ7Az qcuRPI3K8ajFqx7duxDyhkU2wbZ3WKw11Yr7rIX6SQP3Qh2GUoAmgzqPZk6zDEcUblP3 fUTCgsNEuDwbUtV7IxpCjS0pGo2/KAPmbNzRz8sVMXTUKSQg6cQcVywyJJ/RMaZxf2Xw Dwrg== 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=FYWsY1+N4H7CLwGBpVFg0VRy5BIrNigGYHZlus/sqGQ=; b=z5BuyAw0Ztw/cKzhjd2X7OneX49B8QxR1WfSyH63NEbmgpQLVvFxZ2gSnNxrOCk0xs 5emFfwavQDIeIof5VIwSI4vpOZgatOV9VPczGL4O8DUtLFDsfZOA9pngL3Nd5zEa3GUX fTmnyIFUoXAz+E2YK68d7SJ3+Ano720skLMcbXd3xozn5EmK7E7MvAx2LYNISDKmQab1 ZBbKZihbdWmW/nOWAZ7ZW9/vTar7HIA5qiLyT5+IJ6zEw8S6T/PYuRyggYFOSpUcd88K 1MIWv5PeZT+b1YvH2NSC+CoDGkRPRvOX9WsUzYjFg3GjzWJbOOHB9idH3NDTi6uVsLjR s1cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ip83O75N; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 j23si10798874pgn.507.2019.05.20.03.12.47; Mon, 20 May 2019 03:12:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-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=ip83O75N; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 S1732484AbfETKMq (ORCPT + 5 others); Mon, 20 May 2019 06:12:46 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:46083 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732479AbfETKMp (ORCPT ); Mon, 20 May 2019 06:12:45 -0400 Received: by mail-pl1-f194.google.com with SMTP id r18so6489600pls.13 for ; Mon, 20 May 2019 03:12:45 -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=FYWsY1+N4H7CLwGBpVFg0VRy5BIrNigGYHZlus/sqGQ=; b=ip83O75NZLwCKECGfM8b6w+f/ukjta4M9JaLc+MNN/r+BiHh5U+c3obLbGmXR368fc QbjaUkbxGFqa7LV7Z0H0ItwU8gJwB4r5wNeOPOYY/s+jYld1d4r87HmHtf94EhINLOI5 5dRx8h7+EELboXqiAQTsz3r8c0GVbrj35Bf5fuZOCmENS9jfE/F3GeumyIQ8Q18azMoB W1o8N49xYJkVv1nNphy7+SDWOFwWoiVNXHp5Hj2+2m42U4U9SryKWswV8BoJtrBxR09c 9NeG53QxHzarkWRexNeHOXVUs8hZ+/o5qwGEoBYLMpyEyHJHZdifvWvdDR91wF3dUSrn qjBw== 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=FYWsY1+N4H7CLwGBpVFg0VRy5BIrNigGYHZlus/sqGQ=; b=ixVqbKqO5szuQUIalrTwp5y0gwotvGTkdVAmpN9y19F3wrOK6RZe+wJTHHozZb8wW0 +hVXmJMpUS/SzRP3jfoIkVmygmLwBNQtabybNFWm3M6ucoGUOPTbh7tPlU/L687PgMj8 SHhGyuFHHFut7DD3GFBIvoRAylpBTx5hyVmB+m/Z2OhRVbwu5aWaBoBYFy0ojbZJrqOz +Yp4auz7R9vwjh1kgi7CWqVlK9cGqmnXftbo7UWSotjJ9p25vxwjumB5pNRUodc/7xhD hcl19aAOpyXiybjusYo5WD1i3DpUTboBfI1qQ9Kwr2+nMES8HL+v9teCPIKRpdEDC6UT tlXw== X-Gm-Message-State: APjAAAWpDpDbFegh5wHe37y6etm8g09P9VzkQJ2eQ82xZVgdi6MuhFLs oniAvvuDCpJVKP5OiKi6q7idFg== X-Received: by 2002:a17:902:bd06:: with SMTP id p6mr1223581pls.112.1558347165145; Mon, 20 May 2019 03:12:45 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id b3sm30098127pfr.146.2019.05.20.03.12.41 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 May 2019 03:12:44 -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 5/9] mmc: sdhci-sprd: Add HS400 enhanced strobe mode Date: Mon, 20 May 2019 18:11:58 +0800 Message-Id: <20349e8ebd4c1ec64fb5f8cdd9e094d0c1732855.1558346019.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Add HS400 enhanced strobe mode support for Spreadtrum SD host controller. Signed-off-by: Baolin Wang --- drivers/mmc/host/sdhci-sprd.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) -- 1.7.9.5 Acked-by: Adrian Hunter 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;