Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/amlogic Only enable RX interrupts if the device...
details: https://anonhg.NetBSD.org/src/rev/10db81692021
branches: trunk
changeset: 448062:10db81692021
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Jan 20 15:56:40 2019 +0000
description:
Only enable RX interrupts if the device is open. Previously interrupts were
enabled unconditionally, which caused the interrupt handler to consume
input before WSDISPLAY_MULTICONS had a change to poll for data.
diffstat:
sys/arch/arm/amlogic/meson_uart.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diffs (65 lines):
diff -r 2a7d403293fa -r 10db81692021 sys/arch/arm/amlogic/meson_uart.c
--- a/sys/arch/arm/amlogic/meson_uart.c Sun Jan 20 14:50:58 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_uart.c Sun Jan 20 15:56:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_uart.c,v 1.1 2019/01/19 20:56:03 jmcneill Exp $ */
+/* $NetBSD: meson_uart.c,v 1.2 2019/01/20 15:56:40 jmcneill Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: meson_uart.c,v 1.1 2019/01/19 20:56:03 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: meson_uart.c,v 1.2 2019/01/20 15:56:40 jmcneill Exp $");
#define cn_trap() \
do { \
@@ -226,8 +226,7 @@
bus_space_write_4(sc->sc_bst, sc->sc_bsh, UART_MISC_REG, misc);
control = bus_space_read_4(sc->sc_bst, sc->sc_bsh, UART_CONTROL_REG);
- control &= ~UART_CONTROL_TX_INT_EN;
- control |= UART_CONTROL_RX_INT_EN;
+ control &= ~(UART_CONTROL_TX_INT_EN|UART_CONTROL_RX_INT_EN);
bus_space_write_4(sc->sc_bst, sc->sc_bsh, UART_CONTROL_REG, control);
}
@@ -291,6 +290,7 @@
struct meson_uart_softc *sc =
device_lookup_private(&mesonuart_cd, minor(dev));
struct tty *tp = sc->sc_tty;
+ uint32_t control;
if (kauth_authorize_device_tty(l->l_cred,
KAUTH_DEVICE_TTY_OPEN, tp) != 0) {
@@ -306,6 +306,10 @@
tp->t_lflag = TTYDEF_LFLAG;
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
ttsetwater(tp);
+
+ control = bus_space_read_4(sc->sc_bst, sc->sc_bsh, UART_CONTROL_REG);
+ control |= UART_CONTROL_RX_INT_EN;
+ bus_space_write_4(sc->sc_bst, sc->sc_bsh, UART_CONTROL_REG, control);
}
tp->t_state |= TS_CARR_ON;
@@ -318,10 +322,17 @@
struct meson_uart_softc *sc =
device_lookup_private(&mesonuart_cd, minor(dev));
struct tty *tp = sc->sc_tty;
+ uint32_t control;
tp->t_linesw->l_close(tp, flag);
ttyclose(tp);
+ if (!ISSET(tp->t_state, TS_ISOPEN) && tp->t_wopen == 0) {
+ control = bus_space_read_4(sc->sc_bst, sc->sc_bsh, UART_CONTROL_REG);
+ control &= ~UART_CONTROL_RX_INT_EN;
+ bus_space_write_4(sc->sc_bst, sc->sc_bsh, UART_CONTROL_REG, control);
+ }
+
return 0;
}
Home |
Main Index |
Thread Index |
Old Index