summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2006-07-26 17:21:59 +0000
committermarcel <marcel@FreeBSD.org>2006-07-26 17:21:59 +0000
commit9552f61e79c935125c356acdcec65fbd3b1468c0 (patch)
tree49cdb27c117e4eb51468791865ad8438829865e1 /sys/dev/uart
parent2875d23aa565aa2493b0d9e67522c09befb7f3f4 (diff)
downloadFreeBSD-src-9552f61e79c935125c356acdcec65fbd3b1468c0.zip
FreeBSD-src-9552f61e79c935125c356acdcec65fbd3b1468c0.tar.gz
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.
Diffstat (limited to 'sys/dev/uart')
-rw-r--r--sys/dev/uart/uart_dev_z8530.c8
1 files changed, 7 insertions, 1 deletions
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;
OpenPOWER on IntegriCloud