]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
clk: mediaTek: mt8512: add clock tree type flags
authorDavid Lechner <dlechner@baylibre.com>
Fri, 10 Jul 2026 18:56:31 +0000 (13:56 -0500)
committerDavid Lechner <dlechner@baylibre.com>
Wed, 22 Jul 2026 17:01:17 +0000 (12:01 -0500)
Add clock tree type flags to the mt8512 clock tree structures. These
will be used later for parent lookup.

Clock trees had to be split now that each tree has a different type
flag.

Link: https://patch.msgid.link/20260710-mtk-clk-parent-lookup-improvements-v2-15-f3f3a4a28dca@baylibre.com
Signed-off-by: David Lechner <dlechner@baylibre.com>
drivers/clk/mediatek/clk-mt8512.c

index d6e58be8e22e4ef33f2293a8d7d559569d644d1c..2bfd8c4b1b9a87cd385dfaa4151e72f45b4d7f2f 100644 (file)
@@ -792,30 +792,42 @@ static const struct mtk_gate infra_clks[] = {
        GATE_INFRA5(CLK_INFRA_USB_XHCI, CLK_TOP_SSUSB_XHCI_SEL, 11),
 };
 
-static const struct mtk_clk_tree mt8512_clk_tree = {
+static const struct mtk_clk_tree mt8512_apmixed_clk_tree = {
        .pll_parent = EXT_PARENT(CLK_PAD_CLK26M),
+       .ext_clk_rates = ext_clock_rates,
+       .num_ext_clks = ARRAY_SIZE(ext_clock_rates),
+       .plls = apmixed_plls,
+       .num_plls = ARRAY_SIZE(apmixed_plls),
+       .type = MTK_CLK_TREE_APMIXED,
+};
+
+static const struct mtk_clk_tree mt8512_topckgen_clk_tree = {
        .ext_clk_rates = ext_clock_rates,
        .num_ext_clks = ARRAY_SIZE(ext_clock_rates),
        .fdivs_offs = CLK_TOP_SYSPLL1_D2,
        .muxes_offs = CLK_TOP_AXI_SEL,
-       .plls = apmixed_plls,
        .fclks = top_fixed_clks,
        .fdivs = top_fixed_divs,
        .muxes = top_muxes,
-       .num_plls = ARRAY_SIZE(apmixed_plls),
        .num_fclks = ARRAY_SIZE(top_fixed_clks),
        .num_fdivs = ARRAY_SIZE(top_fixed_divs),
        .num_muxes = ARRAY_SIZE(top_muxes),
+       .type = MTK_CLK_TREE_TOPCKGEN,
+};
+
+static const struct mtk_clk_tree mt8512_clk_tree = {
+       .ext_clk_rates = ext_clock_rates,
+       .num_ext_clks = ARRAY_SIZE(ext_clock_rates),
 };
 
 static int mt8512_apmixedsys_probe(struct udevice *dev)
 {
-       return mtk_common_clk_init(dev, &mt8512_clk_tree);
+       return mtk_common_clk_init(dev, &mt8512_apmixed_clk_tree);
 }
 
 static int mt8512_topckgen_probe(struct udevice *dev)
 {
-       return mtk_common_clk_init(dev, &mt8512_clk_tree);
+       return mtk_common_clk_init(dev, &mt8512_topckgen_clk_tree);
 }
 
 static int mt8512_topckgen_cg_probe(struct udevice *dev)
@@ -854,6 +866,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = {
        .name = "mt8512-apmixedsys",
        .id = UCLASS_CLK,
        .of_match = mt8512_apmixed_compat,
+       .bind = mtk_common_clk_parent_bind,
        .probe = mt8512_apmixedsys_probe,
        .priv_auto      = sizeof(struct mtk_clk_priv),
        .ops = &mtk_clk_apmixedsys_ops,
@@ -864,6 +877,7 @@ U_BOOT_DRIVER(mtk_clk_topckgen) = {
        .name = "mt8512-topckgen",
        .id = UCLASS_CLK,
        .of_match = mt8512_topckgen_compat,
+       .bind = mtk_common_clk_parent_bind,
        .probe = mt8512_topckgen_probe,
        .priv_auto      = sizeof(struct mtk_clk_priv),
        .ops = &mtk_clk_topckgen_ops,