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

dp83640: Ensure against premature access to PHY registers after reset

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: Esben Haabendal <eha@deif.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Esben Haabendal and committed by
David S. Miller
76327a35 1f1cba78

+18
+18
drivers/net/phy/dp83640.c
··· 1207 1207 kfree(dp83640); 1208 1208 } 1209 1209 1210 + static int dp83640_soft_reset(struct phy_device *phydev) 1211 + { 1212 + int ret; 1213 + 1214 + ret = genphy_soft_reset(phydev); 1215 + if (ret < 0) 1216 + return ret; 1217 + 1218 + /* From DP83640 datasheet: "Software driver code must wait 3 us 1219 + * following a software reset before allowing further serial MII 1220 + * operations with the DP83640." 1221 + */ 1222 + udelay(10); /* Taking udelay inaccuracy into account */ 1223 + 1224 + return 0; 1225 + } 1226 + 1210 1227 static int dp83640_config_init(struct phy_device *phydev) 1211 1228 { 1212 1229 struct dp83640_private *dp83640 = phydev->priv; ··· 1518 1501 .flags = PHY_HAS_INTERRUPT, 1519 1502 .probe = dp83640_probe, 1520 1503 .remove = dp83640_remove, 1504 + .soft_reset = dp83640_soft_reset, 1521 1505 .config_init = dp83640_config_init, 1522 1506 .ack_interrupt = dp83640_ack_interrupt, 1523 1507 .config_intr = dp83640_config_intr,