Attachment 'jh7110_uart_workaround.patch'

Download

   1 commit 7187bba8bcfa4756d459e09b0bda192ca93b12f9
   2 Author: Mitchell Horne <mhorne@FreeBSD.org>
   3 Date:   Fri Jan 26 13:35:00 2024 -0400
   4 
   5     ns8250: workaround on VisionFive v2
   6     
   7     For some reason, writing to the data register after ns8250_probe() and
   8     before setting the baudrate prevents the garbled output.
   9 
  10 diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c
  11 index f211084cb013..03d17415e87c 100644
  12 --- a/sys/dev/uart/uart_dev_ns8250.c
  13 +++ b/sys/dev/uart/uart_dev_ns8250.c
  14 @@ -281,6 +281,8 @@ ns8250_param(struct uart_bas *bas, int baudrate, int databits, int stopbits,
  15  		lcr |= LCR_STOPB;
  16  	lcr |= parity << 3;
  17  
  18 +	uart_setreg(bas, REG_DATA, 0);
  19 +
  20  	/* Set baudrate. */
  21  	if (baudrate > 0) {
  22  		divisor = ns8250_divisor(bas->rclk, baudrate);

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2024-02-05T19:19:12+0000, 0.8 KB) [[attachment:jh7110_uart_workaround.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.