Commit some sins in the name of "oh god oh god I don't really want to

be able to claim I know how the UART code works."

* Just return 115200 as the current baud rate. I should cache it in the
  device struct and return that but I'm lazy right now.
* don't error out on other ioctl settings for now, just silently ignore them.
* remove some code that was copied from the 8250 driver that isn't needed
  any longer.

Tested:

* AR9331, Carambola-2 board.
This commit is contained in:
adrian 2014-07-27 05:44:42 +00:00
parent 520bf5b954
commit 7a71bbe497

View File

@ -428,8 +428,6 @@ ar933x_bus_getsig(struct uart_softc *sc)
/*
* For now, let's just return that DSR/DCD/CTS is asserted.
*
* XXX TODO: actually verify whether this is correct!
*/
SIGCHG(1, sig, SER_DSR, SER_DDSR);
SIGCHG(1, sig, SER_CTS, SER_DCTS);
@ -441,80 +439,31 @@ ar933x_bus_getsig(struct uart_softc *sc)
return (sig);
}
/*
* XXX TODO: actually implement the rest of this!
*/
static int
ar933x_bus_ioctl(struct uart_softc *sc, int request, intptr_t data)
{
#if 0
struct uart_bas *bas;
int baudrate, divisor, error;
uint8_t efr, lcr;
int error = 0;
bas = &sc->sc_bas;
error = 0;
uart_lock(sc->sc_hwmtx);
/* XXX lock */
switch (request) {
case UART_IOCTL_BREAK:
lcr = uart_getreg(bas, REG_LCR);
if (data)
lcr |= LCR_SBREAK;
else
lcr &= ~LCR_SBREAK;
uart_setreg(bas, REG_LCR, lcr);
uart_barrier(bas);
break;
case UART_IOCTL_IFLOW:
lcr = uart_getreg(bas, REG_LCR);
uart_barrier(bas);
uart_setreg(bas, REG_LCR, 0xbf);
uart_barrier(bas);
efr = uart_getreg(bas, REG_EFR);
if (data)
efr |= EFR_RTS;
else
efr &= ~EFR_RTS;
uart_setreg(bas, REG_EFR, efr);
uart_barrier(bas);
uart_setreg(bas, REG_LCR, lcr);
uart_barrier(bas);
break;
case UART_IOCTL_OFLOW:
lcr = uart_getreg(bas, REG_LCR);
uart_barrier(bas);
uart_setreg(bas, REG_LCR, 0xbf);
uart_barrier(bas);
efr = uart_getreg(bas, REG_EFR);
if (data)
efr |= EFR_CTS;
else
efr &= ~EFR_CTS;
uart_setreg(bas, REG_EFR, efr);
uart_barrier(bas);
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_getreg(bas, REG_DLL) |
(uart_getreg(bas, REG_DLH) << 8);
uart_barrier(bas);
uart_setreg(bas, REG_LCR, lcr);
uart_barrier(bas);
baudrate = (divisor > 0) ? bas->rclk / divisor / 16 : 0;
if (baudrate > 0)
*(int*)data = baudrate;
else
error = ENXIO;
*(int*)data = 115200;
break;
default:
error = EINVAL;
break;
}
uart_unlock(sc->sc_hwmtx);
/* XXX unlock */
return (error);
#endif
return (ENXIO);
}
/*
@ -581,6 +530,8 @@ ar933x_bus_ipend(struct uart_softc *sc)
/*
* Only signal TX idle if we're not busy transmitting.
*
* XXX I never get _out_ of txbusy? Debug that!
*/
if (sc->sc_txbusy) {
if (isr & AR933X_UART_INT_TX_EMPTY) {