]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
clk: mediatek: add separate gates_offs for cg gates
authorDavid Lechner <dlechner@baylibre.com>
Wed, 7 Jan 2026 16:21:09 +0000 (10:21 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 12 Jan 2026 19:35:03 +0000 (13:35 -0600)
Add a gates_offs field to struct mtk_cg_priv and use that instead of
struct mtk_clk_tree.gates_offs.

Prior to this change, struct mtk_clk_tree.gates_offs could be the offset
of struct mtk_clk_tree.gates or struct mtk_cg_priv.gates depending on
the context. This was confusing and error-prone. For example, in mt8365
there is one set of gates that needs an offset and one that does not
that share the same struct mtk_clk_tree. This is fixed in this patch by
giving the correct offset for each gate separately.

Signed-off-by: David Lechner <dlechner@baylibre.com>
15 files changed:
drivers/clk/mediatek/clk-mt7622.c
drivers/clk/mediatek/clk-mt7623.c
drivers/clk/mediatek/clk-mt7629.c
drivers/clk/mediatek/clk-mt7981.c
drivers/clk/mediatek/clk-mt7986.c
drivers/clk/mediatek/clk-mt7987.c
drivers/clk/mediatek/clk-mt7988.c
drivers/clk/mediatek/clk-mt8183.c
drivers/clk/mediatek/clk-mt8188.c
drivers/clk/mediatek/clk-mt8365.c
drivers/clk/mediatek/clk-mt8512.c
drivers/clk/mediatek/clk-mt8516.c
drivers/clk/mediatek/clk-mt8518.c
drivers/clk/mediatek/clk-mtk.c
drivers/clk/mediatek/clk-mtk.h

index 16c6f024e72c595cec10a22c76487142274ad5a9..9621d5efe11a510e89e3426c35cc14c7279ffd52 100644 (file)
@@ -693,7 +693,7 @@ static int mt7622_pericfg_probe(struct udevice *dev)
 static int mt7622_pciesys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, pcie_cgs,
-                                       ARRAY_SIZE(pcie_cgs));
+                                       ARRAY_SIZE(pcie_cgs), 0);
 }
 
 static int mt7622_pciesys_bind(struct udevice *dev)
@@ -712,7 +712,7 @@ static int mt7622_pciesys_bind(struct udevice *dev)
 static int mt7622_ethsys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, eth_cgs,
-                                       ARRAY_SIZE(eth_cgs));
+                                       ARRAY_SIZE(eth_cgs), 0);
 }
 
 static int mt7622_ethsys_bind(struct udevice *dev)
@@ -731,13 +731,13 @@ static int mt7622_ethsys_bind(struct udevice *dev)
 static int mt7622_sgmiisys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, sgmii_cgs,
-                                       ARRAY_SIZE(sgmii_cgs));
+                                       ARRAY_SIZE(sgmii_cgs), 0);
 }
 
 static int mt7622_ssusbsys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, ssusb_cgs,
-                                       ARRAY_SIZE(ssusb_cgs));
+                                       ARRAY_SIZE(ssusb_cgs), 0);
 }
 
 static const struct udevice_id mt7622_apmixed_compat[] = {
index 6ce1d7297368f695ba847a19df693226ba9d7492..3509ea67e7dd4999d760057db80fc4f4e4a7d193 100644 (file)
@@ -1055,15 +1055,13 @@ static int mt7623_topckgen_probe(struct udevice *dev)
 }
 
 static const struct mtk_clk_tree mt7623_clk_gate_tree = {
-       /* Each CLK ID for gates clock starts at index 1 */
-       .gates_offs = 1,
        .xtal_rate = 26 * MHZ,
 };
 
 static int mt7623_infracfg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7623_clk_gate_tree, infra_cgs,
