Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/uart/uart_cpu_fdt.c
Show First 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | |||||
uart_cpu_getdev(int devtype, struct uart_devinfo *di) | uart_cpu_getdev(int devtype, struct uart_devinfo *di) | ||||
{ | { | ||||
const char *propnames[] = {"stdout-path", "linux,stdout-path", "stdout", | const char *propnames[] = {"stdout-path", "linux,stdout-path", "stdout", | ||||
"stdin-path", "stdin", NULL}; | "stdin-path", "stdin", NULL}; | ||||
const char **name; | const char **name; | ||||
struct uart_class *class; | struct uart_class *class; | ||||
phandle_t node, chosen; | phandle_t node, chosen; | ||||
pcell_t shift, br, rclk; | pcell_t shift, br, rclk; | ||||
u_long start, size, pbase, psize; | |||||
char *cp; | char *cp; | ||||
int err; | int err; | ||||
uart_bus_space_mem = fdtbus_bs_tag; | uart_bus_space_mem = fdtbus_bs_tag; | ||||
uart_bus_space_io = NULL; | uart_bus_space_io = NULL; | ||||
/* Allow overriding the FDT using the environment. */ | /* Allow overriding the FDT using the environment. */ | ||||
class = &uart_ns8250_class; | class = &uart_ns8250_class; | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | uart_cpu_getdev(int devtype, struct uart_devinfo *di) | ||||
di->bas.chan = 0; | di->bas.chan = 0; | ||||
di->bas.regshft = (u_int)shift; | di->bas.regshft = (u_int)shift; | ||||
di->baudrate = br; | di->baudrate = br; | ||||
di->bas.rclk = (u_int)rclk; | di->bas.rclk = (u_int)rclk; | ||||
di->ops = uart_getops(class); | di->ops = uart_getops(class); | ||||
di->databits = 8; | di->databits = 8; | ||||
di->stopbits = 1; | di->stopbits = 1; | ||||
di->parity = UART_PARITY_NONE; | di->parity = UART_PARITY_NONE; | ||||
di->bas.bst = uart_bus_space_mem; | |||||
err = fdt_regsize(node, &start, &size); | return (OF_decode_addr(node, 0, &di->bas.bst, &di->bas.bsh)); | ||||
if (err) | |||||
return (ENXIO); | |||||
err = fdt_get_range(OF_parent(node), 0, &pbase, &psize); | |||||
if (err) | |||||
pbase = 0; | |||||
start += pbase; | |||||
return (bus_space_map(di->bas.bst, start, size, 0, &di->bas.bsh)); | |||||
} | } |