static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, int init_hw) { struct uart_port *uport = state->uart_port; struct tty_port *port = &state->port; unsigned long page; int retval = 0; if (uport->type == PORT_UNKNOWN) return 1; if (!state->xmit.buf) { page = get_zeroed_page(GFP_KERNEL); if (!page) return -ENOMEM; state->xmit.buf = (unsigned char *) page; uart_circ_clear(&state->xmit); } retval = uport->ops->startup(uport); if (retval == 0) { if (uart_console(uport) && uport->cons->cflag) { tty->termios->c_cflag = uport->cons->cflag; uport->cons->cflag = 0; } uart_change_speed(tty, state, NULL); if (init_hw) { if (tty->termios->c_cflag & CBAUD) uart_set_mctrl(uport, TIOCM_RTS | TIOCM_DTR); } if (port->flags & ASYNC_CTS_FLOW) { spin_lock_irq(&uport->lock); if (!(uport->ops->get_mctrl(uport) & TIOCM_CTS)) tty->hw_stopped = 1; spin_unlock_irq(&uport->lock); } } if (retval && capable(CAP_SYS_ADMIN)) return 1; return retval; }
static void msm_hsl_start_tx(struct uart_port *port) { struct msm_hsl_port *msm_hsl_port = UART_TO_MSM(port); struct circ_buf *xmit = &port->state->xmit; if(b_terminal_onoff == 0 && console_uart_port && (port == console_uart_port)){ uart_circ_clear(xmit); return; } clk_en(port, 1); msm_hsl_port->imr |= UARTDM_ISR_TXLEV_BMSK; msm_hsl_write(port, msm_hsl_port->imr, UARTDM_IMR_ADDR); clk_en(port, 0); }
static int mtk8250_startup(struct uart_port *port) { #ifdef CONFIG_SERIAL_8250_DMA struct uart_8250_port *up = up_to_u8250p(port); struct mtk8250_data *data = port->private_data; /* disable DMA for console */ if (uart_console(port)) up->dma = NULL; if (up->dma) { data->rx_status = DMA_RX_START; uart_circ_clear(&port->state->xmit); } #endif memset(&port->icount, 0, sizeof(port->icount)); return serial8250_do_startup(port); }
static void uart_flush_buffer(struct tty_struct *tty) { struct uart_state *state = tty->driver_data; struct uart_port *port; unsigned long flags; if (!state) { WARN_ON(1); return; } port = state->uart_port; pr_debug("uart_flush_buffer(%d) called\n", tty->index); spin_lock_irqsave(&port->lock, flags); uart_circ_clear(&state->xmit); if (port->ops->flush_buffer) port->ops->flush_buffer(port); spin_unlock_irqrestore(&port->lock, flags); tty_wakeup(tty); }