-                                       ARRAY_SIZE(infra_cgs));
+                                       ARRAY_SIZE(infra_cgs), 1);
 }
 
 static const struct mtk_clk_tree mt7623_clk_peri_tree = {
@@ -1086,13 +1084,13 @@ static int mt7623_pericfg_probe(struct udevice *dev)
 static int mt7623_hifsys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7623_clk_gate_tree, hif_cgs,
-                                       ARRAY_SIZE(hif_cgs));
+                                       ARRAY_SIZE(hif_cgs), 1);
 }
 
 static int mt7623_ethsys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7623_clk_gate_tree, eth_cgs,
-                                       ARRAY_SIZE(eth_cgs));
+                                       ARRAY_SIZE(eth_cgs), 1);
 }
 
 static int mt7623_ethsys_hifsys_bind(struct udevice *dev)
index e4132f6195f9835230a49ec650d6433ea914dac4..5bbac309e9d13bfede7b0d0ad0c53ff166f42e10 100644 (file)
@@ -581,7 +581,6 @@ static const struct mtk_clk_tree mt7629_clk_tree = {
 static const struct mtk_clk_tree mt7629_peri_clk_tree = {
        .xtal_rate = 40 * MHZ,
        .xtal2_rate = 20 * MHZ,
-       .gates_offs = CLK_PERI_PWM1_PD,
        .fdivs_offs = CLK_TOP_TO_USB3_SYS,
        .muxes_offs = CLK_TOP_AXI_SEL,
        .plls = apmixed_plls,
@@ -635,19 +634,19 @@ static int mt7629_topckgen_probe(struct udevice *dev)
 static int mt7629_infracfg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, infra_cgs,
-                                       ARRAY_SIZE(infra_cgs));
+                                       ARRAY_SIZE(infra_cgs), 0);
 }
 
 static int mt7629_pericfg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7629_peri_clk_tree, peri_cgs,
-                                       ARRAY_SIZE(peri_cgs));
+                                       ARRAY_SIZE(peri_cgs), CLK_PERI_PWM1_PD);
 }
 
 static int mt7629_ethsys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, eth_cgs,
-                                       ARRAY_SIZE(eth_cgs));
+                                       ARRAY_SIZE(eth_cgs), 0);
 }
 
 static int mt7629_ethsys_bind(struct udevice *dev)
@@ -666,13 +665,13 @@ static int mt7629_ethsys_bind(struct udevice *dev)
 static int mt7629_sgmiisys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, sgmii_cgs,
-                                       ARRAY_SIZE(sgmii_cgs));
+                                       ARRAY_SIZE(sgmii_cgs), 0);
 }
 
 static int mt7629_ssusbsys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, ssusb_cgs,
-                                       ARRAY_SIZE(ssusb_cgs));
+                                       ARRAY_SIZE(ssusb_cgs), 0);
 }
 
 static const struct udevice_id mt7629_apmixed_compat[] = {
index c8090688df0c3b73c9c9ad12faddea84fcd689b9..3f96d25db047d15fd315fbb56dfac2a2b1e8f38e 100644 (file)
@@ -631,7 +631,7 @@ static const struct mtk_gate sgmii0_cgs[] = {
 static int mt7981_sgmii0sys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7981_topckgen_clk_tree,
-                                       sgmii0_cgs, ARRAY_SIZE(sgmii0_cgs));
+                                       sgmii0_cgs, ARRAY_SIZE(sgmii0_cgs), 0);
 }
 
 static const struct udevice_id mt7981_sgmii0sys_compat[] = {
@@ -658,7 +658,7 @@ static const struct mtk_gate sgmii1_cgs[] = {
 static int mt7981_sgmii1sys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7981_topckgen_clk_tree,
-                                       sgmii1_cgs, ARRAY_SIZE(sgmii1_cgs));
+                                       sgmii1_cgs, ARRAY_SIZE(sgmii1_cgs), 0);
 }
 
 static const struct udevice_id mt7981_sgmii1sys_compat[] = {
@@ -699,7 +699,7 @@ static const struct mtk_gate eth_cgs[] = {
 static int mt7981_ethsys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7981_topckgen_clk_tree,
-                                       eth_cgs, ARRAY_SIZE(eth_cgs));
+                                       eth_cgs, ARRAY_SIZE(eth_cgs), 0);
 }
 
 static int mt7981_ethsys_bind(struct udevice *dev)
