summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c/src/lib/libbsp/powerpc/ChangeLog15
-rw-r--r--c/src/lib/libbsp/powerpc/shared/console/uart.c8
2 files changed, 22 insertions, 1 deletions
diff --git a/c/src/lib/libbsp/powerpc/ChangeLog b/c/src/lib/libbsp/powerpc/ChangeLog
index 1c28dc96f3..1b20f3262a 100644
--- a/c/src/lib/libbsp/powerpc/ChangeLog
+++ b/c/src/lib/libbsp/powerpc/ChangeLog
@@ -1,5 +1,20 @@
2007-11-21 Till Straumann <strauman@slac.stanford.edu>
+ * shared/console/uart.c: when draining UART during
+ initialization (wait for possible printk() activity
+ to finish) look at TEMT (fifo, holding-reg and shift-reg)
+ rather than THRE (fifo, holding-reg only). This resolved
+ some scrambled output issues for me.
+
+ Enhanced semantics: if BSP initializes BSPBaseBaud to a negative
+ value then the driver interprets the modulus as a speed value
+ and uses the current setting of the divisor to compute the
+ clock speed (BSPBaseBaud). This is useful if you have a board
+ that you know is initialized e.g., to 9600 but you
+ don't know the clock speed.
+
+2007-11-21 Till Straumann <strauman@slac.stanford.edu>
+
* Makefile.am, motorola_powerpc/Makefile.am,
* shared/pci/detect_raven_bridge.c, Makefile.am,
* shared/pci/generic_clear_hberrs.c: separated the generic
diff --git a/c/src/lib/libbsp/powerpc/shared/console/uart.c b/c/src/lib/libbsp/powerpc/shared/console/uart.c
index 11d9b64ce7..2e564a6af9 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/uart.c
+++ b/c/src/lib/libbsp/powerpc/shared/console/uart.c
@@ -144,7 +144,7 @@ BSP_uart_init(int uart, int baud, int hwFlow)
/* Make sure any printk activity drains before
* re-initializing.
*/
- while ( ! (uread(uart, LSR) & THRE) )
+ while ( ! (uread(uart, LSR) & TEMT) )
;
switch(baud)
@@ -171,6 +171,12 @@ BSP_uart_init(int uart, int baud, int hwFlow)
/* Set DLAB bit to 1 */
uwrite(uart, LCR, DLAB);
+ if ( (int)BSPBaseBaud <= 0 ) {
+ /* Use current divisor assuming BSPBaseBaud gives us the current speed */
+ BSPBaseBaud = BSPBaseBaud ? -BSPBaseBaud : 9600;
+ BSPBaseBaud *= ((uread(uart, DLM) << 8) | uread(uart, DLL));
+ }
+
/* Set baud rate */
uwrite(uart, DLL, (BSPBaseBaud/baud) & 0xff);
uwrite(uart, DLM, ((BSPBaseBaud/baud) >> 8) & 0xff);