From patchwork Mon Nov 25 13:59:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 11260437 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 DF54514DB for ; Mon, 25 Nov 2019 13:59:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAFAC20740 for ; Mon, 25 Nov 2019 13:59:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kV9PIvsT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727865AbfKYN7R (ORCPT ); Mon, 25 Nov 2019 08:59:17 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34185 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727770AbfKYN7Q (ORCPT ); Mon, 25 Nov 2019 08:59:16 -0500 Received: by mail-lj1-f196.google.com with SMTP id m6so8606616ljc.1 for ; Mon, 25 Nov 2019 05:59:14 -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=lG/dEFJRZZJTFXBXNbPzSOBTEcwuaUVy4vDeRn16uLE=; b=kV9PIvsTpDEeeeHqrU+NlQGF4XNrp1onAZwFq0GJ859YcuVZqo6KJEB4xsj48nIiez T9wnQsCNszYN9h/W2hciuikxEUGQt+Nq/3zEWDwlxIPXFm7D1pdguMsfNYsa4TLqRQTJ 8loQxAFsJQwzhVRZGzBQLeYn+snDn8oGfzecVMzM8ZluF0oDUq2bbFQKQr2sx8++CuVp hEydHcpEsu1ruAZQiVu/zBDvn50rpeb7cHsfs2GYdv/9NezdQ1jfySrXD311n+6QpDvs Mmauq7PS4XYV5ud6cQw/N0wKpYI5QNHxCKSkJE5J/67OWxCwt/szeVRdEysRi3sHkq8s qqbw== 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=lG/dEFJRZZJTFXBXNbPzSOBTEcwuaUVy4vDeRn16uLE=; b=P2iZreJCK5IPsxDmGhWEcBr3A8+przI+FLdS9q+3KonuLCG41EOvKlJGm7FnbMvWwO 8/iU2LA4J7KtRyrGCT4lboJX7gIPys8gKFIfiPM3BhJ8e65zNkiSE+c9/1q+XzNjU0uC TxvRlOKRC6jVk7Rs05PJzLnQPhPHAHTmTmadgx6PBABfHA4qJ/JQwXgv4Z9iPQrsdCg6 JkJNBs2HgAj9RAd2hePSCpuqTj0P7ArmA/kcwzdsbGVG7X6OfSvPBJsZmT/Nn81ZGGhA YLIi89GHaiNbCPO+7y1+W3Sr9BsBNcpObxW2H+VxH/fYmGSXrE3+CZ1Q3jXBR+KAM/ab agoA== X-Gm-Message-State: APjAAAUUVi2l13LS3zTE3QGjlmmdrXzqx5OHyH8XBWCR9P5LsorR1obm cCtklYt/5iJX/2rEkU7sThXj+A== X-Google-Smtp-Source: APXvYqxEMXtn++rv2T6XDXPQbZOMiGrgR/+Ja1deh3/9f2yuhrPDoGo4I5zMSZUtzpFDFbhsPetlZg== X-Received: by 2002:a05:651c:238:: with SMTP id z24mr23019892ljn.36.1574690354127; Mon, 25 Nov 2019 05:59:14 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 05:59:13 -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 , Rob Herring , Mark Rutland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/7] dt-bindings: mailbox: qcom: Add clock-name optional property Date: Mon, 25 Nov 2019 14:59:03 +0100 Message-Id: <20191125135910.679310-2-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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jorge Ramirez-Ortiz When the APCS clock is registered (platform dependent), it retrieves its parent names from hardcoded values in the driver. The following commit allows the DT node to provide such clock names to the platform data based clock driver therefore avoiding having to explicitly embed those names in the clock driver source code. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Rob Herring Reviewed-by: Bjorn Andersson --- Changes since v2: -Swapped order of "pll" and "aux", in order to not break DT backwards compatibility (in case no clock-names are given). .../mailbox/qcom,apcs-kpss-global.txt | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt b/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt index 0278482af65c..beec612dbe6a 100644 --- a/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt +++ b/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt @@ -21,10 +21,11 @@ platforms. Usage: required Value type: Definition: must specify the base address and size of the global block + - clocks: - Usage: required if #clocks-cells property is present - Value type: - Definition: phandle to the input PLL, which feeds the APCS mux/divider + Usage: required if #clock-names property is present + Value type: + Definition: phandles to the two parent clocks of the clock driver. - #mbox-cells: Usage: required @@ -36,6 +37,12 @@ platforms. Value type: Definition: as described in clock.txt, must be 0 +- clock-names: + Usage: required if the platform data based clock driver needs to + retrieve the parent clock names from device tree. + This will requires two mandatory clocks to be defined. + Value type: + Definition: must be "pll" and "aux" = EXAMPLE The following example describes the APCS HMSS found in MSM8996 and part of the @@ -68,3 +75,14 @@ Below is another example of the APCS binding on MSM8916 platforms: clocks = <&a53pll>; #clock-cells = <0>; }; + +Below is another example of the APCS binding on QCS404 platforms: + + apcs_glb: mailbox@b011000 { + compatible = "qcom,qcs404-apcs-apps-global", "syscon"; + reg = <0x0b011000 0x1000>; + #mbox-cells = <1>; + clocks = <&apcs_hfpll>, <&gcc GCC_GPLL0_AO_OUT_MAIN>; + clock-names = "pll", "aux"; + #clock-cells = <0>; + }; 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: 11260435 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 1F26C15AC for ; Mon, 25 Nov 2019 13:59:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 000DD20863 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 S1727869AbfKYN7S (ORCPT ); Mon, 25 Nov 2019 08:59:18 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:39039 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727666AbfKYN7R (ORCPT ); Mon, 25 Nov 2019 08:59:17 -0500 Received: by mail-lf1-f68.google.com with SMTP id f18so11087613lfj.6 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=c5galsTK7qp3/7Pxk6h4rr4Z4hSHQxdlFmL7Fprnc4oey3qMsHysuOMzucTRNLBq9V T6cgpPr8czgSbxrRi2Wy3JU0Mq5ZgtBckH7h9W0mTCCAgzEu+E8wlSkE9WZ22qL1A0WW K/QsqzojhXiMKh+1ldV4s1ABeNQviv3BXJwg/eLE9AVfVqpb9D8gCjHY+5bxhBzQBo83 9R0aX4cJ1lvINkVrqp1Wd6LfPeDALKQGOQQOwKjNjLZM7w+R8SCIxebkOlh/sG4yjeAu EZiR1F3fHrhKHGUvR9dw9GrbuECk7ajBj0Rn21VOSqmqqGzwBa6RC0R76BQRowKA2i1D Ouew== X-Gm-Message-State: APjAAAWt/Rzt4wp6bYPKP+SltLu1sPkLwFEn0TMAn4owSFpu9zMnOiYT /lUdC7/XifGnj0Ok0fEAAk3lllb87KLl3A== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 11260443 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 E7BB515AC 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 C949220863 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 S1727907AbfKYN7e (ORCPT ); Mon, 25 Nov 2019 08:59:34 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33372 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727904AbfKYN7e (ORCPT ); Mon, 25 Nov 2019 08:59:34 -0500 Received: by mail-lj1-f195.google.com with SMTP id t5so16005950ljk.0 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=mWGWPqZjCKFz5Sv5aGxBjtHb1I71UXmDKI1+JEtbi4XRCdLfNhkUNAz4YAdzKvW2ah QUulGynkmcyp+ly8epBvwObNiVFZwju+aw3IwvV139ghXdbO+ax/4PNzfF9ZCgrajOkD fzf/U8ma+hr9iWQ2ndboRXCZOTPRndDwidSKCzbbOzl2an8UPPGzWNqWeO/jx3hZVKa3 RDylrY1JaZsdeg4BOVrUKzlG3X3DYn/Sx4yj9tbDWQ6r+h5dGu35RrPTkp8isjOYMsoO Y/Di2/zAs+gEIXmoogyGrqC6WIC01Zl6wufRCjZfv3xqU+xBR5dY0wzdpte9S4g+8Rx1 rzQQ== X-Gm-Message-State: APjAAAUrMTI55oJFLjNhjtJToa7kUb2Z5qp18yeJuYaVsQCHVNk/CcSi nVoJFPUXD7qR6xOBfopMGCIcwg== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 11260445 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 CFA92930 for ; Mon, 25 Nov 2019 13:59:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AFC1C20863 for ; Mon, 25 Nov 2019 13:59:36 +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 S1727922AbfKYN7f (ORCPT ); Mon, 25 Nov 2019 08:59:35 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:40280 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727901AbfKYN7f (ORCPT ); Mon, 25 Nov 2019 08:59:35 -0500 Received: by mail-lj1-f193.google.com with SMTP id q2so15996705ljg.7 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=FFkJwaq+/JlFDsIsVWMxOChknOSHAVCQ8nthGflVxc25TSwSfzFPQMuYmgda4txnv5 2i1Gqk69IHRUzSeVMwzq+fLL6VOasyP9ilWjnEFA33sVd/0TyYfliRvdiTCJDuWFvnOd qUt7bKPoI+hnMPoDs7Csy7Pu3UdR5R2a5YXAeByIRrM46D6TsDU06zF9wT9F6fnxgLzK 1AXm/0IjlAarlYULBoP7svfQTy+MzbearL0Fv8t/zkwOaqsBdBAkLtfMOckYbqxREkJa I+pKfh5/s1KS/JWumjZ3OPtyeq/DqpVFTfqtQM2EV2SbK3Mp5ym4dKSk5JKQcguU5QAe PU7A== X-Gm-Message-State: APjAAAUOvXIjsYOky90MAffm/R+L4kZnRQsrbF+pfpzelN53sGtKk+Cp FcKO+7b+zXGGk3YzV1isoBsLKg== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 11260447 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 E3E56930 for ; Mon, 25 Nov 2019 13:59:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3C4420866 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="k9ZRUQYD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727722AbfKYN7i (ORCPT ); Mon, 25 Nov 2019 08:59:38 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44097 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727901AbfKYN7i (ORCPT ); Mon, 25 Nov 2019 08:59:38 -0500 Received: by mail-lf1-f68.google.com with SMTP id v201so10052144lfa.11 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=dWdpH/N3BzakPPzh0zYJLqc444F/+XDbk6Dd5V0kz2lfWglMRKVuYlsrdn7FmiXkoU w4l5izzoU/5KmjjxefW9pKYE8MY7OjD7QgJwLU9l9h1CheN46IZZgZ2wBpJp1x/Bkj+n iAuZg5Gx28oBu6p0entpxYm281kxO5lcnYwJWjnH3An7+BnEK8juc24jkWqmOH++CWQV LV09hVRLwyaUOMpHZLMYyR6pAZZLqdc0B/AvxU4ha0ZMY/vsdGJrPIA0HS2BSMdpB3m+ 3pJpptWtoNSfT1nwO933SIGCEQVWcXm++h8HywDjZkY2s7wMXG13mik26OnjSNF1akoK E5GQ== X-Gm-Message-State: APjAAAUOODKCMEFAKKRVQ7ha416IlhgBCdMKZH/vkqUahJ2Kq+7KhbT7 +NN/Pp0k2qhJ1u8uF6bMPmKNKg== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 11260453 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 95F4C930 for ; Mon, 25 Nov 2019 13:59:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75BA5207FD for ; Mon, 25 Nov 2019 13:59:53 +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 S1727948AbfKYN7x (ORCPT ); Mon, 25 Nov 2019 08:59:53 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:37549 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727877AbfKYN7w (ORCPT ); Mon, 25 Nov 2019 08:59:52 -0500 Received: by mail-lf1-f67.google.com with SMTP id b20so11111725lfp.4 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=IT1ay90WqqrZL7epWGjNez44PC0DmR+wxbozbQrI6pQElgkAsEylbNxWOOulPQqVzg 8IjSnmwTw+hR6BE4qDO/PUqXM4Pv0PoagkYco26Gj/CHTeh9eykwu5rIKbC3l3qFRSBr DcKTVx//gQDtMHHUrqd/Iww76xBPBbNSxZ6ijfhMBf48k89YcN7s1rvjvDfFaOCU+KaD SD4j8Z1dyzxBOJJv7A4ajyhRbF8C2lfV+3jnzUICrtEzy+LS8ncie5QR7ov8Tl1Hos60 H4XNd4JDQcO5n1UcGJkxMRTfEuehkgpfRC3VaCF99UDCSk8U481TRIjL7sDpqzRVqA/H 9VMA== X-Gm-Message-State: APjAAAV35IQBtuaFWPWlKRVamgQotENvDRPol7Zu+3mD7r/lWZ2Tm+fb yaVAyExELgeaqM7bscmtPRUBTg== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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: 11260457 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 55EEB15AC 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 36AAE2084D for ; Mon, 25 Nov 2019 13:59:57 +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 S1727896AbfKYN74 (ORCPT ); Mon, 25 Nov 2019 08:59:56 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:33530 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727767AbfKYN7y (ORCPT ); Mon, 25 Nov 2019 08:59:54 -0500 Received: by mail-lf1-f65.google.com with SMTP id d6so11128111lfc.0 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=kEeK8jvLiJ3+GexfMEzGk8zroh/vWIkEv774NvFg596cpJMfdKDP7dnm0ffQ1KcTsR J1nr32v9pquK+r7Jo/GTa1vW4q0YXgg/sYv9QVEMv1y9Lkw8Ws0DXh3r4C0u/gAe08Vg bA0BQV5qoVH/fgSuAe4fGGiJfU8HVKxDZS8zp9Ew+HBBgCQiobukoC8bshOcSrs0TYLz A6wqaz1wasvzah6Wcg9eCNul7kzIDP31pO56jtN5uiJe4pN4/T7q5QkrZNcrodh66T/j qXsfh4NVb0rz4jx5+EF/uL89nPl941dYyIHETR2i5ylBFdUXYxUOe/uiM01Rhaa/MYtp Q6qw== X-Gm-Message-State: APjAAAUdrxaEooyhu8VHmajk9P3f1bHLfBq+tPBLuvX8ujuP9CKo1St3 vGYS+YzxM5I7P/atPi3NYKkZPQ== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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;