[PATCH 14/20] serial_lpuart: add clock enable if CONFIG_CLK is defined
Giulio Benetti
giulio.benetti at benettiengineering.com
Wed Dec 4 18:44:33 CET 2019
This driver assumes that lpuart clock is already enabled before probing
but using DM only lpuart won't be automatically enabled so add
clk_enable() when probing if CONFIG_CLK is defined.
Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
---
drivers/serial/serial_lpuart.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 4b0a964d1b..52bd2baf7d 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -483,6 +483,19 @@ static int lpuart_serial_pending(struct udevice *dev, bool input)
static int lpuart_serial_probe(struct udevice *dev)
{
+#if CONFIG_IS_ENABLED(CLK)
+ struct clk per_clk;
+ int ret;
+
+ ret = clk_get_by_name(dev, "per", &per_clk);
+ if (ret) {
+ dev_err(dev, "Failed to get per clk: %d\n", ret);
+ return ret;
+ }
+
+ clk_enable(&per_clk);
+#endif
+
if (is_lpuart32(dev))
return _lpuart32_serial_init(dev);
else
--
2.20.1
More information about the U-Boot
mailing list