Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/uart/uart_dev_ns8250.c
Show First 20 Lines • Show All 392 Lines • ▼ Show 20 Lines | struct uart_class uart_ns8250_class = { | ||||
.uc_rclk = DEFAULT_RCLK, | .uc_rclk = DEFAULT_RCLK, | ||||
.uc_rshift = 0 | .uc_rshift = 0 | ||||
}; | }; | ||||
#ifdef FDT | #ifdef FDT | ||||
static struct ofw_compat_data compat_data[] = { | static struct ofw_compat_data compat_data[] = { | ||||
{"ns16550", (uintptr_t)&uart_ns8250_class}, | {"ns16550", (uintptr_t)&uart_ns8250_class}, | ||||
{"ns16550a", (uintptr_t)&uart_ns8250_class}, | {"ns16550a", (uintptr_t)&uart_ns8250_class}, | ||||
{"snps,dw-apb-uart", (uintptr_t)&uart_ns8250_class}, | |||||
{NULL, (uintptr_t)NULL}, | {NULL, (uintptr_t)NULL}, | ||||
}; | }; | ||||
UART_FDT_CLASS_AND_DEVICE(compat_data); | UART_FDT_CLASS_AND_DEVICE(compat_data); | ||||
#endif | #endif | ||||
/* Use token-pasting to form SER_ and MSR_ named constants. */ | /* Use token-pasting to form SER_ and MSR_ named constants. */ | ||||
#define SER(sig) SER_##sig | #define SER(sig) SER_##sig | ||||
#define SERD(sig) SER_D##sig | #define SERD(sig) SER_D##sig | ||||
Show All 36 Lines | ns8250_bus_attach(struct uart_softc *sc) | ||||
struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc; | struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc; | ||||
struct uart_bas *bas; | struct uart_bas *bas; | ||||
unsigned int ivar; | unsigned int ivar; | ||||
#ifdef FDT | #ifdef FDT | ||||
phandle_t node; | phandle_t node; | ||||
pcell_t cell; | pcell_t cell; | ||||
#endif | #endif | ||||
ns8250->busy_detect = 0; | |||||
#ifdef FDT | #ifdef FDT | ||||
/* | /* Check whether uart has a broken txfifo. */ | ||||
* Check whether uart requires to read USR reg when IIR_BUSY and | |||||
* has broken txfifo. | |||||
*/ | |||||
ns8250->busy_detect = ofw_bus_is_compatible(sc->sc_dev, "snps,dw-apb-uart"); | |||||
node = ofw_bus_get_node(sc->sc_dev); | node = ofw_bus_get_node(sc->sc_dev); | ||||
/* XXX: This is kept for a short time for compatibility with older device trees */ | |||||
if ((OF_getencprop(node, "busy-detect", &cell, sizeof(cell))) > 0 | |||||
&& cell != 0) | |||||
ns8250->busy_detect = 1; | |||||
if ((OF_getencprop(node, "broken-txfifo", &cell, sizeof(cell))) > 0) | if ((OF_getencprop(node, "broken-txfifo", &cell, sizeof(cell))) > 0) | ||||
broken_txfifo = cell ? 1 : 0; | broken_txfifo = cell ? 1 : 0; | ||||
#endif | #endif | ||||
bas = &sc->sc_bas; | bas = &sc->sc_bas; | ||||
ns8250->mcr = uart_getreg(bas, REG_MCR); | ns8250->mcr = uart_getreg(bas, REG_MCR); | ||||
ns8250->fcr = FCR_ENABLE; | ns8250->fcr = FCR_ENABLE; | ||||
▲ Show 20 Lines • Show All 558 Lines • Show Last 20 Lines |