From patchwork Wed Mar 15 19:34:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9626509 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 984DC604A9 for ; Wed, 15 Mar 2017 19:35:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A5F625F31 for ; Wed, 15 Mar 2017 19:35:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E07C28648; Wed, 15 Mar 2017 19:35:02 +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 268FB25F31 for ; Wed, 15 Mar 2017 19:35:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751803AbdCOTfC (ORCPT ); Wed, 15 Mar 2017 15:35:02 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35433 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbdCOTfB (ORCPT ); Wed, 15 Mar 2017 15:35:01 -0400 Received: by mail-wm0-f68.google.com with SMTP id z63so6331491wmg.2 for ; Wed, 15 Mar 2017 12:35:00 -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=+qPmgx330K3dI0RRTohCbh0uYcQCdwkmeR6yVWRcqp8=; b=HCu6GVzVvzrCSGqsOqgdP0FAFRz1Ewr4lXdgsA5Wepr0dStXyUC2NzKL3WUak53PxX BYWfUktibB/sLNZYKrIqYz2lH6wSl/CWByCcbxwiX1y+/64T82mHooWtFcHyEkDYMYOk y1z2lo01mx1PWUIHmdzho4LGuiLE2LcvFWmpc+sEt9o2/KBbDP54c5m7sF3wyS6KVch5 qawhrifyajn2x0Ke3H6QOjvotHqpsTMQsbhh+BoswjgVbynRofB5rC88mqGpPVKRICvZ ncHpIYLxkyhOgktLi/Wk8hv+l+voCO20GyFFcEpHbB/HfjYiGQPSJdwngxJgpPtim4+0 sK6A== 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=+qPmgx330K3dI0RRTohCbh0uYcQCdwkmeR6yVWRcqp8=; b=N2nUaJM4a44buJ0wRV+4DOMzdBgc0qhSqYZ4YTHWzk0PKn2bXRSOTfMtUeLe53K0qS iDCfPDIH1G1QGPT9C17FDPxxCoCcoAbvdk/TQePRoboJjljhrG7ZohHG+oHJhzfzkYUD XvXoNAKQoZH6fLKQ16AhQFoPH7RETcAKxmepFgoQmkPVFagrCa7lXpeSFC/wREoBiMh7 vHh6DJFC5Cw2rsy+SkhneOUzSexGNKM9g7uWWSHYNZqGGaFL8iqxe4LH255JxdV2Xf2B CBD/fCsg7K5Pg0ebNsBU8wEVtlMAIgMJUCqPLv7tYzLL5+2oY42l4ByVsSFqOV+UT03L WHOw== X-Gm-Message-State: AFeK/H0F3fN+Styf97WmsiXrsbDI4MNRFBE5TnVtVY03YFj7zG81KwJm7OwqAd3z8PqXDw== X-Received: by 10.28.236.209 with SMTP id h78mr22251166wmi.97.1489606499440; Wed, 15 Mar 2017 12:34:59 -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 y43sm3467419wrd.0.2017.03.15.12.34.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Mar 2017 12:34:58 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 3/5] mmc: meson-gx: use block mode also for just one block To: Ulf Hansson , Kevin Hilman References: Cc: "linux-mmc@vger.kernel.org" , linux-amlogic@lists.infradead.org Message-ID: <13c861ba-9ab0-92e6-8e9a-f7d26ad36b7b@gmail.com> Date: Wed, 15 Mar 2017 20:34:11 +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 Currently block mode isn't used if just one block has to be transferred. Change this to use block mode also in this case. This helps to simplify the code in function meson_mmc_start_cmd which is quite (too?) complex currently. Signed-off-by: Heiner Kallweit --- drivers/mmc/host/meson-gx-mmc.c | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index e675601e..b0dc2cdd 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -458,31 +458,21 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd) /* data? */ if (cmd->data) { - desc->cmd_cfg |= CMD_CFG_DATA_IO; - if (cmd->data->blocks > 1) { - desc->cmd_cfg |= CMD_CFG_BLOCK_MODE; - desc->cmd_cfg |= - (cmd->data->blocks & CMD_CFG_LENGTH_MASK) << - CMD_CFG_LENGTH_SHIFT; - - /* check if block-size matches, if not update */ - cfg = readl(host->regs + SD_EMMC_CFG); - blk_len = cfg & (CFG_BLK_LEN_MASK << CFG_BLK_LEN_SHIFT); - blk_len >>= CFG_BLK_LEN_SHIFT; - if (blk_len != ilog2(cmd->data->blksz)) { - dev_dbg(host->dev, "%s: update blk_len %d -> %d\n", - __func__, blk_len, - ilog2(cmd->data->blksz)); - blk_len = ilog2(cmd->data->blksz); - cfg &= ~(CFG_BLK_LEN_MASK << CFG_BLK_LEN_SHIFT); - cfg |= blk_len << CFG_BLK_LEN_SHIFT; - writel(cfg, host->regs + SD_EMMC_CFG); - } - } else { - desc->cmd_cfg &= ~CMD_CFG_BLOCK_MODE; - desc->cmd_cfg |= - (cmd->data->blksz & CMD_CFG_LENGTH_MASK) << - CMD_CFG_LENGTH_SHIFT; + desc->cmd_cfg |= CMD_CFG_DATA_IO | CMD_CFG_BLOCK_MODE; + desc->cmd_cfg |= (cmd->data->blocks & CMD_CFG_LENGTH_MASK) << + CMD_CFG_LENGTH_SHIFT; + + /* check if block-size matches, if not update */ + cfg = readl(host->regs + SD_EMMC_CFG); + blk_len = cfg & (CFG_BLK_LEN_MASK << CFG_BLK_LEN_SHIFT); + blk_len >>= CFG_BLK_LEN_SHIFT; + if (blk_len != ilog2(cmd->data->blksz)) { + dev_dbg(host->dev, "%s: update blk_len %d -> %d\n", + __func__, blk_len, ilog2(cmd->data->blksz)); + blk_len = ilog2(cmd->data->blksz); + cfg &= ~(CFG_BLK_LEN_MASK << CFG_BLK_LEN_SHIFT); + cfg |= blk_len << CFG_BLK_LEN_SHIFT; + writel(cfg, host->regs + SD_EMMC_CFG); } cmd->data->bytes_xfered = 0;