static int __init msm_console_setup(struct console *co, char *options) { struct uart_port *port; struct msm_port *msm_port; int baud, flow, bits, parity; if (unlikely(co->index >= UART_NR || co->index < 0)) return -ENXIO; port = get_port_from_line(co->index); msm_port = UART_TO_MSM(port); if (unlikely(!port->membase)) return -ENXIO; port->cons = co; msm_init_clock(port); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); bits = 8; parity = 'n'; flow = 'n'; msm_write(port, UART_MR2_BITS_PER_CHAR_8 | UART_MR2_STOP_BIT_LEN_ONE, UART_MR2); /* 8N1 */ if (baud < 300 || baud > 115200) baud = 115200; msm_set_baud_rate(port, baud); msm_reset(port); if (msm_port->is_uartdm) { msm_write(port, UART_CR_CMD_PROTECTION_EN, UART_CR); msm_write(port, UART_CR_TX_ENABLE, UART_CR); } printk(KERN_INFO "msm_serial: console setup on port #%d\n", port->line); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init msm_console_setup(struct console *co, char *options) { struct uart_port *port; int baud, flow, bits, parity; if (unlikely(co->index >= UART_NR || co->index < 0)) return -ENXIO; port = get_port_from_line(co->index); if (unlikely(!port->membase)) return -ENXIO; port->cons = co; pm_runtime_get_noresume(port->dev); #ifndef CONFIG_PM_RUNTIME msm_init_clock(port); #endif pm_runtime_resume(port->dev); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); bits = 8; parity = 'n'; flow = 'n'; msm_write(port, UART_MR2_BITS_PER_CHAR_8 | UART_MR2_STOP_BIT_LEN_ONE, UART_MR2); /* 8N1 */ if (baud < 300 || baud > 115200) baud = 115200; msm_set_baud_rate(port, baud); msm_reset(port); printk(KERN_INFO "msm_serial: console setup on port #%d\n", port->line); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init msm_console_setup(struct console *co, char *options) { struct uart_port *port; int baud, flow, bits, parity; if (unlikely(co->index >= UART_NR || co->index < 0)) return -ENXIO; port = get_port_from_line(co->index); if (unlikely(!port->membase)) return -ENXIO; port->cons = co; msm_init_clock(port); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); bits = 8; parity = 'n'; flow = 'n'; msm_write(port, UART_MR2_BITS_PER_CHAR_8 | UART_MR2_STOP_BIT_LEN_ONE, UART_MR2); /* 8N1 */ if (baud < 300 || baud > 115200) baud = 115200; msm_set_baud_rate(port, baud); msm_reset(port); /* FIH, Debbie, 2010/01/04 { */ #ifdef CONFIG_FIH_FXX fih_printk(serial_debug_mask, FIH_DEBUG_ZONE_G0, "msm_serial: console setup on port #%d\n", port->line); #else printk(KERN_INFO "msm_serial: console setup on port #%d\n", port->line); #endif /* FIH, Debbie, 2010/01/04 } */ return uart_set_options(port, co, baud, parity, bits, flow); }
static void msm_set_termios(struct uart_port *port, struct ktermios *termios, struct ktermios *old) { unsigned long flags; unsigned int baud, mr; struct msm_port *msm_port = UART_TO_MSM(port); spin_lock_irqsave(&port->lock, flags); clk_enable(msm_port->clk); /* calculate and set baud rate */ baud = uart_get_baud_rate(port, termios, old, 300, 115200); msm_set_baud_rate(port, baud); /* calculate parity */ mr = msm_read(port, UART_MR2); mr &= ~UART_MR2_PARITY_MODE; if (termios->c_cflag & PARENB) { if (termios->c_cflag & PARODD) mr |= UART_MR2_PARITY_MODE_ODD; else if (termios->c_cflag & CMSPAR) mr |= UART_MR2_PARITY_MODE_SPACE; else mr |= UART_MR2_PARITY_MODE_EVEN; } /* calculate bits per char */ mr &= ~UART_MR2_BITS_PER_CHAR; switch (termios->c_cflag & CSIZE) { case CS5: mr |= UART_MR2_BITS_PER_CHAR_5; break; case CS6: mr |= UART_MR2_BITS_PER_CHAR_6; break; case CS7: mr |= UART_MR2_BITS_PER_CHAR_7; break; case CS8: default: mr |= UART_MR2_BITS_PER_CHAR_8; break; } /* calculate stop bits */ mr &= ~(UART_MR2_STOP_BIT_LEN_ONE | UART_MR2_STOP_BIT_LEN_TWO); if (termios->c_cflag & CSTOPB) mr |= UART_MR2_STOP_BIT_LEN_TWO; else mr |= UART_MR2_STOP_BIT_LEN_ONE; /* set parity, bits per char, and stop bit */ msm_write(port, mr, UART_MR2); /* calculate and set hardware flow control */ mr = msm_read(port, UART_MR1); mr &= ~(UART_MR1_CTS_CTL | UART_MR1_RX_RDY_CTL); if (termios->c_cflag & CRTSCTS) { mr |= UART_MR1_CTS_CTL; mr |= UART_MR1_RX_RDY_CTL; } msm_write(port, mr, UART_MR1); /* Configure status bits to ignore based on termio flags. */ port->read_status_mask = 0; if (termios->c_iflag & INPCK) port->read_status_mask |= UART_SR_PAR_FRAME_ERR; if (termios->c_iflag & (BRKINT | PARMRK)) port->read_status_mask |= UART_SR_RX_BREAK; uart_update_timeout(port, termios->c_cflag, baud); clk_disable(msm_port->clk); spin_unlock_irqrestore(&port->lock, flags); }