Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Mar 2015 12:47:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 155752] [uart] tcdrain(3) does not work with uart(4) driver
Message-ID:  <bug-155752-8-77TeAglku2@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-155752-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-155752-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=155752

nkoch@demig.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nkoch@demig.de

--- Comment #1 from nkoch@demig.de ---
I came across the same problem: I need to switch the transmitter
of an external RS232/RS485 converter on before satarting transmittision
and off afterwards using RTS.

My quick driver hack is to always call the chip-specific drain
function whenever there is a request to turn off RTS.

This is my patch to the 16550 code:

--- uart_dev_ns8250.c.orig    2015-03-04 13:37:04.000000000 +0100
+++ uart_dev_ns8250.c    2015-03-04 13:40:05.000000000 +0100
@@ -886,6 +886,10 @@
         }
     } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new));
     uart_lock(sc->sc_hwmtx);
+#ifdef UART_HACK_DRAIN_RTSOFF
+        if ((sig & SER_DRTS) && !(sig & SER_RTS))
+                ns8250_drain(bas, UART_DRAIN_TRANSMITTER);
+#endif
     ns8250->mcr &= ~(MCR_DTR|MCR_RTS);
     if (new & SER_DTR)
         ns8250->mcr |= MCR_DTR;

The patch is against head but has been tested with 9.1
using a scope with protocol analyzer function.

I did not look into the other chips' code so may it
will not universally work.

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-155752-8-77TeAglku2>