]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
serial: sh: Enable clock if available
authorMarek Vasut <marek.vasut@gmail.com>
Fri, 15 Sep 2017 19:11:27 +0000 (21:11 +0200)
committerNobuhiro Iwamatsu <iwamatsu@nigauri.org>
Sun, 24 Sep 2017 05:12:07 +0000 (14:12 +0900)
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>
drivers/serial/serial_sh.c

index 087785f9a249ef7151456ae46b9d09d53db70d54..d9db702803cad66f2c036920af32fd7cadb01ba1 100644 (file)
@@ -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;