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
379 * cdns_uart_calc_baud_divs - Calculate baud rate divisors
381 * @baud: Desired baud rate
385 * Return: baud rate, requested baud when possible, or actual baud when there
388 * Formula to obtain baud rate is
395 * baud rate generate register
396 * baud rate clock divisor register
399 unsigned int baud, u32 *rbdiv, u32 *rcd, int *div8) in cdns_uart_calc_baud_divs() argument
407 if (baud < clk / ((CDNS_UART_BDIV_MAX + 1) * CDNS_UART_CD_MAX)) { in cdns_uart_calc_baud_divs()
415 cd = DIV_ROUND_CLOSEST(clk, baud * (bdiv + 1)); in cdns_uart_calc_baud_divs()
421 if (baud > calc_baud) in cdns_uart_calc_baud_divs()
422 bauderror = baud - calc_baud; in cdns_uart_calc_baud_divs()
424 bauderror = calc_baud - baud; in cdns_uart_calc_baud_divs()
434 if (((besterror * 100) / baud) < 3) in cdns_uart_calc_baud_divs()
435 bestbaud = baud; in cdns_uart_calc_baud_divs()
441 * cdns_uart_set_baud_rate - Calculate and set the baud rate
443 * @baud: Baud rate to set
444 * Return: baud rate, requested baud when possible, or actual baud when there
448 unsigned int baud) in cdns_uart_set_baud_rate() argument
456 calc_baud = cdns_uart_calc_baud_divs(port->uartclk, baud, &bdiv, &cd, in cdns_uart_set_baud_rate()
468 cdns_uart->baud = baud; in cdns_uart_set_baud_rate()
502 * Find out if current baud-rate can be achieved with new clock in cdns_uart_clk_notifier_cb()
505 if (!cdns_uart_calc_baud_divs(ndata->new_rate, cdns_uart->baud, in cdns_uart_clk_notifier_cb()
513 /* Disable the TX and RX to set baud rate */ in cdns_uart_clk_notifier_cb()
524 * Set clk dividers to generate correct baud with new clock in cdns_uart_clk_notifier_cb()
533 cdns_uart->baud = cdns_uart_set_baud_rate(cdns_uart->port, in cdns_uart_clk_notifier_cb()
534 cdns_uart->baud); in cdns_uart_clk_notifier_cb()
674 * stop bits, flow control, baud rate
684 unsigned int baud, minbaud, maxbaud; in cdns_uart_set_termios() local
690 /* Disable the TX and RX to set baud rate */ in cdns_uart_set_termios()
696 * Min baud rate = 6bps and Max Baud Rate is 10Mbps for 100Mhz clk in cdns_uart_set_termios()
697 * min and max baud should be calculated here based on port->uartclk. in cdns_uart_set_termios()
698 * this way we get a valid baud and can safely call set_baud() in cdns_uart_set_termios()
703 baud = uart_get_baud_rate(port, termios, old, minbaud, maxbaud); in cdns_uart_set_termios()
704 baud = cdns_uart_set_baud_rate(port, baud); in cdns_uart_set_termios()
706 tty_termios_encode_baud_rate(termios, baud, baud); in cdns_uart_set_termios()
709 uart_update_timeout(port, termios->c_cflag, baud); in cdns_uart_set_termios()
1188 /* only set baud if specified on command line - otherwise in cdns_early_console_setup()
1191 if (port->uartclk && device->baud) { in cdns_early_console_setup()
1196 cdns_uart_calc_baud_divs(port->uartclk, device->baud, in cdns_early_console_setup()
1276 int baud = 9600; in cdns_uart_console_setup() local
1289 uart_parse_options(options, &baud, &parity, &bits, &flow); in cdns_uart_console_setup()
1298 return uart_set_options(port, co, baud, parity, bits, flow); in cdns_uart_console_setup()