From patchwork Thu Jan 26 23:37:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 9540403 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 99D10604A9 for ; Thu, 26 Jan 2017 23:43:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D83628305 for ; Thu, 26 Jan 2017 23:43:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8127D2830A; Thu, 26 Jan 2017 23:43:56 +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 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 872F828305 for ; Thu, 26 Jan 2017 23:43:55 +0000 (UTC) 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 1cWthg-0001Cw-NW; Thu, 26 Jan 2017 23:43:44 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWteb-0007Y3-Jm for linux-arm-kernel@bombadil.infradead.org; Thu, 26 Jan 2017 23:40:33 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWtcW-0004PC-Ue for linux-arm-kernel@lists.infradead.org; Thu, 26 Jan 2017 23:38:25 +0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CC8B4AE88; Thu, 26 Jan 2017 23:37:33 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id C13492112A4; Thu, 26 Jan 2017 23:37:32 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id EA7EC8162C; Fri, 27 Jan 2017 00:37:29 +0100 (CET) From: Gerd Hoffmann To: linux-rpi-kernel@lists.infradead.org Subject: [PATCH 06/13] mmc: bcm2835: add bcm2835_check_cmd_error Date: Fri, 27 Jan 2017 00:37:19 +0100 Message-Id: <1485473846-24537-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1485473846-24537-1-git-send-email-kraxel@redhat.com> References: <1485473846-24537-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 26 Jan 2017 23:37:33 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170126_183825_282864_022782BD X-CRM114-Status: GOOD ( 15.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , Ulf Hansson , Florian Fainelli , Scott Branden , Stephen Warren , Ray Jui , Lee Jones , linux-mmc@vger.kernel.org, open list , Eric Anholt , "maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..." , Gerd Hoffmann , "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Gerd Hoffmann --- drivers/mmc/host/bcm2835.c | 58 ++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 8270c76..33eaebd 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -954,6 +954,38 @@ static void bcm2835_timeout(unsigned long data) spin_unlock_irqrestore(&host->lock, flags); } +static bool bcm2835_check_cmd_error(struct bcm2835_host *host, u32 intmask) +{ + struct device *dev = &host->pdev->dev; + + if (!(intmask & SDHSTS_ERROR_MASK)) + return false; + + if (!host->cmd) + return true; + + dev_err(dev, "sdhost_busy_irq: intmask %x, data %p\n", + intmask, host->mrq->data); + if (intmask & SDHSTS_CRC7_ERROR) { + host->cmd->error = -EILSEQ; + } else if (intmask & (SDHSTS_CRC16_ERROR | + SDHSTS_FIFO_ERROR)) { + if (host->mrq->data) + host->mrq->data->error = -EILSEQ; + else + host->cmd->error = -EILSEQ; + } else if (intmask & SDHSTS_REW_TIME_OUT) { + if (host->mrq->data) + host->mrq->data->error = -ETIMEDOUT; + else + host->cmd->error = -ETIMEDOUT; + } else if (intmask & SDHSTS_CMD_TIME_OUT) { + host->cmd->error = -ETIMEDOUT; + } + bcm2835_dumpregs(host); + return true; +} + static void bcm2835_check_data_error(struct bcm2835_host *host, u32 intmask) { if (!host->data) @@ -983,30 +1015,10 @@ static void bcm2835_busy_irq(struct bcm2835_host *host, u32 intmask) } host->use_busy = false; - if (intmask & SDHSTS_ERROR_MASK) { - dev_err(dev, "sdhost_busy_irq: intmask %x, data %p\n", - intmask, host->mrq->data); - if (intmask & SDHSTS_CRC7_ERROR) { - host->cmd->error = -EILSEQ; - } else if (intmask & (SDHSTS_CRC16_ERROR | - SDHSTS_FIFO_ERROR)) { - if (host->mrq->data) - host->mrq->data->error = -EILSEQ; - else - host->cmd->error = -EILSEQ; - } else if (intmask & SDHSTS_REW_TIME_OUT) { - if (host->mrq->data) - host->mrq->data->error = -ETIMEDOUT; - else - host->cmd->error = -ETIMEDOUT; - } else if (intmask & SDHSTS_CMD_TIME_OUT) { - host->cmd->error = -ETIMEDOUT; - } + if (bcm2835_check_cmd_error(host, intmask)) + return; - bcm2835_dumpregs(host); - } else { - bcm2835_finish_command(host, NULL); - } + bcm2835_finish_command(host, NULL); } static void bcm2835_data_irq(struct bcm2835_host *host, u32 intmask)