rd = kcalloc(nr_rdump, sizeof(*rd), GFP_KERNEL); if (!rd) return NULL;
for (i = 0; i < nr_rdump; ++i)
rd[i].offset = rdump[i];
return rd;
}
/** * samsung_clk_init() - Create and initialize a clock provider object * @dev: CMU device to enable runtime PM, or NULL if RPM is not needed * @base: Start address (mapped) of CMU registers * @nr_clks: Total clock count to allocate in clock provider object * * Setup the essentials required to support clock lookup using Common Clock * Framework. * * Return: Allocated and initialized clock provider object.
*/ struct samsung_clk_provider * __init samsung_clk_init(struct device *dev, void __iomem *base, unsignedlong nr_clks)
{ struct samsung_clk_provider *ctx; int i;
ctx = kzalloc(struct_size(ctx, clk_data.hws, nr_clks), GFP_KERNEL); if (!ctx)
panic("could not allocate clock provider context.\n");
ctx->clk_data.num = nr_clks; for (i = 0; i < nr_clks; ++i)
ctx->clk_data.hws[i] = ERR_PTR(-ENOENT);
void __init samsung_clk_of_add_provider(struct device_node *np, struct samsung_clk_provider *ctx)
{ if (np) { if (of_clk_add_hw_provider(np, of_clk_hw_onecell_get,
&ctx->clk_data))
panic("could not register clk provider\n");
}
}
/* add a clock instance to the clock lookup table used for dt based lookup */ void samsung_clk_add_lookup(struct samsung_clk_provider *ctx, struct clk_hw *clk_hw, unsignedint id)
{ if (id)
ctx->clk_data.hws[id] = clk_hw;
}
/* register a list of aliases */ void __init samsung_clk_register_alias(struct samsung_clk_provider *ctx, conststruct samsung_clock_alias *list, unsignedint nr_clk)
{ struct clk_hw *clk_hw; unsignedint idx, ret;
for (idx = 0; idx < nr_clk; idx++, list++) { if (!list->id) {
pr_err("%s: clock id missing for index %d\n", __func__,
idx); continue;
}
clk_hw = ctx->clk_data.hws[list->id]; if (!clk_hw) {
pr_err("%s: failed to find clock %d\n", __func__,
list->id); continue;
}
ret = clk_hw_register_clkdev(clk_hw, list->alias,
list->dev_name); if (ret)
pr_err("%s: failed to register lookup %s\n",
__func__, list->alias);
}
}
/* register a list of fixed clocks */ void __init samsung_clk_register_fixed_rate(struct samsung_clk_provider *ctx, conststruct samsung_fixed_rate_clock *list, unsignedint nr_clk)
{ struct clk_hw *clk_hw; unsignedint idx;
for (idx = 0; idx < nr_clk; idx++, list++) {
clk_hw = clk_hw_register_fixed_rate(ctx->dev, list->name,
list->parent_name, list->flags, list->fixed_rate); if (IS_ERR(clk_hw)) {
pr_err("%s: failed to register clock %s\n", __func__,
list->name); continue;
}
/** * samsung_cmu_register_clocks() - Register all clocks provided in CMU object * @ctx: Clock provider object * @cmu: CMU object with clocks to register
*/ void __init samsung_cmu_register_clocks(struct samsung_clk_provider *ctx, conststruct samsung_cmu_info *cmu)
{ if (cmu->pll_clks)
samsung_clk_register_pll(ctx, cmu->pll_clks, cmu->nr_pll_clks); if (cmu->mux_clks)
samsung_clk_register_mux(ctx, cmu->mux_clks, cmu->nr_mux_clks); if (cmu->div_clks)
samsung_clk_register_div(ctx, cmu->div_clks, cmu->nr_div_clks); if (cmu->gate_clks)
samsung_clk_register_gate(ctx, cmu->gate_clks,
cmu->nr_gate_clks); if (cmu->fixed_clks)
samsung_clk_register_fixed_rate(ctx, cmu->fixed_clks,
cmu->nr_fixed_clks); if (cmu->fixed_factor_clks)
samsung_clk_register_fixed_factor(ctx, cmu->fixed_factor_clks,
cmu->nr_fixed_factor_clks); if (cmu->cpu_clks)
samsung_clk_register_cpu(ctx, cmu->cpu_clks, cmu->nr_cpu_clks);
}
/* * Common function which registers plls, muxes, dividers and gates * for each CMU. It also add CMU register list to register cache.
*/ struct samsung_clk_provider * __init samsung_cmu_register_one( struct device_node *np, conststruct samsung_cmu_info *cmu)
{ void __iomem *reg_base; struct samsung_clk_provider *ctx;
reg_base = of_iomap(np, 0); if (!reg_base) {
panic("%s: failed to map registers\n", __func__); return NULL;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.