diff options
Diffstat (limited to 'sys/dev/uart/uart_dev_ns8250.c')
-rw-r--r-- | sys/dev/uart/uart_dev_ns8250.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index adac35f..975ed4d 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -468,7 +468,7 @@ static int ns8250_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) { struct uart_bas *bas; - int error; + int divisor, error; uint8_t efr, lcr; bas = &sc->sc_bas; @@ -514,6 +514,16 @@ ns8250_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) uart_setreg(bas, REG_LCR, lcr); uart_barrier(bas); break; + case UART_IOCTL_BAUD: + lcr = uart_getreg(bas, REG_LCR); + uart_setreg(bas, REG_LCR, lcr | LCR_DLAB); + uart_barrier(bas); + divisor = uart_getdreg(bas, REG_DL); + uart_barrier(bas); + uart_setreg(bas, REG_LCR, lcr); + uart_barrier(bas); + *(int*)data = bas->rclk / divisor / 16; + break; default: error = EINVAL; break; |