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

Florian Fainelli
2021-05-25T02:16:27Z

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>
--
Florian