diff options
author | marcel <marcel@FreeBSD.org> | 2007-03-28 18:34:59 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2007-03-28 18:34:59 +0000 |
commit | 43bdc5ab02e5cda0610e75452d3ba1fea988823d (patch) | |
tree | a931c4313990d5047145bda735ad2cddd6fda407 | |
parent | c0fdcbb7ede752eb30ec72442cff0a7daf28e7e3 (diff) | |
download | FreeBSD-src-43bdc5ab02e5cda0610e75452d3ba1fea988823d.zip FreeBSD-src-43bdc5ab02e5cda0610e75452d3ba1fea988823d.tar.gz |
For embedded UARTs compatible with the ns8250 family it is possible
that the driver clock is identical to the processor or bus clock.
This is the case for the PowerQUICC processor. When the clock is
high enough, overflows happen in the calculation of the time it
takes to send 1/10 of a character, used in delay loops. Fix the
overflows so as to fix bugs in the delay loops that can cause either
insufficient delays or excessive delays.
-rw-r--r-- | sys/dev/uart/uart_dev_ns8250.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index 4262f8d..8e6177b 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -81,7 +81,9 @@ ns8250_delay(struct uart_bas *bas) uart_barrier(bas); /* 1/10th the time to transmit 1 character (estimate). */ - return (16000000 * divisor / bas->rclk); + if (divisor <= 134) + return (16000000 * divisor / bas->rclk); + return (16000 * divisor / (bas->rclk / 1000)); } static int |