From patchwork Mon Nov 25 13:59:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 11260433 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6F44930 for ; Mon, 25 Nov 2019 13:59:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9807E2084D for ; Mon, 25 Nov 2019 13:59:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MHDvRHjk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727877AbfKYN7S (ORCPT ); Mon, 25 Nov 2019 08:59:18 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:35454 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727845AbfKYN7R (ORCPT ); Mon, 25 Nov 2019 08:59:17 -0500 Received: by mail-lf1-f65.google.com with SMTP id r15so8169547lff.2 for ; Mon, 25 Nov 2019 05:59:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UyfsDOjViaLy31rOpDuIJP2/tnh70uuMePmLyotTbkw=; b=MHDvRHjkJIFUfMfGegrgrKlpv2zmfBLohiOLgx4UIyE3n0riOQHx0+AxlRvu1q3eHT S1AtdURFgmdpIPgJ7Jt2UK95EnVyTpKWD53sQMm4saA3p1Wd5XW65dWl0j69khJJ1x9w W3AJkht1Xclp90KZZRtanNu5SNy5FKDpU+cJ+uWbUVsQM8mqJ5IVJPinTI6v52fySDiO dai+VItWn95ik4QZJvLT+WpGGcVYcJ3aMFL9evIZC+FN1iXfnmBCM3ll1SEkcmRChedn kSv3FSkifhhu9wjRMdYpeegX9xx5TwfRxzlTzj06ZGM1K6bBInBBg+H0jNENGb4a+fxH AZpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UyfsDOjViaLy31rOpDuIJP2/tnh70uuMePmLyotTbkw=; b=cT6zex/HNNstoUkCquShIkW8Hffi3e3XBGx4x/3oKxwChxvk3tMTXSOu0oare1GRLM hE+rM0gqzTHSnGa3iYaWQGyCYRhGKrcUhdJYMwCf14UiqLKRni/XkAUDqdoTpeegY66A poLdV4EVGToYeS5NA1vbBZZIXHl4sAlineT6mSyUlFOxK0UJvf6tPNCjjDqdMpwCF4Ub tuH+QZzsXK2Lazow4bCuD1aEAW6B03ATR8AArmJZ2Oyw7w+KKXOvejaGXhlBlcI8hpF/ VicXdT8J7acbEqIQAL45Wl3stsjYun6pmRl3ripcB3m7qdEUpi4O2odcU1nXnVhC4zlH RD6A== X-Gm-Message-State: APjAAAVY7sDDkUH5zVlQ4hbnpGVvUyU817Q+HcHiGUEw8Zo33iWvCI65 Yv7fdxAKJsn8d4m4iLjxTlyyIg== X-Google-Smtp-Source: APXvYqxNSlHJd8iQr1qHKpJZCFZ5YInMRzi23oMjI34GeF45sTBW6kOR292nDuXByYR0vGIGVMG52w== X-Received: by 2002:a19:520b:: with SMTP id m11mr20364369lfb.77.1574690355801; Mon, 25 Nov 2019 05:59:15 -0800 (PST) Received: from centauri.lan (ua-84-217-220-205.bbcust.telenor.se. [84.217.220.205]) by smtp.gmail.com with ESMTPSA id w71sm4189705lff.0.2019.11.25.05.59.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 05:59:15 -0800 (PST) From: Niklas Cassel To: Andy Gross , Bjorn Andersson Cc: linux-arm-msm@vger.kernel.org, amit.kucheria@linaro.org, sboyd@kernel.org, Jorge Ramirez-Ortiz , Niklas Cassel , Michael Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/7] clk: qcom: gcc: limit GPLL0_AO_OUT operating frequency Date: Mon, 25 Nov 2019 14:59:04 +0100 Message-Id: <20191125135910.679310-3-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191125135910.679310-1-niklas.cassel@linaro.org> References: <20191125135910.679310-1-niklas.cassel@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org From: Jorge Ramirez-Ortiz Limit the GPLL0_AO_OUT_MAIN operating frequency as per its hardware specifications. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson Acked-by: Stephen Boyd --- Changes since v2: -None drivers/clk/qcom/clk-alpha-pll.c | 8 ++++++++ drivers/clk/qcom/clk-alpha-pll.h | 1 + drivers/clk/qcom/gcc-qcs404.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c index 055318f97991..9228b7b1f56e 100644 --- a/drivers/clk/qcom/clk-alpha-pll.c +++ b/drivers/clk/qcom/clk-alpha-pll.c @@ -878,6 +878,14 @@ static long clk_trion_pll_round_rate(struct clk_hw *hw, unsigned long rate, return clamp(rate, min_freq, max_freq); } +const struct clk_ops clk_alpha_pll_fixed_ops = { + .enable = clk_alpha_pll_enable, + .disable = clk_alpha_pll_disable, + .is_enabled = clk_alpha_pll_is_enabled, + .recalc_rate = clk_alpha_pll_recalc_rate, +}; +EXPORT_SYMBOL_GPL(clk_alpha_pll_fixed_ops); + const struct clk_ops clk_alpha_pll_ops = { .enable = clk_alpha_pll_enable, .disable = clk_alpha_pll_disable, diff --git a/drivers/clk/qcom/clk-alpha-pll.h b/drivers/clk/qcom/clk-alpha-pll.h index 15f27f4b06df..c28eb1a08c0c 100644 --- a/drivers/clk/qcom/clk-alpha-pll.h +++ b/drivers/clk/qcom/clk-alpha-pll.h @@ -109,6 +109,7 @@ struct alpha_pll_config { }; extern const struct clk_ops clk_alpha_pll_ops; +extern const struct clk_ops clk_alpha_pll_fixed_ops; extern const struct clk_ops clk_alpha_pll_hwfsm_ops; extern const struct clk_ops clk_alpha_pll_postdiv_ops; extern const struct clk_ops clk_alpha_pll_huayra_ops; diff --git a/drivers/clk/qcom/gcc-qcs404.c b/drivers/clk/qcom/gcc-qcs404.c index 9b0c4ce2ef4e..46d314d69250 100644 --- a/drivers/clk/qcom/gcc-qcs404.c +++ b/drivers/clk/qcom/gcc-qcs404.c @@ -330,7 +330,7 @@ static struct clk_alpha_pll gpll0_ao_out_main = { .parent_names = (const char *[]){ "cxo" }, .num_parents = 1, .flags = CLK_IS_CRITICAL, - .ops = &clk_alpha_pll_ops, + .ops = &clk_alpha_pll_fixed_ops, }, }, }; From patchwork Mon Nov 25 13:59:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 11260441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7682914DB for ; Mon, 25 Nov 2019 13:59:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 561AB20863 for ; Mon, 25 Nov 2019 13:59:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zmgWdTfe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727905AbfKYN7e (ORCPT ); Mon, 25 Nov 2019 08:59:34 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45174 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727901AbfKYN7d (ORCPT ); Mon, 25 Nov 2019 08:59:33 -0500 Received: by mail-lj1-f196.google.com with SMTP id n21so15934167ljg.12 for ; Mon, 25 Nov 2019 05:59:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mFx2G6rwu7kpdvcXD41l6BM92KOVYIpnpySewMnY058=; b=zmgWdTfearD+sHjWeRlK/bx0dgy/bakLlEYxv8GGf+siHKTg8Pd29fjMZvoTWR5uS7 Pv7/bI+YTelbau7+aLwKBalnifKR5722jLwOg9/+0nRfFVE4bv7QWmUyupBm123opiZw LzPE7f/aWEugYp1FYSUNUyfZCVWJXnrAwcsjeR3p5f3LWlTfuY3uLWhx4HjaCtjW1INw 3bAMgT0va6MHiOYgdrTP5MQQT0R/aODxvK/vi3aFRW+tojJkrsJPMlMf+gy/UmteOfbF W2/HXRW/Nnod0De3hIAseGbAiGbExUflxWVqtbM9uXV1rjs/qC/1TtDPoiOabAAmvqTQ lzxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mFx2G6rwu7kpdvcXD41l6BM92KOVYIpnpySewMnY058=; b=nLKiUnPfkAYlDug7wnTWaCOMkonVlki0nmDss3edfPjo5U5xcAJ2+DHiKYR9/i7W8w txWOKvimK+Yu9c8Oed22PTyTmETEnreHM4ARaSWHQMscZH6gRwa1KNiz9ltOpwYF2KRH Mz4rYFFewvOyUTvvmFJel8aGYM7I8ovDoGrzSYjCR4JwyCGYk3zKpq77BAqlSLC5UtrG QMhBhjUXdEcska/N51p99zDm9w+39PwuekixRSlxDokPeI0Bh4YqU18uGjVHg3ewGUnb IEgMsHUHoDIIAgfnCuttfV31UmhT7sCogG4lnyk7w8/7ePb7X2U+txtxCyzUfdzJA4+b uKiQ== X-Gm-Message-State: APjAAAWzLxwcHFlECnanJRRJiYljutXK//BkzvmfUOH5mgHJkUuzki6B 14CPKMvjKL82HU5P3Vf+IaimFQ== X-Google-Smtp-Source: APXvYqxGNrTj7vs2qjFmDS+0SCPs2ZtKT71xpKo78ewxlVGZ16eFWb8x11iJovyeZ7uQJznUoZr7Yg== X-Received: by 2002:a2e:7016:: with SMTP id l22mr22669006ljc.227.1574690371750; Mon, 25 Nov 2019 05:59:31 -0800 (PST) Received: from centauri.lan (ua-84-217-220-205.bbcust.telenor.se. [84.217.220.205]) by smtp.gmail.com with ESMTPSA id s23sm4041871ljm.20.2019.11.25.05.59.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 05:59:31 -0800 (PST) From: Niklas Cassel To: Andy Gross , Bjorn Andersson Cc: linux-arm-msm@vger.kernel.org, amit.kucheria@linaro.org, sboyd@kernel.org, Jorge Ramirez-Ortiz , Niklas Cassel , Michael Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/7] clk: qcom: hfpll: register as clock provider Date: Mon, 25 Nov 2019 14:59:05 +0100 Message-Id: <20191125135910.679310-4-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191125135910.679310-1-niklas.cassel@linaro.org> References: <20191125135910.679310-1-niklas.cassel@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org From: Jorge Ramirez-Ortiz Make the output of the high frequency pll a clock provider. On the QCS404 this PLL controls cpu frequency scaling. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson Acked-by: Stephen Boyd --- Changes since v2: -None drivers/clk/qcom/hfpll.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c index a6de7101430c..e64c0fd82fe4 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -57,6 +57,7 @@ static int qcom_hfpll_probe(struct platform_device *pdev) .num_parents = 1, .ops = &clk_ops_hfpll, }; + int ret; h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); if (!h) @@ -79,7 +80,14 @@ static int qcom_hfpll_probe(struct platform_device *pdev) h->clkr.hw.init = &init; spin_lock_init(&h->lock); - return devm_clk_register_regmap(&pdev->dev, &h->clkr); + ret = devm_clk_register_regmap(dev, &h->clkr); + if (ret) { + dev_err(dev, "failed to register regmap clock: %d\n", ret); + return ret; + } + + return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, + &h->clkr.hw); } static struct platform_driver qcom_hfpll_driver = { From patchwork Mon Nov 25 13:59:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 11260449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 180F815AC for ; Mon, 25 Nov 2019 13:59:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED2A720874 for ; Mon, 25 Nov 2019 13:59:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VVW80aUa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727928AbfKYN7h (ORCPT ); Mon, 25 Nov 2019 08:59:37 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:37910 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727919AbfKYN7h (ORCPT ); Mon, 25 Nov 2019 08:59:37 -0500 Received: by mail-lj1-f194.google.com with SMTP id k8so5441655ljh.5 for ; Mon, 25 Nov 2019 05:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WZkXKWPlxV38+RGHoXYmkSG5VWJOb6ms6DI9j57Q8ak=; b=VVW80aUaA6CDpUPPAiJcUsgChOZb4zTH0QwFYFtR7JP+HUKkuPJ+i9XWLXyhyQVr50 AWdwJCtNYXP26uSH5xqPCKA769xOd4tpgEP7RC+Y+aDCtOALI8Gy5Ert/WtaDJkTBXmE ezomzfwvrwM6f761uHxxpEbTxUVd3gNfpLKN6N62wxJrPGGSwne7XIZTga8QNCHC/tQc 9h0HyfzZimccS4kViSljdHy/VnqV6TvXAkwYbDDD7U9GqOZ8IRxnVLx1Ku//fVs1tbRR M+8UCF0XyoGB1sYLNH18gnEXmgTTwYQ0nySr2W0IHkcRyrh2+NsailaBHpPcCEkfAQZq M7hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WZkXKWPlxV38+RGHoXYmkSG5VWJOb6ms6DI9j57Q8ak=; b=nz3slYYcKLCCdUFGORIze/hQyFeZPNWQSmxC7MIXB9EtKcZJ09XVyyOWdQQhxTKyzn AvFQnSnUaaaUwnLrTSd7Sjb9fcX0YEKHbA/SARcwxAp+k9ldwPpxrOXjGA1ds1XlSY2t n0vQAPiQSjA6i+yyGOBiPEOp8IeB1EEPhSz/x1eiKWLMtIB8Y+mOMNllHmDkuEOuAY8w jOHI6hNYZyYiHlkd7uy7XG01Ufa9RrtslIkLcJIFRVHVpGWhyJQBX4V7K2IProBPK+C1 +ePwIsBQba0+7T8XPY1SFOhtixMgYz/nBxJVPPK4J/IcenXSKHi02Pe1iwcI1aWkAQ6J mrpQ== X-Gm-Message-State: APjAAAWzg8/OUKG3HCVezlvC8MiF9TQowo9cCYN4pDxBM1NI4Ef6e60j T30x4jQO0VM11DaclxFm61jiDA== X-Google-Smtp-Source: APXvYqxkxEhav7mp9DLDaxmIBhKxHjUP1VcY5YxsCU1X4UHEjN5JNTkSMeSSsHkrhXb9xrhsWEXBVg== X-Received: by 2002:a2e:844e:: with SMTP id u14mr9142325ljh.17.1574690373313; Mon, 25 Nov 2019 05:59:33 -0800 (PST) Received: from centauri.lan (ua-84-217-220-205.bbcust.telenor.se. [84.217.220.205]) by smtp.gmail.com with ESMTPSA id s23sm4041871ljm.20.2019.11.25.05.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 05:59:32 -0800 (PST) From: Niklas Cassel To: Andy Gross , Bjorn Andersson Cc: linux-arm-msm@vger.kernel.org, amit.kucheria@linaro.org, sboyd@kernel.org, Jorge Ramirez-Ortiz , Niklas Cassel , Michael Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/7] clk: qcom: hfpll: CLK_IGNORE_UNUSED Date: Mon, 25 Nov 2019 14:59:06 +0100 Message-Id: <20191125135910.679310-5-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191125135910.679310-1-niklas.cassel@linaro.org> References: <20191125135910.679310-1-niklas.cassel@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org From: Jorge Ramirez-Ortiz When COMMON_CLK_DISABLED_UNUSED is set, in an effort to save power and to keep the software model of the clock in line with reality, the framework transverses the clock tree and disables those clocks that were enabled by the firmware but have not been enabled by any device driver. If CPUFREQ is enabled, early during the system boot, it might attempt to change the CPU frequency ("set_rate"). If the HFPLL is selected as a provider, it will then change the rate for this clock. As boot continues, clk_disable_unused_subtree will run. Since it wont find a valid counter (enable_count) for a clock that is actually enabled it will attempt to disable it which will cause the CPU to stop. Notice that in this driver, calls to check whether the clock is enabled are routed via the is_enabled callback which queries the hardware. The following commit, rather than marking the clock critical and forcing the clock to be always enabled, addresses the above scenario making sure the clock is not disabled but it continues to rely on the firmware to enable the clock. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson --- Changes since v2: -None drivers/clk/qcom/hfpll.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c index e64c0fd82fe4..225c675f6779 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -56,6 +56,13 @@ static int qcom_hfpll_probe(struct platform_device *pdev) .parent_names = (const char *[]){ "xo" }, .num_parents = 1, .ops = &clk_ops_hfpll, + /* + * rather than marking the clock critical and forcing the clock + * to be always enabled, we make sure that the clock is not + * disabled: the firmware remains responsible of enabling this + * clock (for more info check the commit log) + */ + .flags = CLK_IGNORE_UNUSED, }; int ret; From patchwork Mon Nov 25 13:59:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 11260451 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE006930 for ; Mon, 25 Nov 2019 13:59:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AD5912084D for ; Mon, 25 Nov 2019 13:59:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="k9ZRUQYD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727901AbfKYN7k (ORCPT ); Mon, 25 Nov 2019 08:59:40 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:41550 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727921AbfKYN7g (ORCPT ); Mon, 25 Nov 2019 08:59:36 -0500 Received: by mail-lf1-f65.google.com with SMTP id m30so9251048lfp.8 for ; Mon, 25 Nov 2019 05:59:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4n0b7csmummMNxZyeaSszKbcnCZgkdyzjnJK7yDR57M=; b=k9ZRUQYDRGLuJPThscWn5IqxsfcWQDaQNqRK8f+eV8GDXkdsHk7cLxpS1kIb7q/TK9 doPl76pMJCXckPDBFOzdRQr3C7Wi2JVgxyFnVsl7NOXHGiUQoa8fEXoybWLyMiJqjo8U s+pKy6+ty7tBmr8QqFWAzRuvPPvh9/EbUX8nXGO8HBjTHjiK6ciyITdid+9OZI7nLLQe 1jjYyrsMn/ufrJQ4b5A36nNfwz4R/PxnMoNRUGPOUYogvGMIUnC53s5VZFGg2vON5xag tDndGeXXm/WjVSYKyWx9qXaO8zaMxqOaTVUNQhMmGG+vWczNUwpjQBAqquoO3sJ5m7gI n/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4n0b7csmummMNxZyeaSszKbcnCZgkdyzjnJK7yDR57M=; b=bTMAUQCoHfuKfm6Com6Qwyvfa6bv53r1WmZMpG9PUlwatWYuSUnbN3eCftJh+9sciJ lqzj5oxAZ1W7TPy0WsNgvJsPrGH2JMPst1K75BHJgSk6SmuoqeH7aWd5s1/A+1fHcxJ+ Sm8DpZmF+rOWnWttkP9lNjeI9cYE/0xP8+vxa1SXPKb+HYd3IEAsa1SrJVvpfwrzZcOb y0O+vWyO23M2RQPUeKVJFfJjTfPQMifWwTXqImPwj1J7156HG/aPZAhFFQxpqlB0Tb8Z 0ru5jx6UvZYfCZZislpmtceH2hWjMcLsEHEruqmMcXB3Qj4L8PDiHJkyTos/CNqQSsVs 4IVQ== X-Gm-Message-State: APjAAAUhuQUI6wWmuw2TzoZ/SoYHmNPpFER1jwhxJNav4wMqItDbVvhT yCbQWSKx+DcA2VHLphfMovEWkw== X-Google-Smtp-Source: APXvYqyiHXeKNwXqDrb4oHFdRVQdKpRXMlAbnVYruSqWq4Q1yyx/xP5Xtz1cAP8usAyVBwZR4O49+w== X-Received: by 2002:ac2:5305:: with SMTP id c5mr20326251lfh.55.1574690374722; Mon, 25 Nov 2019 05:59:34 -0800 (PST) Received: from centauri.lan (ua-84-217-220-205.bbcust.telenor.se. [84.217.220.205]) by smtp.gmail.com with ESMTPSA id s23sm4041871ljm.20.2019.11.25.05.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 05:59:34 -0800 (PST) From: Niklas Cassel To: Andy Gross , Bjorn Andersson Cc: linux-arm-msm@vger.kernel.org, amit.kucheria@linaro.org, sboyd@kernel.org, Jorge Ramirez-Ortiz , Niklas Cassel , Michael Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/7] clk: qcom: hfpll: use clk_parent_data to specify the parent Date: Mon, 25 Nov 2019 14:59:07 +0100 Message-Id: <20191125135910.679310-6-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191125135910.679310-1-niklas.cassel@linaro.org> References: <20191125135910.679310-1-niklas.cassel@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org From: Jorge Ramirez-Ortiz This permits extending the driver to other platforms without having to modify its source code. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz --- Changes since v2: -None drivers/clk/qcom/hfpll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c index 225c675f6779..5ff7f5a60620 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -53,7 +53,6 @@ static int qcom_hfpll_probe(struct platform_device *pdev) struct regmap *regmap; struct clk_hfpll *h; struct clk_init_data init = { - .parent_names = (const char *[]){ "xo" }, .num_parents = 1, .ops = &clk_ops_hfpll, /* @@ -65,6 +64,7 @@ static int qcom_hfpll_probe(struct platform_device *pdev) .flags = CLK_IGNORE_UNUSED, }; int ret; + struct clk_parent_data pdata = { .index = 0 }; h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); if (!h) @@ -83,6 +83,8 @@ static int qcom_hfpll_probe(struct platform_device *pdev) 0, &init.name)) return -ENODEV; + init.parent_data = &pdata; + h->d = &hdata; h->clkr.hw.init = &init; spin_lock_init(&h->lock); From patchwork Mon Nov 25 13:59:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 11260459 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECE0E930 for ; Mon, 25 Nov 2019 14:00:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC035207FD for ; Mon, 25 Nov 2019 14:00:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jY4XKY/9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727767AbfKYN74 (ORCPT ); Mon, 25 Nov 2019 08:59:56 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40863 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727946AbfKYN7x (ORCPT ); Mon, 25 Nov 2019 08:59:53 -0500 Received: by mail-lf1-f66.google.com with SMTP id v24so11088865lfi.7 for ; Mon, 25 Nov 2019 05:59:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wJXgU1Ng7cyLAs4JFhWANoeuEktL+F9+1MeqR48Alzc=; b=jY4XKY/91dQiNFPe3L28KbxvxKBrbFtLaZUgSfddAtxodbkHZ/5fHWRIsna8DA7F5H miUjEE5uOvc5q98pK6uq7K1CFVeJNxQVGYLF/8tUhfoBQFknfL42uEI3ux8tT8A5SJkE suN+xr+gBO5ofHQDROHoK47oIsE6kTvX5JFZ6+toL498YiRRb8hI9KaVo0gj3KUYIu/c VW/lgGSdP6dhTZ6H4lT2ERz58FjnvUYva+MBYjt+j78jMD0l71zjGKD4vK0IZm/7vdJc hBlSiFQvqSMgCDISmW/RItDQrV9pPchpHpmY89mzDj/9+HBCY6m5NFfi09aA3iJlDMRz 9I9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wJXgU1Ng7cyLAs4JFhWANoeuEktL+F9+1MeqR48Alzc=; b=i9meJRgDE1Gul4Ha3E+/r7MjHg/kv6tmlFMhoviYm7eQXDpPpBNSdboWjVFmHq8Kcs kBElFmhU5BLPkaFZIlVPeH15pEpisuuo8oyJmu3FYe/NScfK7q4HTCjNqB9sPintceJ2 MOj6d5O25Vby4tJsnfoTjbHXPvcJo3JipuPPMhF8hhLK84q8is2yMDthSjct2rVLeAW9 /92OmpgjKCDO+r1RsHJCJXBnWY5jGKM8ABXj2sTG6M6Wo8KATDRkIIo8zfPyEga7G4Jf XC2DksMn3gQ3Y038FEymfnabmpUG4T6M2ZsrXaY4up3gg9VlSw4fB8QwW/VAKr7rfAL0 bFgw== X-Gm-Message-State: APjAAAXpGhEGQwPyiZlHlNZhGa23SPXItuXWA21J0jU4D9i1EvzH+Z7c Hk3+p6aCJiVqYTeMlRLj1eseXw== X-Google-Smtp-Source: APXvYqz3x/As1OKwSedf76XPDYruYgbzSqZRbTQCUjUICqB818J+1El2T/CtYyY7mD7TaivthOYGaA== X-Received: by 2002:ac2:5a08:: with SMTP id q8mr20791341lfn.106.1574690390726; Mon, 25 Nov 2019 05:59:50 -0800 (PST) Received: from centauri.lan (ua-84-217-220-205.bbcust.telenor.se. [84.217.220.205]) by smtp.gmail.com with ESMTPSA id g11sm3688529lfb.94.2019.11.25.05.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 05:59:50 -0800 (PST) From: Niklas Cassel To: Andy Gross , Bjorn Andersson Cc: linux-arm-msm@vger.kernel.org, amit.kucheria@linaro.org, sboyd@kernel.org, Jorge Ramirez-Ortiz , Niklas Cassel , Michael Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/7] clk: qcom: apcs-msm8916: silently error out on EPROBE_DEFER Date: Mon, 25 Nov 2019 14:59:08 +0100 Message-Id: <20191125135910.679310-7-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191125135910.679310-1-niklas.cassel@linaro.org> References: <20191125135910.679310-1-niklas.cassel@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org From: Jorge Ramirez-Ortiz If devm_clk_get() fails due to probe deferral, we shouldn't print an error message. Just be silent in this case. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz --- Changes since v2: -New patch. (This change was previously part of another patch in this series.) drivers/clk/qcom/apcs-msm8916.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index a6c89a310b18..46061b3d230e 100644 --- a/drivers/clk/qcom/apcs-msm8916.c +++ b/drivers/clk/qcom/apcs-msm8916.c @@ -79,7 +79,8 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) a53cc->pclk = devm_clk_get(parent, NULL); if (IS_ERR(a53cc->pclk)) { ret = PTR_ERR(a53cc->pclk); - dev_err(dev, "failed to get clk: %d\n", ret); + if (ret != -EPROBE_DEFER) + dev_err(dev, "failed to get clk: %d\n", ret); return ret; } From patchwork Mon Nov 25 13:59:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 11260455 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D3D014DB for ; Mon, 25 Nov 2019 13:59:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0DD562084D for ; Mon, 25 Nov 2019 13:59:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pSp7Ol94" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727959AbfKYN74 (ORCPT ); Mon, 25 Nov 2019 08:59:56 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:44115 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727896AbfKYN7z (ORCPT ); Mon, 25 Nov 2019 08:59:55 -0500 Received: by mail-lf1-f67.google.com with SMTP id v201so10052860lfa.11 for ; Mon, 25 Nov 2019 05:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YXy+WuvOjN2rxo0woDxe37oYVujdXQVJsXHamcAJo8s=; b=pSp7Ol94mVOT8XSa+yWvPEG7xUJEajtbNYMQyAaZdDVkeRekCsbedXVcnvPoSUieBn P/tLgljfOm7z0c6wH2TS8UMcwLqPFrPDehoM8jVdnnKgc5w77nQdjnB12JytOPc3nA6Q YFbGrKPyq2H15ektCpj8/4MeEJKfOsbPJ87kXqS5OA/cjTkSA/UFHxDEGF6B1DHwe81m GX0fEADDRQHmsdsyhIdT8PmmO9eIXM6DFb0kaYuoPvswX1QUh0EssgW2gXcK+Kqo5ObC +gqngfzNrQqNpk0Ff9kgQoOKZ4mkBd3aJbWNUQUDS/tDesp/kYgGJf8/WgST3sutuVof BqLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YXy+WuvOjN2rxo0woDxe37oYVujdXQVJsXHamcAJo8s=; b=dEX9OHZ7N8fxLTvsy3+Mo4nsf4K+fkUNw6CEasRQLdNXGMyzHuVwhAEMU8v4IN0B7H spJNfUTW8/Z/P2+ClxNESiRtnMFRa5t4ihx9yN47f3cQDGjgtabnqGl8KzyqbIAUSkL0 Jp4ihfza6g7OlFS1ADaJRIaJ8Pr4a0Bky3khl7z4NP7Onjoz6dHXJfWSc1MHSuKDpk9J lCLdPO1b2YjkQXn/baPF3JLx6lrPhFueUw0ZoVqzt/s5i92BmSbMmmgmzIiMYJmVTpvL pkP2A4jR1kzN0azqzJuE/fjQifDWgd0lcWCkmvIqFskE97Q7KdagGyj/KOs2eAKG9Qsy RHoA== X-Gm-Message-State: APjAAAWUUYvhKgQrHRUu2X1MH0ciD8GQsxQ/uf73gK+HMcbQPAP6slQp IOTOjSeDJa9kl9YNjDsXcNAcbA== X-Google-Smtp-Source: APXvYqyPjIvoOQFy64CzwfgIBIRTJ2G/GgebuJdA8M/WZlUJOpD7akE7Mk5euVGlZgzV+RlHm5XUBQ== X-Received: by 2002:a19:7d02:: with SMTP id y2mr19657341lfc.86.1574690392148; Mon, 25 Nov 2019 05:59:52 -0800 (PST) Received: from centauri.lan (ua-84-217-220-205.bbcust.telenor.se. [84.217.220.205]) by smtp.gmail.com with ESMTPSA id g11sm3688529lfb.94.2019.11.25.05.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 05:59:51 -0800 (PST) From: Niklas Cassel To: Andy Gross , Bjorn Andersson Cc: linux-arm-msm@vger.kernel.org, amit.kucheria@linaro.org, sboyd@kernel.org, Niklas Cassel , Michael Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 7/7] clk: qcom: apcs-msm8916: use clk_parent_data to specify the parent Date: Mon, 25 Nov 2019 14:59:09 +0100 Message-Id: <20191125135910.679310-8-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191125135910.679310-1-niklas.cassel@linaro.org> References: <20191125135910.679310-1-niklas.cassel@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Allow accessing the parent clock names required for the driver operation by using the device tree node, while falling back to the previous method of using names in the global name space. This permits extending the driver to other platforms without having to modify its source code. Co-developed-by: Jorge Ramirez-Ortiz Signed-off-by: Jorge Ramirez-Ortiz Signed-off-by: Niklas Cassel Tested-by: Bjorn Andersson Reviewed-by: Bjorn Andersson --- Changes since v2: -Use clk_parent_data when specifying clock parents. drivers/clk/qcom/apcs-msm8916.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index 46061b3d230e..bb91644edc00 100644 --- a/drivers/clk/qcom/apcs-msm8916.c +++ b/drivers/clk/qcom/apcs-msm8916.c @@ -19,9 +19,9 @@ static const u32 gpll0_a53cc_map[] = { 4, 5 }; -static const char * const gpll0_a53cc[] = { - "gpll0_vote", - "a53pll", +static const struct clk_parent_data pdata[] = { + { .fw_name = "aux", .name = "gpll0_vote", }, + { .fw_name = "pll", .name = "a53pll", }, }; /* @@ -51,6 +51,19 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) struct clk_init_data init = { }; int ret = -ENODEV; + /* + * This driver is defined by the devicetree binding + * Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt, + * however, this driver is registered as a platform device by + * qcom-apcs-ipc-mailbox.c. Because of this, when this driver + * uses dev_get_regmap() and devm_clk_get(), it has to send the parent + * device as argument. + * When registering with the clock framework, we cannot use this trick, + * since the clock framework always looks at dev->of_node when it tries + * to find parent clock names using clk_parent_data. + */ + dev->of_node = parent->of_node; + regmap = dev_get_regmap(parent, NULL); if (!regmap) { dev_err(dev, "failed to get regmap: %d\n", ret); @@ -62,8 +75,8 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) return -ENOMEM; init.name = "a53mux"; - init.parent_names = gpll0_a53cc; - init.num_parents = ARRAY_SIZE(gpll0_a53cc); + init.parent_data = pdata; + init.num_parents = ARRAY_SIZE(pdata); init.ops = &clk_regmap_mux_div_ops; init.flags = CLK_SET_RATE_PARENT;