Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Xukai Wang <kingxukai@zohomail.com>
To: Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Conor Dooley <conor@kernel.org>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	Samuel Holland <samuel.holland@sifive.com>,
	Troy Mitchell <TroyMitchell988@gmail.com>
Subject: Re: [PATCH v10 2/3] clk: canaan: Add clock driver for Canaan K230
Date: Thu, 22 Jan 2026 19:40:29 +0800	[thread overview]
Message-ID: <bf39fdb8-6698-418b-bd4a-6d8d40ccc9a0@zohomail.com> (raw)
In-Reply-To: <aW3o8xVziqb9iRBN@duge-virtual-machine>


On 2026/1/19 16:18, Jiayu Du wrote:
>> +
>> +K230_CLK_GATE_FORMAT(hs_hclk_src_gate,
>> +		     K230_HS_HCLK_SRC_GATE,
>> +		     0x18, 0, 0, 0,
>> +		     &hs_hclk_high_src_rate.clk.hw);
> Here, you replaced hs_hclk_high_gate(in v9) with hs_hclk_high_src_rate,

I'm a bit confused, as I don't recall making these specific changes.
Looking at the code below, the only difference between v9 and v10 is
within the K230_CLK_GATE_FORMAT(hs_hclk_src_gate, ...) definition, where
the second parameter changed from 1 to 0. Everything else appears
consistent. Could you clarify which change you were referring to?

The code

in v8:

+K230_CLK_RATE_FORMAT(hs_hclk_high_src_rate, +
K230_HS_HCLK_HIGH_SRC_RATE, + 1, 1, 0, 0, + 1, 8, 0, 0x7, + 0x1C, 31,
div, 0x0, + false, 0, + &pll0_div4.hw); +
+K230_CLK_GATE_FORMAT(hs_hclk_high_gate, + K230_HS_HCLK_HIGH_GATE, +
0x18, 1, 0, 0, + &hs_hclk_high_src_rate.clk.hw); +
+K230_CLK_GATE_FORMAT(hs_hclk_src_gate, + K230_HS_HCLK_SRC_GATE, + 0x18,
1, 0, 0, + &hs_hclk_high_src_rate.clk.hw); +
+K230_CLK_RATE_FORMAT(hs_hclk_src_rate, + K230_HS_HCLK_SRC_RATE, + 1, 1,
0, 0, + 1, 8, 3, 0x7, + 0x1C, 31, div, 0x0, + false, 0, +
&hs_hclk_src_gate.clk.hw);

in v9:

+K230_CLK_RATE_FORMAT(hs_hclk_high_src_rate, +
K230_HS_HCLK_HIGH_SRC_RATE, + 1, 1, 0, 0, + 1, 8, 0, 0x7, + 0x1C, 31,
div, 0x0, + false, 0, + &pll0_div4.hw); +
+K230_CLK_GATE_FORMAT(hs_hclk_high_gate, + K230_HS_HCLK_HIGH_GATE, +
0x18, 1, 0, 0, + &hs_hclk_high_src_rate.clk.hw); +
+K230_CLK_GATE_FORMAT(hs_hclk_src_gate, + K230_HS_HCLK_SRC_GATE, + 0x18,
1, 0, 0, + &hs_hclk_high_src_rate.clk.hw); +
+K230_CLK_RATE_FORMAT(hs_hclk_src_rate, + K230_HS_HCLK_SRC_RATE, + 1, 1,
0, 0, + 1, 8, 3, 0x7, + 0x1C, 31, div, 0x0, + false, 0, +
&hs_hclk_src_gate.clk.hw); +

in v10:

+K230_CLK_RATE_FORMAT(hs_hclk_high_src_rate, +
K230_HS_HCLK_HIGH_SRC_RATE, + 1, 1, 0, 0, + 1, 8, 0, 0x7, + 0x1C, 31,
div, 0x0, + false, 0, + &pll0_div4.hw); +
+K230_CLK_GATE_FORMAT(hs_hclk_high_gate, + K230_HS_HCLK_HIGH_GATE, +
0x18, 1, 0, 0, + &hs_hclk_high_src_rate.clk.hw); +
+K230_CLK_GATE_FORMAT(hs_hclk_src_gate, + K230_HS_HCLK_SRC_GATE, + 0x18,
0, 0, 0, + &hs_hclk_high_src_rate.clk.hw); +
+K230_CLK_RATE_FORMAT(hs_hclk_src_rate, + K230_HS_HCLK_SRC_RATE, + 1, 1,
0, 0, + 1, 8, 3, 0x7, + 0x1C, 31, div, 0x0, + false, 0, +
&hs_hclk_src_gate.clk.hw);

