From: kraxel@redhat.com (Gerd Hoffmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/13] mmc: bcm2835: add bcm2835_check_cmd_error
Date: Fri, 27 Jan 2017 00:37:19 +0100 [thread overview]
Message-ID: <1485473846-24537-7-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1485473846-24537-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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)
--
1.8.3.1
next prev parent reply other threads:[~2017-01-26 23:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1485473846-24537-1-git-send-email-kraxel@redhat.com>
2017-01-26 23:37 ` [PATCH 01/13] mmc: bcm2835: add bcm2835_read_wait_sdcmd Gerd Hoffmann
2017-01-26 23:51 ` Florian Fainelli
2017-01-27 8:04 ` Gerd Hoffmann
2017-01-27 18:23 ` Florian Fainelli
2017-02-15 10:59 ` Jeremy McNicoll
2017-01-27 2:03 ` Shawn Lin
2017-01-27 10:28 ` Gerd Hoffmann
2017-01-26 23:37 ` [PATCH 02/13] mmc: bcm2835: use bcm2835_read_wait_sdcmd in bcm2835_send_command Gerd Hoffmann
2017-01-26 23:37 ` [PATCH 03/13] mmc: bcm2835: add bcm2835_threaded_irq Gerd Hoffmann
2017-01-26 23:37 ` [PATCH 04/13] mmc: bcm2835: add bcm2835_check_data_error Gerd Hoffmann
2017-01-27 2:05 ` Shawn Lin
2017-01-27 10:31 ` Gerd Hoffmann
2017-01-26 23:37 ` [PATCH 05/13] mmc: bcm2835: call bcm2835_block_irq from irqthread Gerd Hoffmann
2017-01-26 23:37 ` Gerd Hoffmann [this message]
2017-01-26 23:37 ` [PATCH 07/13] mmc: bcm2835: call bcm2835_busy_irq " Gerd Hoffmann
2017-01-26 23:37 ` [PATCH 08/13] mmc: bcm2835: split bcm2835_data_irq Gerd Hoffmann
2017-01-26 23:37 ` [PATCH 09/13] mmc: bcm2835: switch locking to mutex Gerd Hoffmann
2017-01-26 23:37 ` [PATCH 10/13] mmc: bcm2835: work queue is dead code now, zap Gerd Hoffmann
2017-01-26 23:37 ` [PATCH 11/13] mmc: bcm2835: kill tasklet Gerd Hoffmann
2017-01-26 23:37 ` [PATCH 12/13] mmc: bcm2835: move timeout to thread context Gerd Hoffmann
2017-01-27 2:08 ` Shawn Lin
2017-01-26 23:37 ` [PATCH 13/13] mmc: bcm2835: use bcm2835_read_wait_sdcmd in bcm2835_finish_command Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485473846-24537-7-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).