Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luo Jie" <jie.luo@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 05/12] clk: qcom: ipq-cmn-pll: Add NSS clock support
Date: Fri, 07 Aug 2026 07:18:44 +0000	[thread overview]
Message-ID: <20260807071845.39C2F1F01559@smtp.kernel.org> (raw)
In-Reply-To: <20260806-qcom_ipq5210_cmnpll-v2-5-cce718b8ec17@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The NSS clock is unconditionally registered as a fixed-rate clock, meaning the new divider registration logic is never invoked.
- [Medium] A kernel WARN will trigger during boot if the 6-bit hardware register happens to be 0.
--

--- Patch [5]: [PATCH v2 05/12] clk: qcom: ipq-cmn-pll: Add NSS clock support ---
commit 4b97f2d301b3cfbdff0e9b058b5b63be9ee7d0dd
Author: Luo Jie <jie.luo@oss.qualcomm.com>

clk: qcom: ipq-cmn-pll: Add NSS clock support

This patch adds NSS clock support by introducing a new clock registration
type and divider logic. It adds ipq_cmn_pll_regmap_div_register() to handle
the NSS clock divider and updates the clk_cmn_pll structures to specify the
clock type.

> diff --git a/drivers/clk/qcom/ipq-cmn-pll.c b/drivers/clk/qcom/ipq-cmn-pll.c
> index 4fdf78f6829e8..c1b00699eb72d 100644
> --- a/drivers/clk/qcom/ipq-cmn-pll.c
> +++ b/drivers/clk/qcom/ipq-cmn-pll.c

[ ... ]

> @@ -105,6 +123,7 @@ struct clk_cmn_pll {
>  #define CLK_PLL_OUTPUT(_id, _name, _rate) {		\
>  	.id =		_id,				\
>  	.name =		_name,				\
> +	.type =		CMN_PLL_CLK_FIXED_RATE,		\
>  	.rate =		_rate,				\
>  }

[Severity: Medium]
Since CLK_PLL_OUTPUT unconditionally assigns CMN_PLL_CLK_FIXED_RATE, and no
other macro is introduced to set CMN_PLL_CLK_NSS, will the NSS clock
actually use the new registration type?

It seems the switch statement in ipq_cmn_pll_register_clks() will only ever
evaluate to CMN_PLL_CLK_FIXED_RATE, leaving the new divider registration logic
as dead code.

[ ... ]

> @@ -357,11 +376,46 @@ static struct clk_hw *ipq_cmn_pll_clk_hw_register(struct platform_device *pdev)
>  	return &cmn_pll->hw;
>  }
>  
> +static struct clk_hw *ipq_cmn_pll_regmap_div_register(struct platform_device *pdev,
> +						      struct regmap *regmap,
> +						      struct clk_hw *cmn_pll_hw,
> +						      const char *name,
> +						      u32 field_mask)
> +{
> +	struct clk_parent_data pdata = { .hw = cmn_pll_hw };
> +	struct device *dev = &pdev->dev;
> +	struct clk_regmap_div *div_clk;
> +	int ret;
> +
> +	div_clk = devm_kzalloc(dev, sizeof(*div_clk), GFP_KERNEL);
> +	if (!div_clk)
> +		return ERR_PTR(-ENOMEM);
> +
> +	div_clk->reg = CMN_PLL_NSS_PPE_FREQ_CTRL;
> +	div_clk->shift = __ffs(field_mask);
> +	div_clk->width = hweight32(field_mask);
> +	div_clk->flags = CLK_DIVIDER_EVEN_INTEGERS_NO_OFFSET;

[Severity: Medium]
Will this trigger a generic clock framework WARN during boot if the
hardware register value happens to be 0?

Since the full 6-bit register range is now allowed, if the bootloader or
hardware leaves the register at 0, clk_regmap_div_ops.recalc_rate will
evaluate a divisor of 0. Without CLK_DIVIDER_ALLOW_ZERO included in the flags,
divider_recalc_rate() will trigger a WARN.

> +	div_clk->clkr.regmap = regmap;
> +	div_clk->clkr.hw.init = &(struct clk_init_data){
> +		.name = name,
> +		.parent_data = &pdata,
> +		.num_parents = 1,
> +		.ops = &clk_regmap_div_ops,
> +	};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260806-qcom_ipq5210_cmnpll-v2-0-cce718b8ec17@oss.qualcomm.com?part=5

  reply	other threads:[~2026-08-07  7:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07  6:53 [PATCH v2 00/12] clk: qcom: ipq-cmn-pll: Add IPQ5210 CMN PLL support Luo Jie
2026-08-07  6:53 ` [PATCH v2 01/12] clk: qcom: ipq-cmn-pll: Use devm_clk_hw_register_fixed_rate_parent_data Luo Jie
2026-08-07  6:53 ` [PATCH v2 02/12] dt-bindings: clock: qcom: Add CMN PLL support for IPQ5210 SoC Luo Jie
2026-08-07  6:53 ` [PATCH v2 03/12] clk: divider: Introduce CLK_DIVIDER_EVEN_INTEGERS_NO_OFFSET flag Luo Jie
2026-08-07  7:12   ` sashiko-bot
2026-08-07  6:53 ` [PATCH v2 04/12] clk: qcom: clk-regmap-divider: Support CLK_DIVIDER_* flags Luo Jie
2026-08-07  7:03   ` sashiko-bot
2026-08-07  6:53 ` [PATCH v2 05/12] clk: qcom: ipq-cmn-pll: Add NSS clock support Luo Jie
2026-08-07  7:18   ` sashiko-bot [this message]
2026-08-07  6:53 ` [PATCH v2 06/12] clk: qcom: ipq-cmn-pll: Add PPE " Luo Jie
2026-08-07  6:53 ` [PATCH v2 07/12] clk: qcom: ipq-cmn-pll: Add PON reference " Luo Jie
2026-08-07  7:03   ` sashiko-bot
2026-08-07  6:53 ` [PATCH v2 08/12] clk: qcom: ipq-cmn-pll: Add EPHY-RAW " Luo Jie
2026-08-07  7:04   ` sashiko-bot
2026-08-07  6:53 ` [PATCH v2 09/12] clk: qcom: ipq-cmn-pll: Add clock gate support for fixed clocks Luo Jie
2026-08-07  6:53 ` [PATCH v2 10/12] clk: qcom: ipq-cmn-pll: Add all output clocks for IPQ5210 Luo Jie
2026-08-07  6:53 ` [PATCH v2 11/12] arm64: dts: qcom: ipq5210: Add CMN PLL device node Luo Jie
2026-08-07  6:53 ` [PATCH v2 12/12] arm64: dts: qcom: Update IPQ5210 xo_board to use fixed factor clock Luo Jie
2026-08-07  7:22   ` sashiko-bot

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=20260807071845.39C2F1F01559@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jie.luo@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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