summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/serial/amba-pl011.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index b604274c1791..028e37ad8d79 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -649,6 +649,15 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
count = PL011_DMA_BUFFER_SIZE;
count = kfifo_out_peek(&tport->xmit_fifo, dmatx->buf, count);
+
+ /*
+ * Align the TX buffer length to the DMA controller's copy_align
+ * requirements. Some DMA controllers (e.g., Tegra GPC DMA) require
+ * word-aligned transfers. Unaligned bytes will be sent via PIO.
+ */
+ if (chan->device->copy_align)
+ count = ALIGN_DOWN(count, 1 << chan->device->copy_align);
+
dmatx->len = count;
dmatx->dma = dma_map_single(dma_dev->dev, dmatx->buf, count,
DMA_TO_DEVICE);