linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-serial@vger.kernel.org
Cc: tony@atomide.com, gregkh@linuxfoundation.org,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	linux-kernel@vger.kernel.org, balbi@ti.com,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/13] tty: serial: 8250: allow to use custom DMA implementation
Date: Mon, 29 Sep 2014 20:06:42 +0200	[thread overview]
Message-ID: <1412014009-13315-7-git-send-email-bigeasy@linutronix.de> (raw)
In-Reply-To: <1412014009-13315-1-git-send-email-bigeasy@linutronix.de>

The OMAP has a few corner cases where it needs a share of kindness of
affection to do the right thing. Heikki Krogerus suggested that instead
adding the quirks into the default DMA implementation, OMAP could get
its own copy of the function. And Alan suggested the same thing so here
we go.

This patch provides callbacks for custom TX/RX DMA implementation. If
there are not setup / used, then the default (current) implementation is
used.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/tty/serial/8250/8250.h      |  3 +++
 drivers/tty/serial/8250/8250_core.c | 11 ++++++++---
 drivers/tty/serial/8250/8250_dma.c  |  2 --
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index ebab625179d4..4bb831ab5db0 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -16,6 +16,9 @@
 #include <linux/dmaengine.h>
 
 struct uart_8250_dma {
+	int (*tx_dma)(struct uart_8250_port *p);
+	int (*rx_dma)(struct uart_8250_port *p, unsigned int iir);
+
 	dma_filter_fn		fn;
 	void			*rx_param;
 	void			*tx_param;
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index ea57c87f8528..93b0799936fd 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -1350,7 +1350,7 @@ static void serial8250_start_tx(struct uart_port *port)
 	struct uart_8250_port *up = up_to_u8250p(port);
 
 	serial8250_rpm_get_tx(up);
-	if (up->dma && !serial8250_tx_dma(up)) {
+	if (up->dma && !up->dma->tx_dma(up)) {
 		return;
 	} else if (!(up->ier & UART_IER_THRI)) {
 		up->ier |= UART_IER_THRI;
@@ -1588,7 +1588,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
 
 	if (status & (UART_LSR_DR | UART_LSR_BI)) {
 		if (up->dma)
-			dma_err = serial8250_rx_dma(up, iir);
+			dma_err = up->dma->rx_dma(up, iir);
 
 		if (!up->dma || dma_err)
 			status = serial8250_rx_chars(up, status);
@@ -3624,8 +3624,13 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 			uart->dl_read = up->dl_read;
 		if (up->dl_write)
 			uart->dl_write = up->dl_write;
-		if (up->dma)
+		if (up->dma) {
 			uart->dma = up->dma;
+			if (!uart->dma->tx_dma)
+				uart->dma->tx_dma = serial8250_tx_dma;
+			if (!uart->dma->rx_dma)
+				uart->dma->rx_dma = serial8250_rx_dma;
+		}
 
 		if (serial8250_isa_config != NULL)
 			serial8250_isa_config(0, &uart->port,
diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index db9eda3c12d6..258430b72039 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -118,7 +118,6 @@ int serial8250_tx_dma(struct uart_8250_port *p)
 	dma->tx_err = 1;
 	return ret;
 }
-EXPORT_SYMBOL_GPL(serial8250_tx_dma);
 
 int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir)
 {
@@ -165,7 +164,6 @@ int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(serial8250_rx_dma);
 
 int serial8250_request_dma(struct uart_8250_port *p)
 {
-- 
2.1.0

  parent reply	other threads:[~2014-09-29 18:06 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29 18:06 [PATCH 00/13 v10] omap 8250 based UART + DMA Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 01/13] tty: serial: 8250: Fix wording in runtime-PM comments Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 02/13] tty: serial: 8250: make serial8250_console_setup() non _init Sebastian Andrzej Siewior
2014-09-30 20:27   ` Peter Hurley
2014-09-29 18:06 ` [PATCH 03/13] tty: serial: Add 8250-core based omap driver Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 04/13] tty: serial: 8250_dma: handle error on TX submit Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 05/13] tty: serial: 8250_dma: keep own book keeping about RX transfers Sebastian Andrzej Siewior
2014-09-29 18:06 ` Sebastian Andrzej Siewior [this message]
2014-09-29 18:06 ` [PATCH 07/13] tty: serial: 8250_omap: add custom DMA-TX callback Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 08/13] tty: serial: 8250_omap: add custom DMA-RX callback Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 09/13] dmaengine: edma: check for echan->edesc => NULL in edma_dma_pause() Sebastian Andrzej Siewior
2014-10-01 12:00   ` Peter Ujfalusi
2014-10-15 15:27   ` Vinod Koul
2014-10-15 15:28   ` Vinod Koul
2014-09-29 18:06 ` [PATCH 10/13] arm: dts: am33xx: add DMA properties for UART Sebastian Andrzej Siewior
2014-09-29 18:06 ` [PATCH 11/13] arm: dts: dra7: " Sebastian Andrzej Siewior
2014-11-04 17:02   ` Lennart Sorensen
2014-11-04 17:06     ` Sebastian Andrzej Siewior
2014-11-04 17:21       ` Lennart Sorensen
2014-11-04 18:32         ` Javier Martinez Canillas
2014-11-04 18:48           ` Nishanth Menon
     [not found]           ` <CABxcv=kT+M70Xoyf_z4eQQyM0Oo9S5Y0YeX2R6PbAqxK-JTLLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-04 19:00             ` Lennart Sorensen
2014-11-04 18:33         ` Lennart Sorensen
2014-11-04 21:03           ` Lennart Sorensen
     [not found]             ` <20141104210315.GF24112-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys@public.gmane.org>
2014-11-05  1:15               ` Lennart Sorensen
     [not found]                 ` <20141105011506.GG24112-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys@public.gmane.org>
2014-11-05  8:11                   ` Sebastian Andrzej Siewior
2014-11-05 15:33                     ` Lennart Sorensen
2014-11-05 16:20                       ` Lennart Sorensen
2014-11-05 16:30                         ` Sebastian Andrzej Siewior
2014-11-05 19:43                           ` Lennart Sorensen
     [not found]                             ` <20141105194323.GI24112-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys@public.gmane.org>
2014-11-13 18:34                               ` Sebastian Andrzej Siewior
2014-11-13 22:08                                 ` Lennart Sorensen
2014-09-29 18:06 ` [PATCH 12/13] tty: serial: 8250: omap: add custom irq handling Sebastian Andrzej Siewior
2014-10-09 13:19   ` Heikki Krogerus
2014-09-29 18:06 ` [PATCH 13/13] tty: serial: 8250: omap: add dma support Sebastian Andrzej Siewior
2014-10-02 16:43 ` [PATCH 00/13 v10] omap 8250 based UART + DMA Tony Lindgren
2014-10-02 23:19   ` Sebastian Andrzej Siewior
2014-10-03 13:08 ` Peter Hurley
2014-11-06  3:14 ` Greg KH
2014-11-06 10:27   ` Sebastian Andrzej Siewior
2014-11-10 17:24     ` Tony Lindgren

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=1412014009-13315-7-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: 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).