Re: [RFC PATCH net-next v3 14/15] net: dsa: mt7530: introduce driver for MT7988 built-in switch
From: Daniel Golle
Date: Wed Mar 29 2023 - 15:05:18 EST
On Wed, Mar 29, 2023 at 06:57:54PM +0200, Andrew Lunn wrote:
> > @@ -18,6 +18,7 @@ enum mt753x_id {
> > ID_MT7530 = 0,
> > ID_MT7621 = 1,
> > ID_MT7531 = 2,
> > + ID_MT7988 = 3,
> > };
> >
> > #define NUM_TRGMII_CTRL 5
> > @@ -54,11 +55,11 @@ enum mt753x_id {
> > #define MT7531_MIRROR_PORT_SET(x) (((x) & MIRROR_MASK) << 16)
> > #define MT7531_CPU_PMAP_MASK GENMASK(7, 0)
> >
> > -#define MT753X_MIRROR_REG(id) (((id) == ID_MT7531) ? \
> > +#define MT753X_MIRROR_REG(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \
> > MT7531_CFC : MT7530_MFC)
> > -#define MT753X_MIRROR_EN(id) (((id) == ID_MT7531) ? \
> > +#define MT753X_MIRROR_EN(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \
> > MT7531_MIRROR_EN : MIRROR_EN)
> > -#define MT753X_MIRROR_MASK(id) (((id) == ID_MT7531) ? \
> > +#define MT753X_MIRROR_MASK(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \
> > MT7531_MIRROR_MASK : MIRROR_MASK)
>
> Are there more devices coming soon? I'm just wondering if these should
> change into static inline functions with a switch statement? The
> current code is not going to scale too much more.
Afaik no devices with different built-in switches are in the pipe at
this time, so this should be fine for a while.