devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yao Zi <me@ziyao.cc>
To: Yixun Lan <dlan@gentoo.org>, Stephen Boyd <sboyd@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>
Cc: Haylen Chu <heylenay@4d2.org>,
	Inochi Amaoto <inochiama@gmail.com>,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 2/4] clk: spacemit: ccu_mix: add inverted enable gate clock
Date: Thu, 11 Dec 2025 03:26:25 +0000	[thread overview]
Message-ID: <aTo54Q3luukdJiJw@pie> (raw)
In-Reply-To: <20251211-k3-clk-v1-2-8ee47c70c5bc@gentoo.org>

On Thu, Dec 11, 2025 at 09:19:42AM +0800, Yixun Lan wrote:
> K3 SoC has the clock IP which support to write value 0 for enabling the
> clock, while write 1 for disabling it, thus the enable BIT is inverted.
> So, introduce a flag to support the inverted gate clock.
> 
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---
>  drivers/clk/spacemit/ccu_mix.c | 12 ++++++++----
>  drivers/clk/spacemit/ccu_mix.h | 12 ++++++++++++
>  2 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/spacemit/ccu_mix.c b/drivers/clk/spacemit/ccu_mix.c
> index 7b7990875372..14fbf7048c89 100644
> --- a/drivers/clk/spacemit/ccu_mix.c
> +++ b/drivers/clk/spacemit/ccu_mix.c
> @@ -16,17 +16,19 @@
>  static void ccu_gate_disable(struct clk_hw *hw)
>  {
>  	struct ccu_mix *mix = hw_to_ccu_mix(hw);
> +	struct ccu_gate_config *gate = &mix->gate;
> +	u32 val = gate->inverted ? gate->mask : 0;
>  
> -	ccu_update(&mix->common, ctrl, mix->gate.mask, 0);
> +	ccu_update(&mix->common, ctrl, gate->mask, val);
>  }
>  
>  static int ccu_gate_enable(struct clk_hw *hw)
>  {
>  	struct ccu_mix *mix = hw_to_ccu_mix(hw);
>  	struct ccu_gate_config *gate = &mix->gate;
> +	u32 val = gate->inverted ? 0 : gate->mask;
>  
> -	ccu_update(&mix->common, ctrl, gate->mask, gate->mask);
> -
> +	ccu_update(&mix->common, ctrl, gate->mask, val);

An unrelated blank line gets removed here, is this intended?

>  	return 0;
>  }

Regards,
Yao Zi

  reply	other threads:[~2025-12-11  3:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11  1:19 [PATCH RFC 0/4] Add clock support for SpacemiT K3 SoC Yixun Lan
2025-12-11  1:19 ` [PATCH RFC 1/4] dt-bindings: soc: spacemit: add k3 syscon compatible Yixun Lan
2025-12-15 16:37   ` Rob Herring (Arm)
2025-12-11  1:19 ` [PATCH RFC 2/4] clk: spacemit: ccu_mix: add inverted enable gate clock Yixun Lan
2025-12-11  3:26   ` Yao Zi [this message]
2025-12-11  1:19 ` [PATCH RFC 3/4] clk: spacemit: ccu_pll: add plla type clock Yixun Lan
2025-12-11  1:19 ` [PATCH RFC 4/4] clk: spacemit: k3: add the clock tree Yixun Lan
2025-12-11  3:38   ` Yao Zi

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=aTo54Q3luukdJiJw@pie \
    --to=me@ziyao.cc \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@gentoo.org \
    --cc=heylenay@4d2.org \
    --cc=inochiama@gmail.com \
    --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=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=spacemit@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;
as well as URLs for NNTP newsgroup(s).