Skip to content

Commit 937bb6e

Browse files
lyakhVinod Koul
authored andcommitted
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>
1 parent 7703eac commit 937bb6e

2 files changed

Lines changed: 8 additions & 19 deletions

File tree

‎drivers/tty/serial/sh-sci.c‎

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,12 +1439,8 @@ static bool filter(struct dma_chan *chan, void *slave)
14391439
dev_dbg(chan->device->dev, "%s: slave ID %d\n", __func__,
14401440
param->slave_id);
14411441

1442-
if (param->dma_dev == chan->device->dev) {
1443-
chan->private = param;
1444-
return true;
1445-
} else {
1446-
return false;
1447-
}
1442+
chan->private = param;
1443+
return true;
14481444
}
14491445

14501446
static void rx_timer_fn(unsigned long arg)
@@ -1470,10 +1466,10 @@ static void sci_request_dma(struct uart_port *port)
14701466
dma_cap_mask_t mask;
14711467
int nent;
14721468

1473-
dev_dbg(port->dev, "%s: port %d DMA %p\n", __func__,
1474-
port->line, s->cfg->dma_dev);
1469+
dev_dbg(port->dev, "%s: port %d\n", __func__,
1470+
port->line);
14751471

1476-
if (!s->cfg->dma_dev)
1472+
if (s->cfg->dma_slave_tx <= 0 || s->cfg->dma_slave_rx <= 0)
14771473
return;
14781474

14791475
dma_cap_zero(mask);
@@ -1483,7 +1479,6 @@ static void sci_request_dma(struct uart_port *port)
14831479

14841480
/* Slave ID, e.g., SHDMA_SLAVE_SCIF0_TX */
14851481
param->slave_id = s->cfg->dma_slave_tx;
1486-
param->dma_dev = s->cfg->dma_dev;
14871482

14881483
s->cookie_tx = -EINVAL;
14891484
chan = dma_request_channel(mask, filter, param);
@@ -1512,7 +1507,6 @@ static void sci_request_dma(struct uart_port *port)
15121507

15131508
/* Slave ID, e.g., SHDMA_SLAVE_SCIF0_RX */
15141509
param->slave_id = s->cfg->dma_slave_rx;
1515-
param->dma_dev = s->cfg->dma_dev;
15161510

15171511
chan = dma_request_channel(mask, filter, param);
15181512
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)
15571551
{
15581552
struct sci_port *s = to_sci_port(port);
15591553

1560-
if (!s->cfg->dma_dev)
1561-
return;
1562-
15631554
if (s->chan_tx)
15641555
sci_tx_dma_release(s, false);
15651556
if (s->chan_rx)
@@ -1967,9 +1958,9 @@ static int __devinit sci_init_single(struct platform_device *dev,
19671958
port->serial_in = sci_serial_in;
19681959
port->serial_out = sci_serial_out;
19691960

1970-
if (p->dma_dev)
1971-
dev_dbg(port->dev, "DMA device %p, tx %d, rx %d\n",
1972-
p->dma_dev, p->dma_slave_tx, p->dma_slave_rx);
1961+
if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0)
1962+
dev_dbg(port->dev, "DMA tx %d, rx %d\n",
1963+
p->dma_slave_tx, p->dma_slave_rx);
19731964

19741965
return 0;
19751966
}

‎include/linux/serial_sci.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ struct plat_sci_port {
131131

132132
struct plat_sci_port_ops *ops;
133133

134-
struct device *dma_dev;
135-
136134
unsigned int dma_slave_tx;
137135
unsigned int dma_slave_rx;
138136
};

0 commit comments

Comments
 (0)