Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 May 1997 23:35:48 +0400 (MSD)
From:      vak@cronyx.ru
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   i386/3523: [patch] sio: automatic detection of 16550/16750 controllers
Message-ID:  <199705061935.XAA00455@crox.net.kiae.su>
Resent-Message-ID: <199705061940.MAA00543@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3523
>Category:       i386
>Synopsis:       sio driver: added automatic detection of 16650/16750 UARTs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue May  6 12:40:01 PDT 1997
>Last-Modified:
>Originator:     Serge V.Vakulenko
>Organization:
Cronyx Engineering Ltd.
>Release:        FreeBSD 2.2.1-RELEASE i386
>Environment:

	FreeBSD 2.2.1 with Cronyx-Omega multiport serial card
	(Based on Startech 16c654 UARTs).
	Or any other serial adapter with 16650 or 16750 chips.

>Description:

	The driver detects UARTs as 16550A which is not correct.

>How-To-Repeat:
>Fix:
	
	Apply the following patch:

--- sio221.c	Sat Feb  1 19:19:05 1997
+++ sio.c	Tue May  6 23:28:37 1997
@@ -856,12 +856,46 @@
 		printf(" 16550?");
 		break;
 	case FIFO_RX_HIGH:
-		printf(" 16550A");
 		if (COM_NOFIFO(isdp)) {
-			printf(" fifo disabled");
+			printf(" 16550A fifo disabled");
 		} else {
+			/* Detect the fifo size. */
+			int i, n;
+
+			/* Enable and reset the FIFO. */
+			outb (iobase+com_fifo, FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST);
+
+			/* Set the loopback mode, 57600 baud. */
+			outb (iobase+com_cfcr, CFCR_DLAB);
+			outb (iobase+com_dlbh, 0);
+			outb (iobase+com_dlbl, 2);
+			outb (iobase+com_cfcr, CFCR_8BITS);
+			outb (iobase+com_mcr, MCR_LOOPBACK);
+			inb (iobase+com_lsr);
+
+			/* Put data into transmit FIFO and wait until overrun. */
+			for (i=n=0; i<20000; ++i) {
+				unsigned char lsr = inb (iobase+com_lsr);
+				if (lsr & LSR_OE)
+					break;
+				if (lsr & LSR_TXRDY) {
+					outb (iobase+com_data, 0x5A);
+					++n;
+				}
+			}
+			outb (iobase+com_mcr, 0);
+			outb (iobase+com_fifo, 0);
+
 			com->hasfifo = TRUE;
-			com->tx_fifo_size = 16;
+			if (n > 40) {
+				com->tx_fifo_size = 64;
+				printf(" 16750");
+			} else if (n > 24) {
+				com->tx_fifo_size = 32;
+				printf(" 16650");
+			} else
+				com->tx_fifo_size = 16;
+				printf(" 16550A");
 #ifdef COM_ESP
 			for (espp = likely_esp_ports; *espp != 0; espp++)
 				if (espattach(isdp, com, *espp)) {


>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705061935.XAA00455>