From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: [PATCH 2/9] serial: 8250_dma: Fix RX handling
Date: Wed, 10 Apr 2013 16:58:25 +0300 [thread overview]
Message-ID: <1365602312-25436-3-git-send-email-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <1365602312-25436-1-git-send-email-heikki.krogerus@linux.intel.com>
Overrun, parity and framing errors should be handled in
8250_core. This also adds check for the dma_status and exits
if the channel is not idle.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
drivers/tty/serial/8250/8250_dma.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index ce2518d..6643061 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -101,20 +101,29 @@ int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir)
struct dma_tx_state state;
int dma_status;
- /*
- * If RCVR FIFO trigger level was not reached, complete the transfer and
- * let 8250.c copy the remaining data.
- */
- if ((iir & 0x3f) == UART_IIR_RX_TIMEOUT) {
- dma_status = dmaengine_tx_status(dma->rxchan, dma->rx_cookie,
- &state);
+ dma_status = dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
+
+ switch (iir & 0x3f) {
+ case UART_IIR_RLSI:
+ /* 8250_core handles errors and break interrupts */
+ return -EIO;
+ case UART_IIR_RX_TIMEOUT:
+ /*
+ * If RCVR FIFO trigger level was not reached, complete the
+ * transfer and let 8250_core copy the remaining data.
+ */
if (dma_status == DMA_IN_PROGRESS) {
dmaengine_pause(dma->rxchan);
__dma_rx_complete(p);
}
return -ETIMEDOUT;
+ default:
+ break;
}
+ if (dma_status)
+ return 0;
+
desc = dmaengine_prep_slave_single(dma->rxchan, dma->rx_addr,
dma->rx_size, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
--
1.7.10.4
next prev parent reply other threads:[~2013-04-10 14:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
2013-04-10 13:58 ` [PATCH 1/9] serial: 8250_dma: TX cleanup Heikki Krogerus
2013-04-10 13:58 ` Heikki Krogerus [this message]
2013-04-10 13:58 ` [PATCH 3/9] serial: 8250_dma: Use dmaengine helpers to get the slave channels Heikki Krogerus
2013-04-10 13:58 ` [PATCH 4/9] serial: 8250_dma: Provide default slave configuration parameters Heikki Krogerus
2013-04-10 13:58 ` [PATCH 5/9] serial: 8250_dw: Enable runtime PM Heikki Krogerus
2013-04-10 13:58 ` [PATCH 6/9] serial: 8250_dw: Support clk framework also with ACPI Heikki Krogerus
2013-04-10 13:58 ` [PATCH 7/9] serial: 8250_dw: Let ACPI code extract the DMA client info Heikki Krogerus
2013-04-10 13:58 ` [PATCH 8/9] serial: 8250_dw: Set port capabilities based on CPR register Heikki Krogerus
2013-04-10 13:58 ` [PATCH 9/9] serial: 8250_dw: Use devm_request_and_ioremap() Heikki Krogerus
2013-04-11 12:20 ` Heikki Krogerus
2013-04-11 12:43 ` [PATCH 9/9] serial: 8250_dw: Convert to devm_ioremap() Heikki Krogerus
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=1365602312-25436-3-git-send-email-heikki.krogerus@linux.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@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
all inboxes | Powered by JetHome®