From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Yassine Oudjana <y.oudjana@protonmail.com>
Cc: Andy Gross <agross@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Ilia Lin <ilia.lin@kernel.org>, Viresh Kumar <vireshk@kernel.org>,
Nishanth Menon <nm@ti.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Loic Poulain <loic.poulain@linaro.org>,
Konrad Dybcio <konrad.dybcio@somainline.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@somainline.org>,
linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht,
phone-devel@vger.kernel.org
Subject: Re: [PATCH 3/8] clk: qcom: msm8996-cpu: Add MSM8996 Pro CBF support
Date: Sun, 24 Oct 2021 12:30:09 -0500 [thread overview]
Message-ID: <YXWYIUUi3rY3N+aK@builder.lan> (raw)
In-Reply-To: <20211014083016.137441-4-y.oudjana@protonmail.com>
On Thu 14 Oct 03:32 CDT 2021, Yassine Oudjana wrote:
> MSM8996 Pro (MSM8996SG) has a few differences in the CBF clock.
>
I think it would be nice if you described what those differences are.
Regards,
Bjorn
> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
> ---
> Dependencies:
> - clk: qcom: msm8996-cpu: Add CBF support
> https://lore.kernel.org/linux-arm-msm/20210528192541.1120703-1-konrad.dybcio@somainline.org/
>
> drivers/clk/qcom/clk-cpu-8996.c | 61 +++++++++++++++++++++------------
> 1 file changed, 40 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/clk/qcom/clk-cpu-8996.c b/drivers/clk/qcom/clk-cpu-8996.c
> index 8afc271f92d0..ab2acbe74f0f 100644
> --- a/drivers/clk/qcom/clk-cpu-8996.c
> +++ b/drivers/clk/qcom/clk-cpu-8996.c
> @@ -70,11 +70,11 @@ enum _pmux_input {
>
> enum {
> CBF_PLL_INDEX = 1,
> - CBF_DIV_2_INDEX,
> + CBF_DIV_INDEX,
> CBF_SAFE_INDEX
> };
>
> -#define DIV_2_THRESHOLD 600000000
> +#define DIV_THRESHOLD 600000000
> #define PWRCL_REG_OFFSET 0x0
> #define PERFCL_REG_OFFSET 0x80000
> #define MUX_OFFSET 0x40
> @@ -142,6 +142,17 @@ static const struct alpha_pll_config cbfpll_config = {
> .early_output_mask = BIT(3),
> };
>
> +static const struct alpha_pll_config cbfpll_config_pro = {
> + .l = 72,
> + .config_ctl_val = 0x200d4aa8,
> + .config_ctl_hi_val = 0x006,
> + .pre_div_mask = BIT(12),
> + .post_div_mask = 0x3 << 8,
> + .post_div_val = 0x3 << 8,
> + .main_output_mask = BIT(0),
> + .early_output_mask = BIT(3),
> +};
> +
> static struct clk_alpha_pll perfcl_pll = {
> .offset = PERFCL_REG_OFFSET,
> .regs = prim_pll_regs,
> @@ -230,7 +241,8 @@ struct clk_cpu_8996_mux {
> u8 width;
> struct notifier_block nb;
> struct clk_hw *pll;
> - struct clk_hw *pll_div_2;
> + struct clk_hw *pll_div;
> + u8 div;
> struct clk_regmap clkr;
> };
>
> @@ -280,11 +292,11 @@ static int clk_cpu_8996_mux_determine_rate(struct clk_hw *hw,
> struct clk_cpu_8996_mux *cpuclk = to_clk_cpu_8996_mux_hw(hw);
> struct clk_hw *parent = cpuclk->pll;
>
> - if (cpuclk->pll_div_2 && req->rate < DIV_2_THRESHOLD) {
> - if (req->rate < (DIV_2_THRESHOLD / 2))
> + if (cpuclk->pll_div &&req->rate < DIV_THRESHOLD) {
> + if (req->rate < (DIV_THRESHOLD / cpuclk->div))
> return -EINVAL;
>
> - parent = cpuclk->pll_div_2;
> + parent = cpuclk->pll_div;
> }
>
> req->best_parent_rate = clk_hw_round_rate(parent, req->rate);
> @@ -336,7 +348,8 @@ static struct clk_cpu_8996_mux pwrcl_pmux = {
> .shift = 0,
> .width = 2,
> .pll = &pwrcl_pll.clkr.hw,
> - .pll_div_2 = &pwrcl_smux.clkr.hw,
> + .pll_div = &pwrcl_smux.clkr.hw,
> + .div = 2,
> .nb.notifier_call = cpu_clk_notifier_cb,
> .clkr.hw.init = &(struct clk_init_data) {
> .name = "pwrcl_pmux",
> @@ -358,7 +371,8 @@ static struct clk_cpu_8996_mux perfcl_pmux = {
> .shift = 0,
> .width = 2,
> .pll = &perfcl_pll.clkr.hw,
> - .pll_div_2 = &perfcl_smux.clkr.hw,
> + .pll_div = &perfcl_smux.clkr.hw,
> + .div = 2,
> .nb.notifier_call = cpu_clk_notifier_cb,
> .clkr.hw.init = &(struct clk_init_data) {
> .name = "perfcl_pmux",
> @@ -481,19 +495,23 @@ static int qcom_cbf_clk_msm8996_register_clks(struct device *dev,
> struct regmap *regmap)
> {
> int ret;
> + bool is_pro = of_device_is_compatible(dev->of_node, "qcom,msm8996pro-apcc");
>
> - cbf_mux.pll_div_2 = clk_hw_register_fixed_factor(dev, "cbf_pll_main",
> - "cbf_pll", CLK_SET_RATE_PARENT,
> - 1, 2);
> - if (IS_ERR(cbf_mux.pll_div_2)) {
> + cbf_mux.div = is_pro ? 4 : 2;
> + cbf_mux.pll_div = clk_hw_register_fixed_factor(dev, "cbf_pll_main",
> + "cbf_pll", CLK_SET_RATE_PARENT,
> + 1, cbf_mux.div);
> +
> + if (IS_ERR(cbf_mux.pll_div)) {
> dev_err(dev, "Failed to initialize cbf_pll_main\n");
> - return PTR_ERR(cbf_mux.pll_div_2);
> + return PTR_ERR(cbf_mux.pll_div);
> }
>
> ret = devm_clk_register_regmap(dev, cbf_msm8996_clks[0]);
> ret = devm_clk_register_regmap(dev, cbf_msm8996_clks[1]);
>
> - clk_alpha_pll_configure(&cbf_pll, regmap, &cbfpll_config);
> + clk_alpha_pll_configure(&cbf_pll, regmap, is_pro ?
> + &cbfpll_config_pro : &cbfpll_config);
> clk_set_rate(cbf_pll.clkr.hw.clk, 614400000);
> clk_prepare_enable(cbf_pll.clkr.hw.clk);
> clk_notifier_register(cbf_mux.clkr.hw.clk, &cbf_mux.nb);
> @@ -575,7 +593,7 @@ static int cpu_clk_notifier_cb(struct notifier_block *nb, unsigned long event,
> qcom_cpu_clk_msm8996_acd_init(base);
> break;
> case POST_RATE_CHANGE:
> - if (cnd->new_rate < DIV_2_THRESHOLD)
> + if (cnd->new_rate < DIV_THRESHOLD)
> ret = clk_cpu_8996_mux_set_parent(&cpuclk->clkr.hw,
> DIV_2_INDEX);
> else
> @@ -600,15 +618,15 @@ static int cbf_clk_notifier_cb(struct notifier_block *nb, unsigned long event,
>
> switch (event) {
> case PRE_RATE_CHANGE:
> - parent = clk_hw_get_parent_by_index(&cbfclk->clkr.hw, CBF_DIV_2_INDEX);
> - ret = clk_cpu_8996_mux_set_parent(&cbfclk->clkr.hw, CBF_DIV_2_INDEX);
> + parent = clk_hw_get_parent_by_index(&cbfclk->clkr.hw, CBF_DIV_INDEX);
> + ret = clk_cpu_8996_mux_set_parent(&cbfclk->clkr.hw, CBF_DIV_INDEX);
>
> - if (cnd->old_rate > DIV_2_THRESHOLD && cnd->new_rate < DIV_2_THRESHOLD)
> - ret = clk_set_rate(parent->clk, cnd->old_rate / 2);
> + if (cnd->old_rate > DIV_THRESHOLD && cnd->new_rate < DIV_THRESHOLD)
> + ret = clk_set_rate(parent->clk, cnd->old_rate / cbfclk->div);
> break;
> case POST_RATE_CHANGE:
> - if (cnd->new_rate < DIV_2_THRESHOLD)
> - ret = clk_cpu_8996_mux_set_parent(&cbfclk->clkr.hw, CBF_DIV_2_INDEX);
> + if (cnd->new_rate < DIV_THRESHOLD)
> + ret = clk_cpu_8996_mux_set_parent(&cbfclk->clkr.hw, CBF_DIV_INDEX);
> else {
> parent = clk_hw_get_parent_by_index(&cbfclk->clkr.hw, CBF_PLL_INDEX);
> ret = clk_set_rate(parent->clk, cnd->new_rate);
> @@ -676,6 +694,7 @@ static int qcom_cpu_clk_msm8996_driver_remove(struct platform_device *pdev)
>
> static const struct of_device_id qcom_cpu_clk_msm8996_match_table[] = {
> { .compatible = "qcom,msm8996-apcc" },
> + { .compatible = "qcom,msm8996pro-apcc" },
> {}
> };
> MODULE_DEVICE_TABLE(of, qcom_cpu_clk_msm8996_match_table);
> --
> 2.33.0
>
>
next prev parent reply other threads:[~2021-10-24 17:30 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-14 8:30 [PATCH 0/8] Add support for MSM8996 Pro Yassine Oudjana
2021-10-14 8:31 ` [PATCH 1/8] dt-bindings: clk: qcom: msm8996-apcc: Add CBF Yassine Oudjana
2021-10-14 14:31 ` Rob Herring
2021-10-16 15:16 ` Yassine Oudjana
2021-10-26 21:08 ` Rob Herring
2021-10-14 8:32 ` [PATCH 2/8] dt-bindings: clk: qcom: msm8996-apcc: Add MSM8996 Pro compatible Yassine Oudjana
2021-10-14 14:31 ` Rob Herring
2021-10-16 15:22 ` Yassine Oudjana
2021-10-26 21:08 ` Rob Herring
2021-10-14 8:32 ` [PATCH 3/8] clk: qcom: msm8996-cpu: Add MSM8996 Pro CBF support Yassine Oudjana
2021-10-15 18:54 ` Konrad Dybcio
2021-10-24 17:30 ` Bjorn Andersson [this message]
2021-10-14 8:32 ` [PATCH 4/8] cpufreq: qcom_cpufreq_nvmem: Simplify reading kryo speedbin Yassine Oudjana
2021-10-14 12:25 ` Dmitry Baryshkov
2021-10-15 18:58 ` Konrad Dybcio
2021-10-28 18:18 ` Bjorn Andersson
2021-10-14 8:32 ` [PATCH 5/8] dt-bindings: opp: Convert qcom-nvmem-cpufreq to DT schema Yassine Oudjana
2021-10-14 14:31 ` Rob Herring
2021-10-14 15:45 ` Rob Herring
2021-11-04 11:32 ` Yassine Oudjana
2021-10-14 8:32 ` [PATCH 6/8] dt-bindings: opp: qcom-cpufreq-nvmem: Remove SMEM Yassine Oudjana
2021-10-14 8:32 ` [PATCH 7/8] arm64: dts: qcom: msm8996: Add MSM8996 Pro support Yassine Oudjana
2021-10-15 19:01 ` Konrad Dybcio
2021-10-16 14:50 ` Yassine Oudjana
2021-10-16 15:09 ` Dmitry Baryshkov
2021-10-14 11:00 ` [PATCH 8/8] arm64: dts: qcom: msm8996-xiaomi-scorpio: Include msm8996pro.dtsi Yassine Oudjana
2021-10-15 19:03 ` Konrad Dybcio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YXWYIUUi3rY3N+aK@builder.lan \
--to=bjorn.andersson@linaro.org \
--cc=agross@kernel.org \
--cc=angelogioacchino.delregno@somainline.org \
--cc=devicetree@vger.kernel.org \
--cc=ilia.lin@kernel.org \
--cc=konrad.dybcio@somainline.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=mturquette@baylibre.com \
--cc=nm@ti.com \
--cc=phone-devel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=vireshk@kernel.org \
--cc=y.oudjana@protonmail.com \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).