cip-dev.lists.cip-project.org archive mirror
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Pavel Machek <pavel@denx.de>
Cc: "cip-dev@lists.cip-project.org" <cip-dev@lists.cip-project.org>,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: RE: [PATCH 6.1.y-cip 3/8] mfd: Add Renesas RZ/G2L MTU3a core driver
Date: Mon, 12 Jun 2023 11:38:04 +0000	[thread overview]
Message-ID: <OS0PR01MB592224CE4AF99CA597F70E628654A@OS0PR01MB5922.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <ZIMAse1ikTuycJ02@duo.ucw.cz>

Hi Pavel,

Thanks for the feedback.

> Subject: Re: [PATCH 6.1.y-cip 3/8] mfd: Add Renesas RZ/G2L MTU3a core
> driver
> 
> Hi!
> 
> > The RZ/G2L multi-function timer pulse unit 3 (MTU3a) is embedded in
> > the Renesas RZ/G2L family SoCs. It consists of eight 16-bit timer
> > channels and one 32-bit timer channel. It supports the following
> > functions
> >  - Counter
> >  - Timer
> >  - PWM
> >
> > The 8/16/32 bit registers are mixed in each channel.
> >
> > Add MTU3a core driver for RZ/G2L SoC. The core driver shares the clk
> > and channel register access for the other child devices like Counter,
> > PWM and Clock event.
> 
> 
> 
> > +static void rz_mtu3_start_stop_ch(struct rz_mtu3_channel *ch, bool
> > +start) {
> > +	struct rz_mtu3 *mtu = dev_get_drvdata(ch->dev->parent);
> > +	struct rz_mtu3_priv *priv = mtu->priv_data;
> > +	unsigned long flags, tstr;
> > +	u16 offset;
> > +	u8 bitpos;
> > +
> > +	/* start stop register shared by multiple timer channels */
> > +	raw_spin_lock_irqsave(&priv->lock, flags);
> > +
> > +	offset = rz_mtu3_get_tstr_offset(ch);
> > +	bitpos = rz_mtu3_get_tstr_bit_pos(ch);
> 
> These two can be done outside raw_spin_lock protection.

Agreed.

> 
> > +	tstr = rz_mtu3_shared_reg_read(ch, offset);
> > +	__assign_bit(bitpos, &tstr, start);
> > +	rz_mtu3_shared_reg_write(ch, offset, tstr);
> > +
> > +	raw_spin_unlock_irqrestore(&priv->lock, flags); }
> > +
> > +bool rz_mtu3_is_enabled(struct rz_mtu3_channel *ch) {
> > +	struct rz_mtu3 *mtu = dev_get_drvdata(ch->dev->parent);
> > +	struct rz_mtu3_priv *priv = mtu->priv_data;
> > +	unsigned long flags, tstr;
> > +	bool ret = false;
> > +	u16 offset;
> > +	u8 bitpos;
> > +
> > +	/* start stop register shared by multiple timer channels */
> > +	raw_spin_lock_irqsave(&priv->lock, flags);
> > +
> > +	offset = rz_mtu3_get_tstr_offset(ch);
> > +	bitpos = rz_mtu3_get_tstr_bit_pos(ch);
> 
> These two can be done outside raw_spin_lock protection.

Agreed.
> 
> > +	tstr = rz_mtu3_shared_reg_read(ch, offset);
> > +	ret = tstr & BIT(bitpos);
> 
> As can be the ret computation.

Agreed. You mean "return tstr & BIT(bitpos);"??

Cheers,
Biju


  reply	other threads:[~2023-06-12 11:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06  7:52 [PATCH 6.1.y-cip 0/8] Add MTU3 core/counter driver support for RZ/G2L alike SoCs Biju Das
2023-06-06  7:52 ` [PATCH 6.1.y-cip 1/8] clk: renesas: r9a07g044: Add MTU3a clock and reset entry Biju Das
2023-06-06  7:52 ` [PATCH 6.1.y-cip 2/8] dt-bindings: timer: Document RZ/G2L MTU3a bindings Biju Das
2023-06-06  9:35   ` Pavel Machek
2023-06-06 10:18     ` Biju Das
2023-06-06  7:52 ` [PATCH 6.1.y-cip 3/8] mfd: Add Renesas RZ/G2L MTU3a core driver Biju Das
2023-06-06  9:59   ` Pavel Machek
2023-06-06 10:11     ` Biju Das
2023-06-09 10:31       ` Pavel Machek
2023-06-09 12:19         ` Biju Das
2023-06-09 10:36   ` Pavel Machek
2023-06-12 11:38     ` Biju Das [this message]
2023-06-06  7:52 ` [PATCH 6.1.y-cip 4/8] Documentation: ABI: sysfs-bus-counter: add cascade_counts_enable and external_input_phase_clock_select Biju Das
2023-06-06 10:01   ` Pavel Machek
2023-06-06 10:19     ` Biju Das
2023-06-06  7:52 ` [PATCH 6.1.y-cip 5/8] counter: Add Renesas RZ/G2L MTU3a counter driver Biju Das
2023-06-06 10:08   ` Pavel Machek
2023-06-06 10:33     ` Biju Das
2023-06-06  7:52 ` [PATCH 6.1.y-cip 6/8] MAINTAINERS: Add entries for " Biju Das
2023-06-06  7:52 ` [PATCH 6.1.y-cip 7/8] arm64: dts: renesas: r9a07g044: Add MTU3a node Biju Das
2023-06-06  7:52 ` [PATCH 6.1.y-cip 8/8] arm64: dts: renesas: r9a07g054: " Biju Das
2023-06-06  9:15 ` [PATCH 6.1.y-cip 0/8] Add MTU3 core/counter driver support for RZ/G2L alike SoCs Pavel Machek
2023-06-06  9:17   ` Biju Das
2023-06-22 11:13 ` Pavel Machek
2023-06-22 11:42   ` Biju Das

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=OS0PR01MB592224CE4AF99CA597F70E628654A@OS0PR01MB5922.jpnprd01.prod.outlook.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=Chris.Paterson2@renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=pavel@denx.de \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    /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).