Skip to contentSkip to conversation

serial: sh: Enable clock if available

PATCH New Marek Vasut 1 participant 1 message Sep 15, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: sh: Enable clock if available

If the clock framework provides the driver with valid clock, enable them, otherwise the SCIF might not work if the clock are not enabled prior to the driver probe.

Cc Nobuhiro Iwamatsu <[email protected]>
---
 drivers/serial/serial_sh.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/serial/serial_sh.c +6 -3
index 087785f9a2..d9db702803 100644
@@ -226,11 +226,14 @@ static int sh_serial_ofdata_to_platdata(struct udevice *dev)
 	plat->base = addr;
 
 	ret = clk_get_by_name(dev, "fck", &sh_serial_clk);
-	if (!ret)
-		plat->clk = clk_get_rate(&sh_serial_clk);
-	else
+	if (!ret) {
+		ret = clk_enable(&sh_serial_clk);
+		if (!ret)
+			plat->clk = clk_get_rate(&sh_serial_clk);
+	} else {
 		plat->clk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
 					   "clock", 1);
+	}
 
 	plat->type = dev_get_driver_data(dev);
 	return 0;
Signature · 1 line
2.11.0