/* Called by serial core driver with u->lock taken. */ static void tegra_uart_start_tx(struct uart_port *u) { struct tegra_uart_port *tup = to_tegra_uport(u); struct circ_buf *xmit = &u->state->xmit; if (!uart_circ_empty(xmit) && !tup->tx_in_progress) tegra_uart_start_next_tx(tup); }
/* * Flush any TX data submitted for DMA and PIO. Called when the * TX circular buffer is reset. */ static void tegra_uart_flush_buffer(struct uart_port *u) { struct tegra_uart_port *tup = to_tegra_uport(u); tup->tx_bytes = 0; if (tup->tx_dma_chan) dmaengine_terminate_all(tup->tx_dma_chan); }
static void tegra_uart_enable_ms(struct uart_port *u) { struct tegra_uart_port *tup = to_tegra_uport(u); if (tup->enable_modem_interrupt) { tup->ier_shadow |= UART_IER_MSI; tegra_uart_write(tup, tup->ier_shadow, UART_IER); } }
static void tegra_uart_set_mctrl(struct uart_port *u, unsigned int mctrl) { struct tegra_uart_port *tup = to_tegra_uport(u); int dtr_enable; tup->rts_active = !!(mctrl & TIOCM_RTS); set_rts(tup, tup->rts_active); dtr_enable = !!(mctrl & TIOCM_DTR); set_dtr(tup, dtr_enable); }
static void tegra_uart_break_ctl(struct uart_port *u, int break_ctl) { struct tegra_uart_port *tup = to_tegra_uport(u); unsigned long lcr; lcr = tup->lcr_shadow; if (break_ctl) lcr |= UART_LCR_SBC; else lcr &= ~UART_LCR_SBC; tegra_uart_write(tup, lcr, UART_LCR); tup->lcr_shadow = lcr; }
static void tegra_uart_shutdown(struct uart_port *u) { struct tegra_uart_port *tup = to_tegra_uport(u); tegra_uart_hw_deinit(tup); tup->rx_in_progress = 0; tup->tx_in_progress = 0; tegra_uart_dma_channel_free(tup, true); tegra_uart_dma_channel_free(tup, false); free_irq(u->irq, tup); }
static void tegra_uart_set_mctrl(struct uart_port *u, unsigned int mctrl) { struct tegra_uart_port *tup = to_tegra_uport(u); unsigned long mcr; int dtr_enable; mcr = tup->mcr_shadow; tup->rts_active = !!(mctrl & TIOCM_RTS); set_rts(tup, tup->rts_active); dtr_enable = !!(mctrl & TIOCM_DTR); set_dtr(tup, dtr_enable); return; }
static unsigned int tegra_uart_tx_empty(struct uart_port *u) { struct tegra_uart_port *tup = to_tegra_uport(u); unsigned int ret = 0; unsigned long flags; spin_lock_irqsave(&u->lock, flags); if (!tup->tx_in_progress) { unsigned long lsr = tegra_uart_read(tup, UART_LSR); if ((lsr & TX_EMPTY_STATUS) == TX_EMPTY_STATUS) ret = TIOCSER_TEMT; } spin_unlock_irqrestore(&u->lock, flags); return ret; }
static void tegra_uart_stop_tx(struct uart_port *u) { struct tegra_uart_port *tup = to_tegra_uport(u); struct circ_buf *xmit = &tup->uport.state->xmit; struct dma_tx_state state; int count; dmaengine_terminate_all(tup->tx_dma_chan); dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); count = tup->tx_bytes_requested - state.residue; async_tx_ack(tup->tx_dma_desc); xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); tup->tx_in_progress = 0; return; }