From: Mike Corrigan Date: Thu, 14 Oct 2010 18:55:13 +0000 (-0500) Subject: [arm]: tegra: serial: DMA allocation fix. X-Git-Tag: firefly_0821_release~9833^2~153^2~2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1785cb19f02da95f064bd4d3c703725b3d39e9ba;p=firefly-linux-kernel-4.4.55.git [arm]: tegra: serial: DMA allocation fix. Handle the case where DMA channels cannot be allocated and PIO must be used. Fixed a typo for forcing RX to use PIO. Change-Id: I167184f9ce936d4a08dd9919ae4f8b0d9ad7e0c4 Signed-off-by: Mike Corrigan --- diff --git a/drivers/serial/tegra_hsuart.c b/drivers/serial/tegra_hsuart.c index d992d36bbd29..a8e3a5c93812 100644 --- a/drivers/serial/tegra_hsuart.c +++ b/drivers/serial/tegra_hsuart.c @@ -213,7 +213,7 @@ static void tegra_start_next_tx(struct tegra_uart_port *t) if (count == 0) goto out; - if (TX_FORCE_PIO || count < TEGRA_UART_MIN_DMA) + if (!t->use_tx_dma || count < TEGRA_UART_MIN_DMA) tegra_start_pio_tx(t, count); else if (BYTES_TO_ALIGN(tail) > 0) tegra_start_pio_tx(t, BYTES_TO_ALIGN(tail)); @@ -666,8 +666,10 @@ static int tegra_uart_init_rx_dma(struct tegra_uart_port *t) void *rx_dma_virt; t->rx_dma = tegra_dma_allocate_channel(TEGRA_DMA_MODE_CONTINUOUS); - if (!t->rx_dma) + if (!t->rx_dma) { + pr_err("%s: failed to allocate RX DMA.\n", __func__); return -ENODEV; + } memset(&t->rx_dma_req, 0, sizeof(t->rx_dma_req)); @@ -712,6 +714,8 @@ static int tegra_startup(struct uart_port *u) t->tx_dma = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT); if (t->tx_dma) t->use_tx_dma = true; + else + pr_err("%s: failed to allocate TX DMA.\n", __func__); } if (t->use_tx_dma) { t->tx_dma_req.instance = u->line; @@ -733,7 +737,7 @@ static int tegra_startup(struct uart_port *u) t->tx_in_progress = 0; t->use_rx_dma = false; - if (!TX_FORCE_PIO) { + if (!RX_FORCE_PIO) { if (!tegra_uart_init_rx_dma(t)) t->use_rx_dma = true; }