summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Stephan <[email protected]>2026-07-15 16:28:58 +0200
committerDavid Lechner <[email protected]>2026-07-29 10:25:19 -0500
commit0f9a65d7b0a72febff33e31da3a6975dd03faa44 (patch)
tree53da1aaf48d83a0a4e51127ac33d1d8a620d6f12
parent6d0ba2669994e0a3efa35f444bd93506a9736477 (diff)
clk: mediatek: mt8189: 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 MT8189 clock drivers, instead of a dedicated probe per controller. The apmixedsys, topckgen and vlpckgen 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, like the clock gate controllers. 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-30-23e907516010@baylibre.com Signed-off-by: David Lechner <[email protected]>
-rw-r--r--drivers/clk/mediatek/clk-mt8189.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/drivers/clk/mediatek/clk-mt8189.c b/drivers/clk/mediatek/clk-mt8189.c
index 883b92f57aa..6aa0235f7fe 100644
--- a/drivers/clk/mediatek/clk-mt8189.c
+++ b/drivers/clk/mediatek/clk-mt8189.c
@@ -1971,17 +1971,26 @@ static const struct mtk_clk_tree mt8189_vlpckgen_clk_tree = {
};
static const struct udevice_id mt8189_apmixed[] = {
- { .compatible = "mediatek,mt8189-apmixedsys", },
+ {
+ .compatible = "mediatek,mt8189-apmixedsys",
+ .data = (ulong)&mt8189_apmixedsys_clk_tree,
+ },
{ }
};
static const struct udevice_id mt8189_topckgen_compat[] = {
- { .compatible = "mediatek,mt8189-topckgen", },
+ {
+ .compatible = "mediatek,mt8189-topckgen",
+ .data = (ulong)&mt8189_topckgen_clk_tree,
+ },
{ }
};
static const struct udevice_id mt8189_vlpckgen[] = {
- { .compatible = "mediatek,mt8189-vlpckgen", },
+ {
+ .compatible = "mediatek,mt8189-vlpckgen",
+ .data = (ulong)&mt8189_vlpckgen_clk_tree,
+ },
{ }
};
@@ -2013,21 +2022,6 @@ static const struct udevice_id of_match_mt8189_clk_gate[] = {
{ }
};
-static int mt8189_apmixedsys_probe(struct udevice *dev)
-{
- return mtk_common_clk_init(dev, &mt8189_apmixedsys_clk_tree);
-}
-
-static int mt8189_topckgen_probe(struct udevice *dev)
-{
- return mtk_common_clk_init(dev, &mt8189_topckgen_clk_tree);
-}
-
-static int mt8189_infrasys_probe(struct udevice *dev)
-{
- return mtk_common_clk_init(dev, &mt8189_vlpckgen_clk_tree);
-}
-
static int mt8189_clk_probe(struct udevice *dev)
{
const struct mtk_clk_tree *tree = (void *)dev_get_driver_data(dev);
@@ -2040,7 +2034,7 @@ U_BOOT_DRIVER(mt8189_clk_apmixedsys) = {
.id = UCLASS_CLK,
.of_match = mt8189_apmixed,
.bind = mtk_common_clk_parent_bind,
- .probe = mt8189_apmixedsys_probe,
+ .probe = mt8189_clk_probe,
.priv_auto = sizeof(struct mtk_clk_priv),
.ops = &mtk_clk_apmixedsys_ops,
.flags = DM_FLAG_PRE_RELOC,
@@ -2051,7 +2045,7 @@ U_BOOT_DRIVER(mt8189_clk_topckgen) = {
.id = UCLASS_CLK,
.of_match = mt8189_topckgen_compat,
.bind = mtk_common_clk_parent_bind,
- .probe = mt8189_topckgen_probe,
+ .probe = mt8189_clk_probe,
.priv_auto = sizeof(struct mtk_clk_priv),
.ops = &mtk_clk_topckgen_ops,
.flags = DM_FLAG_PRE_RELOC,
@@ -2062,7 +2056,7 @@ U_BOOT_DRIVER(mt8189_clk_vlpckgen) = {
.id = UCLASS_CLK,
.of_match = mt8189_vlpckgen,
.bind = mtk_common_clk_parent_bind,
- .probe = mt8189_infrasys_probe,
+ .probe = mt8189_clk_probe,
.priv_auto = sizeof(struct mtk_clk_priv),
.ops = &mtk_clk_infrasys_ops,
.flags = DM_FLAG_PRE_RELOC,