From patchwork Tue Oct 29 05:43:21 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: 177983 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp4376239ill; Mon, 28 Oct 2019 22:44:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6H7DaD2GeKD+KtZrevI9lhN2TrIHSVA4SfMjMMsh3t6HaDD2Ee9QJV7JYDE36aePNI3SC X-Received: by 2002:aa7:cd68:: with SMTP id ca8mr24393471edb.58.1572327869176; Mon, 28 Oct 2019 22:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572327869; cv=none; d=google.com; s=arc-20160816; b=tSwYXwtwru5wr//CGArO7/91oM2QE0VqxF31P2/xaqUHzobd4k/2x7d0zqMNERpu7n BWRtDRjiW5dCeIN+JkBcEJ9h0BA3UeVbJh3ImuJgXH9n2HwOP6YZoA19yEtSXJycMrOM bkUrErBcbP31aV7X1QP5qimfqhFoTuOMpsUsFVxBOyjEuPdu0vs6zNoUy4x08ViCAK4/ iBO6EYc+KnRFtout1Dwomgwr1GIh9EmvAiptnXqCUO+PosVIZEIqavRwWQZ/8Y22K7KO lhXhPtzKDhW0kBETN30oOEw6jLeZorMWZbrt9JFN4PZv5RRP1mo0qdFCSNOMxnvv6q57 zhmQ== 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=shSJXxHkqiOnwVznDt/3eHxUBXqubG/+hrNMGFN/+WI=; b=uyT/AYRKolyu4d5vq3vEG6K83NRQ3iD6e4W0ccoMHISmPkO8nw6HbhEDuly8ACPbBm OZ366w3Uzl0oAenynAFnoHq9xTdpm0WVGheP+dIL2BgkvWtgxjBakPMN5wM6H9eJAjEs Grrubb3AGaUHJq3QSoyKANuqQ9YRciYaLKhi0F9D5BJdq6jA88+9Nt+bexKHGIZtP3k8 U4WC1/x/+4igZjlRWfVehKgL68MG20Q6GflKUCpNqPPwYknUajWVeCfoece1uri5iE/D gd7VgH/LxJT2kxs7IDpyxcqcVtvXKkpf70QYDs5OEm0fDbxXAOtDKWf+8KGkgr7w3k3n C28A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vLoEKlV6; 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 f31si9776832edf.75.2019.10.28.22.44.28; Mon, 28 Oct 2019 22:44:29 -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=vLoEKlV6; 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 S1732183AbfJ2Fo0 (ORCPT + 26 others); Tue, 29 Oct 2019 01:44:26 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:45458 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731877AbfJ2FoZ (ORCPT ); Tue, 29 Oct 2019 01:44:25 -0400 Received: by mail-pl1-f194.google.com with SMTP id y24so6994095plr.12 for ; Mon, 28 Oct 2019 22:44:25 -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=shSJXxHkqiOnwVznDt/3eHxUBXqubG/+hrNMGFN/+WI=; b=vLoEKlV6PhyQnu5TaX9PnU1KHde3KNK0Fv7oOOpqfqAU95PmYyCYQFVqox1q5H7qmM 1ptm2U0iVubob9AJKr4ySIpBNHZiL1SnulsIzu7/5UnYp8zsYdNRVj8LjylFYrqRoh/5 PFot5tr6iBh5FbWJ+z20//D/4S1q7AY9/APYqH2eF6A3vlc5tmSR8SjRYLvfNrWjPQOr u/Zqp/ey8YNSRoJw0W6UuH7TlxouEWEMCqQNAJa/mUVBC3amQNNVmHXXA8yw3yaUPzVN Szh1o0B5BoPOBAknZtU2NHBG0NHVIFWezOTMwqYh2EaH4sBi4RVMmcMEboIvt4NA688s w6uw== 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=shSJXxHkqiOnwVznDt/3eHxUBXqubG/+hrNMGFN/+WI=; b=Rm+ouXeb0qHYOb0cyUjoqxNzfuHwv+FY5KucTd4mp0ZnRIV9in+W1VpF52TkY44rj6 U5leZa9Cx5KoSfeJiHkQSmpkbbKzJQ7zGYdGrQ1FAouIBdXWKluw5BlnYds5XlNnGo+k omdbCs6v5t+z05Y3IKHWbHJoojemRHnuulDtjaqCQGcscGoYumaWHq5kej2ORfa8O587 u2o0A/FtNxmlPWKzhef2UwAum16yJWTwDjHLduHnJw2NAapZ8OD88oYLxVnAOkRxHjhm YmOpLfggXVPNK1UdfxQLs3YlVFCB267SGdzWSpx6gFRDrJsrR3HZNOzPYvB+X/AbpnNv H+0A== X-Gm-Message-State: APjAAAW95YJeSOSOv2s3qnOkRXBzZnIL8P04JJ9Vyjqnze21Bdj0ximL eJlnKitqsC8Qe6LIa/5KZ65iTg== X-Received: by 2002:a17:902:fe89:: with SMTP id x9mr2029967plm.62.1572327864464; Mon, 28 Oct 2019 22:44:24 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id j25sm12026231pfi.113.2019.10.28.22.44.20 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Oct 2019 22:44:23 -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, baolin.wang7@gmail.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 3/4] mmc: host: sdhci-sprd: Add software queue support Date: Tue, 29 Oct 2019 13:43:21 +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 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 efa4019..54b86f6 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -632,6 +632,7 @@ config MMC_SDHCI_SPRD depends on ARCH_SPRD depends on MMC_SDHCI_PLTFM select MMC_SDHCI_IO_ACCESSORS + select MMC_HSQ 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..3cc1277 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 "mmc_hsq.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 (mmc_hsq_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 mmc_hsq *hsq; struct clk *clk; int ret = 0; @@ -631,6 +644,16 @@ static int sdhci_sprd_probe(struct platform_device *pdev) sprd_host->flags = host->flags; + hsq = devm_kzalloc(&pdev->dev, sizeof(*hsq), GFP_KERNEL); + if (!hsq) { + ret = -ENOMEM; + goto err_cleanup_host; + } + + ret = mmc_hsq_init(hsq, 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); + mmc_hsq_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); + mmc_hsq_resume(host->mmc); + return 0; clk_disable: