Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: stmmac: dwc-qos: calibrate tegra with mdio bus idle

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@armlinux.org.uk>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/E1u7EYR-001ZAS-Cr@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Russell King (Oracle) and committed by
Jakub Kicinski
87f43e6f 8ff61751

+10 -2
+10 -2
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
··· 136 136 #define AUTO_CAL_STATUS 0x880c 137 137 #define AUTO_CAL_STATUS_ACTIVE BIT(31) 138 138 139 - static void tegra_eqos_fix_speed(void *priv, int speed, unsigned int mode) 139 + static void tegra_eqos_fix_speed(void *bsp_priv, int speed, unsigned int mode) 140 140 { 141 - struct tegra_eqos *eqos = priv; 141 + struct tegra_eqos *eqos = bsp_priv; 142 142 bool needs_calibration = false; 143 + struct stmmac_priv *priv; 143 144 u32 value; 144 145 int err; 145 146 ··· 159 158 } 160 159 161 160 if (needs_calibration) { 161 + priv = netdev_priv(dev_get_drvdata(eqos->dev)); 162 + 163 + /* Calibration should be done with the MDIO bus idle */ 164 + mutex_lock(&priv->mii->mdio_lock); 165 + 162 166 /* calibrate */ 163 167 value = readl(eqos->regs + SDMEMCOMPPADCTRL); 164 168 value |= SDMEMCOMPPADCTRL_PAD_E_INPUT_OR_E_PWRD; ··· 197 191 value = readl(eqos->regs + SDMEMCOMPPADCTRL); 198 192 value &= ~SDMEMCOMPPADCTRL_PAD_E_INPUT_OR_E_PWRD; 199 193 writel(value, eqos->regs + SDMEMCOMPPADCTRL); 194 + 195 + mutex_unlock(&priv->mii->mdio_lock); 200 196 } else { 201 197 value = readl(eqos->regs + AUTO_CAL_CONFIG); 202 198 value &= ~AUTO_CAL_CONFIG_ENABLE;