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_efr()

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

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250611100319.186924-24-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
c5d43d65 b3be8701

+25 -18
+25 -18
drivers/tty/serial/8250/8250_port.c
··· 2768 2768 serial_port_out(port, UART_IER, up->ier); 2769 2769 } 2770 2770 2771 + static void serial8250_set_efr(struct uart_port *port, struct ktermios *termios) 2772 + { 2773 + struct uart_8250_port *up = up_to_u8250p(port); 2774 + u8 efr_reg = UART_EFR; 2775 + u8 efr = 0; 2776 + 2777 + if (!(up->capabilities & UART_CAP_EFR)) 2778 + return; 2779 + 2780 + /* 2781 + * TI16C752/Startech hardware flow control. FIXME: 2782 + * - TI16C752 requires control thresholds to be set. 2783 + * - UART_MCR_RTS is ineffective if auto-RTS mode is enabled. 2784 + */ 2785 + if (termios->c_cflag & CRTSCTS) 2786 + efr |= UART_EFR_CTS; 2787 + 2788 + if (port->flags & UPF_EXAR_EFR) 2789 + efr_reg = UART_XR_EFR; 2790 + 2791 + serial_port_out(port, UART_LCR, UART_LCR_CONF_MODE_B); 2792 + serial_port_out(port, efr_reg, efr); 2793 + } 2794 + 2771 2795 void 2772 2796 serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, 2773 2797 const struct ktermios *old) ··· 2821 2797 uart_update_timeout(port, termios->c_cflag, baud); 2822 2798 serial8250_set_errors_and_ignores(port, termios); 2823 2799 serial8250_set_ier(port, termios); 2824 - 2825 - if (up->capabilities & UART_CAP_EFR) { 2826 - unsigned char efr = 0; 2827 - /* 2828 - * TI16C752/Startech hardware flow control. FIXME: 2829 - * - TI16C752 requires control thresholds to be set. 2830 - * - UART_MCR_RTS is ineffective if auto-RTS mode is enabled. 2831 - */ 2832 - if (termios->c_cflag & CRTSCTS) 2833 - efr |= UART_EFR_CTS; 2834 - 2835 - serial_port_out(port, UART_LCR, UART_LCR_CONF_MODE_B); 2836 - if (port->flags & UPF_EXAR_EFR) 2837 - serial_port_out(port, UART_XR_EFR, efr); 2838 - else 2839 - serial_port_out(port, UART_EFR, efr); 2840 - } 2841 - 2800 + serial8250_set_efr(port, termios); 2842 2801 serial8250_set_divisor(port, baud, quot, frac); 2843 2802 2844 2803 /*