From: Jane Wan <Jane.Wan@gainspeed.com>
To: <broonie@kernel.org>, <linux-spi@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <Emilian.Medve@Freescale.com>,
<b48286@freescale.com>, <insop.song@gainspeed.com>
Cc: Jane Wan <Jane.Wan@gainspeed.com>
Subject: [PATCH] Fix an error that can cause fsl espi task blocked for more than 120 seconds
Date: Fri, 1 May 2015 16:37:42 -0700 [thread overview]
Message-ID: <1430523462-12306-1-git-send-email-Jane.Wan@gainspeed.com> (raw)
Incorrect condition is used in spin_event_timeout(). When the TX is done, the SPIE_NF bit in ESPI_SPIE register is set to 1 to indicate the Tx FIFO is not full. If the bit is 0, it indicates the Tx FIFO is full.
Due to this error, if the Tx FIFO is full at the beginning, but becomes not full after handling the Rx FIFO (the SPIE_NF bit is set), the spin_event_timeout() returns with timeout occurred. It causes the interrupt handler not to send completion notification to the thread that called wait_for_complete() waiting for the notification.
Signed-off-by: Jane Wan <Jane.Wan@gainspeed.com>
---
drivers/spi/spi-fsl-espi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 9011e5d..333d5c2 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -551,9 +551,13 @@ void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events)
/* spin until TX is done */
ret = spin_event_timeout(((events = mpc8xxx_spi_read_reg(
- ®_base->event)) & SPIE_NF) == 0, 1000, 0);
+ ®_base->event)) & SPIE_NF), 1000, 0);
if (!ret) {
dev_err(mspi->dev, "tired waiting for SPIE_NF\n");
+
+ /* Clear the SPIE bits */
+ mpc8xxx_spi_write_reg(®_base->event, events);
+ complete(&mspi->done);
return;
}
}
--
1.7.9.5
next reply other threads:[~2015-05-01 23:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 23:37 Jane Wan [this message]
[not found] ` <1430523462-12306-1-git-send-email-Jane.Wan-X7+3OicCfH32eFz/2MeuCQ@public.gmane.org>
2015-05-21 21:19 ` [PATCH] Fix an error that can cause fsl espi task blocked for more than 120 seconds Mark Brown
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=1430523462-12306-1-git-send-email-Jane.Wan@gainspeed.com \
--to=jane.wan@gainspeed.com \
--cc=Emilian.Medve@Freescale.com \
--cc=b48286@freescale.com \
--cc=broonie@kernel.org \
--cc=insop.song@gainspeed.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.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).