From f530d78e83dd69537f2b743e884fe04c48483c80 Mon Sep 17 00:00:00 2001 From: Taniya Das Date: Tue, 20 Jun 2017 10:26:46 +0530 Subject: [PATCH] clk: qcom: osm: Initialize ACD when the cluster is online The OSM clock driver currently enables ACD for the silver and gold clusters regardless of whether they've been brought up or not. ACD requires the cluster PLLs to be running for initialization, a requirement which would not be met if the cluster hasn't been brought online. Tie the ACD initialization sequence with enabling OSM for that cluster. Change-Id: I4a7e7176e30b26d096645dd9ce508b7af8ae6df2 Signed-off-by: Taniya Das --- drivers/clk/qcom/clk-cpu-osm.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/clk/qcom/clk-cpu-osm.c b/drivers/clk/qcom/clk-cpu-osm.c index 8bf45f572c5e..d99e13817a29 100644 --- a/drivers/clk/qcom/clk-cpu-osm.c +++ b/drivers/clk/qcom/clk-cpu-osm.c @@ -719,9 +719,22 @@ static int clk_osm_set_rate(struct clk_hw *hw, unsigned long rate, return 0; } +static int clk_osm_acd_init(struct clk_osm *c); + static int clk_osm_enable(struct clk_hw *hw) { struct clk_osm *cpuclk = to_clk_osm(hw); + int rc; + + rc = clk_osm_acd_init(cpuclk); + if (rc) { + pr_err("Failed to initialize ACD for cluster %d, rc=%d\n", + cpuclk->cluster_num, rc); + return rc; + } + + /* Wait for 5 usecs before enabling OSM */ + udelay(5); clk_osm_write_reg(cpuclk, 1, ENABLE_REG); @@ -3272,17 +3285,6 @@ static int clk_cpu_osm_driver_probe(struct platform_device *pdev) clk_osm_setup_cluster_pll(&perfcl_clk); } - rc = clk_osm_acd_init(&pwrcl_clk); - if (rc) { - pr_err("failed to initialize ACD for pwrcl, rc=%d\n", rc); - return rc; - } - rc = clk_osm_acd_init(&perfcl_clk); - if (rc) { - pr_err("failed to initialize ACD for perfcl, rc=%d\n", rc); - return rc; - } - spin_lock_init(&pwrcl_clk.lock); spin_lock_init(&perfcl_clk.lock);