summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2015-10-15 17:16:09 -0700
committerStefan Agner <stefan.agner@toradex.com>2015-10-20 15:38:41 -0700
commitdb6b1f8270757539d90422ee5294bc25ff13a040 (patch)
treeab67b07b9d8353ce61d4756b44edbbc246cdebac
parentdb509ca6ce2a4c04fe0d2a2e0611bb917ebe4aa8 (diff)
tty: serial: fsl_lpuart: implement module parameter to disable DMA
The DMA implementation has been and is still affected by bugs and race conditions. To bridge the time until those have been addressed, add fsl-lpuart.nodma module parameter which allows to disable the UART DMA using a kernel argument.
-rw-r--r--drivers/tty/serial/fsl_lpuart.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 1f52532ce943..f6549ac5a8cf 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -230,6 +230,9 @@
#define DEV_NAME "ttyLP"
#define UART_NR 6
+static bool nodma = true;
+module_param(nodma, bool, S_IRUGO);
+
struct lpuart_port {
struct uart_port port;
struct clk *clk;
@@ -1795,6 +1798,15 @@ static struct uart_driver lpuart_reg = {
.cons = LPUART_CONSOLE,
};
+static void lpuart_request_dma_chan(struct lpuart_port *sport,
+ struct dma_chan *chan, const char *name)
+{
+ chan = dma_request_slave_channel(sport->port.dev, name);
+ if (!chan)
+ dev_info(sport->port.dev, "DMA %s channel request failed, "
+ "operating without %s DMA\n", name, name);
+}
+
static int lpuart_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -1864,15 +1876,10 @@ static int lpuart_probe(struct platform_device *pdev)
return ret;
}
- sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx");
- if (!sport->dma_tx_chan)
- dev_info(sport->port.dev, "DMA tx channel request failed, "
- "operating without tx DMA\n");
-
- sport->dma_rx_chan = dma_request_slave_channel(sport->port.dev, "rx");
- if (!sport->dma_rx_chan)
- dev_info(sport->port.dev, "DMA rx channel request failed, "
- "operating without rx DMA\n");
+ if (!nodma) {
+ lpuart_request_dma_chan(sport, sport->dma_tx_chan, "tx");
+ lpuart_request_dma_chan(sport, sport->dma_rx_chan, "rx");
+ }
if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time")) {
sport->port.rs485.flags |= SER_RS485_ENABLED;