From patchwork Tue Dec 12 12:31:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Lin X-Patchwork-Id: 10106915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BED6760327 for ; Tue, 12 Dec 2017 12:34:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B56C529B82 for ; Tue, 12 Dec 2017 12:34:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA40229B97; Tue, 12 Dec 2017 12:34:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B5A129B82 for ; Tue, 12 Dec 2017 12:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ZisXVIO4NPkUbGN+7Jo9BKV2odRwVq5nSwnoGwatXac=; b=XaH8mi8VmqV7Y/Z0In10KSZFbm COFPJCk/akJxn6I0UF5W9EGOiAJ4gbh/sHdrnVM7RhvbDcPDIH0A7dj1v2BNOJYGGOGy7vS/oVwDM y9pzfEDBlrLpX+PFGKm4UiOA2o3g+s/f2MF/hISdKZFFeLvjCZAmkOFV21xp9499JqlYo3s0nkAxd xhvHX7mvJDrA56SzKyRR2rMQpIkZknRj3Cqde72pTiZJYk2FgkfNLz+h3e0GsPff7RbfFZrJC6XHQ 4F/p0alSyd8RnZQxlARWNwZ5qYU/SsKRxQqS/Hh2ia2jpZf/92THYPm8/P8BUryT2Cddtq5Ijzfi/ S3xy5TEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eOjlG-0003Sb-8u; Tue, 12 Dec 2017 12:34:14 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eOjjX-0001Ys-DK for linux-arm-kernel@lists.infradead.org; Tue, 12 Dec 2017 12:32:30 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CF15260ADA; Tue, 12 Dec 2017 12:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1513081926; bh=89FTjzbY3H3qZBmMfpsX6fF7vekEV4qjRiR+Kpgt50Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AjyO6KeviLnvjyJU2AyqDOiPUglxVLXTCVXVCO2BhK6A2b8KrJklKmPO1KsrFpHwG dfk+I/G8CAPWSdM4uPsOpOAkXlZdxtIfBbx+SAG2uuVnuQ/mXKE0ZaZ99inFgW/piY vcCGlhg+6ohwQUQ7v7mOD6E5MwkVuH0Q2a2bSwjI= Received: from lx-ilial.mea.qualcomm.com (unknown [185.23.60.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ilialin@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E3EB160AD1; Tue, 12 Dec 2017 12:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1513081924; bh=89FTjzbY3H3qZBmMfpsX6fF7vekEV4qjRiR+Kpgt50Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e01G05DZU7zR6O0LlRVjJj1VcHErQwqEXX63aqZ10CN0qgfH8XbuoqW+t2Mvmaj8X oc4a1EkrwhJKtWpZDXHL0rMmK2YD3MzGRR8C6yGp/4WkrOD8thXPeGmArtcjXIEieK PykFher4xonpXgpIT7GS9TNoFodnk+F8Dv4YvCKA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E3EB160AD1 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilialin@codeaurora.org From: Ilia Lin To: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, sboyd@codeaurora.org Subject: [PATCH 07/10] clk: qcom: clk-cpu-8996: Prepare PLLs on probe Date: Tue, 12 Dec 2017 14:31:34 +0200 Message-Id: <1513081897-31612-8-git-send-email-ilialin@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513081897-31612-1-git-send-email-ilialin@codeaurora.org> References: <1513081897-31612-1-git-send-email-ilialin@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171212_043227_527796_E6B56895 X-CRM114-Status: GOOD ( 11.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, rnayak@codeaurora.org, will.deacon@arm.com, tfinkel@codeaurora.org, qualcomm-lt@lists.linaro.org, ilialin@codeaurora.org, celster@codeaurora.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The PLLs must be prepared enabled during the probe to be accessible by the OPPs. Otherwise an OPP may switch to non-enabled clock. Signed-off-by: Ilia Lin --- drivers/clk/qcom/clk-cpu-8996.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/clk/qcom/clk-cpu-8996.c b/drivers/clk/qcom/clk-cpu-8996.c index 79db4e8..0d41fa9 100644 --- a/drivers/clk/qcom/clk-cpu-8996.c +++ b/drivers/clk/qcom/clk-cpu-8996.c @@ -15,7 +15,7 @@ #include #include #include - +#include #include "clk-alpha-pll.h" #define VCO(a, b, c) { \ @@ -159,7 +159,7 @@ static int clk_cpu_8996_mux_set_parent(struct clk_hw *hw, u8 index) cpuclk->shift); val = index; - val = cpuclk->shift; + val <<= cpuclk->shift; return regmap_update_bits(clkr->regmap, cpuclk->reg, mask, val); } @@ -268,7 +268,7 @@ int cpu_clk_notifier_cb(struct notifier_block *nb, unsigned long event, }, .num_parents = 4, .ops = &clk_cpu_8996_mux_ops, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, }, }; @@ -284,12 +284,12 @@ int cpu_clk_notifier_cb(struct notifier_block *nb, unsigned long event, .parent_names = (const char *[]){ "perfcl_smux", "perfcl_pll", - "pwrcl_pll_acd", + "perfcl_pll_acd", "perfcl_alt_pll", }, .num_parents = 4, .ops = &clk_cpu_8996_mux_ops, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, }, }; @@ -354,6 +354,18 @@ struct clk_hw_clks { clk_alpha_pll_configure(&perfcl_alt_pll, regmap, &altpll_config); clk_alpha_pll_configure(&pwrcl_alt_pll, regmap, &altpll_config); + /* Enable all PLLs and alt PLLs */ + clk_prepare_enable(pwrcl_alt_pll.clkr.hw.clk); + clk_prepare_enable(perfcl_alt_pll.clkr.hw.clk); + clk_prepare_enable(pwrcl_pll.clkr.hw.clk); + clk_prepare_enable(perfcl_pll.clkr.hw.clk); + + /* Set initial boot frequencies for power/perf PLLs */ + clk_set_rate(pwrcl_alt_pll.clkr.hw.clk, 652800000); + clk_set_rate(perfcl_alt_pll.clkr.hw.clk, 652800000); + clk_set_rate(pwrcl_pll.clkr.hw.clk, 652800000); + clk_set_rate(perfcl_pll.clkr.hw.clk, 652800000); + ret = clk_notifier_register(pwrcl_pmux.clkr.hw.clk, &pwrcl_pmux.nb); if (ret) return ret;