add device hints to control the rx FIFO interrupt level on 16550A parts

PR:		kern/121421
Submitted by:	UEMURA Tetsuya
Reviewed by:	marcel
MFC after:	2 weeks
This commit is contained in:
Sam Leffler 2008-03-12 19:09:20 +00:00
parent 16630f3430
commit 823c77d78b
2 changed files with 18 additions and 1 deletions

View File

@ -74,6 +74,10 @@ extern struct uart_class uart_z8530_class __attribute__((weak));
*/
#define UART_FLAGS_CONSOLE(f) ((f) & 0x10)
#define UART_FLAGS_DBGPORT(f) ((f) & 0x80)
#define UART_FLAGS_FCR_RX_LOW(f) ((f) & 0x100)
#define UART_FLAGS_FCR_RX_MEDL(f) ((f) & 0x200)
#define UART_FLAGS_FCR_RX_MEDH(f) ((f) & 0x400)
#define UART_FLAGS_FCR_RX_HIGH(f) ((f) & 0x800)
/*
* Data parity values (magical numbers related to ns8250).

View File

@ -382,11 +382,24 @@ ns8250_bus_attach(struct uart_softc *sc)
{
struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc;
struct uart_bas *bas;
unsigned int ivar;
bas = &sc->sc_bas;
ns8250->mcr = uart_getreg(bas, REG_MCR);
ns8250->fcr = FCR_ENABLE | FCR_RX_MEDH;
ns8250->fcr = FCR_ENABLE;
if (!resource_int_value("uart", device_get_unit(sc->sc_dev), "flags",
&ivar)) {
if (UART_FLAGS_FCR_RX_LOW(ivar))
ns8250->fcr |= FCR_RX_LOW;
else if (UART_FLAGS_FCR_RX_MEDL(ivar))
ns8250->fcr |= FCR_RX_MEDL;
else if (UART_FLAGS_FCR_RX_HIGH(ivar))
ns8250->fcr |= FCR_RX_HIGH;
else
ns8250->fcr |= FCR_RX_MEDH;
} else
ns8250->fcr |= FCR_RX_MEDH;
uart_setreg(bas, REG_FCR, ns8250->fcr);
uart_barrier(bas);
ns8250_bus_flush(sc, UART_FLUSH_RECEIVER|UART_FLUSH_TRANSMITTER);