From patchwork Mon Mar 27 20:02:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9647441 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 80BD7602BF for ; Mon, 27 Mar 2017 20:11:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72F7128419 for ; Mon, 27 Mar 2017 20:11:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67C3228449; Mon, 27 Mar 2017 20:11:36 +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 0DEC028419 for ; Mon, 27 Mar 2017 20:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751396AbdC0ULa (ORCPT ); Mon, 27 Mar 2017 16:11:30 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33636 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183AbdC0ULa (ORCPT ); Mon, 27 Mar 2017 16:11:30 -0400 Received: by mail-wr0-f193.google.com with SMTP id 20so16525312wrx.0 for ; Mon, 27 Mar 2017 13:11:28 -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=IO4uorTNCFsuiuHOkLMRwF2eGl2wiubWMxmw66GnPzc=; b=o0nvdxhLNl7i/sG5NborC+Tycxg/Xhj/lm+ohydcSqrmbW1PVuUiP3gc+kgPZ5hF37 wWicAj0MpXwsEufvMBa9Nrhop+oUYLOsoAmtrp4ysZRTt9yIlwnuhCP+lNVaQkZn04Ns dwZ4nmSjDjuN23tom8B0t/dV3TqnfpuOghwYrukTM5eOsVnBxkKYpptdzfHO66jDGN84 /J/nOTcfD1ihQ3RWGGR17Qr0gSQjxKSc4XuzcVf1H6rT2EOmhK4/tQdcM/xGEvY4sZUg g/btomgVDo6SBB2CcQaKp65nkATN0Hp8aN7dey33+Nnv6WCtwr/4W//z35AWwxQ+9nVz QmGA== 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=IO4uorTNCFsuiuHOkLMRwF2eGl2wiubWMxmw66GnPzc=; b=oMtzCJ64R1YTN14UTVnvWKpU29mELS/paxE8EG0DlSh4/wdLEfXEUVAl8OG+OC4wzs +vvCi2ZuD2TlhJsEsBiN01nmKg7ddBihohLrC87vTok/+BR2A4S1J1HdIKCyCUt/e+XX MRop6r0e5xUQvWpbd9TT1uyB7Y20aqdXAUUjbLSKUKtOVUdBAp6O7pbeMtllOYkIFH0y A2zXpxfxjDy2Df/FpcyTYgdpGnfFH3Ywv5fz38gPiYRBY9jcM+NpIQZcwQj61u1PQYtp 5YhT3QzzZcS0JoYSily6XpYY+W/X/sscBxFUKDfb9ZDZIPdqTpciUNRQ0GXfpCR6CTB8 hRaQ== X-Gm-Message-State: AFeK/H2oxFDzg15pNBBHFkg700ZsztMNhdNpd8pCo4jH999ovU9J62bba2onPIUgQuDq/A== X-Received: by 10.223.154.11 with SMTP id z11mr21695603wrb.76.1490644965822; Mon, 27 Mar 2017 13:02:45 -0700 (PDT) Received: from ?IPv6:2003:c6:ebdc:4000:9598:a7fc:fe65:51e7? (p200300C6EBDC40009598A7FCFE6551E7.dip0.t-ipconnect.de. [2003:c6:ebdc:4000:9598:a7fc:fe65:51e7]) by smtp.googlemail.com with ESMTPSA id d29sm735620wmi.21.2017.03.27.13.02.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Mar 2017 13:02:45 -0700 (PDT) Subject: [PATCH 2/2] mmc: meson-gx: factor out setting response configuration bits To: Ulf Hansson , Kevin Hilman References: Cc: "linux-mmc@vger.kernel.org" , linux-amlogic@lists.infradead.org From: Heiner Kallweit Message-ID: Date: Mon, 27 Mar 2017 22:02:32 +0200 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 Factor out setting the response configuration bits thus further reducing complexity of function meson_mmc_start_cmd. Signed-off-by: Heiner Kallweit Reviewed-by: Kevin Hilman --- drivers/mmc/host/meson-gx-mmc.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 0de32008..0036680b 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -456,6 +456,23 @@ static void meson_mmc_set_blksz(struct mmc_host *mmc, unsigned int blksz) writel(cfg, host->regs + SD_EMMC_CFG); } +static void meson_mmc_set_response_bits(struct mmc_command *cmd, u32 *cmd_cfg) +{ + if (cmd->flags & MMC_RSP_PRESENT) { + if (cmd->flags & MMC_RSP_136) + *cmd_cfg |= CMD_CFG_RESP_128; + *cmd_cfg |= CMD_CFG_RESP_NUM; + + if (!(cmd->flags & MMC_RSP_CRC)) + *cmd_cfg |= CMD_CFG_RESP_NOCRC; + + if (cmd->flags & MMC_RSP_BUSY) + *cmd_cfg |= CMD_CFG_R1B; + } else { + *cmd_cfg |= CMD_CFG_NO_RESP; + } +} + static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd) { struct meson_host *host = mmc_priv(mmc); @@ -469,20 +486,7 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd) cmd_cfg |= FIELD_PREP(CMD_CFG_CMD_INDEX_MASK, cmd->opcode); cmd_cfg |= CMD_CFG_OWNER; /* owned by CPU */ - /* Response */ - if (cmd->flags & MMC_RSP_PRESENT) { - if (cmd->flags & MMC_RSP_136) - cmd_cfg |= CMD_CFG_RESP_128; - cmd_cfg |= CMD_CFG_RESP_NUM; - - if (!(cmd->flags & MMC_RSP_CRC)) - cmd_cfg |= CMD_CFG_RESP_NOCRC; - - if (cmd->flags & MMC_RSP_BUSY) - cmd_cfg |= CMD_CFG_R1B; - } else { - cmd_cfg |= CMD_CFG_NO_RESP; - } + meson_mmc_set_response_bits(cmd, &cmd_cfg); /* data? */ if (data) {