From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tony@atomide.com, balbi@ti.com, gregkh@linuxfoundation.org, Sebastian Andrzej Siewior <bigeasy@linutronix.de> Subject: [PATCH 12/16] tty: serial: 8250_dma: handle the UART RDI event while DMA remains idle Date: Wed, 10 Sep 2014 21:30:07 +0200 [thread overview] Message-ID: <1410377411-26656-13-git-send-email-bigeasy@linutronix.de> (raw) In-Reply-To: <1410377411-26656-1-git-send-email-bigeasy@linutronix.de> Sometimes the OMAP UART does not signal the DMA engine to unload the FIFO. Usually this happens when we have >threshold bytes in the FIFO and start the DMA transfer. It seems that in those cases the UART won't trigger the transfer once the requested threshold is reached. In some rare cases the UART does not trigger the DMA transfer even if programmed while the FIFO was empty. In those cases the UART drops an RDI event and we have to empty the FIFO manually. If we ignore it because the DMA transfer is programmed then we will enter the function a few times until we receive the RX_TIMEOUT event. At that point the FIFO is usually full and we risk to overflow the FIFO. Reviewed-by: Tony Lindgren <tony@atomide.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/tty/serial/8250/8250_dma.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c index fa1dc966f394..898a6781d0b3 100644 --- a/drivers/tty/serial/8250/8250_dma.c +++ b/drivers/tty/serial/8250/8250_dma.c @@ -193,6 +193,24 @@ int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir) __dma_rx_do_complete(p, true); } return -ETIMEDOUT; + case UART_IIR_RDI: + if (p->bugs & UART_BUG_DMA_RX) + break; + /* + * The OMAP UART is a special BEAST. If we receive RDI we _have_ + * a DMA transfer programmed but it didn't worked. One reason is + * that we were too slow and there were too many bytes in the + * FIFO, the UART counted wrong and never kicked the DMA engine + * to do anything. That means once we receive RDI on OMAP than + * the DMA won't do anything soon so we have to cancel the DMA + * transfer and purge the FIFO manually. + */ + if (dma->rx_running) { + dmaengine_pause(dma->rxchan); + __dma_rx_do_complete(p, true); + } + return -ETIMEDOUT; + default: break; } -- 2.1.0
WARNING: multiple messages have this Message-ID (diff)
From: bigeasy@linutronix.de (Sebastian Andrzej Siewior) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 12/16] tty: serial: 8250_dma: handle the UART RDI event while DMA remains idle Date: Wed, 10 Sep 2014 21:30:07 +0200 [thread overview] Message-ID: <1410377411-26656-13-git-send-email-bigeasy@linutronix.de> (raw) In-Reply-To: <1410377411-26656-1-git-send-email-bigeasy@linutronix.de> Sometimes the OMAP UART does not signal the DMA engine to unload the FIFO. Usually this happens when we have >threshold bytes in the FIFO and start the DMA transfer. It seems that in those cases the UART won't trigger the transfer once the requested threshold is reached. In some rare cases the UART does not trigger the DMA transfer even if programmed while the FIFO was empty. In those cases the UART drops an RDI event and we have to empty the FIFO manually. If we ignore it because the DMA transfer is programmed then we will enter the function a few times until we receive the RX_TIMEOUT event. At that point the FIFO is usually full and we risk to overflow the FIFO. Reviewed-by: Tony Lindgren <tony@atomide.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/tty/serial/8250/8250_dma.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c index fa1dc966f394..898a6781d0b3 100644 --- a/drivers/tty/serial/8250/8250_dma.c +++ b/drivers/tty/serial/8250/8250_dma.c @@ -193,6 +193,24 @@ int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir) __dma_rx_do_complete(p, true); } return -ETIMEDOUT; + case UART_IIR_RDI: + if (p->bugs & UART_BUG_DMA_RX) + break; + /* + * The OMAP UART is a special BEAST. If we receive RDI we _have_ + * a DMA transfer programmed but it didn't worked. One reason is + * that we were too slow and there were too many bytes in the + * FIFO, the UART counted wrong and never kicked the DMA engine + * to do anything. That means once we receive RDI on OMAP than + * the DMA won't do anything soon so we have to cancel the DMA + * transfer and purge the FIFO manually. + */ + if (dma->rx_running) { + dmaengine_pause(dma->rxchan); + __dma_rx_do_complete(p, true); + } + return -ETIMEDOUT; + default: break; } -- 2.1.0
next prev parent reply other threads:[~2014-09-10 19:57 UTC|newest] Thread overview: 236+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-09-10 19:29 [PATCH 00/16 v9] omap 8250 based uart + DMA Sebastian Andrzej Siewior 2014-09-10 19:29 ` Sebastian Andrzej Siewior 2014-09-10 19:29 ` Sebastian Andrzej Siewior 2014-09-10 19:29 ` [PATCH 01/16] tty: serial: 8250_core: allow to set ->throttle / ->unthrottle callbacks Sebastian Andrzej Siewior 2014-09-10 19:29 ` Sebastian Andrzej Siewior 2014-09-10 19:29 ` [PATCH 02/16] tty: serial: 8250_core: add run time pm Sebastian Andrzej Siewior 2014-09-10 19:29 ` Sebastian Andrzej Siewior 2014-09-10 19:29 ` Sebastian Andrzej Siewior 2014-09-29 9:46 ` Frans Klaver 2014-09-29 9:46 ` Frans Klaver 2014-09-29 9:46 ` Frans Klaver 2014-09-29 13:39 ` Sebastian Andrzej Siewior 2014-09-29 13:39 ` Sebastian Andrzej Siewior 2014-09-10 19:29 ` [PATCH 03/16] tty: serial: 8250_core: read only RX if there is something in the FIFO Sebastian Andrzej Siewior 2014-09-10 19:29 ` Sebastian Andrzej Siewior 2015-02-09 13:34 ` Nicolas Schichan 2015-02-09 13:34 ` Nicolas Schichan 2015-02-09 23:34 ` Peter Hurley 2015-02-09 23:34 ` Peter Hurley 2015-02-10 9:32 ` Sebastian Andrzej Siewior 2015-02-10 9:32 ` Sebastian Andrzej Siewior 2015-02-10 12:04 ` Nicolas Schichan 2015-02-10 12:04 ` Nicolas Schichan 2015-02-10 17:46 ` Peter Hurley 2015-02-10 17:46 ` Peter Hurley 2015-02-11 20:01 ` Peter Hurley 2015-02-11 20:01 ` Peter Hurley 2015-02-11 20:03 ` Tony Lindgren 2015-02-11 20:03 ` Tony Lindgren 2015-02-11 20:03 ` Tony Lindgren 2015-02-11 20:42 ` Peter Hurley 2015-02-11 20:42 ` Peter Hurley 2015-02-12 8:45 ` Sebastian Andrzej Siewior 2015-02-12 8:45 ` Sebastian Andrzej Siewior 2015-02-12 9:40 ` Russell King - ARM Linux 2015-02-12 9:40 ` Russell King - ARM Linux 2015-02-12 16:32 ` Peter Hurley 2015-02-12 16:32 ` Peter Hurley 2015-02-12 19:23 ` Sebastian Andrzej Siewior 2015-02-12 19:23 ` Sebastian Andrzej Siewior 2015-02-12 19:55 ` Peter Hurley 2015-02-12 19:55 ` Peter Hurley 2015-02-12 20:34 ` Sebastian Andrzej Siewior 2015-02-12 20:34 ` Sebastian Andrzej Siewior 2015-02-13 18:51 ` Sebastian Andrzej Siewior 2015-02-13 18:51 ` Sebastian Andrzej Siewior 2015-02-13 23:15 ` Russell King - ARM Linux 2015-02-13 23:15 ` Russell King - ARM Linux 2015-02-15 17:32 ` [PATCH] serial: 8250: Revert "tty: serial: 8250_core: read only RX if there is something in the FIFO" Sebastian Andrzej Siewior 2015-02-15 17:32 ` Sebastian Andrzej Siewior 2015-05-12 20:25 ` Tony Lindgren 2015-05-12 20:25 ` Tony Lindgren 2014-09-10 19:29 ` [PATCH 04/16] tty: serial: 8250_core: use the ->line argument as a hint in serial8250_find_match_or_unused() Sebastian Andrzej Siewior 2014-09-10 19:29 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` [PATCH 05/16] tty: serial: 8250_core: remove UART_IER_RDI in serial8250_stop_rx() Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-11 11:19 ` Heikki Krogerus 2014-09-11 11:19 ` Heikki Krogerus 2014-09-10 19:30 ` [PATCH 06/16] tty: serial: Add 8250-core based omap driver Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-11 11:57 ` Peter Hurley 2014-09-11 11:57 ` Peter Hurley 2014-09-11 11:57 ` Peter Hurley 2014-09-16 17:01 ` Sebastian Andrzej Siewior 2014-09-16 17:01 ` Sebastian Andrzej Siewior 2014-09-16 17:01 ` Sebastian Andrzej Siewior 2014-09-29 9:38 ` Frans Klaver 2014-09-29 9:38 ` Frans Klaver 2014-09-29 9:38 ` Frans Klaver 2014-09-29 13:27 ` Sebastian Andrzej Siewior 2014-09-29 13:27 ` Sebastian Andrzej Siewior 2014-09-29 13:34 ` Frans Klaver 2014-09-29 13:34 ` Frans Klaver 2014-09-10 19:30 ` [PATCH 07/16] tty: serial: 8250_dma: handle error on TX submit Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` [PATCH 08/16] tty: serial: 8250_dma: enqueue RX dma again on completion Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` [PATCH 09/16] tty: serial: 8250_dma: Add a TX trigger workaround for AM33xx Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-11 11:17 ` Heikki Krogerus 2014-09-11 11:17 ` Heikki Krogerus 2014-09-11 11:17 ` Heikki Krogerus 2014-09-11 11:42 ` Sebastian Andrzej Siewior 2014-09-11 11:42 ` Sebastian Andrzej Siewior 2014-09-11 11:42 ` Sebastian Andrzej Siewior 2014-09-11 12:32 ` Peter Hurley 2014-09-11 12:32 ` Peter Hurley 2014-09-11 12:50 ` Sebastian Andrzej Siewior 2014-09-11 12:50 ` Sebastian Andrzej Siewior 2014-09-11 14:35 ` Peter Hurley 2014-09-11 14:35 ` Peter Hurley 2014-09-11 14:35 ` Peter Hurley 2014-09-15 17:01 ` Sebastian Andrzej Siewior 2014-09-15 17:01 ` Sebastian Andrzej Siewior 2014-09-16 16:55 ` Sebastian Andrzej Siewior 2014-09-16 16:55 ` Sebastian Andrzej Siewior 2014-09-16 16:55 ` Sebastian Andrzej Siewior 2014-09-17 12:20 ` Peter Hurley 2014-09-17 12:20 ` Peter Hurley 2014-09-17 16:25 ` Sebastian Andrzej Siewior 2014-09-17 16:25 ` Sebastian Andrzej Siewior 2014-09-17 16:25 ` Sebastian Andrzej Siewior 2014-09-29 16:15 ` Sebastian Andrzej Siewior 2014-09-29 16:15 ` Sebastian Andrzej Siewior 2014-09-11 15:11 ` Frans Klaver 2014-09-11 15:11 ` Frans Klaver 2014-09-11 15:11 ` Frans Klaver 2014-09-11 16:04 ` Sebastian Andrzej Siewior 2014-09-11 16:04 ` Sebastian Andrzej Siewior 2014-09-11 17:04 ` Frans Klaver 2014-09-11 17:04 ` Frans Klaver 2014-09-12 7:23 ` Sebastian Andrzej Siewior 2014-09-12 7:23 ` Sebastian Andrzej Siewior 2014-09-12 9:40 ` Frans Klaver 2014-09-12 9:40 ` Frans Klaver 2014-09-12 9:51 ` Sebastian Andrzej Siewior 2014-09-12 9:51 ` Sebastian Andrzej Siewior 2014-09-12 10:28 ` Frans Klaver 2014-09-12 10:28 ` Frans Klaver 2014-09-12 10:28 ` Frans Klaver 2014-09-15 16:42 ` Sebastian Andrzej Siewior 2014-09-15 16:42 ` Sebastian Andrzej Siewior 2014-09-16 9:05 ` Frans Klaver 2014-09-16 9:05 ` Frans Klaver 2014-09-16 9:05 ` Frans Klaver 2014-09-16 12:42 ` Frans Klaver 2014-09-16 12:42 ` Frans Klaver 2014-09-16 12:42 ` Frans Klaver 2014-09-16 14:23 ` Frans Klaver 2014-09-16 14:23 ` Frans Klaver 2014-09-16 14:23 ` Frans Klaver 2014-09-17 10:28 ` Frans Klaver 2014-09-17 10:28 ` Frans Klaver 2014-09-17 10:28 ` Frans Klaver 2014-09-21 20:41 ` Sebastian Andrzej Siewior 2014-09-21 20:41 ` Sebastian Andrzej Siewior 2014-09-21 20:41 ` Sebastian Andrzej Siewior 2014-09-22 9:28 ` Frans Klaver 2014-09-22 9:28 ` Frans Klaver 2014-09-22 9:28 ` Frans Klaver 2014-09-24 7:56 ` Sebastian Andrzej Siewior 2014-09-24 7:56 ` Sebastian Andrzej Siewior 2014-09-25 15:14 ` Sebastian Andrzej Siewior 2014-09-25 15:14 ` Sebastian Andrzej Siewior 2014-09-25 15:18 ` Frans Klaver 2014-09-25 15:18 ` Frans Klaver 2014-09-29 8:50 ` Frans Klaver 2014-09-29 8:50 ` Frans Klaver 2014-09-29 8:50 ` Frans Klaver 2014-09-29 9:54 ` Sebastian Andrzej Siewior 2014-09-29 9:54 ` Sebastian Andrzej Siewior 2014-09-29 10:30 ` Frans Klaver 2014-09-29 10:30 ` Frans Klaver 2014-09-29 10:30 ` Frans Klaver 2014-09-30 8:44 ` Frans Klaver 2014-09-30 8:44 ` Frans Klaver 2014-09-30 8:44 ` Frans Klaver 2014-10-02 10:27 ` Sebastian Andrzej Siewior 2014-10-02 10:27 ` Sebastian Andrzej Siewior 2014-10-02 10:27 ` Sebastian Andrzej Siewior 2014-10-13 14:55 ` Frans Klaver 2014-10-13 14:55 ` Frans Klaver 2014-10-13 14:55 ` Frans Klaver 2014-09-23 17:03 ` Peter Hurley 2014-09-23 17:03 ` Peter Hurley 2014-09-24 7:53 ` Sebastian Andrzej Siewior 2014-09-24 7:53 ` Sebastian Andrzej Siewior 2014-09-25 10:42 ` Sebastian Andrzej Siewior 2014-09-25 10:42 ` Sebastian Andrzej Siewior 2014-09-25 11:31 ` Peter Hurley 2014-09-25 11:31 ` Peter Hurley 2014-09-25 13:11 ` Sebastian Andrzej Siewior 2014-09-25 13:11 ` Sebastian Andrzej Siewior 2014-09-25 13:11 ` Sebastian Andrzej Siewior 2014-09-17 16:34 ` Sebastian Andrzej Siewior 2014-09-17 16:34 ` Sebastian Andrzej Siewior 2014-09-17 16:34 ` Sebastian Andrzej Siewior 2014-09-19 10:22 ` Heikki Krogerus 2014-09-19 10:22 ` Heikki Krogerus 2014-09-19 10:22 ` Heikki Krogerus 2014-09-19 10:58 ` Sebastian Andrzej Siewior 2014-09-19 10:58 ` Sebastian Andrzej Siewior 2014-09-19 11:25 ` Peter Hurley 2014-09-19 11:25 ` Peter Hurley 2014-09-22 7:46 ` Heikki Krogerus 2014-09-22 7:46 ` Heikki Krogerus 2014-09-25 9:24 ` Sebastian Andrzej Siewior 2014-09-25 9:24 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` [PATCH 10/16] tty: serial: 8250_dma: optimize the xmit path due to UART_BUG_DMA_TX Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` [PATCH 11/16] tty: serial: 8250_dma: keep own book keeping about RX transfers Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior [this message] 2014-09-10 19:30 ` [PATCH 12/16] tty: serial: 8250_dma: handle the UART RDI event while DMA remains idle Sebastian Andrzej Siewior 2014-09-29 9:23 ` Frans Klaver 2014-09-29 9:23 ` Frans Klaver 2014-09-29 9:23 ` Frans Klaver 2014-09-10 19:30 ` [PATCH 13/16] tty: serial: 8250_dma: add pm runtime Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-29 9:26 ` Frans Klaver 2014-09-29 9:26 ` Frans Klaver 2014-09-29 9:26 ` Frans Klaver 2014-09-29 9:56 ` Sebastian Andrzej Siewior 2014-09-29 9:56 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` [PATCH 14/16] arm: dts: am33xx: add DMA properties for UART Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` [PATCH 15/16] arm: dts: dra7: " Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-10 19:30 ` [PATCH 16/16] tty: serial: 8250: omap: add dma support Sebastian Andrzej Siewior 2014-09-10 19:30 ` Sebastian Andrzej Siewior 2014-09-12 22:43 ` [PATCH 00/16 v9] omap 8250 based uart + DMA Tony Lindgren 2014-09-12 22:43 ` Tony Lindgren 2014-09-12 22:43 ` Tony Lindgren 2014-09-15 11:50 ` Sebastian Andrzej Siewior 2014-09-15 11:50 ` Sebastian Andrzej Siewior 2014-09-15 11:50 ` Sebastian Andrzej Siewior 2014-09-16 12:57 ` Sebastian Andrzej Siewior 2014-09-16 12:57 ` Sebastian Andrzej Siewior 2014-09-16 12:57 ` Sebastian Andrzej Siewior 2014-09-16 16:48 ` Tony Lindgren 2014-09-16 16:48 ` Tony Lindgren 2014-09-16 21:30 ` Tony Lindgren 2014-09-16 21:30 ` Tony Lindgren 2014-09-16 21:30 ` Tony Lindgren 2014-09-17 8:38 ` Sebastian Andrzej Siewior 2014-09-17 8:38 ` Sebastian Andrzej Siewior 2014-09-17 9:05 ` Sebastian Andrzej Siewior 2014-09-17 9:05 ` Sebastian Andrzej Siewior 2014-09-26 16:02 ` Greg KH 2014-09-26 16:02 ` Greg KH 2014-09-26 16:02 ` 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=1410377411-26656-13-git-send-email-bigeasy@linutronix.de \ --to=bigeasy@linutronix.de \ --cc=balbi@ti.com \ --cc=gregkh@linuxfoundation.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=linux-serial@vger.kernel.org \ --cc=tony@atomide.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.