summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_dev_pl011.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/uart/uart_dev_pl011.c')
-rw-r--r--sys/dev/uart/uart_dev_pl011.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/dev/uart/uart_dev_pl011.c b/sys/dev/uart/uart_dev_pl011.c
index 82e8b03..3253cd1 100644
--- a/sys/dev/uart/uart_dev_pl011.c
+++ b/sys/dev/uart/uart_dev_pl011.c
@@ -242,6 +242,8 @@ static int uart_pl011_bus_probe(struct uart_softc *);
static int uart_pl011_bus_receive(struct uart_softc *);
static int uart_pl011_bus_setsig(struct uart_softc *, int);
static int uart_pl011_bus_transmit(struct uart_softc *);
+static void uart_pl011_bus_grab(struct uart_softc *);
+static void uart_pl011_bus_ungrab(struct uart_softc *);
static kobj_method_t uart_pl011_methods[] = {
KOBJMETHOD(uart_attach, uart_pl011_bus_attach),
@@ -255,6 +257,9 @@ static kobj_method_t uart_pl011_methods[] = {
KOBJMETHOD(uart_receive, uart_pl011_bus_receive),
KOBJMETHOD(uart_setsig, uart_pl011_bus_setsig),
KOBJMETHOD(uart_transmit, uart_pl011_bus_transmit),
+ KOBJMETHOD(uart_grab, uart_pl011_bus_grab),
+ KOBJMETHOD(uart_ungrab, uart_pl011_bus_ungrab),
+
{ 0, 0 }
};
@@ -441,3 +446,27 @@ uart_pl011_bus_transmit(struct uart_softc *sc)
return (0);
}
+
+static void
+uart_pl011_bus_grab(struct uart_softc *sc)
+{
+ struct uart_bas *bas;
+
+ bas = &sc->sc_bas;
+ uart_lock(sc->sc_hwmtx);
+ __uart_setreg(bas, UART_IMSC, /* Switch to RX polling while grabbed */
+ ~UART_RXREADY & __uart_getreg(bas, UART_IMSC));
+ uart_unlock(sc->sc_hwmtx);
+}
+
+static void
+uart_pl011_bus_ungrab(struct uart_softc *sc)
+{
+ struct uart_bas *bas;
+
+ bas = &sc->sc_bas;
+ uart_lock(sc->sc_hwmtx);
+ __uart_setreg(bas, UART_IMSC, /* Switch to RX interrupts while not grabbed */
+ UART_RXREADY | __uart_getreg(bas, UART_IMSC));
+ uart_unlock(sc->sc_hwmtx);
+}
OpenPOWER on IntegriCloud