clk: mediatek: Add fixed clocks support for Mediatek SoC.
authorJames Liao <jamesjj.liao@mediatek.com>
Fri, 10 Jul 2015 03:39:15 +0000 (11:39 +0800)
committerJames Liao <jamesjj.liao@mediatek.com>
Thu, 1 Oct 2015 04:04:49 +0000 (12:04 +0800)
This patch adds fixed clocks support by using CCF fixed-rate
clock implementation.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
drivers/clk/mediatek/clk-mtk.c
drivers/clk/mediatek/clk-mtk.h

index 268b6ff23aec16edaed43919d233819b34f2313f..cf08db6c130c9887e6bc4ed40415aa683efd9b8d 100644 (file)
@@ -49,6 +49,29 @@ err_out:
        return NULL;
 }
 
+void __init mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks,
+               int num, struct clk_onecell_data *clk_data)
+{
+       int i;
+       struct clk *clk;
+
+       for (i = 0; i < num; i++) {
+               const struct mtk_fixed_clk *rc = &clks[i];
+
+               clk = clk_register_fixed_rate(NULL, rc->name, rc->parent,
+                               rc->parent ? 0 : CLK_IS_ROOT, rc->rate);
+
+               if (IS_ERR(clk)) {
+                       pr_err("Failed to register clk %s: %ld\n",
+                                       rc->name, PTR_ERR(clk));
+                       continue;
+               }
+
+               if (clk_data)
+                       clk_data->clks[rc->id] = clk;
+       }
+}
+
 void __init mtk_clk_register_factors(const struct mtk_fixed_factor *clks,
                int num, struct clk_onecell_data *clk_data)
 {
index 9f1982059cffb6d500c3838d544db1ab4500c329..24b73ff84e06b7c97a081ef3a79d6f3775753d95 100644 (file)
@@ -26,6 +26,23 @@ struct clk;
 
 #define MHZ (1000 * 1000)
 
+struct mtk_fixed_clk {
+       int id;
+       const char *name;
+       const char *parent;
+       unsigned long rate;
+};
+
+#define FIXED_CLK(_id, _name, _parent, _rate) {                \
+               .id = _id,                              \
+               .name = _name,                          \
+               .parent = _parent,                      \
+               .rate = _rate,                          \
+       }
+
+void mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks,
+               int num, struct clk_onecell_data *clk_data);
+
 struct mtk_fixed_factor {
        int id;
        const char *name;
This page took 0.025996 seconds and 5 git commands to generate.