index 735e824c874a2825462aaab05d54707b5fb5daa8..a8f39a3beb6ca677c1578055ab137e3de52ac53a 100644 (file)
@@ -637,7 +637,7 @@ static const struct mtk_gate eth_cgs[] = {
 static int mt7986_ethsys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7986_topckgen_clk_tree, eth_cgs,
-                                       ARRAY_SIZE(eth_cgs));
+                                       ARRAY_SIZE(eth_cgs), 0);
 }
 
 static int mt7986_ethsys_bind(struct udevice *dev)
index 99ff57c5dc52c028878102a03b39b77d9698d5d2..818f45ef6bbfd5fb8b39a3fb9c26922ce5ae54e8 100644 (file)
@@ -819,7 +819,7 @@ static const struct mtk_gate eth_cgs[] = {
 static int mt7987_ethsys_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7987_topckgen_clk_tree, eth_cgs,
-                                       ARRAY_SIZE(eth_cgs));
+                                       ARRAY_SIZE(eth_cgs), 0);
 }
 
 static int mt7987_ethsys_bind(struct udevice *dev)
index da1d2e89d61b3f9f2a250806dbf2f9af0503cd2f..6da7c62c585cb0c8e011d7698322bb41527e531e 100644 (file)
@@ -893,7 +893,7 @@ static int mt7988_ethdma_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7988_topckgen_clk_tree,
                                        ethdma_mtk_gate,
-                                       ARRAY_SIZE(ethdma_mtk_gate));
+                                       ARRAY_SIZE(ethdma_mtk_gate), 0);
 }
 
 static int mt7988_ethdma_bind(struct udevice *dev)
@@ -952,7 +952,7 @@ static int mt7988_sgmiisys_0_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7988_topckgen_clk_tree,
                                        sgmiisys_0_mtk_gate,
-                                       ARRAY_SIZE(sgmiisys_0_mtk_gate));
+                                       ARRAY_SIZE(sgmiisys_0_mtk_gate), 0);
 }
 
 static const struct udevice_id mt7988_sgmiisys_0_compat[] = {
@@ -997,7 +997,7 @@ static int mt7988_sgmiisys_1_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7988_topckgen_clk_tree,
                                        sgmiisys_1_mtk_gate,
-                                       ARRAY_SIZE(sgmiisys_1_mtk_gate));
+                                       ARRAY_SIZE(sgmiisys_1_mtk_gate), 0);
 }
 
 static const struct udevice_id mt7988_sgmiisys_1_compat[] = {
@@ -1044,7 +1044,7 @@ static int mt7988_ethwarp_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt7988_topckgen_clk_tree,
                                        ethwarp_mtk_gate,
-                                       ARRAY_SIZE(ethwarp_mtk_gate));
+                                       ARRAY_SIZE(ethwarp_mtk_gate), 0);
 }
 
 static int mt7988_ethwarp_bind(struct udevice *dev)
index 5b41cf4b88c34a706205390de22c6e5951d0e337..5a353e82f3f5a50e3ccf90348571100bc015a5af 100644 (file)
@@ -778,7 +778,7 @@ static int mt8183_topckgen_probe(struct udevice *dev)
 static int mt8183_infracfg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8183_clk_tree, infra_clks,
