blob: 36c8726bc98cac42938f0dc58058d6976e2c2fef [file] [log] [blame]
From 1015acd59f4143b31c38d6b91e878e15c02de363 Mon Sep 17 00:00:00 2001
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date: Thu, 5 Sep 2013 17:34:54 +0300
Subject: serial: 8250_dw: provide a filter for DMA channel detection
The channel IDs are set to -1 by default. It will prevent
dmaengine from trying to provide the first free channel if
it fails to allocate exclusive channel. This will fix an
issue with ACPI enumerated UARTs that do not support DMA
but still end up getting a DMA channel incorrectly.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 7fb8c56c7fa0fa11168d3788d4591951bec27f4b)
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
---
drivers/tty/serial/8250/8250_dw.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -184,6 +184,14 @@ dw8250_do_pm(struct uart_port *port, uns
pm_runtime_put_sync_suspend(port->dev);
}
+static bool dw8250_dma_filter(struct dma_chan *chan, void *param)
+{
+ struct dw8250_data *data = param;
+
+ return chan->chan_id == data->dma.tx_chan_id ||
+ chan->chan_id == data->dma.rx_chan_id;
+}
+
static void dw8250_setup_port(struct uart_8250_port *up)
{
struct uart_port *p = &up->port;
@@ -344,6 +352,12 @@ static int dw8250_probe(struct platform_
uart.port.uartclk = clk_get_rate(data->clk);
}
+ data->dma.rx_chan_id = -1;
+ data->dma.tx_chan_id = -1;
+ data->dma.rx_param = data;
+ data->dma.tx_param = data;
+ data->dma.fn = dw8250_dma_filter;
+
uart.port.iotype = UPIO_MEM;
uart.port.serial_in = dw8250_serial_in;
uart.port.serial_out = dw8250_serial_out;