[PATCH net-next v2 3/6] net: dsa: lantiq_gswip: ignore SerDes modes in phylink_mac_config()

Daniel Golle posted 6 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH net-next v2 3/6] net: dsa: lantiq_gswip: ignore SerDes modes in phylink_mac_config()
Posted by Daniel Golle 1 month, 1 week ago
We can safely ignore SerDes interface modes 1000Base-X, 2500Base-X and
SGMII in phylink_mac_config() as they are being taken care of by the
PCS.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
v2: no changes

 drivers/net/dsa/lantiq/lantiq_gswip.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq/lantiq_gswip.c
index acb6996356e9..3e2a54569828 100644
--- a/drivers/net/dsa/lantiq/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq/lantiq_gswip.c
@@ -1444,6 +1444,10 @@ static void gswip_phylink_mac_config(struct phylink_config *config,
 	miicfg |= GSWIP_MII_CFG_LDCLKDIS;
 
 	switch (state->interface) {
+	case PHY_INTERFACE_MODE_SGMII:
+	case PHY_INTERFACE_MODE_1000BASEX:
+	case PHY_INTERFACE_MODE_2500BASEX:
+		return;
 	case PHY_INTERFACE_MODE_MII:
 	case PHY_INTERFACE_MODE_INTERNAL:
 		miicfg |= GSWIP_MII_CFG_MODE_MIIM;
-- 
2.51.0
Re: [PATCH net-next v2 3/6] net: dsa: lantiq_gswip: ignore SerDes modes in phylink_mac_config()
Posted by Vladimir Oltean 1 month ago
On Wed, Aug 27, 2025 at 12:06:03AM +0100, Daniel Golle wrote:
> We can safely ignore SerDes interface modes 1000Base-X, 2500Base-X and
> SGMII in phylink_mac_config() as they are being taken care of by the
> PCS.
> 
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
> v2: no changes
> 
>  drivers/net/dsa/lantiq/lantiq_gswip.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq/lantiq_gswip.c
> index acb6996356e9..3e2a54569828 100644
> --- a/drivers/net/dsa/lantiq/lantiq_gswip.c
> +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c
> @@ -1444,6 +1444,10 @@ static void gswip_phylink_mac_config(struct phylink_config *config,
>  	miicfg |= GSWIP_MII_CFG_LDCLKDIS;
>  
>  	switch (state->interface) {
> +	case PHY_INTERFACE_MODE_SGMII:
> +	case PHY_INTERFACE_MODE_1000BASEX:
> +	case PHY_INTERFACE_MODE_2500BASEX:
> +		return;
>  	case PHY_INTERFACE_MODE_MII:
>  	case PHY_INTERFACE_MODE_INTERNAL:
>  		miicfg |= GSWIP_MII_CFG_MODE_MIIM;
> -- 
> 2.51.0

Is "miicfg" irrelevant in these 3 modes? Doesn't it have to be set to
GSWIP_MII_CFG_MODE_GMII?
Re: [PATCH net-next v2 3/6] net: dsa: lantiq_gswip: ignore SerDes modes in phylink_mac_config()
Posted by Daniel Golle 1 month ago
On Thu, Aug 28, 2025 at 11:39:35PM +0300, Vladimir Oltean wrote:
> On Wed, Aug 27, 2025 at 12:06:03AM +0100, Daniel Golle wrote:
> > We can safely ignore SerDes interface modes 1000Base-X, 2500Base-X and
> > SGMII in phylink_mac_config() as they are being taken care of by the
> > PCS.
> > 
> > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> > ---
> > v2: no changes
> > 
> >  drivers/net/dsa/lantiq/lantiq_gswip.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/net/dsa/lantiq/lantiq_gswip.c b/drivers/net/dsa/lantiq/lantiq_gswip.c
> > index acb6996356e9..3e2a54569828 100644
> > --- a/drivers/net/dsa/lantiq/lantiq_gswip.c
> > +++ b/drivers/net/dsa/lantiq/lantiq_gswip.c
> > @@ -1444,6 +1444,10 @@ static void gswip_phylink_mac_config(struct phylink_config *config,
> >  	miicfg |= GSWIP_MII_CFG_LDCLKDIS;
> >  
> >  	switch (state->interface) {
> > +	case PHY_INTERFACE_MODE_SGMII:
> > +	case PHY_INTERFACE_MODE_1000BASEX:
> > +	case PHY_INTERFACE_MODE_2500BASEX:
> > +		return;
> >  	case PHY_INTERFACE_MODE_MII:
> >  	case PHY_INTERFACE_MODE_INTERNAL:
> >  		miicfg |= GSWIP_MII_CFG_MODE_MIIM;
> > -- 
> > 2.51.0
> 
> Is "miicfg" irrelevant in these 3 modes? Doesn't it have to be set to
> GSWIP_MII_CFG_MODE_GMII?

The function is basically already a no-op for SGMII ports for which
there isn't a GSWIP_MII_CFG register (ie. gswip_mii_mask_cfg() will
just return and do nothing). The same is true for gswip_mii_mask_pcdu(),
so what is left is just the printing of the error message
"Unsupported interface: ...", which is misleading (and could maybe be
removed completely now that I think about it as phylink_get_caps() should
already make sure that phylink_mac_config() only gets called with a
supported interface mode).