aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/uart/uart_subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/uart/uart_subr.c')
-rw-r--r--sys/dev/uart/uart_subr.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/dev/uart/uart_subr.c b/sys/dev/uart/uart_subr.c
index 03c7fd8caea9..ca127b3a956e 100644
--- a/sys/dev/uart/uart_subr.c
+++ b/sys/dev/uart/uart_subr.c
@@ -185,6 +185,7 @@ out:
* mm = Memory mapped I/O address
* pa = Parity
* rs = Register shift
+ * rw = Register width
* sb = Stopbits
* xo = Device clock (xtal oscillator)
*
@@ -200,13 +201,6 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
int error;
/*
- * All uart_class references are weak. Make sure the default
- * device class has been compiled-in.
- */
- if (class == NULL)
- return (ENXIO);
-
- /*
* Check the environment variables "hw.uart.console" and
* "hw.uart.dbgport". These variables, when present, specify
* which UART port is to be used as serial console or debug
@@ -278,6 +272,8 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
break;
case UART_TAG_XO:
di->bas.rclk = uart_parse_long(&spec);
+ if (di->bas.rclk == 0)
+ di->bas.rclk_guess = 1;
break;
default:
goto inval;
@@ -298,6 +294,13 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
freeenv(cp);
/*
+ * The default uart_class reference is weak. Make sure the default
+ * device class has been compiled-in or we've set one with dt=.
+ */
+ if (class == NULL)
+ return (ENXIO);
+
+ /*
* Accept only the well-known baudrates. Any invalid baudrate
* is silently replaced with a 0-valued baudrate. The 0 baudrate
* has special meaning. It means that we're not supposed to