aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Xiwen <forbidden405@outlook.com>2024-02-28 18:57:52 +0800
committerTom Rini <trini@konsulko.com>2024-03-07 07:59:16 -0500
commit91febe80c9f2434170c6c2e866942c75372aed75 (patch)
treebc3c0bd56461c0039f3b4b6bccb30731483e1452
parentbe2eb3ad8fa748d075e28328ab454f702d10bc4f (diff)
downloadu-boot-91febe80c9f2434170c6c2e866942c75372aed75.zip
u-boot-91febe80c9f2434170c6c2e866942c75372aed75.tar.gz
u-boot-91febe80c9f2434170c6c2e866942c75372aed75.tar.bz2
serial: pl01x: set baudrate when probing
It is found that when DM is enabled, only generic init function is called in .probe(). Baudrate is never honored. Add a function call to .setbrg() when probing so that we can update the baudrate of the serial device. Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
-rw-r--r--drivers/serial/serial_pl01x.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index 428a4d2..f04c21e 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -290,6 +290,7 @@ int pl01x_serial_probe(struct udevice *dev)
{
struct pl01x_serial_plat *plat = dev_get_plat(dev);
struct pl01x_priv *priv = dev_get_priv(dev);
+ int ret;
#if CONFIG_IS_ENABLED(OF_PLATDATA)
struct dtd_serial_pl01x *dtplat = &plat->dtplat;
@@ -301,10 +302,14 @@ int pl01x_serial_probe(struct udevice *dev)
#endif
priv->type = plat->type;
- if (!plat->skip_init)
- return pl01x_generic_serial_init(priv->regs, priv->type);
- else
+ if (!plat->skip_init) {
+ ret = pl01x_generic_serial_init(priv->regs, priv->type);
+ if (ret)
+ return ret;
+ return pl01x_serial_setbrg(dev, gd->baudrate);
+ } else {
return 0;
+ }
}
int pl01x_serial_getc(struct udevice *dev)