> but after my board test, I find that when hs_hclk_high_gate is turned
> off, the mmc/sd and other high-speed subsystems can not work. So maybe
> you should not change the hs_hclk_high_gate to hs_hclk_high_src_rate.

Regarding the clock management, I recommend explicitly enabling
hs_hclk_high_gateas it will be closed by `close unused clocks`.

>
> When I used clk_ignore_unused, I saw the log as follows, while the enable
> and prepare count of hs_hclk_high_gate is zero. Here is the log:
>        pll0_div4                     5  5  0  400000000   0   0     50000      Y  deviceless   no_connection_id
>           hs_hclk_high_src_rate      1  1  0  400000000   0   0     50000      Y     deviceless   no_connection_id
>              hs_hclk_high_gate       0  0  0  400000000   0   0     50000      Y        deviceless   no_connection_id
>              hs_hclk_src_gate        1  1  0  400000000   0   0     50000      Y        deviceless   no_connection_id
>                 hs_hclk_src_rate     4  4  0  200000000   0   0     50000      Y           deviceless   no_connection_id
>                    hs_sd0_ahb_gate   1  1  0  200000000   0   0     50000      Y              91580000.mmc   ahb
>                                                                                             deviceless   no_connection_id
>                    hs_sd1_ahb_gate   1  1  0  200000000   0   0     50000      Y              91581000.mmc   ahb
>                                                                                             deviceless   no_connection_id
>                    hs_ssi1_ahb_gate  0  0  0  200000000   0   0     50000      Y              deviceless   no_connection_id
>                    hs_ssi2_ahb_gate  0  0  0  200000000   0   0     50000      Y              deviceless   no_connection_id
>                    hs_usb0_ahb_gate  1  1  0  200000000   0   0     50000      Y              91500000.usb   otg
>                                                                                             deviceless   no_connection_id
>                    hs_usb1_ahb_gate  1  1  0  200000000   0   0     50000      Y              91540000.usb   otg
>
> Regards,
> Jiayu Du
>> +
>> +K230_CLK_RATE_FORMAT(hs_hclk_src_rate,
>> +		     K230_HS_HCLK_SRC_RATE,

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2026-01-22 11:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16 13:26 [PATCH v10 0/3] riscv: canaan: Add support for K230 clock Xukai Wang
2026-01-16 13:26 ` [PATCH v10 1/3] dt-bindings: clock: Add bindings for Canaan K230 clock controller Xukai Wang
2026-01-16 13:26 ` [PATCH v10 2/3] clk: canaan: Add clock driver for Canaan K230 Xukai Wang
2026-01-19  8:18   ` Jiayu Du
2026-01-22 11:40     ` Xukai Wang [this message]
2026-01-22 16:01       ` Jiayu Du
2026-01-27 11:03         ` Xukai Wang
2026-01-27 12:22           ` Jiayu Du
2026-01-27 13:21             ` Xukai Wang
2026-01-16 13:26 ` [PATCH v10 3/3] riscv: dts: canaan: Add clock definition for K230 Xukai Wang
2026-02-04 16:15 ` [PATCH v10 0/3] riscv: canaan: Add support for K230 clock Jiayu Du
2026-02-13 16:37   ` Xukai Wang
2026-02-14  6:33     ` Jiayu Du
2026-02-14  7:34       ` Xukai Wang
2026-02-14  8:15         ` Jiayu Du

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=bf39fdb8-6698-418b-bd4a-6d8d40ccc9a0@zohomail.com \
    --to=kingxukai@zohomail.com \
    --cc=TroyMitchell988@gmail.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jiayu.riscv@isrc.iscas.ac.cn \
    --cc=krzk+dt@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh@kernel.org \
    --cc=samuel.holland@sifive.com \
    --cc=sboyd@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