summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/adm5120/uart_dev_adm5120.c27
-rw-r--r--sys/mips/atheros/uart_dev_ar933x.c32
-rw-r--r--sys/mips/cavium/uart_dev_oct16550.c35
-rw-r--r--sys/mips/rt305x/uart_dev_rt305x.c31
4 files changed, 124 insertions, 1 deletions
diff --git a/sys/mips/adm5120/uart_dev_adm5120.c b/sys/mips/adm5120/uart_dev_adm5120.c
index 9f2dc02..5ec18c8 100644
--- a/sys/mips/adm5120/uart_dev_adm5120.c
+++ b/sys/mips/adm5120/uart_dev_adm5120.c
@@ -149,6 +149,8 @@ static int adm5120_uart_bus_probe(struct uart_softc *);
static int adm5120_uart_bus_receive(struct uart_softc *);
static int adm5120_uart_bus_setsig(struct uart_softc *, int);
static int adm5120_uart_bus_transmit(struct uart_softc *);
+static void adm5120_uart_bus_grab(struct uart_softc *);
+static void adm5120_uart_bus_ungrab(struct uart_softc *);
static kobj_method_t adm5120_uart_methods[] = {
KOBJMETHOD(uart_attach, adm5120_uart_bus_attach),
@@ -162,6 +164,8 @@ static kobj_method_t adm5120_uart_methods[] = {
KOBJMETHOD(uart_receive, adm5120_uart_bus_receive),
KOBJMETHOD(uart_setsig, adm5120_uart_bus_setsig),
KOBJMETHOD(uart_transmit, adm5120_uart_bus_transmit),
+ KOBJMETHOD(uart_grab, adm5120_uart_bus_grab),
+ KOBJMETHOD(uart_ungrab, adm5120_uart_bus_ungrab),
{ 0, 0 }
};
@@ -450,3 +454,26 @@ adm5120_uart_bus_transmit(struct uart_softc *sc)
uart_unlock(sc->sc_hwmtx);
return (0);
}
+
+static void
+adm5120_uart_bus_grab(struct uart_softc *sc)
+{
+
+ /* Enable interrupts - no RX_INT or RX_TIMEOUT */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(&sc->sc_bas, UART_CR_REG,
+ UART_CR_PORT_EN | UART_CR_MODEM_STATUS_INT_EN);
+ uart_unlock(sc->sc_hwmtx);
+}
+
+static void
+adm5120_uart_bus_ungrab(struct uart_softc *sc)
+{
+
+ /* Enable interrupts */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(&sc->sc_bas, UART_CR_REG,
+ UART_CR_PORT_EN|UART_CR_RX_INT_EN|UART_CR_RX_TIMEOUT_INT_EN|
+ UART_CR_MODEM_STATUS_INT_EN);
+ uart_unlock(sc->sc_hwmtx);
+}
diff --git a/sys/mips/atheros/uart_dev_ar933x.c b/sys/mips/atheros/uart_dev_ar933x.c
index 30f05ba..f719805 100644
--- a/sys/mips/atheros/uart_dev_ar933x.c
+++ b/sys/mips/atheros/uart_dev_ar933x.c
@@ -325,6 +325,8 @@ static int ar933x_bus_probe(struct uart_softc *);
static int ar933x_bus_receive(struct uart_softc *);
static int ar933x_bus_setsig(struct uart_softc *, int);
static int ar933x_bus_transmit(struct uart_softc *);
+static void ar933x_bus_grab(struct uart_softc *);
+static void ar933x_bus_ungrab(struct uart_softc *);
static kobj_method_t ar933x_methods[] = {
KOBJMETHOD(uart_attach, ar933x_bus_attach),
@@ -338,6 +340,8 @@ static kobj_method_t ar933x_methods[] = {
KOBJMETHOD(uart_receive, ar933x_bus_receive),
KOBJMETHOD(uart_setsig, ar933x_bus_setsig),
KOBJMETHOD(uart_transmit, ar933x_bus_transmit),
+ KOBJMETHOD(uart_grab, ar933x_bus_grab),
+ KOBJMETHOD(uart_ungrab, ar933x_bus_ungrab),
{ 0, 0 }
};
@@ -752,3 +756,31 @@ ar933x_bus_transmit(struct uart_softc *sc)
return (0);
}
+
+static void
+ar933x_bus_grab(struct uart_softc *sc)
+{
+ struct uart_bas *bas = &sc->sc_bas;
+ uint32_t reg;
+
+ /* Disable the host interrupt now */
+ uart_lock(sc->sc_hwmtx);
+ reg = ar933x_getreg(bas, AR933X_UART_CS_REG);
+ reg &= ~AR933X_UART_CS_HOST_INT_EN;
+ ar933x_setreg(bas, AR933X_UART_CS_REG, reg);
+ uart_unlock(sc->sc_hwmtx);
+}
+
+static void
+ar933x_bus_ungrab(struct uart_softc *sc)
+{
+ struct uart_bas *bas = &sc->sc_bas;
+ uint32_t reg;
+
+ /* Enable the host interrupt now */
+ uart_lock(sc->sc_hwmtx);
+ reg = ar933x_getreg(bas, AR933X_UART_CS_REG);
+ reg |= AR933X_UART_CS_HOST_INT_EN;
+ ar933x_setreg(bas, AR933X_UART_CS_REG, reg);
+ uart_unlock(sc->sc_hwmtx);
+}
diff --git a/sys/mips/cavium/uart_dev_oct16550.c b/sys/mips/cavium/uart_dev_oct16550.c
index 753559f..f3d47ca 100644
--- a/sys/mips/cavium/uart_dev_oct16550.c
+++ b/sys/mips/cavium/uart_dev_oct16550.c
@@ -398,6 +398,8 @@ static int oct16550_bus_probe(struct uart_softc *);
static int oct16550_bus_receive(struct uart_softc *);
static int oct16550_bus_setsig(struct uart_softc *, int);
static int oct16550_bus_transmit(struct uart_softc *);
+static void oct16550_bus_grab(struct uart_softc *);
+static void oct16550_bus_ungrab(struct uart_softc *);
static kobj_method_t oct16550_methods[] = {
KOBJMETHOD(uart_attach, oct16550_bus_attach),
@@ -411,6 +413,8 @@ static kobj_method_t oct16550_methods[] = {
KOBJMETHOD(uart_receive, oct16550_bus_receive),
KOBJMETHOD(uart_setsig, oct16550_bus_setsig),
KOBJMETHOD(uart_transmit, oct16550_bus_transmit),
+ KOBJMETHOD(uart_grab, oct16550_bus_grab),
+ KOBJMETHOD(uart_ungrab, oct16550_bus_ungrab),
{ 0, 0 }
};
@@ -810,3 +814,34 @@ oct16550_bus_transmit (struct uart_softc *sc)
uart_unlock(sc->sc_hwmtx);
return (0);
}
+
+static void
+oct16550_bus_grab(struct uart_softc *sc)
+{
+ struct uart_bas *bas = &sc->sc_bas;
+
+ /*
+ * turn off all interrupts to enter polling mode. Leave the
+ * saved mask alone. We'll restore whatever it was in ungrab.
+ * All pending interupt signals are reset when IER is set to 0.
+ */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(bas, REG_IER, 0);
+ uart_barrier(bas);
+ uart_unlock(sc->sc_hwmtx);
+}
+
+static void
+oct16550_bus_ungrab(struct uart_softc *sc)
+{
+ struct oct16550_softc *oct16550 = (struct oct16550_softc*)sc;
+ struct uart_bas *bas = &sc->sc_bas;
+
+ /*
+ * Restore previous interrupt mask
+ */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(bas, REG_IER, oct16550->ier);
+ uart_barrier(bas);
+ uart_unlock(sc->sc_hwmtx);
+}
diff --git a/sys/mips/rt305x/uart_dev_rt305x.c b/sys/mips/rt305x/uart_dev_rt305x.c
index 94d0386..3154cb9 100644
--- a/sys/mips/rt305x/uart_dev_rt305x.c
+++ b/sys/mips/rt305x/uart_dev_rt305x.c
@@ -195,6 +195,8 @@ static int rt305x_uart_bus_probe(struct uart_softc *);
static int rt305x_uart_bus_receive(struct uart_softc *);
static int rt305x_uart_bus_setsig(struct uart_softc *, int);
static int rt305x_uart_bus_transmit(struct uart_softc *);
+static void rt305x_uart_bus_grab(struct uart_softc *);
+static void rt305x_uart_bus_ungrab(struct uart_softc *);
static kobj_method_t rt305x_uart_methods[] = {
KOBJMETHOD(uart_attach, rt305x_uart_bus_attach),
@@ -208,6 +210,8 @@ static kobj_method_t rt305x_uart_methods[] = {
KOBJMETHOD(uart_receive, rt305x_uart_bus_receive),
KOBJMETHOD(uart_setsig, rt305x_uart_bus_setsig),
KOBJMETHOD(uart_transmit, rt305x_uart_bus_transmit),
+ KOBJMETHOD(uart_grab, rt305x_uart_bus_grab),
+ KOBJMETHOD(uart_ungrab, rt305x_uart_bus_ungrab),
{ 0, 0 }
};
@@ -278,7 +282,7 @@ rt305x_uart_bus_attach(struct uart_softc *sc)
uart_setreg(bas, UART_FCR_REG,
uart_getreg(bas, UART_FCR_REG) |
UART_FCR_FIFOEN | UART_FCR_TXTGR_1 | UART_FCR_RXTGR_1);
- uart_barrier(bas);
+ uart_barrier(bas);
/* Enable interrupts */
uart_setreg(bas, UART_IER_REG,
UART_IER_EDSSI | UART_IER_ELSI | UART_IER_ERBFI);
@@ -505,3 +509,28 @@ rt305x_uart_bus_transmit(struct uart_softc *sc)
uart_unlock(sc->sc_hwmtx);
return (0);
}
+
+static void
+rt305x_uart_bus_grab(struct uart_softc *sc)
+{
+ struct uart_bas *bas = &sc->sc_bas;
+
+ /* disable interrupts -- XXX not sure which one is RX, so kill them all */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(bas, UART_IER_REG, 0);
+ uart_barrier(bas);
+ uart_unlock(sc->sc_hwmtx);
+}
+
+static void
+rt305x_uart_bus_ungrab(struct uart_softc *sc)
+{
+ struct uart_bas *bas = &sc->sc_bas;
+
+ /* Enable interrupts */
+ uart_lock(sc->sc_hwmtx);
+ uart_setreg(bas, UART_IER_REG,
+ UART_IER_EDSSI | UART_IER_ELSI | UART_IER_ERBFI);
+ uart_barrier(bas);
+ uart_unlock(sc->sc_hwmtx);
+}
OpenPOWER on IntegriCloud