summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Stephan <[email protected]>2026-07-15 16:28:53 +0200
committerDavid Lechner <[email protected]>2026-07-29 10:10:10 -0500
commit8ee35039efae8ee9e1f9645d16c0211473920a0f (patch)
tree8e6a15d854ae02469e36a8e94f1754e662a4b96b
parent05d109e09b0ba00bf1e2023a108288b20b724f73 (diff)
clk: mediatek: mt8365: deduplicate clock gate drivers
Describe the infracfg 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-25-23e907516010@baylibre.com Signed-off-by: David Lechner <[email protected]>
-rw-r--r--drivers/clk/mediatek/clk-mt8365.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/clk/mediatek/clk-mt8365.c b/drivers/clk/mediatek/clk-mt8365.c
index bb00d6154e1..1a0d1149496 100644
--- a/drivers/clk/mediatek/clk-mt8365.c
+++ b/drivers/clk/mediatek/clk-mt8365.c
@@ -757,6 +757,8 @@ static const struct mtk_gate ifr_clks[] = {
static const struct mtk_clk_tree mt8365_infracfg_tree = {
.ext_clk_rates = ext_clock_rates,
.num_ext_clks = ARRAY_SIZE(ext_clock_rates),
+ .gates = ifr_clks,
+ .num_gates = ARRAY_SIZE(ifr_clks),
};
static int mt8365_apmixedsys_probe(struct udevice *dev)
@@ -769,10 +771,11 @@ static int mt8365_topckgen_probe(struct udevice *dev)
return mtk_common_clk_init(dev, &mt8365_topckgen_tree);
}
-static int mt8365_infracfg_probe(struct udevice *dev)
+static int mt8365_clk_probe(struct udevice *dev)
{
- return mtk_common_clk_gate_init(dev, &mt8365_infracfg_tree, ifr_clks,
- ARRAY_SIZE(ifr_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 mt8365_apmixed_compat[] = {
@@ -786,7 +789,10 @@ static const struct udevice_id mt8365_topckgen_compat[] = {
};
static const struct udevice_id mt8365_infracfg_compat[] = {
- { .compatible = "mediatek,mt8365-infracfg", },
+ {
+ .compatible = "mediatek,mt8365-infracfg",
+ .data = (ulong)&mt8365_infracfg_tree,
+ },
{ }
};
@@ -816,8 +822,8 @@ U_BOOT_DRIVER(mt8365_clk_infracfg) = {
.name = "mt8365-infracfg",
.id = UCLASS_CLK,
.of_match = mt8365_infracfg_compat,
- .probe = mt8365_infracfg_probe,
- .priv_auto = sizeof(struct mtk_cg_priv),
- .ops = &mtk_clk_gate_ops,
+ .probe = mt8365_clk_probe,
+ .priv_auto = sizeof(struct mtk_clk_priv),
+ .ops = &mtk_clk_topckgen_ops,
.flags = DM_FLAG_PRE_RELOC,
};