Re: UART question
Robert Swindells <[email protected]>
| Newsgroups | gmane.os.netbsd.ports.arm |
|---|---|
| Message-ID | <[email protected]> |
Lloyd Parkes <[email protected]> wrote: > On Mon, 2025-07-07 at 20:03 +0000, Vincent DEFERT wrote: >> Is there something special I should do to bind mesonuart0 to a device >> under /dev? > > A quick check of the PC serial port support shows that it calls > com_attach_subr(). > > Maybe that's the function you are looking for. Maybe it's a function > that calls the function you are looking for. https://nxr.netbsd.org/ > should help. The driver for the meson uart works fine, it is what provides the serial console, it isn't related to com.c. I suspect that nobody has ever used the uarts for anything other than the console on an amlogic system. The driver allocates a major number at runtime but doesn't print it, the patch below generates this for me: mesonuart0 at simplebus6: console mesonuart0: interrupting on GIC irq 225 mesonuart0: major 368 You could create /dev/ttyXX nodes with whatever major is picked and try that but we need something better in the long term. I don't see why we need to reserve a major number for each different builtin uart, only one of them will ever be attached for a given SoC, we could reserve a major for 'socuart' and reuse it for all the non-com.c uart drivers. I also think we also have a mismatch between userland and the kernel of major numbers for evbarm, /dev/MAKEDEV is always built from majors.arm32 but an aarch64 kernel uses majors.aarch64. Index: meson_uart.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/amlogic/meson_uart.c,v retrieving revision 1.7 diff -u -r1.7 meson_uart.c --- meson_uart.c 26 Oct 2022 23:38:06 -0000 1.7 +++ meson_uart.c 7 Jul 2025 21:46:13 -0000 @@ -233,6 +233,7 @@ aprint_normal("\n"); aprint_normal_dev(self, "interrupting on %s\n", intrstr); + aprint_normal_dev(self, "major %d\n", meson_uart_cmajor); misc = bus_space_read_4(sc->sc_bst, sc->sc_bsh, UART_MISC_REG); misc &= ~UART_MISC_TX_IRQ_CNT;