-                                       ARRAY_SIZE(infra_clks));
+                                       ARRAY_SIZE(infra_clks), 0);
 }
 
 static const struct udevice_id mt8183_apmixed_compat[] = {
index a4cbb3213e376392689e6f163b83fa73cfdc170e..d967a915fac6f5d6a8d6fb7aec859ea3a04e5c5d 100644 (file)
@@ -1535,7 +1535,6 @@ static const struct mtk_gate infracfg_ao_clks[] = {
 static const struct mtk_clk_tree mt8188_infracfg_ao_clk_tree = {
        .xtal_rate = 26 * MHZ,
        .xtal2_rate = 26 * MHZ,
-       .gates_offs = 0, /* CLK_INFRA_AO_PMIC_TMR */
 };
 
 static const struct mtk_gate_regs peri_ao_cg_regs = {
@@ -1570,7 +1569,6 @@ static const struct mtk_gate pericfg_ao_clks[] = {
 static const struct mtk_clk_tree mt8188_pericfg_ao_clk_tree = {
        .xtal_rate = 26 * MHZ,
        .xtal2_rate = 26 * MHZ,
-       .gates_offs = 0, /* CLK_PERI_AO_ETHERNET */
 };
 
 static const struct mtk_gate_regs top0_cg_regs = {
@@ -1629,7 +1627,6 @@ static const struct mtk_gate topckgen_cg_clks[] = {
 static const struct mtk_clk_tree mt8188_topckgen_cg_clk_tree = {
        .xtal_rate = 26 * MHZ,
        .xtal2_rate = 26 * MHZ,
-       .gates_offs = 185, /* CLK_TOP_CFGREG_CLOCK_EN_VPP0 */
 };
 
 static const struct mtk_gate_regs imp_iic_wrap_cg_regs = {
@@ -1665,22 +1662,16 @@ static const struct mtk_gate imp_iic_wrap_en_clks[] = {
 const struct mtk_clk_tree mt8188_imp_iic_wrap_c_clk_tree = {
        .xtal_rate = 26 * MHZ,
        .xtal2_rate = 26 * MHZ,
-       /* CLK_IMP_IIC_WRAP_C_AP_CLOCK_I2C0 */
-       .gates_offs = 0,
 };
 
 const struct mtk_clk_tree mt8188_imp_iic_wrap_w_clk_tree = {
        .xtal_rate = 26 * MHZ,
        .xtal2_rate = 26 * MHZ,
-       /* CLK_IMP_IIC_WRAP_C_AP_CLOCK_I2C1 */
-       .gates_offs = 0,
 };
 
 const struct mtk_clk_tree mt8188_imp_iic_wrap_en_clk_tree = {
        .xtal_rate = 26 * MHZ,
        .xtal2_rate = 26 * MHZ,
-       /* imp_iic_wrap_en: CLK_IMP_IIC_WRAP_EN_AP_CLOCK_I2C5 */
-       .gates_offs = 0,
 };
 
 static int mt8188_apmixedsys_probe(struct udevice *dev)
@@ -1697,42 +1688,43 @@ static int mt8188_topckgen_cg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8188_topckgen_cg_clk_tree,
                                        topckgen_cg_clks,
-                                       ARRAY_SIZE(topckgen_cg_clks));
+                                       ARRAY_SIZE(topckgen_cg_clks),
+                                       CLK_TOP_CFGREG_CLOCK_EN_VPP0);
 }
 
 static int mt8188_infracfg_ao_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8188_infracfg_ao_clk_tree,
                                        infracfg_ao_clks,
-                                       ARRAY_SIZE(infracfg_ao_clks));
+                                       ARRAY_SIZE(infracfg_ao_clks), 0);
 }
 
 static int mt8188_pericfg_ao_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8188_pericfg_ao_clk_tree,
                                        pericfg_ao_clks,
-                                       ARRAY_SIZE(pericfg_ao_clks));
+                                       ARRAY_SIZE(pericfg_ao_clks), 0);
 }
 
 static int mt8188_imp_iic_wrap_c_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8188_imp_iic_wrap_c_clk_tree,
                                        imp_iic_wrap_c_clks,
-                                       ARRAY_SIZE(imp_iic_wrap_c_clks));
+                                       ARRAY_SIZE(imp_iic_wrap_c_clks), 0);
 }
 
 static int mt8188_imp_iic_wrap_w_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8188_imp_iic_wrap_w_clk_tree,
                                        imp_iic_wrap_w_clks,
