All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Han Gao" <gaohan@iscas.ac.cn>
Cc: devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev,
	linux-clk@vger.kernel.org, linux-rtc@vger.kernel.org,
	linux-gpio@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH 06/19] clk: sunxi-ng: add support for the Allwinner V861 CCU
Date: Fri, 13 Nov 2026 22:46:34 +0000	[thread overview]
Message-ID: <sashiko-outbox-213839@kernel.org> (raw)
In-Reply-To: <20261114-v861-v1-6-eb71ec3ee523@iscas.ac.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] clk: sunxi-ng: ccu_mp_set_rate() ignores
  CCU_FEATURE_UPDATE_BIT for dram_clk
--

commit 4dcfa888826dc579312b5e254290daa03aed3f59
Author: Han Gao <gaohan@iscas.ac.cn>

clk: sunxi-ng: add support for the Allwinner V861 CCU

This commit adds the main CCU clock and reset driver for the Allwinner
V861 SoC.

> diff --git a/drivers/clk/sunxi-ng/ccu-sun252i-v861.c b/drivers/clk/sunxi-ng/ccu-sun252i-v861.c
> new file mode 100644
> index 0000000000000..af84c49fbaf16
> --- /dev/null
> +++ b/drivers/clk/sunxi-ng/ccu-sun252i-v861.c
[ ... ]
> +static const struct clk_parent_data dram_parents[] = {
> +	{ .fw_name = "hosc" },
> +	{ .hw = &pll_ddr_clk.common.hw },
> +	{ .hw = &pll_periph0_2x_clk.common.hw },
> +	{ .hw = &pll_periph0_800M_clk.common.hw },
> +};
> +
> +static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(dram_clk, "dram", dram_parents,
> +					    0x800,
> +					    0, 5,	/* M */
> +					    8, 2,	/* P */
> +					    24, 3,	/* mux */
> +					    BIT(31),	/* gate */
> +					    CLK_IS_CRITICAL,
> +					    CCU_FEATURE_UPDATE_BIT);

[Severity: Medium]
Does changing the rate of dram_clk actually latch the new dividers in
hardware?

dram_clk uses ccu_mp_ops with CCU_FEATURE_UPDATE_BIT, but unlike
ccu_div_set_rate(), ccu_mp_set_rate() never checks CCU_FEATURE_UPDATE_BIT
or sets CCU_SUNXI_UPDATE_BIT before writing the register:

drivers/clk/sunxi-ng/ccu_mp.c:ccu_mp_set_rate() {
    ...
	if (shift)
		reg |= ilog2(p) << cmp->p.shift;
	else
		reg |= (p - cmp->p.offset) << cmp->p.shift;

	writel(reg, cmp->common.base + cmp->common.reg);
    ...
}

When clk_set_rate() updates the M or P dividers without a parent mux or
gate change, the hardware ignores the unlatched divider update while
ccu_mp_recalc_rate() reads back the new register fields and reports the
wrong rate to the clock framework and child clocks such as mbus_clk.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261114-v861-v1-0-eb71ec3ee523@iscas.ac.cn?part=6

  reply	other threads:[~2026-11-13 22:46 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 22:33 [PATCH 00/19] riscv: add initial support for the Allwinner V861 and Avaota F2 Han Gao
2026-11-13 22:33 ` Han Gao via B4 Relay
2026-11-13 22:33 ` Han Gao via B4 Relay
2026-11-13 22:33 ` [PATCH 01/19] riscv: sunxi: describe the wider Allwinner SoC family Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao
2026-11-13 22:36   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 02/19] dt-bindings: riscv: cpus: add the XuanTie C907 Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:39   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 03/19] dt-bindings: interrupt-controller: add the Allwinner V861 PLIC Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:37   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 04/19] dt-bindings: timer: add the Allwinner V861 CLINT Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:36   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 05/19] dt-bindings: clock: sunxi-ng: document the Allwinner V861 CCUs Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:39   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 06/19] clk: sunxi-ng: add support for the Allwinner V861 CCU Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:46   ` sashiko-bot [this message]
2026-11-13 22:33 ` [PATCH 07/19] clk: sunxi-ng: add support for the Allwinner V861 PRCM CCU Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:36   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 08/19] dt-bindings: rtc: sun6i: add the Allwinner V861 RTC Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:37   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 09/19] clk: sunxi-ng: sun6i-rtc: allow variants without a 32k fanout mux Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:36   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 10/19] clk: sunxi-ng: sun6i-rtc: allow another 24 MHz to 32k divider ratio Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:36   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 11/19] clk: sunxi-ng: sun6i-rtc: add Allwinner V861 support Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:37   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 12/19] dt-bindings: pinctrl: add the Allwinner V861 pin controllers Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:41   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 13/19] pinctrl: sunxi: allow a per-controller IRQ register base Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:39   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 14/19] pinctrl: sunxi: add support for the Allwinner V861 PIO Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:42   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 15/19] pinctrl: sunxi: add support for the Allwinner V861 R-PIO Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:39   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 16/19] riscv: dts: allwinner: add the Allwinner V861 SoC Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:41   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 17/19] dt-bindings: riscv: sunxi: add the YuzukiHD Avaota F2 Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:37   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 18/19] riscv: dts: allwinner: add the YuzukiHD Avaota F2 board Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:39   ` sashiko-bot
2026-11-13 22:33 ` [PATCH 19/19] MAINTAINERS: add an entry for the Allwinner V861 SoC Han Gao
2026-11-13 22:33   ` Han Gao via B4 Relay
2026-11-13 22:33   ` Han Gao via B4 Relay

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=sashiko-outbox-213839@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gaohan@iscas.ac.cn \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.