Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial: 8250: extract serial8250_set_afe()

serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of MCR for UART_CAP_AFE ports.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20250611100319.186924-21-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
3b3d253b cc7c9cbe

+17 -15
+17 -15
drivers/tty/serial/8250/8250_port.c
··· 2704 2704 up->fcr |= UART_FCR_TRIGGER_1; 2705 2705 } 2706 2706 2707 + /* 2708 + * MCR-based auto flow control. When AFE is enabled, RTS will be deasserted when the receive FIFO 2709 + * contains more characters than the trigger, or the MCR RTS bit is cleared. 2710 + */ 2711 + static void serial8250_set_afe(struct uart_port *port, struct ktermios *termios) 2712 + { 2713 + struct uart_8250_port *up = up_to_u8250p(port); 2714 + 2715 + if (!(up->capabilities & UART_CAP_AFE)) 2716 + return; 2717 + 2718 + up->mcr &= ~UART_MCR_AFE; 2719 + if (termios->c_cflag & CRTSCTS) 2720 + up->mcr |= UART_MCR_AFE; 2721 + } 2722 + 2707 2723 void 2708 2724 serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, 2709 2725 const struct ktermios *old) ··· 2745 2729 2746 2730 up->lcr = cval; /* Save computed LCR */ 2747 2731 serial8250_set_trigger_for_slow_speed(port, termios, baud); 2748 - 2749 - /* 2750 - * MCR-based auto flow control. When AFE is enabled, RTS will be 2751 - * deasserted when the receive FIFO contains more characters than 2752 - * the trigger, or the MCR RTS bit is cleared. 2753 - */ 2754 - if (up->capabilities & UART_CAP_AFE) { 2755 - up->mcr &= ~UART_MCR_AFE; 2756 - if (termios->c_cflag & CRTSCTS) 2757 - up->mcr |= UART_MCR_AFE; 2758 - } 2759 - 2760 - /* 2761 - * Update the per-port timeout. 2762 - */ 2732 + serial8250_set_afe(port, termios); 2763 2733 uart_update_timeout(port, termios->c_cflag, baud); 2764 2734 2765 2735 /*