git: fa93443af9fb - main - uart: Prefer rclk passed in over rclk in the class
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 14 Oct 2024 22:17:30 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=fa93443af9fb05989dc069ea37932be1b760e7f3 commit fa93443af9fb05989dc069ea37932be1b760e7f3 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2024-10-14 21:57:09 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-10-14 22:03:58 +0000 uart: Prefer rclk passed in over rclk in the class If rclk is set in sysdev, then it was set during the boot process and is intended to override the defaults. By prefering the sysdev one over the class, xo=XXXX in hw.uart.console can give the user a usable console for non-traditional UARTs, especially on !x86 platforms. The default rclk generally only is good for I/O mapped UARTS or PCI ones that we can do a table lookup on. Other times, it can be hard to know what a good default is without more information. Sponsored by: Netflix Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D47069 --- sys/dev/uart/uart_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c index c2bc818a6fc2..71f39e4c71e7 100644 --- a/sys/dev/uart/uart_core.c +++ b/sys/dev/uart/uart_core.c @@ -559,8 +559,14 @@ uart_bus_probe(device_t dev, int regshft, int regiowidth, int rclk, int rid, int uart_cpu_eqres(&sc->sc_bas, &sysdev->bas)) { /* XXX check if ops matches class. */ sc->sc_sysdev = sysdev; - sysdev->bas.rclk = sc->sc_bas.rclk; - } + if (sysdev->bas.rclk != 0) { + /* Let the boot sequence control */ + sc->sc_bas.rclk = sysdev->bas.rclk; + } else { + /* Boot didn't set it, use use class */ + sysdev->bas.rclk = sc->sc_bas.rclk; + } + } } error = UART_PROBE(sc);