* [PATCH] Fix an error that can cause fsl espi task blocked for more than 120 seconds
@ 2015-05-01 23:37 Jane Wan
[not found] ` <1430523462-12306-1-git-send-email-Jane.Wan-X7+3OicCfH32eFz/2MeuCQ@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Jane Wan @ 2015-05-01 23:37 UTC (permalink / raw)
To: broonie, linux-spi, linux-kernel, Emilian.Medve, b48286,
insop.song
Cc: Jane Wan
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix an error that can cause fsl espi task blocked for more than 120 seconds
[not found] ` <1430523462-12306-1-git-send-email-Jane.Wan-X7+3OicCfH32eFz/2MeuCQ@public.gmane.org>
@ 2015-05-21 21:19 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-05-21 21:19 UTC (permalink / raw)
To: Jane Wan
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
Emilian.Medve-eDlz3WWmN0ll57MIdRCFDg,
b48286-KZfg59tc24xl57MIdRCFDg, insop.song-X7+3OicCfH32eFz/2MeuCQ
[-- Attachment #1: Type: text/plain, Size: 471 bytes --]
On Fri, May 01, 2015 at 04:37:42PM -0700, Jane Wan wrote:
> 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.
Applied, thanks. Please submit patches in the format covered in
SubmittingPatches - use subject lines matching the style for the
subsysetem and keep commit message lines below 80 columns.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-21 21:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-01 23:37 [PATCH] Fix an error that can cause fsl espi task blocked for more than 120 seconds Jane Wan
[not found] ` <1430523462-12306-1-git-send-email-Jane.Wan-X7+3OicCfH32eFz/2MeuCQ@public.gmane.org>
2015-05-21 21:19 ` Mark Brown
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).