Pass each controller's struct mtk_clk_tree through the driver data and use the generic probe function for all the MT7629 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. The apmixedsys probe still performs its SoC specific register tweaks. No functional change intended. Signed-off-by: Julien Stephan <[email protected]> --- drivers/clk/mediatek/clk-mt7629.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt7629.c b/drivers/clk/mediatek/clk-mt7629.c index 2edf085970f..4bacabc8556 100644 --- a/drivers/clk/mediatek/clk-mt7629.c +++ b/drivers/clk/mediatek/clk-mt7629.c @@ -654,9 +654,10 @@ static int mt7629_mcucfg_probe(struct udevice *dev) static int mt7629_apmixedsys_probe(struct udevice *dev) { struct mtk_clk_priv *priv = dev_get_priv(dev); + const struct mtk_clk_tree *tree = (void *)dev_get_driver_data(dev); int ret; - ret = mtk_common_clk_init(dev, &mt7629_apmixed_clk_tree); + ret = mtk_common_clk_init(dev, tree); if (ret) return ret; @@ -668,11 +669,6 @@ static int mt7629_apmixedsys_probe(struct udevice *dev) return 0; } -static int mt7629_topckgen_probe(struct udevice *dev) -{ - return mtk_common_clk_init(dev, &mt7629_topckgen_clk_tree); -} - static int mt7629_clk_probe(struct udevice *dev) { const struct mtk_clk_tree *tree = (void *)dev_get_driver_data(dev); @@ -694,12 +690,18 @@ static int mt7629_ethsys_bind(struct udevice *dev) } static const struct udevice_id mt7629_apmixed_compat[] = { - { .compatible = "mediatek,mt7629-apmixedsys" }, + { + .compatible = "mediatek,mt7629-apmixedsys", + .data = (ulong)&mt7629_apmixed_clk_tree + }, { } }; static const struct udevice_id mt7629_topckgen_compat[] = { - { .compatible = "mediatek,mt7629-topckgen" }, + { + .compatible = "mediatek,mt7629-topckgen", + .data = (ulong)&mt7629_topckgen_clk_tree + }, { } }; @@ -764,7 +766,7 @@ U_BOOT_DRIVER(mt7629_clk_topckgen) = { .id = UCLASS_CLK, .of_match = mt7629_topckgen_compat, .bind = mtk_common_clk_parent_bind, - .probe = mt7629_topckgen_probe, + .probe = mt7629_clk_probe, .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_topckgen_ops, .flags = DM_FLAG_PRE_RELOC, -- 2.54.0

