diff options
author | Shunli Wang <shunli.wang@mediatek.com> | 2016-11-04 08:43:05 +0100 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2016-11-09 00:59:49 +0100 |
commit | e9862118272aa528e35e54ef9f1e35c217870fd7 (patch) | |
tree | 8dc89a1e94dfef635dab7ac98d423cda5247627a /drivers/clk/mediatek/clk-mtk.c | |
parent | clk: pxa mark dummy helper as 'inline' (diff) | |
download | linux-e9862118272aa528e35e54ef9f1e35c217870fd7.tar.xz linux-e9862118272aa528e35e54ef9f1e35c217870fd7.zip |
clk: mediatek: Add MT2701 clock support
Add MT2701 clock support, include topckgen, apmixedsys,
infracfg, pericfg and subsystem clocks.
Signed-off-by: Shunli Wang <shunli.wang@mediatek.com>
Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Signed-off-by: Erin Lo <erin.lo@mediatek.com>
Tested-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/mediatek/clk-mtk.c')
-rw-r--r-- | drivers/clk/mediatek/clk-mtk.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index bb30f7063569..0541df78141c 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -58,6 +58,9 @@ void mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, for (i = 0; i < num; i++) { const struct mtk_fixed_clk *rc = &clks[i]; + if (clk_data && !IS_ERR_OR_NULL(clk_data->clks[rc->id])) + continue; + clk = clk_register_fixed_rate(NULL, rc->name, rc->parent, 0, rc->rate); @@ -81,6 +84,9 @@ void mtk_clk_register_factors(const struct mtk_fixed_factor *clks, for (i = 0; i < num; i++) { const struct mtk_fixed_factor *ff = &clks[i]; + if (clk_data && !IS_ERR_OR_NULL(clk_data->clks[ff->id])) + continue; + clk = clk_register_fixed_factor(NULL, ff->name, ff->parent_name, CLK_SET_RATE_PARENT, ff->mult, ff->div); @@ -116,6 +122,9 @@ int mtk_clk_register_gates(struct device_node *node, for (i = 0; i < num; i++) { const struct mtk_gate *gate = &clks[i]; + if (!IS_ERR_OR_NULL(clk_data->clks[gate->id])) + continue; + clk = mtk_clk_register_gate(gate->name, gate->parent_name, regmap, gate->regs->set_ofs, @@ -232,6 +241,9 @@ void mtk_clk_register_composites(const struct mtk_composite *mcs, for (i = 0; i < num; i++) { const struct mtk_composite *mc = &mcs[i]; + if (clk_data && !IS_ERR_OR_NULL(clk_data->clks[mc->id])) + continue; + clk = mtk_clk_register_composite(mc, base, lock); if (IS_ERR(clk)) { @@ -244,3 +256,31 @@ void mtk_clk_register_composites(const struct mtk_composite *mcs, clk_data->clks[mc->id] = clk; } } + +void mtk_clk_register_dividers(const struct mtk_clk_divider *mcds, + int num, void __iomem *base, spinlock_t *lock, + struct clk_onecell_data *clk_data) +{ + struct clk *clk; + int i; + + for (i = 0; i < num; i++) { + const struct mtk_clk_divider *mcd = &mcds[i]; + + if (clk_data && !IS_ERR_OR_NULL(clk_data->clks[mcd->id])) + continue; + + clk = clk_register_divider(NULL, mcd->name, mcd->parent_name, + mcd->flags, base + mcd->div_reg, mcd->div_shift, + mcd->div_width, mcd->clk_divider_flags, lock); + + if (IS_ERR(clk)) { + pr_err("Failed to register clk %s: %ld\n", + mcd->name, PTR_ERR(clk)); + continue; + } + + if (clk_data) + clk_data->clks[mcd->id] = clk; + } +} |