Re: [PATCH net-next v13 11/16] net: dsa: mt7530: use external PCS driver

From: Daniel Golle
Date: Tue Mar 14 2023 - 13:45:37 EST


On Tue, Mar 14, 2023 at 08:16:35PM +0300, Arınç ÜNAL wrote:
> On 9.03.2023 13:57, Daniel Golle wrote:
> > [...]
> > +static int mt7530_regmap_read(void *context, unsigned int reg, unsigned int *val)
> > +{
> > + struct mt7530_priv *priv = context;
> > +
> > + *val = mt7530_read(priv, reg);
> > + return 0;
> > +};
> > +
> > +static int mt7530_regmap_write(void *context, unsigned int reg, unsigned int val)
> > +{
> > + struct mt7530_priv *priv = context;
> > +
> > + mt7530_write(priv, reg, val);
> > + return 0;
> > +};
> > +
> > +static int mt7530_regmap_update_bits(void *context, unsigned int reg,
> > + unsigned int mask, unsigned int val)
> > +{
> > + struct mt7530_priv *priv = context;
> > +
> > + mt7530_rmw(priv, reg, mask, val);
> > + return 0;
> > +};
> > +
> > +static const struct regmap_bus mt7531_regmap_bus = {
> > + .reg_write = mt7530_regmap_write,
> > + .reg_read = mt7530_regmap_read,
> > + .reg_update_bits = mt7530_regmap_update_bits,
>
> These new functions can be used for both switches, mt7530 and mt7531,
> correct?

In theory, yes, they could be used on all switch ICs supported by the
mt7530.c driver. In practise they are used on MT7531 only because MT7530
and MT7621 don't have any SGMII/SerDes ports, but only MT7531 does.


> If so, I believe they are supposed to be called mt753x since
> 88bdef8be9f6 ("net: dsa: mt7530: Extend device data ready for adding a new
> hardware").
>
> mt753x: functions that can be used for mt7530 and mt7531 switches.
> mt7530: functions specific to mt7530 switch.
> mt7531: functions specific to mt7531 switch.

Good catch, so mt7530_* is for sure not accurate. I used that naming
due to existing function names mt7530_read, mt7530_write and mt7530_rmw.

Given the situation I've explained above I think that mt753x_* would
be the best and I will change that for v14.

Thank you for reviewing!


Daniel