summaryrefslogtreecommitdiff
path: root/drivers/serial/tegra_hsuart.c
diff options
context:
space:
mode:
authorMike Corrigan <michael.corrigan@motorola.com>2010-10-14 13:55:13 -0500
committerColin Cross <ccross@android.com>2010-10-14 16:07:37 -0700
commit1785cb19f02da95f064bd4d3c703725b3d39e9ba (patch)
tree37ca07453676ad3f8d1d52614dcba393575901b6 /drivers/serial/tegra_hsuart.c
parent90b46c5cf7de431390d04be89821bac9b2fced30 (diff)
[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 <michael.corrigan@motorola.com>
Diffstat (limited to 'drivers/serial/tegra_hsuart.c')
-rw-r--r--drivers/serial/tegra_hsuart.c10
1 files changed, 7 insertions, 3 deletions
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;
}