summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorEric Tremblay <etremblay@distech-controls.com>2022-03-30 13:46:40 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-15 12:37:27 +0300
commitf6f586102add59d57bcc6eea06fdeaae11bb17a1 (patch)
treed04ec5638a815f6002841e276acb9f6c46c0a1ef /include/linux
parent0e0fd55719fa081de6f9e5d9e6cef48efb04d34a (diff)
downloadlinux-f6f586102add59d57bcc6eea06fdeaae11bb17a1.tar.xz
serial: 8250: Handle UART without interrupt on TEMT using em485
Introduce the UART_CAP_NOTEMT capability. The capability indicates that the UART doesn't have an interrupt available on TEMT. In the case where the device does not support it, we calculate the maximum time it could take for the transmitter to empty the shift register. When we get in the situation where we get the THRE interrupt, we check if the TEMT bit is set. If it's not, we start the a timer and recall __stop_tx() after the delay. The transmit sequence is a bit modified when the capability is set. The new timer is used between the last interrupt(THRE) and a potential stop_tx timer. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> [moved to use added UART_CAP_TEMT] Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> [moved to use added UART_CAP_NOTEMT, improve timeout] Signed-off-by: Eric Tremblay <etremblay@distech-controls.com> [rebased to v5.17, making use of tty_get_frame_size] Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220330104642.229507-2-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/serial_8250.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index ff84a3ed10ea..de135852107c 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -79,7 +79,9 @@ struct uart_8250_ops {
struct uart_8250_em485 {
struct hrtimer start_tx_timer; /* "rs485 start tx" timer */
struct hrtimer stop_tx_timer; /* "rs485 stop tx" timer */
+ struct hrtimer no_temt_timer; /* "rs485 no TEMT interrupt" timer */
struct hrtimer *active_timer; /* pointer to active timer */
+ unsigned long no_temt_delay; /* Delay for no_temt_timer */
struct uart_8250_port *port; /* for hrtimer callbacks */
unsigned int tx_stopped:1; /* tx is currently stopped */
};