Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp5876472ybx; Sun, 10 Nov 2019 23:38:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzabObKp2HhVAjicmY7SipTHnTR2qcNZOJ3ZEx4U+w5yF6qMPiz0ev7QVRB6QImGVC9a06J X-Received: by 2002:a17:906:c797:: with SMTP id cw23mr21333621ejb.19.1573457886802; Sun, 10 Nov 2019 23:38:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573457886; cv=none; d=google.com; s=arc-20160816; b=oR9fDaZyiTd59NrOHz4xLyJ0wLKDogFeJXU6rTwjA3YRP88FXHIKZl8KRdV45WVFij UL1feeHh0A84mSewoY6PtqULVZMN/7HH3iLWL9Dg3XPfFOUmvAJelHsRI2N7OWEqWRZ5 qM2jpsXBqTJporAOLYSR+fwBVux/77vV8tBJDEYP05aHu+jy9NT2x3QLKc0S9U5Ufa6/ yfwvjlLcCR0xffyb1kq+N6AtSl2D0t2BSBk5o78K2adXp5awcMzNMLIwlXL6EyNG4U9E lOZ0WykOfZuZlL8SC83JDxaZN5T7OFmWx+Pnp9NldlAbnBRp0u8+pa3+r8YLi75TIs63 zi3A== 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=fQEDJ9wIUY91T3GYiK1d8lyKwMei+wqRePWRPvW8cOCUAeC9+B3iQjMZEFFaQOjtOf 4fb+W0k6gEzksQMhDqcS/b/kpUnf/+hrllNH10HCuQpv00xGqLgwx+pbVz+bcGIrk/OR 9+3jWRLJbsK5v5cHOZoOvQn56dqpn0A/X5S07C9r4krZ1rzQjGtxhFml5rionpdD+lM9 6ZlZqQbzmk7gSCbLrEBfkQpNrInJvTgCX0AsJzeDvcK26EnvfijiAQpwglbHBawcuBN0 jRn/8rm0qZ15MU0uqbOR1DdPyZjCankuIKLXuumz5imVphzMV78t5ZCR2edIfl8FtfNs A/9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s0ExBf69; 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 r3si12514455edb.245.2019.11.10.23.37.41; Sun, 10 Nov 2019 23:38:06 -0800 (PST) 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=s0ExBf69; 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 S1727022AbfKKHfY (ORCPT + 99 others); Mon, 11 Nov 2019 02:35:24 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:33156 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbfKKHfX (ORCPT ); Mon, 11 Nov 2019 02:35:23 -0500 Received: by mail-pg1-f193.google.com with SMTP id h27so8945488pgn.0 for ; Sun, 10 Nov 2019 23:35:23 -0800 (PST) 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=s0ExBf69BmmTL8g8enNiPwaRmpBMFWW+q7MngojPegddgeqfh2kgXDFE2hDQ8T2JyG ggi+0b0rIR/nNwAiYSw6V/WvnJpfITQzXqiNJtBp/wqHduWt3VLLhzVBSTM7p3KZGs/N ex5F/9AKeJcvhao21rlQ8yVLzgJ39s90ruG/NY28kqG1I7UI6aH93dX1eOX1ccF2Q4Vn o5XOb0liCGl/CZxAlUiwyHaXC8NQIbKk6gejnCc99hzVFILoZbA5kX/i4b7wkD1KtBlX ZLogjfb2lQyl5XmpZDRB2UH0VrmWkiV57kI1rh/oVYq1IEScxehvEKBlH4vAu3VE9hGk BWAA== 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=l21gw4APUtMwNmzoHCrzRJP9m8bL9j49HJkcHShtBqBzJm8Qx940REKXAW68TDIkn6 UqNSD8dvucH2eydIunUTDb+qxmyMN/+X4jmKOeyhbea7tzJbl5v1wwsIDOnXhiFoTkel 5r4QRpslbtnsGDrTrKay7l/HYF89pHxWNrVjLkj0P1m4rDUy4Bw9Tz05lsVFQ7mIT8Vi Ao34nOpFNNhGNW9SFKDWRqiSqPfysRpDCOkPQLWuknZ2xfXjp9njnF7JEwaqBXMomLYk oNQy5hmzvzUfU9UOKXWOhtGZTEqnc7tNYJpXy2cPzReMcTyP7Xg9ibF4+I2PLeVTVQxr 295w== X-Gm-Message-State: APjAAAUrV9MShkPMejzD/p079jNqVnMUh3gRFkyxzfUgVuFS81pu0kKs NCC7mWT8wX8lfuFxTR3McNb9QA== X-Received: by 2002:a62:ea1a:: with SMTP id t26mr5386170pfh.14.1573457722961; Sun, 10 Nov 2019 23:35:22 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id c184sm17345285pfc.159.2019.11.10.23.35.18 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Nov 2019 23:35:22 -0800 (PST) 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 v6 3/4] mmc: host: sdhci-sprd: Add software queue support Date: Mon, 11 Nov 2019 15:33:59 +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(+) 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: -- 1.7.9.5