devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: 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>,
	 Magnus Damm <magnus.damm@gmail.com>,
	linux-renesas-soc@vger.kernel.org,  linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org,
	 Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
	 Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [RFC PATCH v2 3/4] clk: renesas: Add family-specific clock driver for RZ/V2H(P)
Date: Thu, 27 Jun 2024 14:24:45 +0100	[thread overview]
Message-ID: <CA+V-a8vFjZdprmxFyHn1v4Uc7X7ZGhhxTMxXXgrZQTikO50=6w@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdUryuN9xfYEX_eVGp1hV9zzhw5=bjvJBQb1FwcBcrNs4g@mail.gmail.com>

Hi Geert,

On Thu, Jun 27, 2024 at 8:01 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Wed, Jun 26, 2024 at 7:36 PM Lad, Prabhakar
> <prabhakar.csengg@gmail.com> wrote:
> > On Wed, Jun 26, 2024 at 11:07 AM Geert Uytterhoeven
> > <geert@linux-m68k.org> wrote:
> > > On Tue, Jun 11, 2024 at 1:32 AM Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > >
> > > > Add family-specific clock driver for RZ/V2H(P) SoCs.
> > > >
> > > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> > > > +/**
> > > > + * struct mod_clock - Module clock
> > > > + *
> > > > + * @hw: handle between common and hardware-specific interfaces
> > > > + * @off: register offset
> > > > + * @bit: ON/MON bit
> > > > + * @monoff: monitor register offset
> > > > + * @monbit: montor bit
> > > > + * @priv: CPG private data
> > > > + */
> > > > +struct mod_clock {
> > > > +       struct clk_hw hw;
> > > > +       u8 on_index;
> > > > +       u8 on_bit;
> > > > +       u16 mon_index;
>
> BTW, why is this u16? The corresponding member in rzv2h_mod_clk is u8.
>
Oops, I will fix this.

> > > > +       u8 mon_bit;
>
> > > > +static int rzv2h_mod_clock_endisable(struct clk_hw *hw, bool enable)
> > > > +{
> > > > +       struct mod_clock *clock = to_mod_clock(hw);
> > > > +       unsigned int reg = GET_CLK_ON_OFFSET(clock->on_index);
> > > > +       struct rzv2h_cpg_priv *priv = clock->priv;
> > > > +       u32 bitmask = BIT(clock->on_bit);
> > > > +       struct device *dev = priv->dev;
> > > > +       u32 value;
> > > > +       int error;
> > > > +
> > > > +       dev_dbg(dev, "CLK_ON 0x%x/%pC %s\n", reg, hw->clk,
> > > > +               enable ? "ON" : "OFF");
> > > > +
> > > > +       value = bitmask << 16;
> > > > +       if (enable)
> > > > +               value |= bitmask;
> > > > +
> > > > +       writel(value, priv->base + reg);
> > > > +
> > > > +       if (!enable)
> > > > +               return 0;
> > > > +
> > > > +       reg = GET_CLK_MON_OFFSET(clock->mon_index);
> > >
> > > What if a clock does not have a clock monitor bit?
> > > Clock bits in registers CPG_CLKON_22 and later do not have corresponding
> > > clock monitor bits.
> > >
> > Oops I had missed this case.
> >
> > I'll introduce a macro (NO_MON_REG_INDEX) for clocks which do not have
> > monitor support and add a check above to skip clk monitor operation if
> > clock->mon_index == NO_MON_REG_INDEX.
> >
> > /* monitor index for clocks which do not have CLKMON support */
> > #define NO_MON_REG_INDEX    0xff
> >
> > Does this sound OK?
>
> Either that, or make mon_index signed (which would reduce its
> effective range by one bit).
>
Ok I'll make it to s8 instead and add a negative check monitor index.

Cheers,
Prabhakar

  reply	other threads:[~2024-06-27 13:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10 23:32 [RFC PATCH v2 0/4] Add CPG support for RZ/V2H(P) SoC Prabhakar
2024-06-10 23:32 ` [RFC PATCH v2 1/4] dt-bindings: clock: renesas: Document RZ/V2H(P) SoC CPG Prabhakar
2024-06-11  7:02   ` Krzysztof Kozlowski
2024-06-13  9:53     ` Lad, Prabhakar
2024-06-13 12:57       ` Krzysztof Kozlowski
2024-06-26  9:35         ` Geert Uytterhoeven
2024-06-26  9:41           ` Krzysztof Kozlowski
2024-06-26 11:45             ` Geert Uytterhoeven
2024-06-13 10:07   ` Lad, Prabhakar
2024-06-10 23:32 ` [RFC PATCH v2 2/4] dt-bindings: clock: Add R9A09G057 core clocks Prabhakar
2024-06-11  6:59   ` Krzysztof Kozlowski
2024-06-13  9:57     ` Lad, Prabhakar
2024-06-13 12:55       ` Krzysztof Kozlowski
2024-06-13 15:15         ` Geert Uytterhoeven
2024-06-13 18:55           ` Lad, Prabhakar
2024-06-17  8:05   ` Geert Uytterhoeven
2024-06-10 23:32 ` [RFC PATCH v2 3/4] clk: renesas: Add family-specific clock driver for RZ/V2H(P) Prabhakar
2024-06-26 10:06   ` Geert Uytterhoeven
2024-06-26 17:35     ` Lad, Prabhakar
2024-06-27  7:00       ` Geert Uytterhoeven
2024-06-27 13:24         ` Lad, Prabhakar [this message]
2024-06-10 23:32 ` [RFC PATCH v2 4/4] clk: renesas: Add RZ/V2H(P) CPG driver Prabhakar
2024-06-26 10:14   ` Geert Uytterhoeven
2024-06-27 13:27     ` Lad, Prabhakar

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='CA+V-a8vFjZdprmxFyHn1v4Uc7X7ZGhhxTMxXXgrZQTikO50=6w@mail.gmail.com' \
    --to=prabhakar.csengg@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert@linux-m68k.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).