Lines Matching full:bpmp

11 #include <soc/tegra/bpmp.h>
12 #include <soc/tegra/bpmp-abi.h>
31 struct tegra_bpmp *bpmp; member
59 static int tegra_bpmp_clk_transfer(struct tegra_bpmp *bpmp, in tegra_bpmp_clk_transfer() argument
86 err = tegra_bpmp_transfer(bpmp, &msg); in tegra_bpmp_clk_transfer()
104 return tegra_bpmp_clk_transfer(clk->bpmp, &msg); in tegra_bpmp_clk_prepare()
117 err = tegra_bpmp_clk_transfer(clk->bpmp, &msg); in tegra_bpmp_clk_unprepare()
119 dev_err(clk->bpmp->dev, "failed to disable clock %s: %d\n", in tegra_bpmp_clk_unprepare()
136 err = tegra_bpmp_clk_transfer(clk->bpmp, &msg); in tegra_bpmp_clk_is_prepared()
160 err = tegra_bpmp_clk_transfer(clk->bpmp, &msg); in tegra_bpmp_clk_recalc_rate()
190 err = tegra_bpmp_clk_transfer(clk->bpmp, &msg); in tegra_bpmp_clk_determine_rate()
218 err = tegra_bpmp_clk_transfer(clk->bpmp, &msg); in tegra_bpmp_clk_set_parent()
241 err = tegra_bpmp_clk_transfer(clk->bpmp, &msg); in tegra_bpmp_clk_get_parent()
243 dev_err(clk->bpmp->dev, "failed to get parent for %s: %d\n", in tegra_bpmp_clk_get_parent()
274 return tegra_bpmp_clk_transfer(clk->bpmp, &msg); in tegra_bpmp_clk_set_rate()
331 static int tegra_bpmp_clk_get_max_id(struct tegra_bpmp *bpmp) in tegra_bpmp_clk_get_max_id() argument
342 err = tegra_bpmp_clk_transfer(bpmp, &msg); in tegra_bpmp_clk_get_max_id()
352 static int tegra_bpmp_clk_get_info(struct tegra_bpmp *bpmp, unsigned int id, in tegra_bpmp_clk_get_info() argument
366 err = tegra_bpmp_clk_transfer(bpmp, &msg); in tegra_bpmp_clk_get_info()
381 static void tegra_bpmp_clk_info_dump(struct tegra_bpmp *bpmp, in tegra_bpmp_clk_info_dump() argument
413 dev_printk(level, bpmp->dev, "%03u: %s\n", info->id, info->name); in tegra_bpmp_clk_info_dump()
414 dev_printk(level, bpmp->dev, " flags: %lx %s\n", info->flags, flags); in tegra_bpmp_clk_info_dump()
415 dev_printk(level, bpmp->dev, " parents: %u\n", info->num_parents); in tegra_bpmp_clk_info_dump()
418 dev_printk(level, bpmp->dev, " %03u\n", info->parents[i]); in tegra_bpmp_clk_info_dump()
421 static int tegra_bpmp_probe_clocks(struct tegra_bpmp *bpmp, in tegra_bpmp_probe_clocks() argument
429 err = tegra_bpmp_clk_get_max_id(bpmp); in tegra_bpmp_probe_clocks()
435 dev_dbg(bpmp->dev, "maximum clock ID: %u\n", max_id); in tegra_bpmp_probe_clocks()
444 err = tegra_bpmp_clk_get_info(bpmp, id, info); in tegra_bpmp_probe_clocks()
449 dev_err(bpmp->dev, in tegra_bpmp_probe_clocks()
455 /* clock not exposed by BPMP */ in tegra_bpmp_probe_clocks()
465 tegra_bpmp_clk_info_dump(bpmp, KERN_DEBUG, info); in tegra_bpmp_probe_clocks()
468 dev_dbg(bpmp->dev, "holes: %u\n", holes); in tegra_bpmp_probe_clocks()
502 tegra_bpmp_clk_register(struct tegra_bpmp *bpmp, in tegra_bpmp_clk_register() argument
513 clk = devm_kzalloc(bpmp->dev, sizeof(*clk), GFP_KERNEL); in tegra_bpmp_clk_register()
518 clk->bpmp = bpmp; in tegra_bpmp_clk_register()
520 clk->parents = devm_kcalloc(bpmp->dev, info->num_parents, in tegra_bpmp_clk_register()
533 dev_WARN(bpmp->dev, in tegra_bpmp_clk_register()
573 dev_err(bpmp->dev, "no parent %u found for %u\n", in tegra_bpmp_clk_register()
583 err = devm_clk_hw_register(bpmp->dev, &clk->hw); in tegra_bpmp_clk_register()
593 static void tegra_bpmp_register_clocks_one(struct tegra_bpmp *bpmp, in tegra_bpmp_register_clocks_one() argument
602 if (bpmp->clocks[i]) { in tegra_bpmp_register_clocks_one()
613 tegra_bpmp_register_clocks_one(bpmp, infos, p_i, count); in tegra_bpmp_register_clocks_one()
616 clk = tegra_bpmp_clk_register(bpmp, info, infos, count); in tegra_bpmp_register_clocks_one()
618 dev_err(bpmp->dev, in tegra_bpmp_register_clocks_one()
622 * bpmp->clocks[i] to avoid re-attempting the in tegra_bpmp_register_clocks_one()
627 bpmp->clocks[i] = clk; in tegra_bpmp_register_clocks_one()
630 static int tegra_bpmp_register_clocks(struct tegra_bpmp *bpmp, in tegra_bpmp_register_clocks() argument
636 bpmp->num_clocks = count; in tegra_bpmp_register_clocks()
638 bpmp->clocks = devm_kcalloc(bpmp->dev, count, sizeof(struct tegra_bpmp_clk), GFP_KERNEL); in tegra_bpmp_register_clocks()
639 if (!bpmp->clocks) in tegra_bpmp_register_clocks()
643 tegra_bpmp_register_clocks_one(bpmp, infos, i, count); in tegra_bpmp_register_clocks()
649 static void tegra_bpmp_unregister_clocks(struct tegra_bpmp *bpmp) in tegra_bpmp_unregister_clocks() argument
653 for (i = 0; i < bpmp->num_clocks; i++) in tegra_bpmp_unregister_clocks()
654 clk_hw_unregister(&bpmp->clocks[i]->hw); in tegra_bpmp_unregister_clocks()
661 struct tegra_bpmp *bpmp = data; in tegra_bpmp_clk_of_xlate() local
663 for (i = 0; i < bpmp->num_clocks; i++) { in tegra_bpmp_clk_of_xlate()
664 struct tegra_bpmp_clk *clk = bpmp->clocks[i]; in tegra_bpmp_clk_of_xlate()
676 int tegra_bpmp_init_clocks(struct tegra_bpmp *bpmp) in tegra_bpmp_init_clocks() argument
682 err = tegra_bpmp_probe_clocks(bpmp, &clocks); in tegra_bpmp_init_clocks()
688 dev_dbg(bpmp->dev, "%u clocks probed\n", count); in tegra_bpmp_init_clocks()
690 err = tegra_bpmp_register_clocks(bpmp, clocks, count); in tegra_bpmp_init_clocks()
694 err = of_clk_add_hw_provider(bpmp->dev->of_node, in tegra_bpmp_init_clocks()
696 bpmp); in tegra_bpmp_init_clocks()
698 tegra_bpmp_unregister_clocks(bpmp); in tegra_bpmp_init_clocks()