Commit 94cd624e authored by Esben Haabendal's avatar Esben Haabendal Committed by Khalid Elmously

dp83640: Ensure against premature access to PHY registers after reset

BugLink: https://bugs.launchpad.net/bugs/1775771

[ Upstream commit 76327a35 ]

The datasheet specifies a 3uS pause after performing a software
reset. The default implementation of genphy_soft_reset() does not
provide this, so implement soft_reset with the needed pause.
Signed-off-by: default avatarEsben Haabendal <eha@deif.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent b5be05bb
......@@ -1203,6 +1203,23 @@ static void dp83640_remove(struct phy_device *phydev)
kfree(dp83640);
}
static int dp83640_soft_reset(struct phy_device *phydev)
{
int ret;
ret = genphy_soft_reset(phydev);
if (ret < 0)
return ret;
/* From DP83640 datasheet: "Software driver code must wait 3 us
* following a software reset before allowing further serial MII
* operations with the DP83640."
*/
udelay(10); /* Taking udelay inaccuracy into account */
return 0;
}
static int dp83640_config_init(struct phy_device *phydev)
{
struct dp83640_private *dp83640 = phydev->priv;
......@@ -1496,6 +1513,7 @@ static struct phy_driver dp83640_driver = {
.flags = PHY_HAS_INTERRUPT,
.probe = dp83640_probe,
.remove = dp83640_remove,
.soft_reset = dp83640_soft_reset,
.config_init = dp83640_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment