linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Chen-Yu Tsai <wens@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej@kernel.org>,
	Samuel Holland <samuel@sholland.org>,
	linux-sunxi@lists.linux.dev, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/8] clk: sunxi-ng: mp: Fix dual-divider clock rate readback
Date: Fri, 5 Sep 2025 16:12:36 +0100	[thread overview]
Message-ID: <20250905161236.51b6ecee@donnerap> (raw)
In-Reply-To: <20250830170901.1996227-4-wens@kernel.org>

On Sun, 31 Aug 2025 01:08:56 +0800
Chen-Yu Tsai <wens@kernel.org> wrote:

> From: Chen-Yu Tsai <wens@csie.org>
> 
> When dual-divider clock support was introduced, the P divider offset was
> left out of the .recalc_rate readback function. This causes the clock
> rate to become bogus or even zero (possibly due to the P divider being
> 1, leading to a divide-by-zero).

Ah, a nice catch, thanks for that! Just curious, how did you find this?
The MMC clocks use the dual divider type as well, but I didn't observe
them being wrong?

Regardless:

> Fix this by incorporating the P divider offset into the calculation.
> 
> Fixes: 45717804b75e ("clk: sunxi-ng: mp: introduce dual-divider clock")
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Thanks,
Andre

> ---
>  drivers/clk/sunxi-ng/ccu_mp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/sunxi-ng/ccu_mp.c b/drivers/clk/sunxi-ng/ccu_mp.c
> index 354c981943b6..4221b1888b38 100644
> --- a/drivers/clk/sunxi-ng/ccu_mp.c
> +++ b/drivers/clk/sunxi-ng/ccu_mp.c
> @@ -185,7 +185,7 @@ static unsigned long ccu_mp_recalc_rate(struct clk_hw *hw,
>  	p &= (1 << cmp->p.width) - 1;
>  
>  	if (cmp->common.features & CCU_FEATURE_DUAL_DIV)
> -		rate = (parent_rate / p) / m;
> +		rate = (parent_rate / (p + cmp->p.offset)) / m;
>  	else
>  		rate = (parent_rate >> p) / m;
>  



  reply	other threads:[~2025-09-05 19:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-30 17:08 [PATCH 0/8] arm64: allwinner: a523: Enable MCU PRCM and NPU Chen-Yu Tsai
2025-08-30 17:08 ` [PATCH 1/8] dt-bindings: clock: sun55i-a523-ccu: Add missing NPU module clock Chen-Yu Tsai
2025-09-01 21:29   ` Rob Herring (Arm)
2025-09-05 15:12   ` Andre Przywara
2025-08-30 17:08 ` [PATCH 2/8] dt-bindings: clock: sun55i-a523-ccu: Add A523 MCU CCU clock controller Chen-Yu Tsai
2025-09-01 21:31   ` Rob Herring (Arm)
2025-08-30 17:08 ` [PATCH 3/8] clk: sunxi-ng: mp: Fix dual-divider clock rate readback Chen-Yu Tsai
2025-09-05 15:12   ` Andre Przywara [this message]
2025-09-05 15:17     ` Chen-Yu Tsai
2025-08-30 17:08 ` [PATCH 4/8] clk: sunxi-ng: sun55i-a523-ccu: Add missing NPU module clock Chen-Yu Tsai
2025-09-05 15:14   ` Andre Przywara
2025-09-05 15:19     ` Chen-Yu Tsai
2025-08-30 17:08 ` [PATCH 5/8] clk: sunxi-ng: div: support power-of-two dividers Chen-Yu Tsai
2025-08-30 17:08 ` [PATCH 6/8] clk: sunxi-ng: add support for the A523/T527 MCU CCU Chen-Yu Tsai
2025-09-05 15:14   ` Andre Przywara
2025-09-05 16:13     ` Chen-Yu Tsai
2025-09-05 17:21       ` Andre Przywara
2025-08-30 17:09 ` [PATCH 7/8] arm64: dts: allwinner: a523: Add MCU PRCM CCU node Chen-Yu Tsai
2025-09-05 15:14   ` Andre Przywara
2025-08-30 17:09 ` [PATCH 8/8] arm64: dts: allwinner: a523: Add NPU device node Chen-Yu Tsai
2025-09-05 15:14   ` Andre Przywara
2025-09-10 15:46 ` (subset) [PATCH 0/8] arm64: allwinner: a523: Enable MCU PRCM and NPU Chen-Yu Tsai
2025-09-10 15:48 ` Chen-Yu Tsai
2025-09-11  8:32   ` Chen-Yu Tsai

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=20250905161236.51b6ecee@donnerap \
    --to=andre.przywara@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jernej@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=sboyd@kernel.org \
    --cc=wens@csie.org \
    --cc=wens@kernel.org \
    /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).