Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3604686ybh; Tue, 17 Mar 2020 03:15:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsyzucu3Oc9OQhr3SP/u9qVTqGqQr5ScMbU1iNk9/XiYlkvJSy34vnV48sUkE3CQvfGcZpl X-Received: by 2002:aca:de07:: with SMTP id v7mr2972511oig.22.1584440122988; Tue, 17 Mar 2020 03:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584440122; cv=none; d=google.com; s=arc-20160816; b=wqKHv91/jQHosp5btgRjDmQko6oTqS5YhKcKEIKaiI/BLjKIeu5wiys7B+6t3pb1OB PvqkVyNBWX7I6R2/9k/iPhRBHN3Qob9CZiEpn0VIZm598VUAFjpGytRmsRTvGvQIggX3 8CmE5EOw0pyhEpMk105Dh13l8kQpfk5+d6JLDPNDSWdonkv5EslB3Rs084p2QGOr9g38 4qA8EysoEbeF4YaGX26LtIoki8p07s0Ew1qUc6RCigvV2E+p7gHD0fLgn+X3tDLcnFXN 9C7t7Eni/GtxOK3aiQls5Jvgx49yAoEf9KZlSS3dG8zPy2D5+gnUfEXYAEXB+8e8eq5a U0vw== 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=unr3k2tfwI2GqRohsFvvT8LxV6+FWELnFqCEg/uISRU=; b=ZI2AI7L2x5mztmo8Pk8m2+awgFtnnneO7YWMierx4h2xUNOf01E+8O3JX/x0qgHI5a Ie8r+QLzhGUWY2Jt7AanF+QFdiv1blfnyLKm6kI5VM0HEJs5DQROO9t02VEnYXLamzgO vYx0p/q8vhf0AHc0P624UWPzZI63kU98qFAIFexqbW8peYFlKoAXuq9SMgqmZ56S+jZg TLIgC7PFpzzTXk+5Z2smgZ+B7cvUCyWGon+N6KsMDgaXsaus/cLIYKFgquiXFc9nHl1x PLMbln0ornTbeN18+qGtBl23qA2AeaMow+tC9sm7sKq+mVUZIAx+dsZ2l6Pz+efdE2Z4 qfdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VW6deAEG; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b20si1419674otq.263.2020.03.17.03.15.10; Tue, 17 Mar 2020 03:15: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=@gmail.com header.s=20161025 header.b=VW6deAEG; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726476AbgCQKOb (ORCPT + 99 others); Tue, 17 Mar 2020 06:14:31 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43674 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbgCQKOb (ORCPT ); Tue, 17 Mar 2020 06:14:31 -0400 Received: by mail-pg1-f193.google.com with SMTP id u12so11459164pgb.10; Tue, 17 Mar 2020 03:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=unr3k2tfwI2GqRohsFvvT8LxV6+FWELnFqCEg/uISRU=; b=VW6deAEGfLYbY7pS6MtMsUncuzhTbxcO4qKni6upZKof/ofZXI+1u0W3aK9al4MPug F5E05y6PMNqPlPk3l2Dw7Qy9mPI4eGPghQ7eBfaqmH7o7EXTY944XoipebnA9jSgLdtr jRRC1vsQS3lwxbV98io69ZRCUTk8bxOV+gJH3HInXmMLk9x5Wpy4s2/QTY4mzdub/f/O KEqTo0MOHyDMU8s4TOh3Ikr7+02Y8YtGQ2+nJ4QL5wWsTH6G3F+vKrB79pJgI4pTu4Nq WSrY107HREU7h2nWywPMPo8hUddKJ5ylEQfh06CcmAJwUFLW1NM1+W5QoGkKNcX3X+8T Uvog== 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=unr3k2tfwI2GqRohsFvvT8LxV6+FWELnFqCEg/uISRU=; b=FMyO8Mj4VF0CDDJBulZrRS8GScbfc2H9pmTdAs0MkS+4y6mBkKhL/bqbv2QPW6xqHh ZNafCRBM2yrk1eVQz4NWDUwUG58+JopTNZ4QwyBT9bzbbqDst34jSWDzSWxDOT9o3AQ0 Fdo9r0SKcgl6LUoGTOT8scPmMNgngJkE/7KJrvA09Qlp3rWmwCFM2MdFfaH4L6vXkJuc /61ktgvcEjwPMQspzLWiZsQfzBSV77s1els/qaM1AMPUfu9JtWgMlf0sAaQL+bFs54Xx BVAY+5dmeZoeoGaeLYJS/Ni79oTRlM4ijmVIu7S8oBDlj/bQzOEKHyu5o9YIauQxLiyy 58OQ== X-Gm-Message-State: ANhLgQ3XRbAYTPsERzdxErDH6yMfLbWpg4W1NNUgsICJFas5fICe18lZ EjKo/XBOkbzhrnXF6eEB87Bx3IWNLvo= X-Received: by 2002:aa7:87c1:: with SMTP id i1mr4521301pfo.297.1584440069616; Tue, 17 Mar 2020 03:14:29 -0700 (PDT) Received: from sh03840pcu.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id s25sm2195487pgv.70.2020.03.17.03.14.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Mar 2020 03:14:29 -0700 (PDT) From: Baolin Wang To: adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: orsonzhai@gmail.com, zhang.lyra@gmail.com, baolin.wang7@gmail.com, arnd@arndb.de, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] mmc: host: sdhci-sprd: Implement the request_atomic() API Date: Tue, 17 Mar 2020 18:14:11 +0800 Message-Id: <8cc959db07c9f9dbcad5dfdbffd78760c06f1c7b.1584428736.git.baolin.wang7@gmail.com> X-Mailer: git-send-email 1.9.1 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 Implement the request_atomic() API for nonremovable cards, that means we can submit next request in the irq hard handler context to reduce latency. Moreover factor out the AUTO CMD23 checking into a separate function to reduce duplicate code. Signed-off-by: Baolin Wang --- drivers/mmc/host/sdhci-sprd.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c index 2ab42c5..9a08f70 100644 --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -406,7 +406,8 @@ static void sdhci_sprd_request_done(struct sdhci_host *host, .request_done = sdhci_sprd_request_done, }; -static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) +static void sdhci_sprd_check_auto_cmd23(struct mmc_host *mmc, + struct mmc_request *mrq) { struct sdhci_host *host = mmc_priv(mmc); struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host); @@ -422,10 +423,23 @@ static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) mrq->sbc && (mrq->sbc->arg & SDHCI_SPRD_ARG2_STUFF) && (host->flags & SDHCI_AUTO_CMD23)) host->flags &= ~SDHCI_AUTO_CMD23; +} + +static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) +{ + sdhci_sprd_check_auto_cmd23(mmc, mrq); sdhci_request(mmc, mrq); } +static void sdhci_sprd_request_atomic(struct mmc_host *mmc, + struct mmc_request *mrq) +{ + sdhci_sprd_check_auto_cmd23(mmc, mrq); + + sdhci_request_atomic(mmc, mrq); +} + static int sdhci_sprd_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios) { struct sdhci_host *host = mmc_priv(mmc); @@ -561,6 +575,11 @@ static int sdhci_sprd_probe(struct platform_device *pdev) if (ret) goto pltfm_free; + if (!mmc_card_is_removable(host->mmc)) + host->mmc_host_ops.request_atomic = sdhci_sprd_request_atomic; + else + host->always_defer_done = true; + sprd_host = TO_SPRD_HOST(host); sdhci_sprd_phy_param_parse(sprd_host, pdev->dev.of_node); @@ -654,8 +673,6 @@ static int sdhci_sprd_probe(struct platform_device *pdev) if (ret) goto err_cleanup_host; - host->always_defer_done = true; - ret = __sdhci_add_host(host); if (ret) goto err_cleanup_host; -- 1.9.1