svn commit: r274451 - head/sys/dev/uart
Zbigniew Bodek
zbb at FreeBSD.org
Wed Nov 12 21:38:32 UTC 2014
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);
}
More information about the svn-src-head
mailing list