Lines Matching full:baud
53 #define CDNS_UART_BAUDGEN 0x18 /* Baud Rate Generator */
60 #define CDNS_UART_BAUDDIV 0x34 /* Baud Rate Divider */
180 /* baud dividers min/max values */
192 * @baud: Current baud rate
202 unsigned int baud; member
377 * cdns_uart_calc_baud_divs - Calculate baud rate divisors
379 * @baud: Desired baud rate
383 * Return: baud rate, requested baud when possible, or actual baud when there
386 * Formula to obtain baud rate is
393 * baud rate generate register
394 * baud rate clock divisor register
397 unsigned int baud, u32 *rbdiv, u32 *rcd, int *div8) in cdns_uart_calc_baud_divs() argument
405 if (baud < clk / ((CDNS_UART_BDIV_MAX + 1) * CDNS_UART_CD_MAX)) { in cdns_uart_calc_baud_divs()
413 cd = DIV_ROUND_CLOSEST(clk, baud * (bdiv + 1)); in cdns_uart_calc_baud_divs()
419 if (baud > calc_baud) in cdns_uart_calc_baud_divs()
420 bauderror = baud - calc_baud; in cdns_uart_calc_baud_divs()
422 bauderror = calc_baud - baud; in cdns_uart_calc_baud_divs()
432 if (((besterror * 100) / baud) < 3) in cdns_uart_calc_baud_divs()
433 bestbaud = baud; in cdns_uart_calc_baud_divs()
439 * cdns_uart_set_baud_rate - Calculate and set the baud rate
441 * @baud: Baud rate to set
442 * Return: baud rate, requested baud when possible, or actual baud when there
446 unsigned int baud) in cdns_uart_set_baud_rate() argument
454 calc_baud = cdns_uart_calc_baud_divs(port->uartclk, baud, &bdiv, &cd, in cdns_uart_set_baud_rate()
466 cdns_uart->baud = baud; in cdns_uart_set_baud_rate()
500 * Find out if current baud-rate can be achieved with new clock in cdns_uart_clk_notifier_cb()
503 if (!cdns_uart_calc_baud_divs(ndata->new_rate, cdns_uart->baud, in cdns_uart_clk_notifier_cb()
511 /* Disable the TX and RX to set baud rate */ in cdns_uart_clk_notifier_cb()
522 * Set clk dividers to generate correct baud with new clock in cdns_uart_clk_notifier_cb()
531 cdns_uart->baud = cdns_uart_set_baud_rate(cdns_uart->port, in cdns_uart_clk_notifier_cb()
532 cdns_uart->baud); in cdns_uart_clk_notifier_cb()
672 * stop bits, flow control, baud rate
682 unsigned int baud, minbaud, maxbaud; in cdns_uart_set_termios() local
688 /* Disable the TX and RX to set baud rate */ in cdns_uart_set_termios()
694 * Min baud rate = 6bps and Max Baud Rate is 10Mbps for 100Mhz clk in cdns_uart_set_termios()
695 * min and max baud should be calculated here based on port->uartclk. in cdns_uart_set_termios()
696 * this way we get a valid baud and can safely call set_baud() in cdns_uart_set_termios()
701 baud = uart_get_baud_rate(port, termios, old, minbaud, maxbaud); in cdns_uart_set_termios()
702 baud = cdns_uart_set_baud_rate(port, baud); in cdns_uart_set_termios()
704 tty_termios_encode_baud_rate(termios, baud, baud); in cdns_uart_set_termios()
707 uart_update_timeout(port, termios->c_cflag, baud); in cdns_uart_set_termios()
1186 /* only set baud if specified on command line - otherwise in cdns_early_console_setup()
1189 if (port->uartclk && device->baud) { in cdns_early_console_setup()
1194 cdns_uart_calc_baud_divs(port->uartclk, device->baud, in cdns_early_console_setup()
1274 int baud = 9600; in cdns_uart_console_setup() local
1287 uart_parse_options(options, &baud, &parity, &bits, &flow); in cdns_uart_console_setup()
1296 return uart_set_options(port, co, baud, parity, bits, flow); in cdns_uart_console_setup()