All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Edworthy <phil.edworthy@renesas.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	Biju Das <biju.das.jz@bp.renesas.com>
Subject: RE: [PATCH v2 09/13] clk: renesas: rzg2l: Add support for RZ/V2M reset monitor reg
Date: Wed, 27 Apr 2022 18:00:24 +0000	[thread overview]
Message-ID: <OS3PR01MB708084236C44425A51C48B4CF5FA9@OS3PR01MB7080.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAMuHMdXSRx5XxS0a0OkJd+tiyXmXGxprQkwgWDT9FODLz5=msw@mail.gmail.com>

Hi Geert,

On  26 April 2022 16:37 Geert Uytterhoeven wrote:
> On Wed, Mar 30, 2022 at 5:42 PM Phil Edworthy wrote:
> > The RZ/V2M doesn't have a matching set of reset monitor regs for each
> reset
> > reg like the RZ/G2L. Instead, it has a single CPG_RST_MON reg which has
> a
> > single bit per module.
> >
> > Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> 
> Thanks for your patch!
> 
> > --- a/drivers/clk/renesas/rzg2l-cpg.c
> > +++ b/drivers/clk/renesas/rzg2l-cpg.c
> > @@ -748,8 +748,12 @@ static int rzg2l_cpg_status(struct
> reset_controller_dev *rcdev,
> >         const struct rzg2l_cpg_info *info = priv->info;
> >         unsigned int reg = info->resets[id].off;
> >         u32 bitmask = BIT(info->resets[id].bit);
> > +       u32 monbitmask = BIT(info->resets[id].monbit);
> 
> BIT(-1) is not defined...
> 
> >
> > -       return !(readl(priv->base + CLK_MRST_R(reg)) & bitmask);
> > +       if (info->has_clk_mon_regs)
> > +               return !(readl(priv->base + CLK_MRST_R(reg)) & bitmask);
> > +       else
> > +               return !!(readl(priv->base + CPG_RST_MON) & monbitmask);
> 
> ... hence the above may behave badly when the reset has no bit in
> CPG_RST_MON (69 resets do not have a bit in CPG_RST_MON).

Ah, right. The SoCs other than RZ/V2M have monbit = -1, but they all
have info->has_clk_mon_regs = 1.
Still, I take you point that it's not very good code.


> > --- a/drivers/clk/renesas/rzg2l-cpg.h
> > +++ b/drivers/clk/renesas/rzg2l-cpg.h
> > @@ -18,6 +18,7 @@
> >  #define CPG_PL3_SSEL           (0x408)
> >  #define CPG_PL6_SSEL           (0x414)
> >  #define CPG_PL6_ETH_SSEL       (0x418)
> > +#define CPG_RST_MON            (0x680)
> >
> >  #define CPG_CLKSTATUS_SELSDHI0_STS     BIT(28)
> >  #define CPG_CLKSTATUS_SELSDHI1_STS     BIT(29)
> > @@ -151,17 +152,22 @@ struct rzg2l_mod_clk {
> >   *
> >   * @off: register offset
> >   * @bit: reset bit
> > + * @monbit: monitor bit in CPG_RST_MON register, -1 if none
> >   */
> >  struct rzg2l_reset {
> >         u16 off;
> >         u8 bit;
> > +       s8 monbit;
> >  };
> >
> > -#define DEF_RST(_id, _off, _bit)       \
> > +#define DEF_RST_MON(_id, _off, _bit, _monbit)  \
> >         [_id] = { \
> >                 .off = (_off), \
> > -               .bit = (_bit) \
> > +               .bit = (_bit), \
> > +               .monbit = (_monbit) \
> >         }
> > +#define DEF_RST(_id, _off, _bit)       \
> > +       DEF_RST_MON(_id, _off, _bit, -1)
> >
> >  /**
> >   * struct rzg2l_cpg_info - SoC-specific CPG Description

Thanks
Phil

  reply	other threads:[~2022-04-27 18:00 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 15:40 [PATCH v2 00/14] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
2022-03-30 15:40 ` [PATCH v2 01/13] dt-bindings: arm: renesas: Document Renesas RZ/V2M SoC and EVK board Phil Edworthy
2022-04-26 14:18   ` Geert Uytterhoeven
2022-03-30 15:40 ` [PATCH v2 02/13] dt-bindings: serial: renesas,em-uart: Document r9a09g011 bindings Phil Edworthy
2022-04-04 19:24   ` Rob Herring
2022-04-20 21:26   ` Geert Uytterhoeven
2022-04-22  8:28     ` Phil Edworthy
2022-04-22  8:45       ` Geert Uytterhoeven
2022-04-22  9:31         ` Phil Edworthy
2022-04-22 15:22           ` Geert Uytterhoeven
2022-03-30 15:40 ` [PATCH v2 03/13] dt-bindings: clock: Add r9a09g011 CPG Clock Definitions Phil Edworthy
2022-04-04 19:24   ` Rob Herring
2022-04-20 21:12   ` Geert Uytterhoeven
2022-04-22 11:29     ` Phil Edworthy
2022-04-22 15:02       ` Geert Uytterhoeven
2022-04-25  9:40         ` Phil Edworthy
2022-03-30 15:40 ` [PATCH v2 04/13] dt-bindings: clock: renesas,rzg2l: Document RZ/V2M SoC Phil Edworthy
2022-04-26 14:21   ` Geert Uytterhoeven
2022-04-26 14:39     ` Phil Edworthy
2022-04-26 15:00       ` Geert Uytterhoeven
2022-03-30 15:40 ` [PATCH v2 05/13] serial: 8250: Make SERIAL_8250_EM available for arm64 systems Phil Edworthy
2022-04-26 14:23   ` Geert Uytterhoeven
2022-03-30 15:40 ` [PATCH v2 07/13] clk: renesas: rzg2l: Set HIWORD mask for all mux and dividers Phil Edworthy
2022-04-26 15:20   ` Geert Uytterhoeven
2022-03-30 15:40 ` [PATCH v2 08/13] clk: renesas: rzg2l: Make use of CLK_MON registers optional Phil Edworthy
2022-04-26 15:31   ` Geert Uytterhoeven
2022-03-30 15:40 ` [PATCH v2 09/13] clk: renesas: rzg2l: Add support for RZ/V2M reset monitor reg Phil Edworthy
2022-04-26 15:37   ` Geert Uytterhoeven
2022-04-27 18:00     ` Phil Edworthy [this message]
2022-03-30 15:40 ` [PATCH v2 10/13] clk: renesas: Add RZ/V2M support using the rzg2l driver Phil Edworthy
2022-04-26 16:19   ` Geert Uytterhoeven
2022-03-30 15:40 ` [PATCH v2 11/13] arm64: defconfig: Enable Renesas RZ/V2M SoC Phil Edworthy
2022-03-30 15:40   ` Phil Edworthy
2022-04-26 16:20   ` Geert Uytterhoeven
2022-04-26 16:20     ` Geert Uytterhoeven
2022-03-30 15:40 ` [PATCH v2 12/13] arm64: dts: renesas: Add initial DTSI for " Phil Edworthy
2022-04-26 18:13   ` Geert Uytterhoeven
2022-04-27 18:53     ` Phil Edworthy
2022-04-28  7:28       ` Geert Uytterhoeven
2022-03-30 15:40 ` [PATCH v2 13/13] arm64: dts: renesas: Add initial device tree for RZ/V2M EVK Phil Edworthy
2022-04-26 18:17   ` Geert Uytterhoeven
2022-04-20 20:11 ` [PATCH v2 00/14] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Geert Uytterhoeven
2022-04-20 20:28   ` Phil Edworthy
2022-04-20 20:43 ` [PATCH v2 06/13] soc: renesas: Add RZ/V2M (R9A09G011) config option Phil Edworthy
2022-04-26 15:02   ` Geert Uytterhoeven

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=OS3PR01MB708084236C44425A51C48B4CF5FA9@OS3PR01MB7080.jpnprd01.prod.outlook.com \
    --to=phil.edworthy@renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mturquette@baylibre.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 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.