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]> --- drivers/clk/mediatek/clk-mt8189.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt8189.c b/drivers/clk/mediatek/clk-mt8189.c index 562e55078a0..5600f9aae8d 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, -- 2.54.0

