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.
This commit is contained in:
Marcel Moolenaar 2006-07-26 17:21:59 +00:00
parent e997db5d3a
commit afd396ac93

View File

@ -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;