From: stefan@agner.ch (Stefan Agner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] serial: fsl_lpuart: avoid new transfer while DMA is running
Date: Fri, 28 Nov 2014 01:23:24 +0100 [thread overview]
Message-ID: <1417134205-4400-4-git-send-email-stefan@agner.ch> (raw)
In-Reply-To: <1417134205-4400-1-git-send-email-stefan@agner.ch>
When the UART is DMA receive mode (RDMAS set) and a character just
arrived, while another interrupt is handled, the RDRF (receiver data
register full flag) is set. But since the DMA will take care of it
there is no need to handle it by calling lpuart_prepare_rx. Handling
it leads in adding the RX timeout timer twice:
[ 43.528029] Kernel BUG at 8004ee7c [verbose debug info unavailable]
[ 43.534329] Internal error: Oops - BUG: 0 [#1] ARM
[ 43.539145] Modules linked in:
[ 43.542242] CPU: 0 PID: 0 Comm: swapper Not tainted 3.18.0-rc5-00014-ge956e1a-dirty #1293
[ 43.550448] task: 80795630 ti: 8078a000 task.ti: 8078a000
[ 43.555886] PC is at add_timer+0x24/0x28
[ 43.559833] LR is at lpuart_int+0x188/0x3b0
[ 43.564039] pc : [<8004ee7c>] lr : [<802cbd3c>] psr: a0000193
[ 43.564039] sp : 8078be18 ip : 8078be28 fp : 8078be24
[ 43.575560] r10: 8e80b840 r9 : 807d23ff r8 : 20000193
[ 43.580812] r7 : 00000020 r6 : 00000001 r5 : 000000a0 r4 : 8e994e10
[ 43.587368] r3 : ffff9bd1 r2 : 80815360 r1 : 8e994e10 r0 : 8e994f20
[ 43.593923] Flags: NzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
[ 43.601352] Control: 10c5387d Table: 8c424059 DAC: 00000015
[ 43.607125] Process swapper (pid: 0, stack limit = 0x8078a238)
...
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
drivers/tty/serial/fsl_lpuart.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 629291d..be9ccdf 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -756,18 +756,18 @@ out:
static irqreturn_t lpuart_int(int irq, void *dev_id)
{
struct lpuart_port *sport = dev_id;
- unsigned char sts;
+ unsigned char sts, crdma;
sts = readb(sport->port.membase + UARTSR1);
+ crdma = readb(sport->port.membase + UARTCR5);
- if (sts & UARTSR1_RDRF) {
+ if (sts & UARTSR1_RDRF && !(crdma & UARTCR5_RDMAS)) {
if (sport->lpuart_dma_rx_use)
lpuart_prepare_rx(sport);
else
lpuart_rxint(irq, dev_id);
}
- if (sts & UARTSR1_TDRE &&
- !(readb(sport->port.membase + UARTCR5) & UARTCR5_TDMAS)) {
+ if (sts & UARTSR1_TDRE && !(crdma & UARTCR5_TDMAS)) {
if (sport->lpuart_dma_tx_use)
lpuart_pio_tx(sport);
else
--
2.1.3
next prev parent reply other threads:[~2014-11-28 0:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-28 0:23 [PATCH 0/4] serial: fsl_lpuart: fix various DMA related issues Stefan Agner
2014-11-28 0:23 ` [PATCH 1/4] serial: fsl_lpuart: delete timer on shutdown Stefan Agner
2014-11-28 0:23 ` [PATCH 2/4] serial: fsl_lpuart: move DMA channel request to probe Stefan Agner
2014-11-28 0:23 ` Stefan Agner [this message]
2014-11-28 0:23 ` [PATCH 4/4] serial: fsl_lpuart: update RX timer on successful DMA transfer Stefan Agner
2014-12-12 13:44 ` [PATCH 0/4] serial: fsl_lpuart: fix various DMA related issues Stefan Agner
2014-12-12 14:32 ` Greg KH
2014-12-12 16:19 ` Stefan Agner
2015-01-09 22:14 ` Greg KH
2015-01-09 22:19 ` Stefan Agner
2015-01-09 22:34 ` Greg KH
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=1417134205-4400-4-git-send-email-stefan@agner.ch \
--to=stefan@agner.ch \
--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).