public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: don't filter on DMA device, use only channel ID
@ 2011-06-24 11:56 Guennadi Liakhovetski
  2011-06-24 11:47 ` Koul, Vinod
  0 siblings, 1 reply; 25+ messages in thread
From: Guennadi Liakhovetski @ 2011-06-24 11:56 UTC (permalink / raw)
  To: linux-sh; +Cc: linux-kernel, Dan Williams, Vinod Koul, Magnus Damm

On some sh-mobile systems there are more than one DMA controllers, that
can be used for serial ports. Specifying a DMA device in sh-sci platform
data unnecessarily restricts the driver to only use one DMA controller.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/tty/serial/sh-sci.c |   25 ++++++++-----------------
 include/linux/serial_sci.h  |    2 --
 2 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index ebd8629..8711f4e 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1295,12 +1295,8 @@ static bool filter(struct dma_chan *chan, void *slave)
 	dev_dbg(chan->device->dev, "%s: slave ID %d\n", __func__,
 		param->slave_id);
 
-	if (param->dma_dev == chan->device->dev) {
-		chan->private = param;
-		return true;
-	} else {
-		return false;
-	}
+	chan->private = param;
+	return true;
 }
 
 static void rx_timer_fn(unsigned long arg)
@@ -1326,10 +1322,10 @@ static void sci_request_dma(struct uart_port *port)
 	dma_cap_mask_t mask;
 	int nent;
 
-	dev_dbg(port->dev, "%s: port %d DMA %p\n", __func__,
-		port->line, s->cfg->dma_dev);
+	dev_dbg(port->dev, "%s: port %d\n", __func__,
+		port->line);
 
-	if (!s->cfg->dma_dev)
+	if (s->cfg->dma_slave_tx <= 0 || s->cfg->dma_slave_rx <= 0)
 		return;
 
 	dma_cap_zero(mask);
@@ -1339,7 +1335,6 @@ static void sci_request_dma(struct uart_port *port)
 
 	/* Slave ID, e.g., SHDMA_SLAVE_SCIF0_TX */
 	param->slave_id = s->cfg->dma_slave_tx;
-	param->dma_dev = s->cfg->dma_dev;
 
 	s->cookie_tx = -EINVAL;
 	chan = dma_request_channel(mask, filter, param);
@@ -1368,7 +1363,6 @@ static void sci_request_dma(struct uart_port *port)
 
 	/* Slave ID, e.g., SHDMA_SLAVE_SCIF0_RX */
 	param->slave_id = s->cfg->dma_slave_rx;
-	param->dma_dev = s->cfg->dma_dev;
 
 	chan = dma_request_channel(mask, filter, param);
 	dev_dbg(port->dev, "%s: RX: got channel %p\n", __func__, chan);
@@ -1413,9 +1407,6 @@ static void sci_free_dma(struct uart_port *port)
 {
 	struct sci_port *s = to_sci_port(port);
 
-	if (!s->cfg->dma_dev)
-		return;
-
 	if (s->chan_tx)
 		sci_tx_dma_release(s, false);
 	if (s->chan_rx)
@@ -1790,9 +1781,9 @@ static int __devinit sci_init_single(struct platform_device *dev,
 	 */
 	port->irq		= p->irqs[SCIx_RXI_IRQ];
 
-	if (p->dma_dev)
-		dev_dbg(port->dev, "DMA device %p, tx %d, rx %d\n",
-			p->dma_dev, p->dma_slave_tx, p->dma_slave_rx);
+	if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0)
+		dev_dbg(port->dev, "DMA tx %d, rx %d\n",
+			p->dma_slave_tx, p->dma_slave_rx);
 
 	return 0;
 }
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index a2afc9f..9d01ffa 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -56,8 +56,6 @@ struct plat_sci_port {
 	unsigned int	scbrr_algo_id;		/* SCBRR calculation algo */
 	unsigned int	scscr;			/* SCSCR initialization */
 
-	struct device	*dma_dev;
-
 	unsigned int	dma_slave_tx;
 	unsigned int	dma_slave_rx;
 };
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2011-09-19  3:17 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-24 11:56 [PATCH] serial: sh-sci: don't filter on DMA device, use only channel ID Guennadi Liakhovetski
2011-06-24 11:47 ` Koul, Vinod
2011-08-29  8:00   ` Paul Mundt
2011-08-29  8:16     ` Magnus Damm
2011-08-29 11:55       ` Vinod Koul
2011-08-30  7:54         ` Guennadi Liakhovetski
2011-08-30 10:02           ` Vinod Koul
2011-08-30 11:20             ` Guennadi Liakhovetski
2011-08-30 11:23               ` Vinod Koul
2011-08-30 11:40                 ` Guennadi Liakhovetski
2011-09-05  8:04                   ` Guennadi Liakhovetski
2011-09-05 13:13                     ` Vinod Koul
2011-09-05 13:48                       ` Guennadi Liakhovetski
2011-09-05 14:43                         ` Vinod Koul
2011-09-05 15:01                           ` Guennadi Liakhovetski
2011-09-05 15:08                             ` Vinod Koul
2011-09-05 15:21                               ` Guennadi Liakhovetski
2011-09-07 18:42                                 ` Koul, Vinod
2011-09-07 20:01                                   ` Guennadi Liakhovetski
2011-09-07 21:37                                     ` Koul, Vinod
2011-09-08  1:21                                       ` Paul Mundt
2011-09-08 19:31                                         ` Vinod Koul
2011-09-14  5:16                                           ` Vinod Koul
2011-09-14 18:52                                             ` Alan Cox
2011-09-19  3:13                                               ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox