[arm]: tegra: serial: DMA allocation fix.
authorMike Corrigan <michael.corrigan@motorola.com>
Thu, 14 Oct 2010 18:55:13 +0000 (13:55 -0500)
committerColin Cross <ccross@android.com>
Thu, 14 Oct 2010 23:07:37 +0000 (16:07 -0700)
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 <michael.corrigan@motorola.com>
drivers/serial/tegra_hsuart.c

index d992d36bbd2925c565d782e8bcd35eed20e5d5bd..a8e3a5c93812d46e2c406e2ad102ea0161292679 100644 (file)
@@ -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;
        }