aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/sh-sci.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2011-06-24 07:56:15 -0400
committerVinod Koul <vinod.koul@intel.com>2011-09-18 23:09:17 -0400
commit937bb6e4c676fecbfbc1939b942241c3f27bf5d8 (patch)
treee8b8aac1dd1d93a423751fcacde590faa1c51646 /drivers/tty/serial/sh-sci.c
parent7703eac96abd119dcfbb04f287a5127462d18269 (diff)
serial: sh-sci: don't filter on DMA device, use only channel ID
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> [Fixed the trivial conflict in include/linux/serial_sci.h] Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r--drivers/tty/serial/sh-sci.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index a9414facda47..dbd32a1286d3 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1439,12 +1439,8 @@ static bool filter(struct dma_chan *chan, void *slave)
1439 dev_dbg(chan->device->dev, "%s: slave ID %d\n", __func__, 1439 dev_dbg(chan->device->dev, "%s: slave ID %d\n", __func__,
1440 param->slave_id); 1440 param->slave_id);
1441 1441
1442 if (param->dma_dev == chan->device->dev) { 1442 chan->private = param;
1443 chan->private = param; 1443 return true;
1444 return true;
1445 } else {
1446 return false;
1447 }
1448} 1444}
1449 1445
1450static void rx_timer_fn(unsigned long arg) 1446static void rx_timer_fn(unsigned long arg)
@@ -1470,10 +1466,10 @@ static void sci_request_dma(struct uart_port *port)
1470 dma_cap_mask_t mask; 1466 dma_cap_mask_t mask;
1471 int nent; 1467 int nent;
1472 1468
1473 dev_dbg(port->dev, "%s: port %d DMA %p\n", __func__, 1469 dev_dbg(port->dev, "%s: port %d\n", __func__,
1474 port->line, s->cfg->dma_dev); 1470 port->line);
1475 1471
1476 if (!s->cfg->dma_dev) 1472 if (s->cfg->dma_slave_tx <= 0 || s->cfg->dma_slave_rx <= 0)
1477 return; 1473 return;
1478 1474
1479 dma_cap_zero(mask); 1475 dma_cap_zero(mask);
@@ -1483,7 +1479,6 @@ static void sci_request_dma(struct uart_port *port)
1483 1479
1484 /* Slave ID, e.g., SHDMA_SLAVE_SCIF0_TX */ 1480 /* Slave ID, e.g., SHDMA_SLAVE_SCIF0_TX */
1485 param->slave_id = s->cfg->dma_slave_tx; 1481 param->slave_id = s->cfg->dma_slave_tx;
1486 param->dma_dev = s->cfg->dma_dev;
1487 1482
1488 s->cookie_tx = -EINVAL; 1483 s->cookie_tx = -EINVAL;
1489 chan = dma_request_channel(mask, filter, param); 1484 chan = dma_request_channel(mask, filter, param);
@@ -1512,7 +1507,6 @@ static void sci_request_dma(struct uart_port *port)
1512 1507
1513 /* Slave ID, e.g., SHDMA_SLAVE_SCIF0_RX */ 1508 /* Slave ID, e.g., SHDMA_SLAVE_SCIF0_RX */
1514 param->slave_id = s->cfg->dma_slave_rx; 1509 param->slave_id = s->cfg->dma_slave_rx;
1515 param->dma_dev = s->cfg->dma_dev;
1516 1510
1517 chan = dma_request_channel(mask, filter, param); 1511 chan = dma_request_channel(mask, filter, param);
1518 dev_dbg(port->dev, "%s: RX: got channel %p\n", __func__, chan); 1512 dev_dbg(port->dev, "%s: RX: got channel %p\n", __func__, chan);
@@ -1557,9 +1551,6 @@ static void sci_free_dma(struct uart_port *port)
1557{ 1551{
1558 struct sci_port *s = to_sci_port(port); 1552 struct sci_port *s = to_sci_port(port);
1559 1553
1560 if (!s->cfg->dma_dev)
1561 return;
1562
1563 if (s->chan_tx) 1554 if (s->chan_tx)
1564 sci_tx_dma_release(s, false); 1555 sci_tx_dma_release(s, false);
1565 if (s->chan_rx) 1556 if (s->chan_rx)
@@ -1967,9 +1958,9 @@ static int __devinit sci_init_single(struct platform_device *dev,
1967 port->serial_in = sci_serial_in; 1958 port->serial_in = sci_serial_in;
1968 port->serial_out = sci_serial_out; 1959 port->serial_out = sci_serial_out;
1969 1960
1970 if (p->dma_dev) 1961 if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0)
1971 dev_dbg(port->dev, "DMA device %p, tx %d, rx %d\n", 1962 dev_dbg(port->dev, "DMA tx %d, rx %d\n",
1972 p->dma_dev, p->dma_slave_tx, p->dma_slave_rx); 1963 p->dma_slave_tx, p->dma_slave_rx);
1973 1964
1974 return 0; 1965 return 0;
1975} 1966}