If baud_divisor is not set (i.e. == -1), we should use the baud divisor
already in use for flushing the xmit register. If we don't flush the
xmit register, then SPL will hang.
Signed-off-by: Patrik Dahlström <risca@dalakolonin.se>
== UART_LSR_THRE) {
if (baud_divisor != -1)
NS16550_setbrg(com_port, baud_divisor);
+ else {
+ // Re-use old baud rate divisor to flush transmit reg.
+ const int dll = serial_in(&com_port->dll);
+ const int dlm = serial_in(&com_port->dlm);
+ const int divisor = dll | (dlm << 8);
+ NS16550_setbrg(com_port, divisor);
+ }
serial_out(0, &com_port->mdr1);
}
#endif