From owner-freebsd-bugs@FreeBSD.ORG Wed Mar 4 12:47:44 2015 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CD500756 for ; Wed, 4 Mar 2015 12:47:44 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2C3DDEB for ; Wed, 4 Mar 2015 12:47:44 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t24ClibU032039 for ; Wed, 4 Mar 2015 12:47:44 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 155752] [uart] tcdrain(3) does not work with uart(4) driver Date: Wed, 04 Mar 2015 12:47:44 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 9.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: nkoch@demig.de X-Bugzilla-Status: In Progress X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2015 12:47:44 -0000 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.