From patchwork Thu Sep 19 05:58:47 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: 174029 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp584886ill; Wed, 18 Sep 2019 22:59:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8e+XQxS2I0/iNI7zMgpJPfJYIWCTPbD6fWjBsE2aaHXs8P3vgh7pkggZME9uz3QdNOCvG X-Received: by 2002:a17:906:48d4:: with SMTP id d20mr12839014ejt.84.1568872762235; Wed, 18 Sep 2019 22:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568872762; cv=none; d=google.com; s=arc-20160816; b=lUHiyeZ1YLCaPfO9LoLYdnSwwBHWoV4AgCI+IjMx7bGNR2uMEOdCcXYSdT/OENHTbV y8gHATD665i1a/oDgaO62iyNRjikhX66Xh9Wuna6cA1qZXrnnwCu6Qbmj7XQu5+X9o+B R1foVvAlYytKicbEmWK2QVbsAyktG/43Iscyo/QNTxdlKnrv28nc9iQah7k2A1ss/vzg MmVTJPncF/H8mRGhQ1SSkfk/yH471AoP3Ps32kW8YVeYGRFMfyYqjDdn7Qeo1zJY3YAo 7g21wQKu1XUCGQ915OyuMzyKLr/CBGYMcCZLL+UQkt6p8/Orz9r41IH3FIA1MZCg8I30 VdNg== 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=4zoX/y4PganInWe3/mARbaR8aRBFEpK4D2RgCbSuiC4=; b=irsG8LM/fG3s4N3nXzocu9KDVGwpnZkK/rx28t1aM3epdho8ULSPxwSlbb2b/o8/NH c7VIZXqz+9YJIDAXBuWshdzydHxI0wAxvvwvrEOARzEDCPb3JKDdZct4pYI6KD8rjEiT dC6oe7ptraZuFuMGEk7zyAohwPB2yLJcxByRQTKP0J4u5ycj9/ukwA3T1eTVf9iwnbyB 7XAeEjr5CND7RKMIV5/LZaOeod6bB3vm5XAUhh+8XIER7o2DnXXriZ6xQ2IcBMnjVp8/ so7zUmDD5EYv9+0IX1Hvx7TWX0c65nssn+9X7aoweAGQpTtAXmF/KDoj223S1/7n5cIt DTgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="o/AXHGJN"; 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 l23si2531092edr.187.2019.09.18.22.59.22; Wed, 18 Sep 2019 22:59:22 -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="o/AXHGJN"; 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 S1731703AbfISF7V (ORCPT + 26 others); Thu, 19 Sep 2019 01:59:21 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46688 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731642AbfISF7S (ORCPT ); Thu, 19 Sep 2019 01:59:18 -0400 Received: by mail-pg1-f193.google.com with SMTP id a3so1208132pgm.13 for ; Wed, 18 Sep 2019 22:59:18 -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=4zoX/y4PganInWe3/mARbaR8aRBFEpK4D2RgCbSuiC4=; b=o/AXHGJNcTfb/QBuxV38Fov0fPaFAUpu8RlqAYA4p8z9IGQUjrbH1dhdTrh7Pxn5tt 1c4mVI7h4+1BboYpvs2myRmOEcH8K0jR+YSh2OvqgmCpviiwqzimh64MVuKX2ti+hhxX LtvbniIR/k8e8TUEm10xjPxY9KLs8J08cAK77cFe3pI08aJpQHb2mqSHvDQFv9eknMuZ pw6qLJahZEZCj8epZ7qNz/1PZWUA9o8N6+34wQl37HLz1ObtcasbIVBSJNxTMuhbho7h inGOKpUPjGqphtG8c1q9JUH7O3yCf5MzZv9lH08E9tLPgEZefupgWwXVDzmQl8WBz0Wd vG4w== 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=4zoX/y4PganInWe3/mARbaR8aRBFEpK4D2RgCbSuiC4=; b=fcIxG3OEgGcF7R8H8r9P8oLkqEVJOIUcthrPYGlYjf2PtfniMBrIoGbWyB/vu6VLYo rmjdxTIqskHaL3yn620Rz6CMxUcJ+zcsjVMmQOHaXQohYYYmbn0Q6vI5KRx4WPe2jqD8 l+pKj07pXn3SxqKSuUiUp4zYnpg+CN0eGsSHoVPTGG1UnvNTZN2XtYFMlKbXKXXca1Xw R3IZWV3T1v/q4X2Snv4MzhDXymc3XLlNXx9H8auj7KXK3Idu0u1dfp37nhwGdJrqmK5e eQjrn/rN2MV77Zoy5xDVOyhQgJdK6bw9Ti5frXghOw8cgkVi+jVdrk/mXpYPtr7HzAWM Yy0Q== X-Gm-Message-State: APjAAAU+x5nA/UVZFbEEfR2/WH/+sxThjNz3RrQczpIAeQBaX+XvFmNW 5bldS5kQo7ippBDvA7xxK419Yw== X-Received: by 2002:a62:583:: with SMTP id 125mr8684554pff.69.1568872757864; Wed, 18 Sep 2019 22:59:17 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id c127sm9666027pfb.5.2019.09.18.22.59.13 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Sep 2019 22:59:17 -0700 (PDT) From: Baolin Wang To: adrian.hunter@intel.com, ulf.hansson@linaro.org, asutoshd@codeaurora.org Cc: orsonzhai@gmail.com, zhang.lyra@gmail.com, arnd@arndb.de, linus.walleij@linaro.org, vincent.guittot@linaro.org, baolin.wang@linaro.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] mmc: host: sdhci-sprd: Add software queue support Date: Thu, 19 Sep 2019 13:58:47 +0800 Message-Id: <17069e44dbab0302bb7bd5eee64dc769b1f181d3.1568864713.git.baolin.wang@linaro.org> 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 software queue support to improve the performance. Signed-off-by: Baolin Wang --- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-sprd.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) -- 1.7.9.5 diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index d117f18..862e8e9 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -619,6 +619,7 @@ config MMC_SDHCI_SPRD depends on ARCH_SPRD depends on MMC_SDHCI_PLTFM select MMC_SDHCI_IO_ACCESSORS + select MMC_SQHCI help This selects the SDIO Host Controller in Spreadtrum SoCs, this driver supports R11(IP version: R11P0). diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c index d07b979..4dec0b3 100644 --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -19,6 +19,7 @@ #include #include "sdhci-pltfm.h" +#include "sqhci.h" /* SDHCI_ARGUMENT2 register high 16bit */ #define SDHCI_SPRD_ARG2_STUFF GENMASK(31, 16) @@ -379,6 +380,16 @@ static unsigned int sdhci_sprd_get_ro(struct sdhci_host *host) return 0; } +static void sdhci_sprd_request_done(struct sdhci_host *host, + struct mmc_request *mrq) +{ + /* Validate if the request was from software queue firstly. */ + if (sqhci_finalize_request(host->mmc, mrq)) + return; + + mmc_request_done(host->mmc, mrq); +} + static struct sdhci_ops sdhci_sprd_ops = { .read_l = sdhci_sprd_readl, .write_l = sdhci_sprd_writel, @@ -392,6 +403,7 @@ static unsigned int sdhci_sprd_get_ro(struct sdhci_host *host) .hw_reset = sdhci_sprd_hw_reset, .get_max_timeout_count = sdhci_sprd_get_max_timeout_count, .get_ro = sdhci_sprd_get_ro, + .request_done = sdhci_sprd_request_done, }; static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) @@ -521,6 +533,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev) { struct sdhci_host *host; struct sdhci_sprd_host *sprd_host; + struct sqhci_host *sq_host; struct clk *clk; int ret = 0; @@ -631,6 +644,16 @@ static int sdhci_sprd_probe(struct platform_device *pdev) sprd_host->flags = host->flags; + sq_host = devm_kzalloc(&pdev->dev, sizeof(*sq_host), GFP_KERNEL); + if (!sq_host) { + ret = -ENOMEM; + goto err_cleanup_host; + } + + ret = sqhci_init(sq_host, host->mmc); + if (ret) + goto err_cleanup_host; + ret = __sdhci_add_host(host); if (ret) goto err_cleanup_host; @@ -689,6 +712,7 @@ static int sdhci_sprd_runtime_suspend(struct device *dev) struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host); + sqhci_suspend(host->mmc); sdhci_runtime_suspend_host(host); clk_disable_unprepare(sprd_host->clk_sdio); @@ -717,6 +741,8 @@ static int sdhci_sprd_runtime_resume(struct device *dev) goto clk_disable; sdhci_runtime_resume_host(host, 1); + sqhci_resume(host->mmc); + return 0; clk_disable: