summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Stephan <[email protected]>2026-07-15 16:28:50 +0200
committerDavid Lechner <[email protected]>2026-07-29 10:10:10 -0500
commitc58d6877c11a1e179ef4babf6a52510980042ea0 (patch)
tree85fb352d38d4cecc5a7921cb83ac925e56d8278a
parentedb0ff28dc3c6e04f11f27104cb1a5cc434d27fb (diff)
clk: mediatek: mt8518: use driver data to store the clock tree
Pass each controller's struct mtk_clk_tree through the driver data and use the generic probe function for all the MT8518 clock drivers, instead of a dedicated probe per controller. The apmixedsys and topckgen controllers keep their own U_BOOT_DRIVER since they rely on dedicated ops and on the parent bind() callback, but they now get their tree from the compatible data. 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-22-23e907516010@baylibre.com Signed-off-by: David Lechner <[email protected]>
-rw-r--r--drivers/clk/mediatek/clk-mt8518.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/clk/mediatek/clk-mt8518.c b/drivers/clk/mediatek/clk-mt8518.c
index 273ab03df46..95e66b97fbd 100644
--- a/drivers/clk/mediatek/clk-mt8518.c
+++ b/drivers/clk/mediatek/clk-mt8518.c
@@ -1530,16 +1530,6 @@ static const struct mtk_clk_tree mt8518_clk_tree = {
.num_gates = ARRAY_SIZE(top_clks),
};
-static int mt8518_apmixedsys_probe(struct udevice *dev)
-{
- return mtk_common_clk_init(dev, &mt8518_apmixed_clk_tree);
-}
-
-static int mt8518_topckgen_probe(struct udevice *dev)
-{
- return mtk_common_clk_init(dev, &mt8518_topckgen_clk_tree);
-}
-
static int mt8518_clk_probe(struct udevice *dev)
{
const struct mtk_clk_tree *tree = (void *)dev_get_driver_data(dev);
@@ -1548,12 +1538,18 @@ static int mt8518_clk_probe(struct udevice *dev)
}
static const struct udevice_id mt8518_apmixed_compat[] = {
- { .compatible = "mediatek,mt8518-apmixedsys", },
+ {
+ .compatible = "mediatek,mt8518-apmixedsys",
+ .data = (ulong)&mt8518_apmixed_clk_tree,
+ },
{ }
};
static const struct udevice_id mt8518_topckgen_compat[] = {
- { .compatible = "mediatek,mt8518-topckgen", },
+ {
+ .compatible = "mediatek,mt8518-topckgen",
+ .data = (ulong)&mt8518_topckgen_clk_tree,
+ },
{ }
};
@@ -1570,7 +1566,7 @@ U_BOOT_DRIVER(mt8518_clk_apmixedsys) = {
.id = UCLASS_CLK,
.of_match = mt8518_apmixed_compat,
.bind = mtk_common_clk_parent_bind,
- .probe = mt8518_apmixedsys_probe,
+ .probe = mt8518_clk_probe,
.priv_auto = sizeof(struct mtk_clk_priv),
.ops = &mtk_clk_apmixedsys_ops,
.flags = DM_FLAG_PRE_RELOC,
@@ -1581,7 +1577,7 @@ U_BOOT_DRIVER(mt8518_clk_topckgen) = {
.id = UCLASS_CLK,
.of_match = mt8518_topckgen_compat,
.bind = mtk_common_clk_parent_bind,
- .probe = mt8518_topckgen_probe,
+ .probe = mt8518_clk_probe,
.priv_auto = sizeof(struct mtk_clk_priv),
.ops = &mtk_clk_topckgen_ops,
.flags = DM_FLAG_PRE_RELOC,