The branch main has been updated by andrew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=eae36de826cc6fde3a78b1febad824dad20e004d

commit eae36de826cc6fde3a78b1febad824dad20e004d
Author:     Andrew Turner <[email protected]>
AuthorDate: 2024-01-08 15:22:58 +0000
Commit:     Andrew Turner <[email protected]>
CommitDate: 2024-02-13 11:48:52 +0000

    dev/uart: Support setting the register io width
    
    Some uarts require a specific register width. Support setting this in
    the kernel environment.
    
    Reviewed by:    imp (earlier version)
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D43362
---
 sys/dev/uart/uart_subr.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/dev/uart/uart_subr.c b/sys/dev/uart/uart_subr.c
index e7570e173358..03c7fd8caea9 100644
--- a/sys/dev/uart/uart_subr.c
+++ b/sys/dev/uart/uart_subr.c
@@ -47,6 +47,7 @@
 #define        UART_TAG_SB     8
 #define        UART_TAG_XO     9
 #define        UART_TAG_BD     10
+#define        UART_TAG_RW     11
 
 static bus_addr_t
 uart_parse_addr(const char **p)
@@ -148,6 +149,10 @@ uart_parse_tag(const char **p)
                tag = UART_TAG_RS;
                goto out;
        }
+       if ((*p)[0] == 'r' && (*p)[1] == 'w') {
+               tag = UART_TAG_RW;
+               goto out;
+       }
        if ((*p)[0] == 's' && (*p)[1] == 'b') {
                tag = UART_TAG_SB;
                goto out;
@@ -225,6 +230,7 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct 
uart_class *class)
        /* Set defaults. */
        di->bas.chan = 0;
        di->bas.regshft = 0;
+       di->bas.regiowidth = 1;
        di->bas.rclk = 0;
        di->baudrate = 0;
        di->databits = 8;
@@ -264,6 +270,9 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct 
uart_class *class)
                case UART_TAG_RS:
                        di->bas.regshft = uart_parse_long(&spec);
                        break;
+               case UART_TAG_RW:
+                       di->bas.regiowidth = uart_parse_long(&spec);
+                       break;
                case UART_TAG_SB:
                        di->stopbits = uart_parse_long(&spec);
                        break;

Reply via email to