Re: [PATCH net-next 02/13] net: dsa: sja1105: allow SGMII PCS configuration to be per port

Vladimir Oltean
2021-05-26T12:40:07Z

On Mon, May 24, 2021 at 07:16:20PM -0700, Florian Fainelli wrote:
>
>
> On 5/24/2021 4:22 PM, Vladimir Oltean wrote:
> > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> >
> > The SJA1105 R and S switches have 1 SGMII port (port 4). Because there
> > is only one such port, there is no "port" parameter in the configuration
> > code for the SGMII PCS.
> >
> > However, the SJA1110 can have up to 4 SGMII ports, each with its own
> > SGMII register map. So we need to generalize the logic.
> >
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > ---
> [snip]
> >
> > - if (sja1105_supports_sgmii(priv, SJA1105_SGMII_PORT)) {
> > - bool an_enabled = !!(bmcr & BMCR_ANENABLE);
> > + if (!sja1105_supports_sgmii(priv, i))
> > + continue;
> > +
> > + an_enabled = !!(bmcr[i] & BMCR_ANENABLE);
>
> Nit you could have a temporary bmcr variable here in the loop which
> aliases bmcr[i] just for the sake of reducing the diff to review.
>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

I could have, but I don't have a good name for the bmcr array, and
"bmcr = bmcr_arr[i]" looks worse to me than just working with bmcr[i].