Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a2c21ce authored by Junjie Wu's avatar Junjie Wu
Browse files

clock-gcc-8916: Get all external clocks before registration



clock-gcc-8916 only gets parent for xo_a_clk_src after registering
its clock table with framework. This introduces two errors:
1) The parent of xo_a_clk_src is potentially not handed off
2) When clock table registers, xo_a_clk_src fails handoff because
it's an external clock without a parent. Thus its CLKFLAG_INIT_DONE
is not set even if its parent is actually ready. Instead,
xo_a_clk_src is added onto orphan list.

CLKFLAG_INIT_DONE will only be set when another driver registers
clocks and triggers a handoff for orphan clocks.

Fix the issue by filling the parent before registering clock table
in clock-gcc-8916.

Change-Id: Ie0f568cd530a2c4b218c7db8094b1bd10196a10f
Signed-off-by: default avatarJunjie Wu <junjiew@codeaurora.org>
parent ecf49392
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -2793,6 +2793,13 @@ static int msm_gcc_probe(struct platform_device *pdev)
	regval |= BIT(0);
	writel_relaxed(regval, GCC_REG_BASE(APCS_GPLL_ENA_VOTE));

	xo_a_clk_src.c.parent = clk_get(&pdev->dev, "xo_a");
	if (IS_ERR(xo_a_clk_src.c.parent)) {
		if (!(PTR_ERR(xo_a_clk_src.c.parent) == -EPROBE_DEFER))
			dev_err(&pdev->dev, "Unable to get xo_a clock!!!\n");
		return PTR_ERR(xo_a_clk_src.c.parent);
	}

	ret = of_msm_clock_register(pdev->dev.of_node,
				msm_clocks_lookup,
				ARRAY_SIZE(msm_clocks_lookup));
@@ -2802,13 +2809,6 @@ static int msm_gcc_probe(struct platform_device *pdev)
	clk_set_rate(&apss_ahb_clk_src.c, 19200000);
	clk_prepare_enable(&apss_ahb_clk_src.c);

	xo_a_clk_src.c.parent = clk_get(&pdev->dev, "xo_a");
	if (IS_ERR(xo_a_clk_src.c.parent)) {
		if (!(PTR_ERR(xo_a_clk_src.c.parent) == -EPROBE_DEFER))
			dev_err(&pdev->dev, "Unable to get xo_a clock!!!\n");
		return PTR_ERR(xo_a_clk_src.c.parent);
	}

	dev_info(&pdev->dev, "Registered GCC clocks\n");

	return 0;