summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorPradeep Kumar <pgoudagunta@nvidia.com>2012-02-27 14:05:46 +0530
committerSimone Willett <swillett@nvidia.com>2012-02-29 17:04:19 -0800
commitdd33d027f8b7f8e809a0bed091fc68aef0460b68 (patch)
treea33f6c47d631c2df1874813cdd0fc0c469349284 /drivers/tty
parent9e69c4d626959f8a2509230127a282e9dc26bfff (diff)
tty: serial: tegra: Fix dma/cpu coherency issues
Call dma sync single api's to maintain coherency between CPU, dma and device in data transfers. Bug 935876 Bug 918880 Signed-off-by: Pradeep Kumar <pgoudagunta@nvidia.com> Change-Id: I45d7d998b1d091e726c1bfb512c8b0b087d7452e Reviewed-on: http://git-master/r/86054 Tested-by: Pradeep Goudagunta <pgoudagunta@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/tegra_hsuart.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tty/serial/tegra_hsuart.c b/drivers/tty/serial/tegra_hsuart.c
index 2d9cc200c7f7..fd68004a2765 100644
--- a/drivers/tty/serial/tegra_hsuart.c
+++ b/drivers/tty/serial/tegra_hsuart.c
@@ -263,6 +263,8 @@ static void tegra_start_tx(struct uart_port *u)
static int tegra_start_dma_rx(struct tegra_uart_port *t)
{
wmb();
+ dma_sync_single_for_device(t->uport.dev, t->rx_dma_req.dest_addr,
+ t->rx_dma_req.size, DMA_TO_DEVICE);
if (tegra_dma_enqueue_req(t->rx_dma, &t->rx_dma_req)) {
dev_err(t->uport.dev, "Could not enqueue Rx DMA req\n");
return -EINVAL;
@@ -308,6 +310,8 @@ static void tegra_rx_dma_complete_callback(struct tegra_dma_req *req)
req->status);
if (req->bytes_transferred) {
t->uport.icount.rx += req->bytes_transferred;
+ dma_sync_single_for_cpu(t->uport.dev, req->dest_addr,
+ req->size, DMA_FROM_DEVICE);
copied = tty_insert_flip_string(tty,
((unsigned char *)(req->virt_addr)),
req->bytes_transferred);
@@ -317,6 +321,8 @@ static void tegra_rx_dma_complete_callback(struct tegra_dma_req *req)
"to tty layer Req %d and coped %d\n",
req->bytes_transferred, copied);
}
+ dma_sync_single_for_device(t->uport.dev, req->dest_addr,
+ req->size, DMA_TO_DEVICE);
}
do_handle_rx_pio(t);