Skip to content

Commit ea879ce

Browse files
paulkocialkowskiwens
authored andcommitted
clk: sunxi-ng: v3s: Assign the de and tcon clocks to the video pll
It appears (based on experimentation) that both the de and tcon clocks need to have the same parent for the two units to work together. Assign them both to the video pll by manually clearing the parent selection bits (effectively setting index 0) and marking the clocks with the CLK_SET_RATE_NO_REPARENT flag, which ensures that they will never use a different parent. The video pll is also a possible parent for the camera subsystem, but it can use the dedicated isp pll if needed so there should be no negative side-effect due to this change. Note that ccu_mux_helper_set_parent cannot be used at this stage as it requires the clock driver to be initialized and this configuration is best done before the clock driver is available to consumers. Signed-off-by: Paul Kocialkowski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Chen-Yu Tsai <[email protected]>
1 parent e8ab346 commit ea879ce

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

drivers/clk/sunxi-ng/ccu-sun8i-v3s.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,13 @@ static SUNXI_CCU_GATE(dram_ohci_clk, "dram-ohci", "dram",
347347

348348
static const char * const de_parents[] = { "pll-video", "pll-periph0" };
349349
static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
350-
0x104, 0, 4, 24, 3, BIT(31), 0);
350+
0x104, 0, 4, 24, 3, BIT(31),
351+
CLK_SET_RATE_NO_REPARENT);
351352

352353
static const char * const tcon_parents[] = { "pll-video" };
353354
static SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents,
354-
0x118, 0, 4, 24, 3, BIT(31), 0);
355+
0x118, 0, 4, 24, 3, BIT(31),
356+
CLK_SET_RATE_NO_REPARENT);
355357

356358
static SUNXI_CCU_GATE(csi_misc_clk, "csi-misc", "osc24M",
357359
0x130, BIT(31), 0);
@@ -753,6 +755,21 @@ static int sun8i_v3s_ccu_probe(struct platform_device *pdev)
753755
val &= ~GENMASK(19, 16);
754756
writel(val, reg + SUN8I_V3S_PLL_AUDIO_REG);
755757

758+
/*
759+
* Assign the DE and TCON clock to the video PLL. Both clocks need to
760+
* have the same parent for the units to work together.
761+
*/
762+
763+
val = readl(reg + de_clk.common.reg);
764+
val &= ~GENMASK(de_clk.mux.shift + de_clk.mux.width - 1,
765+
de_clk.mux.shift);
766+
writel(val, reg + de_clk.common.reg);
767+
768+
val = readl(reg + tcon_clk.common.reg);
769+
val &= ~GENMASK(tcon_clk.mux.shift + tcon_clk.mux.width - 1,
770+
tcon_clk.mux.shift);
771+
writel(val, reg + tcon_clk.common.reg);
772+
756773
return devm_sunxi_ccu_probe(&pdev->dev, reg, desc);
757774
}
758775

0 commit comments

Comments
 (0)