* [PATCH] serial: ns16550: Use old baud rate divisor for flushing if not given
@ 2019-12-21 16:25 Patrik Dahlström
2020-01-25 17:08 ` Tom Rini
0 siblings, 1 reply; 2+ messages in thread
From: Patrik Dahlström @ 2019-12-21 16:25 UTC (permalink / raw)
To: u-boot
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>
---
drivers/serial/ns16550.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 754b6e9921..d9da7f799c 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -170,6 +170,13 @@ void NS16550_init(NS16550_t com_port, int baud_divisor)
== 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
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] serial: ns16550: Use old baud rate divisor for flushing if not given
2019-12-21 16:25 [PATCH] serial: ns16550: Use old baud rate divisor for flushing if not given Patrik Dahlström
@ 2020-01-25 17:08 ` Tom Rini
0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2020-01-25 17:08 UTC (permalink / raw)
To: u-boot
On Sat, Dec 21, 2019 at 05:25:12PM +0100, Patrik Dahlström wrote:
> 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>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200125/2d040723/attachment.sig>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-25 17:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-21 16:25 [PATCH] serial: ns16550: Use old baud rate divisor for flushing if not given Patrik Dahlström
2020-01-25 17:08 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.