Skip to content

Commit 19024c9

Browse files
Nicolas Frattarolibebarino
authored andcommitted
clk: mediatek: Add mfg_eb as parent to mt8196 mfgpll clocks
All the MFGPLL require MFG_EB to be on for any operation on them, and they only tick when MFG_EB is on as well, therefore making this a parent-child relationship. This dependency wasn't clear during the initial upstreaming of these clock controllers, as it only made itself known when I could observe the effects of the clock by bringing up a different piece of hardware. Add a new PLL_PARENT_EN flag to mediatek's clk-pll.h, and check for it when initialising the pll to then translate it into the actual CLK_OPS_PARENT_ENABLE flag. Then add the mfg_eb parent to the mfgpll clocks, and set the new PLL_PARENT_EN flag. Fixes: 03dc02f ("clk: mediatek: Add MT8196 mfg clock support") Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 483f364 commit 19024c9

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

drivers/clk/mediatek/clk-mt8196-mfg.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,25 @@
5858
.pcw_shift = _pcw_shift, \
5959
.pcwbits = _pcwbits, \
6060
.pcwibits = MT8196_INTEGER_BITS, \
61+
.parent_name = "mfg_eb", \
6162
}
6263

6364
static const struct mtk_pll_data mfg_ao_plls[] = {
64-
PLL(CLK_MFG_AO_MFGPLL, "mfgpll", MFGPLL_CON0, MFGPLL_CON0, 0, 0, 0,
65-
BIT(0), MFGPLL_CON1, 24, 0, 0, 0,
65+
PLL(CLK_MFG_AO_MFGPLL, "mfgpll", MFGPLL_CON0, MFGPLL_CON0, 0, 0,
66+
PLL_PARENT_EN, BIT(0), MFGPLL_CON1, 24, 0, 0, 0,
6667
MFGPLL_CON1, 0, 22),
6768
};
6869

6970
static const struct mtk_pll_data mfgsc0_ao_plls[] = {
7071
PLL(CLK_MFGSC0_AO_MFGPLL_SC0, "mfgpll-sc0", MFGPLL_SC0_CON0,
71-
MFGPLL_SC0_CON0, 0, 0, 0, BIT(0), MFGPLL_SC0_CON1, 24, 0, 0, 0,
72-
MFGPLL_SC0_CON1, 0, 22),
72+
MFGPLL_SC0_CON0, 0, 0, PLL_PARENT_EN, BIT(0), MFGPLL_SC0_CON1, 24,
73+
0, 0, 0, MFGPLL_SC0_CON1, 0, 22),
7374
};
7475

7576
static const struct mtk_pll_data mfgsc1_ao_plls[] = {
7677
PLL(CLK_MFGSC1_AO_MFGPLL_SC1, "mfgpll-sc1", MFGPLL_SC1_CON0,
77-
MFGPLL_SC1_CON0, 0, 0, 0, BIT(0), MFGPLL_SC1_CON1, 24, 0, 0, 0,
78-
MFGPLL_SC1_CON1, 0, 22),
78+
MFGPLL_SC1_CON0, 0, 0, PLL_PARENT_EN, BIT(0), MFGPLL_SC1_CON1, 24,
79+
0, 0, 0, MFGPLL_SC1_CON1, 0, 22),
7980
};
8081

8182
static const struct of_device_id of_match_clk_mt8196_mfg[] = {

drivers/clk/mediatek/clk-pll.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ struct clk_hw *mtk_clk_register_pll_ops(struct mtk_clk_pll *pll,
359359

360360
init.name = data->name;
361361
init.flags = (data->flags & PLL_AO) ? CLK_IS_CRITICAL : 0;
362+
if (data->flags & PLL_PARENT_EN)
363+
init.flags |= CLK_OPS_PARENT_ENABLE;
364+
362365
init.ops = pll_ops;
363366
if (data->parent_name)
364367
init.parent_names = &data->parent_name;

drivers/clk/mediatek/clk-pll.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct mtk_pll_div_table {
1919

2020
#define HAVE_RST_BAR BIT(0)
2121
#define PLL_AO BIT(1)
22+
#define PLL_PARENT_EN BIT(2)
2223
#define POSTDIV_MASK GENMASK(2, 0)
2324

2425
struct mtk_pll_data {

0 commit comments

Comments
 (0)