Re: [PATCH net-next v2 2/4] net: dsa: yt921x: Refactor long register helpers
From: David Yang
Date: Thu Apr 02 2026 - 20:48:19 EST
On Fri, Apr 3, 2026 at 8:26 AM Andrew Lunn <andrew@xxxxxxx> wrote:
>
> > -static int yt921x_reg64_write(struct yt921x_priv *priv, u32 reg, u64 val)
>
> > +yt921x_reg64_write(struct yt921x_priv *priv, u32 reg, const u32 *vals)
> > +{
>
> The old reg64_write actually took a u64 value, so the name fit. The
> new one takes 2x a u32. So i'm not sure calling is reg64 actually
> fits. Maybe yt921x_reg32x2_write()?
>
> > +static int yt921x_vlan_del(struct yt921x_priv *priv, int port, u16 vid)
> > {
> > - u64 mask64;
> > + u32 masks[2];
> >
> > - mask64 = YT921X_VLAN_CTRL_PORTS(port) |
> > - YT921X_VLAN_CTRL_UNTAG_PORTn(port);
> > + masks[0] = YT921X_VLAN_CTRLa_PORTn(port);
> > + masks[1] = YT921X_VLAN_CTRLb_UNTAG_PORTn(port);
> >
> > - return yt921x_reg64_clear_bits(priv, YT921X_VLANn_CTRL(vid), mask64);
> > + return yt921x_reg64_clear_bits(priv, YT921X_VLANn_CTRL(vid), masks);
>
> Or you could make yt921x_reg64_write() continue to take a u64, and
> avoid all these changes?
>
I'd like so, but I hate much to use u64 for 2x and u32[] for 3x.
> How does the datasheet describe these registers? Are they 64bit
> registers, or 2x 32bit registers?
>
They act more like 64b/96b registers since there are unaligned fields
across the 32bit boundary.
> Andrew