[PATCH 1/1] serial: ns16550: Add clock ctrl to driver

Maxim Kochetkov fido_max at inbox.ru
Fri Jul 26 13:58:40 CEST 2024


Add code to get all clock inputs as in serial DT node. A clock
property is an optional feature, so do not fail if a clock property
is not present.

If a clock property is discovered, then use it to get clock. It
marks clock as used and prevents disabling shared clocks.

Signed-off-by: Maxim Kochetkov <fido_max at inbox.ru>
---
 drivers/serial/ns16550.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 6fcb5b523a..d2065a77bf 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -513,6 +513,7 @@ int ns16550_serial_probe(struct udevice *dev)
 	struct ns16550_plat *plat = dev_get_plat(dev);
 	struct ns16550 *const com_port = dev_get_priv(dev);
 	struct reset_ctl_bulk reset_bulk;
+	struct clk_bulk clk_bulk;
 	fdt_addr_t addr;
 	fdt_addr_t size;
 	int ret;
@@ -528,6 +529,10 @@ int ns16550_serial_probe(struct udevice *dev)
 			return ret;
 	}
 
+	ret = clk_get_bulk(dev, &clk_bulk);
+	if (!ret)
+		clk_enable_bulk(&clk_bulk);
+
 	ret = reset_get_bulk(dev, &reset_bulk);
 	if (!ret)
 		reset_deassert_bulk(&reset_bulk);
-- 
2.45.2



More information about the U-Boot mailing list