mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-06-10 18:13:28 -04:00
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>
This commit is contained in:
committed by
Jakub Kicinski
parent
8ff6175139
commit
87f43e6f06
@@ -136,10 +136,11 @@ static int dwc_qos_probe(struct platform_device *pdev,
|
|||||||
#define AUTO_CAL_STATUS 0x880c
|
#define AUTO_CAL_STATUS 0x880c
|
||||||
#define AUTO_CAL_STATUS_ACTIVE BIT(31)
|
#define AUTO_CAL_STATUS_ACTIVE BIT(31)
|
||||||
|
|
||||||
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;
|
bool needs_calibration = false;
|
||||||
|
struct stmmac_priv *priv;
|
||||||
u32 value;
|
u32 value;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -158,6 +159,11 @@ static void tegra_eqos_fix_speed(void *priv, int speed, unsigned int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (needs_calibration) {
|
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);
|
||||||
|
|
||||||
/* calibrate */
|
/* calibrate */
|
||||||
value = readl(eqos->regs + SDMEMCOMPPADCTRL);
|
value = readl(eqos->regs + SDMEMCOMPPADCTRL);
|
||||||
value |= SDMEMCOMPPADCTRL_PAD_E_INPUT_OR_E_PWRD;
|
value |= SDMEMCOMPPADCTRL_PAD_E_INPUT_OR_E_PWRD;
|
||||||
@@ -191,6 +197,8 @@ static void tegra_eqos_fix_speed(void *priv, int speed, unsigned int mode)
|
|||||||
value = readl(eqos->regs + SDMEMCOMPPADCTRL);
|
value = readl(eqos->regs + SDMEMCOMPPADCTRL);
|
||||||
value &= ~SDMEMCOMPPADCTRL_PAD_E_INPUT_OR_E_PWRD;
|
value &= ~SDMEMCOMPPADCTRL_PAD_E_INPUT_OR_E_PWRD;
|
||||||
writel(value, eqos->regs + SDMEMCOMPPADCTRL);
|
writel(value, eqos->regs + SDMEMCOMPPADCTRL);
|
||||||
|
|
||||||
|
mutex_unlock(&priv->mii->mdio_lock);
|
||||||
} else {
|
} else {
|
||||||
value = readl(eqos->regs + AUTO_CAL_CONFIG);
|
value = readl(eqos->regs + AUTO_CAL_CONFIG);
|
||||||
value &= ~AUTO_CAL_CONFIG_ENABLE;
|
value &= ~AUTO_CAL_CONFIG_ENABLE;
|
||||||
|
|||||||
Reference in New Issue
Block a user