Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jan 2014 04:57:58 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r261180 - head/sys/arm/at91
Message-ID:  <201401260457.s0Q4vwf5048444@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sun Jan 26 04:57:58 2014
New Revision: 261180
URL: http://svnweb.freebsd.org/changeset/base/261180

Log:
  Before resetting the USART, delay a bit to allow the transmitter to
  finish the current character to drain to avoid glitching. Also,
  simplify the code a smidge.

Modified:
  head/sys/arm/at91/uart_dev_at91usart.c

Modified: head/sys/arm/at91/uart_dev_at91usart.c
==============================================================================
--- head/sys/arm/at91/uart_dev_at91usart.c	Sun Jan 26 02:41:00 2014	(r261179)
+++ head/sys/arm/at91/uart_dev_at91usart.c	Sun Jan 26 04:57:58 2014	(r261180)
@@ -421,7 +421,6 @@ at91_usart_bus_attach(struct uart_softc 
 {
 	int err;
 	int i;
-	uint32_t cr;
 	struct at91_usart_softc *atsc;
 
 	atsc = (struct at91_usart_softc *)sc;
@@ -490,8 +489,8 @@ at91_usart_bus_attach(struct uart_softc 
 	}
 
 	/* Turn on rx and tx */
-	cr = USART_CR_RSTSTA | USART_CR_RSTRX | USART_CR_RSTTX;
-	WR4(&sc->sc_bas, USART_CR, cr);
+	DELAY(1000);		/* Give pending character a chance to drain.  */
+	WR4(&sc->sc_bas, USART_CR, USART_CR_RSTSTA | USART_CR_RSTRX | USART_CR_RSTTX);
 	WR4(&sc->sc_bas, USART_CR, USART_CR_RXEN | USART_CR_TXEN);
 
 	/*



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