-                                       ARRAY_SIZE(imp_iic_wrap_w_clks));
+                                       ARRAY_SIZE(imp_iic_wrap_w_clks), 0);
 }
 
 static int mt8188_imp_iic_wrap_en_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8188_imp_iic_wrap_en_clk_tree,
                                        imp_iic_wrap_en_clks,
-                                       ARRAY_SIZE(imp_iic_wrap_en_clks));
+                                       ARRAY_SIZE(imp_iic_wrap_en_clks), 0);
 }
 
 static const struct udevice_id mt8188_apmixed_compat[] = {
index b6332b14aeaf7af1157477a68e5b33f2f9dae5a7..02d30ab12d8e14c408999f8766017888c722edc6 100644 (file)
@@ -708,13 +708,14 @@ static int mt8365_topckgen_probe(struct udevice *dev)
 static int mt8365_topckgen_cg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8365_clk_tree, top_clk_gates,
-                                       ARRAY_SIZE(top_clk_gates));
+                                       ARRAY_SIZE(top_clk_gates),
+                                       CLK_TOP_AUD_I2S0_M);
 }
 
 static int mt8365_infracfg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8365_clk_tree, ifr_clks,
-                                       ARRAY_SIZE(ifr_clks));
+                                       ARRAY_SIZE(ifr_clks), 0);
 }
 
 static const struct udevice_id mt8365_apmixed_compat[] = {
index d4f6604c160ea89f0a69d4e22e86232d0af93458..bad8c62601d773cacded592322abdae8a8a9273c 100644 (file)
@@ -809,13 +809,13 @@ static int mt8512_topckgen_probe(struct udevice *dev)
 static int mt8512_topckgen_cg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8512_clk_tree, top_clks,
-                                       ARRAY_SIZE(top_clks));
+                                       ARRAY_SIZE(top_clks), 0);
 }
 
 static int mt8512_infracfg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8512_clk_tree, infra_clks,
-                                       ARRAY_SIZE(infra_clks));
+                                       ARRAY_SIZE(infra_clks), 0);
 }
 
 static const struct udevice_id mt8512_apmixed_compat[] = {
index d5f922886a3aa60180640edf6273aa16943b97b8..a84a5f360f5f1033c0de990cf73df412f82a1d84 100644 (file)
@@ -758,7 +758,7 @@ static int mt8516_topckgen_probe(struct udevice *dev)
 static int mt8516_topckgen_cg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8516_clk_tree, top_clks,
-                                       ARRAY_SIZE(top_clks));
+                                       ARRAY_SIZE(top_clks), 0);
 }
 
 static const struct udevice_id mt8516_apmixed_compat[] = {
index 92730f3f06ce3aee8c5c85db39ef5c372f193d3e..43a06217d338c3b27c0ebef300b86a9a6e1530c1 100644 (file)
@@ -1514,7 +1514,7 @@ static int mt8518_topckgen_probe(struct udevice *dev)
 static int mt8518_topckgen_cg_probe(struct udevice *dev)
 {
        return mtk_common_clk_gate_init(dev, &mt8518_clk_tree, top_clks,
-                                       ARRAY_SIZE(top_clks));
+                                       ARRAY_SIZE(top_clks), 0);
 }
 
 static const struct udevice_id mt8518_apmixed_compat[] = {
index a3dd18363f6f95c247ffdd4f54277fb74cf9e632..6ba2fabfd08dc90f669ef2e47c4f42ef69d28d79 100644 (file)
@@ -1018,8 +1018,8 @@ static const int mtk_clk_gate_of_xlate(struct clk *clk,
        if (ret)
                return ret;
 
-       if (clk->id >= tree->gates_offs &&
-           clk->id < tree->gates_offs + priv->num_gates)
+       if (clk->id >= priv->gates_offs &&
+           clk->id < priv->gates_offs + priv->num_gates)
                return 0;
 
        return -ENOENT;
@@ -1030,10 +1030,10 @@ static int mtk_clk_gate_enable(struct clk *clk)
        struct mtk_cg_priv *priv = dev_get_priv(clk->dev);
        const struct mtk_gate *gate;
 
-       if (clk->id < priv->tree->gates_offs)
+       if (clk->id < priv->gates_offs)
                return -EINVAL;
 
-       gate = &priv->gates[clk->id - priv->tree->gates_offs];
+       gate = &priv->gates[clk->id - priv->gates_offs];
        return mtk_gate_enable(priv->base, gate);
 }
 
@@ -1042,10 +1042,10 @@ static int mtk_clk_gate_disable(struct clk *clk)
        struct mtk_cg_priv *priv = dev_get_priv(clk->dev);
        const struct mtk_gate *gate;
 
-       if (clk->id < priv->tree->gates_offs)
+       if (clk->id < priv->gates_offs)
                return -EINVAL;
 
-       gate = &priv->gates[clk->id - priv->tree->gates_offs];
+       gate = &priv->gates[clk->id - priv->gates_offs];
        return mtk_gate_disable(priv->base, gate);
 }
 
