summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Jackson <Andrew.Jackson@arm.com>2014-11-07 14:14:47 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-07 08:35:56 -0800
commit2d3b7d6e7dc8785f9a6c0e4d38188dd1a0859d11 (patch)
tree17f4ea42ff0182799f516227714a32cb1fb0ca5c
parentc64be9231e089350fa55c7e03adc79e341ab8e89 (diff)
downloadlwn-2d3b7d6e7dc8785f9a6c0e4d38188dd1a0859d11.tar.gz
lwn-2d3b7d6e7dc8785f9a6c0e4d38188dd1a0859d11.zip
serial: pl011: Don't enable RX DMA if residue processing not supported
If the DMA engine doesn't support residue processing then the RX DMA handling won't work terribly well if polling is enabled. So, disable RX DMA if residue handling isn't available. Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/amba-pl011.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 55dc00dd0e5e..d984a97043b3 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -322,7 +322,22 @@ static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port *
.src_maxburst = uap->fifosize >> 2,
.device_fc = false,
};
+ struct dma_slave_caps caps;
+ /*
+ * Some DMA controllers provide information on their capabilities.
+ * If the controller does, check for suitable residue processing
+ * otherwise assime all is well.
+ */
+ if (0 == dma_get_slave_caps(chan, &caps)) {
+ if (caps.residue_granularity ==
+ DMA_RESIDUE_GRANULARITY_DESCRIPTOR) {
+ dma_release_channel(chan);
+ dev_info(uap->port.dev,
+ "RX DMA disabled - no residue processing\n");
+ return;
+ }
+ }
dmaengine_slave_config(chan, &rx_conf);
uap->dmarx.chan = chan;