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: "Andrew Lunn" <andrew@lunn.ch>,
	"Clément Léger" <clement.leger@bootlin.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Biju Das" <biju.das.jz@bp.renesas.com>,
	"Fabrizio Castro" <fabrizio.castro.jz@renesas.com>,
	"Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH net-next v2 6/9] net: pcs: rzn1-miic: Make switch mode mask SoC-specific
Date: Fri, 5 Sep 2025 11:01:06 +0100	[thread overview]
Message-ID: <CA+V-a8unTSqBottT7uDGkSxDYpRAYnpZvRC2RKsm9M0rw09iFQ@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdVnhjA0xi+wojMc40Zmv_JBZpOm04GO_ewBSzFndbtegQ@mail.gmail.com>

Hi Geert,

On Fri, Sep 5, 2025 at 8:02 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Andrew,
>
> On Thu, 4 Sept 2025 at 22:37, Andrew Lunn <andrew@lunn.ch> wrote:
> > On Thu, Sep 04, 2025 at 12:42:00PM +0100, Prabhakar wrote:
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > Move the hardcoded switch mode mask definition into the SoC-specific
> > > miic_of_data structure. This allows each SoC to define its own mask
> > > value rather than relying on a single fixed constant. For RZ/N1 the
> > > mask remains GENMASK(4, 0).
> > >
> > > This is in preparation for adding support for RZ/T2H, where the
> > > switch mode mask is GENMASK(2, 0).
> >
> > > -#define MIIC_MODCTRL_SW_MODE         GENMASK(4, 0)
> >
> > >       miic_reg_writel(miic, MIIC_MODCTRL,
> > > -                     FIELD_PREP(MIIC_MODCTRL_SW_MODE, cfg_mode));
> > > +                     ((cfg_mode << __ffs(sw_mode_mask)) & sw_mode_mask));
> >
> > _ffs() should return 0 for both GENMASK(2,0) and GENMASK(4, 0). So
> > this __ffs() is pointless.
> >
> > You might however want to add a comment that this assumption is being
> > made.
>
> I guess Prabhakar did it this way to make it easier to find
> candidates for a future conversion to field_prep(), if this ever becomes
> available[1].
>
> [1] "[PATCH v3 0/4] Non-const bitfield helpers"
>     https://lore.kernel.org/all/cover.1739540679.git.geert+renesas@glider.be
>
Ah thanks, I wanted to explore this and add a new macro but I thought
it might delay this series so I dropped it. Hopefully your series will
get in soon.

Cheers,
Prabhakar

  reply	other threads:[~2025-09-05 10:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 11:41 [PATCH net-next v2 0/9] Add PCS support for Renesas RZ/{T2H,N2H} SoCs Prabhakar
2025-09-04 11:41 ` [PATCH net-next v2 1/9] dt-bindings: net: pcs: renesas,rzn1-miic: Add RZ/T2H and RZ/N2H support Prabhakar
2025-09-04 11:41 ` [PATCH net-next v2 2/9] net: pcs: rzn1-miic: Drop trailing comma from of_device_id table Prabhakar
2025-09-04 20:16   ` Andrew Lunn
2025-09-04 11:41 ` [PATCH net-next v2 3/9] net: pcs: rzn1-miic: Add missing include files Prabhakar
2025-09-04 20:16   ` Andrew Lunn
2025-09-04 11:41 ` [PATCH net-next v2 4/9] net: pcs: rzn1-miic: Move configuration data to SoC-specific struct Prabhakar
2025-09-04 11:41 ` [PATCH net-next v2 5/9] net: pcs: rzn1-miic: move port range handling into SoC data Prabhakar
2025-09-04 20:24   ` Andrew Lunn
2025-09-04 11:42 ` [PATCH net-next v2 6/9] net: pcs: rzn1-miic: Make switch mode mask SoC-specific Prabhakar
2025-09-04 20:37   ` Andrew Lunn
2025-09-05  7:02     ` Geert Uytterhoeven
2025-09-05 10:01       ` Lad, Prabhakar [this message]
2025-09-05 12:02     ` Lad, Prabhakar
2025-09-04 11:42 ` [PATCH net-next v2 7/9] net: pcs: rzn1-miic: Add support to handle resets Prabhakar
2025-09-04 20:43   ` Andrew Lunn
2025-09-04 11:42 ` [PATCH net-next v2 8/9] net: pcs: rzn1-miic: Add per-SoC control for MIIC register unlock/lock Prabhakar
2025-09-04 20:55   ` Andrew Lunn
2025-09-05 11:48     ` Lad, Prabhakar
2025-09-04 11:42 ` [PATCH net-next v2 9/9] net: pcs: rzn1-miic: Add RZ/T2H MIIC support Prabhakar
2025-09-04 20:57   ` Andrew Lunn
2025-09-05 11:49     ` Lad, Prabhakar
2025-09-04 12:41 ` [PATCH net-next v2 0/9] Add PCS support for Renesas RZ/{T2H,N2H} SoCs Simon Horman
2025-09-04 12:47   ` Lad, Prabhakar
2025-09-06 12:19 ` Wolfram Sang
2025-09-10 10:18   ` Wolfram Sang
2025-09-10 19:06     ` 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-a8unTSqBottT7uDGkSxDYpRAYnpZvRC2RKsm9M0rw09iFQ@mail.gmail.com \
    --to=prabhakar.csengg@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=clement.leger@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=hkallweit1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=magnus.damm@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --cc=wsa+renesas@sang-engineering.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).