diff --git a/sys/arm/ti/am335x/am335x_dmtimer.c b/sys/arm/ti/am335x/am335x_dmtimer.c index 09acb3d..bb17eb0 100644 --- a/sys/arm/ti/am335x/am335x_dmtimer.c +++ b/sys/arm/ti/am335x/am335x_dmtimer.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #define AM335X_NUM_TIMERS 8 diff --git a/sys/dev/uart/uart_bus.h b/sys/dev/uart/uart_bus.h index 322e9a8..f40ad9a 100644 --- a/sys/dev/uart/uart_bus.h +++ b/sys/dev/uart/uart_bus.h @@ -70,6 +70,7 @@ struct uart_class { struct uart_ops *uc_ops; /* Low-level console operations. */ u_int uc_range; /* Bus space address range. */ u_int uc_rclk; /* Default rclk for this device. */ + u_int uc_regshft; /* Default regshift for this device. */ }; struct uart_softc { diff --git a/sys/dev/uart/uart_bus_fdt.c b/sys/dev/uart/uart_bus_fdt.c index 121bebb..d569a09 100644 --- a/sys/dev/uart/uart_bus_fdt.c +++ b/sys/dev/uart/uart_bus_fdt.c @@ -88,7 +88,7 @@ uart_fdt_get_shift(phandle_t node, pcell_t *cell) { if ((OF_getencprop(node, "reg-shift", cell, sizeof(*cell))) <= 0) - *cell = 0; + return (-1); return (0); } @@ -127,7 +127,8 @@ uart_fdt_probe(device_t dev) if ((err = uart_fdt_get_clock(node, &clock)) != 0) return (err); - uart_fdt_get_shift(node, &shift); + if (uart_fdt_get_shift(node, &shift) < 0) + shift = sc->sc_class->uc_regshft; return (uart_bus_probe(dev, (int)shift, (int)clock, 0, 0)); } diff --git a/sys/dev/uart/uart_cpu_fdt.c b/sys/dev/uart/uart_cpu_fdt.c index 6f6ebda..dea9bba 100644 --- a/sys/dev/uart/uart_cpu_fdt.c +++ b/sys/dev/uart/uart_cpu_fdt.c @@ -161,7 +161,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) /* * Retrieve serial attributes. */ - uart_fdt_get_shift(node, &shift); + if (OF_getprop(node, "current-speed", &br, sizeof(br)) <= 0) br = 0; else @@ -185,6 +185,9 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) rclk = 0; } + if (uart_fdt_get_shift(node, &shift) < 0) + shift = class->uc_regshft; + /* * Finalize configuration. */ diff --git a/sys/dev/uart/uart_dev_ti8250.c b/sys/dev/uart/uart_dev_ti8250.c index daddbb7..78689e4 100644 --- a/sys/dev/uart/uart_dev_ti8250.c +++ b/sys/dev/uart/uart_dev_ti8250.c @@ -137,10 +124,13 @@ static struct uart_class uart_ti8250_class = { sizeof(struct ti8250_softc), .uc_ops = &uart_ns8250_ops, .uc_range = 0x88, - .uc_rclk = 48000000 + .uc_rclk = 48000000, + .uc_regshft = 2 }; static struct ofw_compat_data compat_data[] = { {"ti,ns16550", (uintptr_t)&uart_ti8250_class}, + {"ti,omap3-uart", (uintptr_t)&uart_ti8250_class}, + {"ti,omap4-uart", (uintptr_t)&uart_ti8250_class}, {NULL, (uintptr_t)NULL}, }; UART_FDT_CLASS_AND_DEVICE(compat_data);