From patchwork Sat Mar 25 10:28:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9644497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0E14460327 for ; Sat, 25 Mar 2017 10:28:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF57426785 for ; Sat, 25 Mar 2017 10:28:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D433326907; Sat, 25 Mar 2017 10:28:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D2FB26785 for ; Sat, 25 Mar 2017 10:28:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751264AbdCYK2l (ORCPT ); Sat, 25 Mar 2017 06:28:41 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36286 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbdCYK2k (ORCPT ); Sat, 25 Mar 2017 06:28:40 -0400 Received: by mail-wm0-f68.google.com with SMTP id x124so2332953wmf.3 for ; Sat, 25 Mar 2017 03:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=j0eeFaEmUpfzSsx/f+smj4GqOMlORh6RIKMs/t6fDX8=; b=pK+M0onsJjqoeKfzzZF9mqGlHx1cUKNqssJ7wnWlzRWX3WZ0NLoyXVniOMeUt4iQE/ 1cpZYaAKKAaHZfL+zGZt2HP51iGSCzD5rvkHPZBsKkYu5nyvXYTU05ZpUFdhlMeb5199 xE10SlDkYg9+zaW8Qin3AijyRXdLWWXCw2eJvfi3EnDuccHZLGScmqDE56GbRPP8j616 2teia3fa27TRe31Ipo8IC8ljESunBWCU7b/5nhNQf8xIj7IQ63znak4ErdNqyCsVXPg4 avxA3wEfG9h+/F5oS1mvAdQZmUv2+dY5/qW3P6QKCk5Qu2/1yXSGYmn1/v4FgapML+t9 tDiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=j0eeFaEmUpfzSsx/f+smj4GqOMlORh6RIKMs/t6fDX8=; b=UcmpC6XKCyZlls5N30btNUHCjGle8zrbiKPMHiZo7f1HH7gf8VNw6HLG/GauRer74+ VPXVt0m2V4PvR4AI7KwWLg8i04/XEMt5vVbh2S3GxVVE1FFI4ndHlRv3yBHchP8FIrGv /Aw1MKEA/THC7baTLc7BCG/81+pCu7xgfRUtoTZLMr4LUBqBcvxWKVszLaKlXN4p8nKN oxYtMUJeBqVWCQomaFM+qYO92VfmWuTFT67toIxka4v40thhu1UF6bSOzuX1RQX06TTV UL49TzRZk8EYxWCCG1AFSmELfDF+zjPc9n5og4rnIgwi+DP9etyOBJAlPixYoYT+vVKk atWQ== X-Gm-Message-State: AFeK/H316dmIZSe/g4JIKAEwycrPpYvhf82X7kyydGDdzM/4Uz9OJkFmOmHMhbKpM2AHww== X-Received: by 10.28.214.146 with SMTP id n140mr1541469wmg.58.1490437718731; Sat, 25 Mar 2017 03:28:38 -0700 (PDT) Received: from ?IPv6:2003:c6:ebdc:4000:b429:3993:904f:3ba7? (p200300C6EBDC4000B4293993904F3BA7.dip0.t-ipconnect.de. [2003:c6:ebdc:4000:b429:3993:904f:3ba7]) by smtp.googlemail.com with ESMTPSA id t79sm5334685wmd.29.2017.03.25.03.28.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Mar 2017 03:28:38 -0700 (PDT) Subject: [PATCH v2 4/4] mmc: meson-gx: add CMD23 mode To: Ulf Hansson , Kevin Hilman References: Cc: "linux-mmc@vger.kernel.org" , linux-amlogic@lists.infradead.org From: Heiner Kallweit Message-ID: <2802b35f-7f45-223c-11c4-3a51563b3330@gmail.com> Date: Sat, 25 Mar 2017 11:28:13 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP CMD23 mode (use "set block count" command before transferring multiple data blocks) typically is more performant as host / card know upfront how many data blocks to expect. Therefore add support for this mode to the driver. Signed-off-by: Heiner Kallweit Reviewed-by: Kevin Hilman --- v2: - no changes --- drivers/mmc/host/meson-gx-mmc.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 810b68d5..f5dd5cc7 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -175,6 +175,17 @@ static unsigned int meson_mmc_get_timeout_msecs(struct mmc_data *data) return min(timeout, 32768U); /* max. 2^15 ms */ } +static struct mmc_command *meson_mmc_get_next_command(struct mmc_command *cmd) +{ + if (cmd->opcode == MMC_SET_BLOCK_COUNT && !cmd->error) + return cmd->mrq->cmd; + else if (mmc_op_multi(cmd->opcode) && + (!cmd->mrq->sbc || cmd->error || cmd->data->error)) + return cmd->mrq->stop; + else + return NULL; +} + static int meson_mmc_clk_set(struct meson_host *host, unsigned long clk_rate) { struct mmc_host *mmc = host->mmc; @@ -620,7 +631,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id) { struct meson_host *host = dev_id; - struct mmc_command *cmd = host->cmd; + struct mmc_command *next_cmd, *cmd = host->cmd; struct mmc_data *data; unsigned int xfer_bytes; @@ -635,10 +646,11 @@ static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id) host->bounce_buf, xfer_bytes); } - if (!data || !data->stop || cmd->mrq->sbc) - meson_mmc_request_done(host->mmc, cmd->mrq); + next_cmd = meson_mmc_get_next_command(cmd); + if (next_cmd) + meson_mmc_start_cmd(host->mmc, next_cmd); else - meson_mmc_start_cmd(host->mmc, data->stop); + meson_mmc_request_done(host->mmc, cmd->mrq); return IRQ_HANDLED; } @@ -750,6 +762,7 @@ static int meson_mmc_probe(struct platform_device *pdev) if (ret) goto err_div_clk; + mmc->caps |= MMC_CAP_CMD23; mmc->max_blk_count = CMD_CFG_LENGTH_MASK; mmc->max_req_size = mmc->max_blk_count * mmc->max_blk_size;