From patchwork Tue Feb 14 20:07:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9572711 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 47486601E7 for ; Tue, 14 Feb 2017 20:08:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44CB826E4D for ; Tue, 14 Feb 2017 20:08:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 399042840E; Tue, 14 Feb 2017 20:08:06 +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 D856F26E4D for ; Tue, 14 Feb 2017 20:08:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754620AbdBNUIE (ORCPT ); Tue, 14 Feb 2017 15:08:04 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36746 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754658AbdBNUH5 (ORCPT ); Tue, 14 Feb 2017 15:07:57 -0500 Received: by mail-wm0-f65.google.com with SMTP id r18so5222449wmd.3 for ; Tue, 14 Feb 2017 12:07:57 -0800 (PST) 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=io94uRsuI6rGo6iOyZwWwFzbiMO+KEivr/VeLiqs72E=; b=VWyRVnT4NGa5alKmr3RaGD/5RZL9s3rXHtRvLkrsKqB4jQ5dJH3NUUhW8tR9rb0GNq B4hSkY8EQa+gswJjyYyxOt/qwbFQf1gbS6338anwMhZln058uQ1JeTgkTp58dYYP/BkQ WzTPn2srFm7jKeoGl4VotjDZ5uE2IlvMlxfeiiI5tSAUFGNbAIIvuufcmpyY2gOsDNAW VNe9t+IMG3XdiXFUnHbp1/2COMQ86jMMdlgkLZa1CR9hrY2yQw2WV8SPWFg+hWcs/hsr JWpnzKBr9c2XnxmG6eirg/9lq9jAm5II29AsDQl/jNkMLBQICG3G8HB2OVanlQhkK85F pong== 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=io94uRsuI6rGo6iOyZwWwFzbiMO+KEivr/VeLiqs72E=; b=IMseLchGmvPOtD/PGOr+zfIk3EWI0vRH+PeeOgzfhVXvDMruOZqGZZKN3CLkVPSNUg lu3OaW7RX/sLM1Jb1E59Fn9eeAupLGg5ZeKwflrNuFLdjJMblpjQdNL6DZ9j1ud+XA2d XuseVTenHVvMIgqvQp1gnv/dD264Fxt/NzxQGqQrsPAfgA6LiHbS7jBpjrYvPsnRziao cYfZDrUcg4XW4tPhJZcuFkX6y1u/0Te3MJ2NWs9CZ2UN3P4hKmIF9skcShaINB/b7Eys HCixj+sRcsmtrGYHNzmd3G3x/Tdsa4WTE2uJ6v+btFO5xyGCp20x8VUCfEyBC8CgY19b a0OA== X-Gm-Message-State: AMke39nbHrnuM9m+fKwX3A2CMpmRWbrTOYV8dGL8MjM4tKiUBO3En5mIwysO0z65tBTYeQ== X-Received: by 10.28.230.91 with SMTP id d88mr4719595wmh.129.1487102871577; Tue, 14 Feb 2017 12:07:51 -0800 (PST) Received: from ?IPv6:2003:c6:ebdc:4000:9533:a20:55f1:fb4b? (p200300C6EBDC400095330A2055F1FB4B.dip0.t-ipconnect.de. [2003:c6:ebdc:4000:9533:a20:55f1:fb4b]) by smtp.googlemail.com with ESMTPSA id q5sm2032389wrd.32.2017.02.14.12.07.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Feb 2017 12:07:51 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 16/18] mmc: meson-gx: improve response reading and sending stop command To: Ulf Hansson , Kevin Hilman References: <420b75a9-b8c2-b3d7-ae60-3ed8a5a18ead@gmail.com> Cc: Carlo Caione , "linux-mmc@vger.kernel.org" , linux-amlogic@lists.infradead.org Message-ID: Date: Tue, 14 Feb 2017 21:07:09 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <420b75a9-b8c2-b3d7-ae60-3ed8a5a18ead@gmail.com> 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 Stopping execution at the beginning of command processing (again) is not needed as reading SD_EMMC_CMD_RSP implicitely stops execution. We just have to take care of the case that a command doesn't return a response. Therefore read SD_EMMC_CMD_RSP always. In addition we can read the response in the main irq handler already, we don't have to do this in the threaded handler. Signed-off-by: Heiner Kallweit Acked-by: Kevin Hilman --- drivers/mmc/host/meson-gx-mmc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 25b46d36..6721aee2 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -510,9 +510,6 @@ static void meson_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) WARN_ON(host->mrq != NULL); - /* Stop execution */ - writel(0, host->regs + SD_EMMC_START); - host->mrq = mrq; meson_mmc_start_cmd(mmc, mrq->cmd); } @@ -521,12 +518,16 @@ static void meson_mmc_read_resp(struct mmc_host *mmc, struct mmc_command *cmd) { struct meson_host *host = mmc_priv(mmc); + /* + * reading SD_EMMC_CMD_RSP stops processing, therefore read + * this register even if command has no response + */ if (cmd->flags & MMC_RSP_136) { cmd->resp[0] = readl(host->regs + SD_EMMC_CMD_RSP3); cmd->resp[1] = readl(host->regs + SD_EMMC_CMD_RSP2); cmd->resp[2] = readl(host->regs + SD_EMMC_CMD_RSP1); cmd->resp[3] = readl(host->regs + SD_EMMC_CMD_RSP); - } else if (cmd->flags & MMC_RSP_PRESENT) { + } else { cmd->resp[0] = readl(host->regs + SD_EMMC_CMD_RSP); } } @@ -564,6 +565,8 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) goto out; } + meson_mmc_read_resp(host->mmc, cmd); + cmd->error = 0; if (status & IRQ_RXD_ERR_MASK) { dev_dbg(host->dev, "Unhandled IRQ: RXD error\n"); @@ -610,10 +613,8 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) /* ack all (enabled) interrupts */ writel(status, host->regs + SD_EMMC_STATUS); - if (ret == IRQ_HANDLED) { - meson_mmc_read_resp(host->mmc, cmd); + if (ret == IRQ_HANDLED) meson_mmc_request_done(host->mmc, cmd->mrq); - } spin_unlock(&host->lock); return ret; @@ -643,7 +644,6 @@ static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id) data->bytes_xfered = xfer_bytes; } - meson_mmc_read_resp(host->mmc, cmd); if (mmc_op_multi(cmd->opcode)) meson_mmc_start_cmd(host->mmc, data->stop); else