diff mbox series

serial: Set baudrate on boot

Message ID da80dd64-cef3-022b-5acd-f379b8dd70d1@gmail.com
State Accepted
Commit b41d4b83f0203be79a3bfa1e4bde316355c7f2a0
Delegated to: Simon Glass
Headers show
Series serial: Set baudrate on boot | expand

Commit Message

Sean Anderson Feb. 2, 2020, 6:15 p.m. UTC
Currently, the baud rate is never set on boot. This works ok when a previous
bootloader has configured the baudrate properly, or when the baudrate is set to
a reasonable default in the serial driver's probe(). However, when this is not
the case, we could be using a different baud rate than what was configured.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---
 drivers/serial/serial-uclass.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Simon Glass Feb. 3, 2020, 12:04 a.m. UTC | #1
Hi Sean,

On Sun, 2 Feb 2020 at 11:15, Sean Anderson <seanga2@gmail.com> wrote:
>
> Currently, the baud rate is never set on boot. This works ok when a previous
> bootloader has configured the baudrate properly, or when the baudrate is set to
> a reasonable default in the serial driver's probe(). However, when this is not
> the case, we could be using a different baud rate than what was configured.
>
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
>  drivers/serial/serial-uclass.c | 1 +
>  1 file changed, 1 insertion(+)

This looks right to me.

Can you please update the docs for setbrg() in serial.h to mention
that this method is always called after probing, so there is now no
need to set the baud rate in the probe() method?
Sean Anderson Feb. 3, 2020, 1:15 a.m. UTC | #2
> This looks right to me.
> 
> Can you please update the docs for setbrg() in serial.h to mention
> that this method is always called after probing, so there is now no
> need to set the baud rate in the probe() method?
> 

Sure. Will do that in v2.
Simon Glass March 3, 2020, 2:46 a.m. UTC | #3
> This looks right to me.
>
> Can you please update the docs for setbrg() in serial.h to mention
> that this method is always called after probing, so there is now no
> need to set the baud rate in the probe() method?
>

Sure. Will do that in v2.

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 0f5f1fa406..8aa542c32f 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -161,6 +161,7 @@  int serial_init(void)
 #if CONFIG_IS_ENABLED(SERIAL_PRESENT)
 	serial_find_console_or_panic();
 	gd->flags |= GD_FLG_SERIAL_READY;
+	serial_setbrg();
 #endif
 
 	return 0;