From patchwork Wed Mar 15 19:34:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9626511 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 E8A8D604A9 for ; Wed, 15 Mar 2017 19:35:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB6DA25F31 for ; Wed, 15 Mar 2017 19:35:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D047D28648; Wed, 15 Mar 2017 19:35:03 +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 73EAF25F31 for ; Wed, 15 Mar 2017 19:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752865AbdCOTfD (ORCPT ); Wed, 15 Mar 2017 15:35:03 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33222 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbdCOTfC (ORCPT ); Wed, 15 Mar 2017 15:35:02 -0400 Received: by mail-wr0-f195.google.com with SMTP id g10so3276893wrg.0 for ; Wed, 15 Mar 2017 12:35:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=Yr7swewG+//uuQ9fiDHiFnFhXw9IShljGWwgCMFcp/U=; b=uKZr1/E4uQceJgqRb18YloJU0rsHIJOCHiil82ZhjhUmsJ/4/OIzcy6H5FVAEzB2rs MM6kJBEucWHpi8BQmwXvqTwvys6qb479OyzkAEKJuzsioDwWpYePSPvH69pGu8Zpkcx/ MdzwRH5SA3QBYsaoqcqE68EechDzkTOOhQ7XCOFQ52WK3h0WGiM/xx9fux3pI/q63ZUB 6PX6Q6Vk+agKmCeGX+vFqL+QI4VGQf91IYO1o2m7cwdMXfI2XkpskxmBKxgDFjhkQ9a2 vxPqvo+tm+VMod0MaI39yC8r9qy4xmtLEqle7KO+r/FjcmJGC7hz1Y/SzqPQeogJUDBQ wAqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Yr7swewG+//uuQ9fiDHiFnFhXw9IShljGWwgCMFcp/U=; b=WMtu1k3HMTR+xq0/0s+jnlqNi9/XZ2FxgUL5Oilr8On+Alb/A0YBSfwck/BK5KeZyl WqPeTB2H6TMKRQPIhpqcMdeMAUvkycU2oy5lH7d5A18yuex77HQCbBGGzD34hVl8TtUa Nc5J8gamKTfur6tLpHY2P+o9iUFBXAjXA0wlKSIrtbfNqohZL3CerY1ZRi/wh7zJmVeC cGgNXVl2/7lqG2wNFfx5gQosRyPd6rWYvaqusTi6HSVMF2VqyoCwTzdMhY8oGFvU0dIT z7UCGaptkBgwGSf8uClY09p45Ejbrs7fRuYicn0MJmeFm3nI6sXXzy/hdfeJqOJRqMcO eT3A== X-Gm-Message-State: AFeK/H0rpVpgWIT2MH5ainOdIVt7Bg+ZQ1PTloD2zISAU215SBCFkAMabRXd8cXXb4dPIQ== X-Received: by 10.223.169.171 with SMTP id b40mr4908094wrd.132.1489606500713; Wed, 15 Mar 2017 12:35:00 -0700 (PDT) Received: from ?IPv6:2003:c6:ebdc:4000:c5e4:fad9:4bd9:799d? (p200300C6EBDC4000C5E4FAD94BD9799D.dip0.t-ipconnect.de. [2003:c6:ebdc:4000:c5e4:fad9:4bd9:799d]) by smtp.googlemail.com with ESMTPSA id x193sm1575198wme.23.2017.03.15.12.34.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Mar 2017 12:35:00 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 4/5] mmc: meson-gx: add support for CMD23 mode To: Ulf Hansson , Kevin Hilman References: Cc: "linux-mmc@vger.kernel.org" , linux-amlogic@lists.infradead.org Message-ID: <3f10855e-0930-2a50-47d4-62c7a9f1e2ba@gmail.com> Date: Wed, 15 Mar 2017 20:34:20 +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 This patch adds CMD23 support to the meson-gx driver. Typically it's more performant if host and card know upfront how many blocks to transfer. Signed-off-by: Heiner Kallweit --- drivers/mmc/host/meson-gx-mmc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index b0dc2cdd..425060da 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -175,6 +175,16 @@ struct sd_emmc_desc { #define CMD_RESP_MASK (~0x1) #define CMD_RESP_SRAM BIT(0) +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)) + 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; @@ -621,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; @@ -637,10 +647,11 @@ static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id) data->bytes_xfered = 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; } @@ -751,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;