aboutsummaryrefslogtreecommitdiff
path: root/drivers/serial
diff options
context:
space:
mode:
authorMarek Vasut2017-09-15 21:11:27 +0200
committerNobuhiro Iwamatsu2017-09-24 14:12:07 +0900
commit791c174d58f6fbea2b055b5851ab33d8f73b2c93 (patch)
treefdaa3b7048f4d3cb24595d39b796a6101719dbd7 /drivers/serial
parentbddb44e94a51d387ff8fc307d21a5f76bd3093e9 (diff)
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. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_sh.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index 087785f9a24..d9db702803c 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -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;