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: 9572751 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 BCEDA601E7 for ; Tue, 14 Feb 2017 20:08:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8FEF26E4D for ; Tue, 14 Feb 2017 20:08:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADFDB2840E; Tue, 14 Feb 2017 20:08:37 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6AD2926E4D for ; Tue, 14 Feb 2017 20:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:Subject:From:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JDzEtyNBmtI2/gi7RfdMhAdOlJ1xlj5yW+BlCUiYzzY=; b=OjyYx2zq0RVsa6 HnxUplSC7fNgikILcEUQs78X9cI7paefCMvgFF3tAgmfsNSJOPaQjmv4p+YkavarFkv/tIj4a+Eg0 vuuSz9+9ti4t/F3oy8Wjv33j2uUgHiq9pX9lZVu2noc8tb3em9bxGJtU37EnSNCI4pHcgKB/R0flo HpAZ6uAfzhM6sAr08Z5XFEoCesjzPM/dcotM64aU04f2+3GBkEPT84z+yzjabCw/oJFOAksklfOjS RCGn1KywggDhOS7EajGWDocCHCITH3wE9UN6qIf3NDOy0hJIv9E/+hbNiMZt0AP3oMTkhor5F15bq BII+ooNo1i150KCQ2xpw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cdjOo-0002Md-S9; Tue, 14 Feb 2017 20:08:30 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cdjOd-0002Ch-Hn for linux-amlogic@bombadil.infradead.org; Tue, 14 Feb 2017 20:08:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:Cc:References:To:Subject:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=io94uRsuI6rGo6iOyZwWwFzbiMO+KEivr/VeLiqs72E=; b=29uuH76q7vuwzW4svYt+xyG6Fe qoLimYilETFEItkudxcf/oE5dSdSHQAA86CC97J6RxQvBSWIybIv3A5jfCJ+bTMGMXLGu6CzafTeq lAXX2MO8K85n+WpaAH+fOjdyRBmUICBLCTUxSIZqjlZhl8Ld7Z4WCM9F9FgL1T1Ld2Po3F2rPEppU CbLDZVkGxubTDcufGd6IXC44qK4DSpkOGn5XvolNL++aP4Xv6O8JrTzrdU0NUqVdowylpgwPWLlRb iuFF8zxarM60XiEBTDWvapuoUNaeHteCkqJE5lXNc3SPZBLyyVHxyDUJeGXr8z/Mm++yv0ajZmqbQ QV7HPnIA==; Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cdjOb-0004K1-Q6 for linux-amlogic@lists.infradead.org; Tue, 14 Feb 2017 20:08:18 +0000 Received: by mail-wm0-x241.google.com with SMTP id u63so5220263wmu.2 for ; Tue, 14 Feb 2017 12:07:53 -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=lFNIAuBFTrM7QLelUc5WogIZu+O0C9ypyYS3jfn5iDY7ST/+1Br8OSqqvRUeBgFFCg AeNBOomOK2chMHXjKETt8IAtsr8x8jrf2MhClH3Z5rIR5utjYVorFcq1UZ7/iK1LLROk ay8JDM9x7aoig+EK0MkuPdVqKsXbgf6i9tsYPzT3ckGz3kI7dSqMfNXt4StPj4T99ggm KFAFLDsea7iynKDtHDiWy6spk41/eEgTLyoPuVo99qW3/KTeTVQmDrtxhbGFzIjKKT94 wDcAy3JDyp8+G4Fe4GuzI+56zv4fSG8m1GNKMMgpFP4YlWVOPYUtQHSCqdw5h5kpNVxx pnMg== X-Gm-Message-State: AMke39m/YGRhJK1XiiZHGCOpHKfPhWQtZIbsbaNeTUOuBy8+A0i0AaqtnZNLa/BiouYAOg== 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> 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170214_150818_000645_55768F2A X-CRM114-Status: GOOD ( 12.63 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlo Caione , linux-amlogic@lists.infradead.org, "linux-mmc@vger.kernel.org" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.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