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

Commit a5a2e2ac authored by Saket Saurabh's avatar Saket Saurabh
Browse files

phy-msm-usb : Do clk_get for optional alt_core_clk after mandatory clk



Linux clock driver API implementation for clk_get() has changed where
it returns -EPROBE_DEFER when clock is not found. As "alt_core_clk"
is optional for msm_otg and calling clk_get() for "alt_core_clk"
is returning -EPROBE_DEFER, msm_otg_probe keeps on retrying and never
succeds.

Fixing the issue by doing clk_get() for optional "alt_core_clk" after
all mandatory clocks. If all the mandatory clock gets succeed, then
failure of the optional clock means the clock is not there and hence
do not reurn -EPROBE_DEFER for optional clock from msm_otg_probe.

CRs-Fixed: 590336
Change-Id: Ib9e9d509858b32a1e2933fee1c1233cf13e007e4
Signed-off-by: default avatarSaket Saurabh <ssaurabh@codeaurora.org>
parent 39e0d0b3
Loading
Loading
Loading
Loading
+13 −20
Original line number Diff line number Diff line
@@ -4394,28 +4394,12 @@ static int __init msm_otg_probe(struct platform_device *pdev)
		goto put_core_clk;
	}

	/*
	 * Targets on which link uses asynchronous reset methodology,
	 * free running clock is not required during the reset.
	 */
	motg->clk = clk_get(&pdev->dev, "alt_core_clk");
	if (IS_ERR(motg->clk)) {
		ret = PTR_ERR(motg->clk);
		motg->clk = NULL;
		if (ret != -EPROBE_DEFER)
			dev_dbg(&pdev->dev, "alt_core_clk is not present\n");
		else
			goto put_pclk;
	} else {
		clk_set_rate(motg->clk, 60000000);
	}

	motg->xo_clk = clk_get(&pdev->dev, "xo");
	if (IS_ERR(motg->xo_clk)) {
		ret = PTR_ERR(motg->xo_clk);
		motg->xo_clk = NULL;
		if (ret == -EPROBE_DEFER)
			goto put_clk;
			goto put_pclk;
	}

	/*
@@ -4439,6 +4423,18 @@ static int __init msm_otg_probe(struct platform_device *pdev)
		}
	}

	/*
	 * Targets on which link uses asynchronous reset methodology,
	 * free running clock is not required during the reset.
	 */
	motg->clk = clk_get(&pdev->dev, "alt_core_clk");
	if (IS_ERR(motg->clk)) {
		motg->clk = NULL;
		dev_dbg(&pdev->dev, "alt_core_clk is not present\n");
	} else {
		clk_set_rate(motg->clk, 60000000);
	}

	if (pdev->dev.of_node) {
		dev_dbg(&pdev->dev, "device tree enabled\n");
		pdata = msm_otg_dt_to_pdata(pdev);
@@ -4851,9 +4847,6 @@ put_sleep_clk:
put_xo_clk:
	if (motg->xo_clk)
		clk_put(motg->xo_clk);
put_clk:
	if (motg->clk)
		clk_put(motg->clk);
put_pclk:
	if (motg->pclk)
		clk_put(motg->pclk);