summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Stephan <[email protected]>2026-07-15 16:28:47 +0200
committerDavid Lechner <[email protected]>2026-07-29 10:10:10 -0500
commita49f820faec56dadab60d5b2c141e6460831e388 (patch)
tree4e1e65b007d66c116ea989d3a474bafaf8dffb32
parent4b040cc0df1be6bc51617649d625a336bd41797d (diff)
clk: mediatek: mt8516: deduplicate clock gate drivers
Describe the topckgen clock gates directly in a struct mtk_clk_tree, reference the tree from the driver data and use the generic mtk_clk_topckgen_ops instead of the dedicated clock gate ops. This stops using mtk_common_clk_gate_init() and struct mtk_cg_priv, which are scheduled for removal. No functional change intended. Signed-off-by: Julien Stephan <[email protected]> Link: https://patch.msgid.link/20260715-b4-mtk-clk-cleanup-clock-gate-drivers-v2-19-23e907516010@baylibre.com Signed-off-by: David Lechner <[email protected]>
-rw-r--r--drivers/clk/mediatek/clk-mt8516.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/clk/mediatek/clk-mt8516.c b/drivers/clk/mediatek/clk-mt8516.c
index 9c510005b42..1ead3d3ffc5 100644
--- a/drivers/clk/mediatek/clk-mt8516.c
+++ b/drivers/clk/mediatek/clk-mt8516.c
@@ -770,6 +770,8 @@ static const struct mtk_clk_tree mt8516_topckgen_clk_tree = {
static const struct mtk_clk_tree mt8516_clk_tree = {
.ext_clk_rates = ext_clock_rates,
.num_ext_clks = ARRAY_SIZE(ext_clock_rates),
+ .gates = top_clks,
+ .num_gates = ARRAY_SIZE(top_clks),
};
static int mt8516_apmixedsys_probe(struct udevice *dev)
@@ -782,10 +784,11 @@ static int mt8516_topckgen_probe(struct udevice *dev)
return mtk_common_clk_init(dev, &mt8516_topckgen_clk_tree);
}
-static int mt8516_topckgen_cg_probe(struct udevice *dev)
+static int mt8516_clk_probe(struct udevice *dev)
{
- return mtk_common_clk_gate_init(dev, &mt8516_clk_tree, top_clks,
- ARRAY_SIZE(top_clks), 0);
+ const struct mtk_clk_tree *tree = (void *)dev_get_driver_data(dev);
+
+ return mtk_common_clk_init(dev, tree);
}
static const struct udevice_id mt8516_apmixed_compat[] = {
@@ -799,7 +802,10 @@ static const struct udevice_id mt8516_topckgen_compat[] = {
};
static const struct udevice_id mt8516_topckgen_cg_compat[] = {
- { .compatible = "mediatek,mt8516-topckgen-cg", },
+ {
+ .compatible = "mediatek,mt8516-topckgen-cg",
+ .data = (ulong)&mt8516_clk_tree,
+ },
{ }
};
@@ -829,8 +835,8 @@ U_BOOT_DRIVER(mt8516_clk_topckgen_cg) = {
.name = "mt8516-topckgen-cg",
.id = UCLASS_CLK,
.of_match = mt8516_topckgen_cg_compat,
- .probe = mt8516_topckgen_cg_probe,
- .priv_auto = sizeof(struct mtk_cg_priv),
- .ops = &mtk_clk_gate_ops,
+ .probe = mt8516_clk_probe,
+ .priv_auto = sizeof(struct mtk_clk_priv),
+ .ops = &mtk_clk_topckgen_ops,
.flags = DM_FLAG_PRE_RELOC,
};