[PATCH net-next] net: stmmac: dwc-qos: calibrate tegra with mdio bus idle

Maxime Chevallier maxime.chevallier at bootlin.com
Tue Apr 22 07:42:30 PDT 2025


Hello Russell,

On Tue, 22 Apr 2025 15:24:55 +0100
"Russell King (Oracle)" <rmk+kernel at armlinux.org.uk> wrote:

> Thierry states that there are prerequists for Tegra's calibration
> that should be met before starting calibration - both the RGMII and
> MDIO interfaces should be idle.
> 
> This commit adds the necessary MII bus locking to ensure that the MDIO
> interface is idle during calibration.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>

[...]
	
> -static void tegra_eqos_fix_speed(void *priv, int speed, unsigned int mode)
> +static void tegra_eqos_fix_speed(void *bsp_priv, int speed, unsigned int mode)
>  {
> -	struct tegra_eqos *eqos = priv;
> +	struct tegra_eqos *eqos = bsp_priv;
>  	bool needs_calibration = false;
> +	struct stmmac_priv *priv;
>  	u32 value;
>  	int err;
>  
> @@ -158,6 +159,11 @@ static void tegra_eqos_fix_speed(void *priv, int speed, unsigned int mode)
>  	}
>  
>  	if (needs_calibration) {
> +		priv = netdev_priv(dev_get_drvdata(eqos->dev));
> +
> +		/* Calibration should be done with the MDIO bus idle */
> +		mutex_lock(&priv->mii->mdio_lock);

Can't priv->mii be NULL, if the PHY for that MAC is connected to
another MDIO bus for instance ?

Maxime



More information about the linux-arm-kernel mailing list