From 9552f61e79c935125c356acdcec65fbd3b1468c0 Mon Sep 17 00:00:00 2001 From: marcel Date: Wed, 26 Jul 2006 17:21:59 +0000 Subject: Implement UART_IOCTL_BAUD for the Z8530. This allows a serial console on PowerPC use the current setting of the hardware and not second guess what the OFW does on various machines. --- sys/dev/uart/uart_dev_z8530.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sys/dev/uart') diff --git a/sys/dev/uart/uart_dev_z8530.c b/sys/dev/uart/uart_dev_z8530.c index bcde32f..49b152b 100644 --- a/sys/dev/uart/uart_dev_z8530.c +++ b/sys/dev/uart/uart_dev_z8530.c @@ -383,7 +383,7 @@ z8530_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) { struct z8530_softc *z8530 = (struct z8530_softc*)sc; struct uart_bas *bas; - int error; + int baudrate, divisor, error; bas = &sc->sc_bas; error = 0; @@ -397,6 +397,12 @@ z8530_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) uart_setmreg(bas, WR_TPC, z8530->tpc); uart_barrier(bas); break; + case UART_IOCTL_BAUD: + divisor = uart_getmreg(bas, RR_TCH); + divisor = (divisor << 8) | uart_getmreg(bas, RR_TCL); + baudrate = bas->rclk / 2 / (divisor + 2); + *(int*)data = baudrate; + break; default: error = EINVAL; break; -- cgit v1.1