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>
此提交包含在:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
新增問題並參考
封鎖使用者