Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Nov 2014 21:38:32 +0000 (UTC)
From:      Zbigniew Bodek <zbb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274451 - head/sys/dev/uart
Message-ID:  <201411122138.sACLcWRt010480@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zbb
Date: Wed Nov 12 21:38:31 2014
New Revision: 274451
URL: https://svnweb.freebsd.org/changeset/base/274451

Log:
  Make PL011 UART to wait on putc only when TX FIFO is full
  
  Instead of waiting for empty TX FIFO it is more reasonable to
  block on full FIFO. As soon as FIFO slot is free the character
  can be transmitted.
  In case of TX FIFO disabled, TXFF bit indicates that transmit
  register is not empty.
  
  Obtained from:   Semihalf
  Reviewed by:     andrew, emaste
  Sponsored by:    The FreeBSD Foundation

Modified:
  head/sys/dev/uart/uart_dev_pl011.c

Modified: head/sys/dev/uart/uart_dev_pl011.c
==============================================================================
--- head/sys/dev/uart/uart_dev_pl011.c	Wed Nov 12 20:57:29 2014	(r274450)
+++ head/sys/dev/uart/uart_dev_pl011.c	Wed Nov 12 21:38:31 2014	(r274451)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #define	DR_OE		(1 << 11)	/* Overrun error */
 
 #define	UART_FR		0x06		/* Flag register */
+#define	FR_TXFF		(1 << 5)	/* Transmit FIFO/reg full */
 #define	FR_RXFF		(1 << 6)	/* Receive FIFO/reg full */
 #define	FR_TXFE		(1 << 7)	/* Transmit FIFO/reg empty */
 
@@ -194,7 +195,8 @@ static void
 uart_pl011_putc(struct uart_bas *bas, int c)
 {
 
-	while (!(__uart_getreg(bas, UART_FR) & FR_TXFE))
+	/* Wait when TX FIFO full. Push character otherwise. */
+	while (__uart_getreg(bas, UART_FR) & FR_TXFF)
 		;
 	__uart_setreg(bas, UART_DR, c & 0xff);
 }



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