[PATCH net-next] net: stmmac: clarify difference between "interface" and "phy_interface"

Alexander Stein alexander.stein at ew.tq-group.com
Tue Aug 29 06:20:43 PDT 2023


Am Dienstag, 29. August 2023, 15:10:40 CEST schrieb Russell King (Oracle):
> On Tue, Aug 29, 2023 at 02:38:33PM +0200, Alexander Stein wrote:
> > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > > b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index
> > > ff330423ee66..35f4b1484029 100644
> > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > > @@ -419,9 +419,9 @@ stmmac_probe_config_dt(struct platform_device *pdev,
> > > u8
> > > *mac) return ERR_PTR(phy_mode);
> > > 
> > >  	plat->phy_interface = phy_mode;
> > > 
> > > -	plat->interface = stmmac_of_get_mac_mode(np);
> > > -	if (plat->interface < 0)
> > > -		plat->interface = plat->phy_interface;
> > > +	plat->mac_interface = stmmac_of_get_mac_mode(np);
> > > +	if (plat->mac_interface < 0)
> > 
> > This check is never true as mac_interface is now an unsigned enum
> > (phy_interface_t). Thus mac_interface is not set to phy_interface
> > resulting in an invalid mac_interface. My platform
> > (arch/arm64/boot/dts/freescale/imx8mp- tqma8mpql-mba8mpxl.dts) fails to
> > probe now.
> 
> Thanks for catching that. Does this patch fix it for you?
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index
> 231152ee5a32..0451d2c2aa43 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -420,9 +420,9 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8
> *mac) return ERR_PTR(phy_mode);
> 
>  	plat->phy_interface = phy_mode;
> -	plat->interface = stmmac_of_get_mac_mode(np);
> -	if (plat->interface < 0)
> -		plat->interface = plat->phy_interface;
> +
> +	rc = stmmac_of_get_mac_mode(np);
> +	plat->interface = rc < 0 ? plat->phy_interface : rc;

I need to use plat->mac_interface on top of your patch. But despite that this 
fixes the probe error.

Thanks and best regards,
Alexander

> 
>  	/* Some wrapper drivers still rely on phy_node. Let's save it while
>  	 * they are not converted to phylink. */


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/





More information about the Linux-mediatek mailing list