svn commit: r261180 - head/sys/arm/at91

Warner Losh imp at FreeBSD.org
Sun Jan 26 04:57:58 UTC 2014


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);
 
 	/*


More information about the svn-src-all mailing list