@@ -1055,10 +1055,10 @@ static ulong mtk_clk_gate_get_rate(struct clk *clk)
        struct udevice *parent = priv->parent;
        const struct mtk_gate *gate;
 
-       if (clk->id < priv->tree->gates_offs)
+       if (clk->id < priv->gates_offs)
                return -EINVAL;
 
-       gate = &priv->gates[clk->id - priv->tree->gates_offs];
+       gate = &priv->gates[clk->id - priv->gates_offs];
        /*
         * With requesting a TOPCKGEN parent, make sure the dev parent
         * is actually topckgen. This might not be the case for an
@@ -1094,8 +1094,8 @@ static void mtk_clk_gate_dump(struct udevice *dev)
                const struct mtk_gate *gate = &priv->gates[i];
 
                printf("[GATE%u] DT: %u", i, gate->id);
-               mtk_clk_print_mapped_id(gate->id, i + tree->gates_offs, tree->id_offs_map);
-               mtk_clk_print_rate(dev, i + tree->gates_offs);
+               mtk_clk_print_mapped_id(gate->id, i + priv->gates_offs, tree->id_offs_map);
+               mtk_clk_print_rate(dev, i + priv->gates_offs);
                mtk_clk_print_single_parent(gate->parent, gate->flags);
                printf("\n");
        }
@@ -1196,7 +1196,8 @@ int mtk_common_clk_infrasys_init(struct udevice *dev,
 
 int mtk_common_clk_gate_init(struct udevice *dev,
                             const struct mtk_clk_tree *tree,
-                            const struct mtk_gate *gates, int num_gates)
+                            const struct mtk_gate *gates, int num_gates,
+                            int gates_offs)
 {
        struct mtk_cg_priv *priv = dev_get_priv(dev);
        struct udevice *parent;
@@ -1218,6 +1219,7 @@ int mtk_common_clk_gate_init(struct udevice *dev,
        priv->tree = tree;
        priv->gates = gates;
        priv->num_gates = num_gates;
+       priv->gates_offs = gates_offs;
 
        return 0;
 }
index bd8899193c97895f238863b5e2746935336047bd..068240b123ef0eb873c7cbc7cea624d926c9c2d2 100644 (file)
@@ -285,6 +285,7 @@ struct mtk_cg_priv {
        const struct mtk_clk_tree *tree;
        const struct mtk_gate *gates;
        int num_gates;
+       int gates_offs;
 };
 
 extern const struct clk_ops mtk_clk_apmixedsys_ops;
@@ -299,6 +300,7 @@ int mtk_common_clk_infrasys_init(struct udevice *dev,
                                 const struct mtk_clk_tree *tree);
 int mtk_common_clk_gate_init(struct udevice *dev,
                             const struct mtk_clk_tree *tree,
-                            const struct mtk_gate *gates, int num_gates);
+                            const struct mtk_gate *gates, int num_gates,
+                            int gates_offs);
 
 #endif /* __DRV_CLK_MTK_H */