mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-29 06:31:28 +01:00
serial: ns16550: Use old baud rate divisor for flushing if not given
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>
This commit is contained in:
parent
b1b147f2b8
commit
1c16606aac
@ -171,6 +171,13 @@ void NS16550_init(NS16550_t com_port, int baud_divisor)
|
|||||||
== UART_LSR_THRE) {
|
== UART_LSR_THRE) {
|
||||||
if (baud_divisor != -1)
|
if (baud_divisor != -1)
|
||||||
NS16550_setbrg(com_port, baud_divisor);
|
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);
|
serial_out(0, &com_port->mdr1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user