Skip to content

Commit 75075ae

Browse files
committed
net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices
On a setup with KSZ9131 and MACB drivers it happens on suspend path, from time to time, that the PHY interrupt arrives after PHY and MACB were suspended (PHY via genphy_suspend(), MACB via macb_suspend()). In this case the phy_read() at the beginning of kszphy_handle_interrupt() will fail (as MACB driver is suspended at this time) leading to phy_error() being called and a stack trace being displayed on console. To solve this .suspend/.resume functions for all KSZ devices implementing .handle_interrupt were replaced with kszphy_suspend()/kszphy_resume() which disable/enable interrupt before/after calling genphy_suspend()/genphy_resume(). The fix has been adapted for all KSZ devices which implements .handle_interrupt but it has been tested only on KSZ9131. Fixes: 59ca4e5 ("net: phy: micrel: implement generic .handle_interrupt() callback") Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f027418 commit 75075ae

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

drivers/net/phy/micrel.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,8 +1547,8 @@ static struct phy_driver ksphy_driver[] = {
15471547
.config_init = kszphy_config_init,
15481548
.config_intr = kszphy_config_intr,
15491549
.handle_interrupt = kszphy_handle_interrupt,
1550-
.suspend = genphy_suspend,
1551-
.resume = genphy_resume,
1550+
.suspend = kszphy_suspend,
1551+
.resume = kszphy_resume,
15521552
}, {
15531553
.phy_id = PHY_ID_KSZ8021,
15541554
.phy_id_mask = 0x00ffffff,
@@ -1562,8 +1562,8 @@ static struct phy_driver ksphy_driver[] = {
15621562
.get_sset_count = kszphy_get_sset_count,
15631563
.get_strings = kszphy_get_strings,
15641564
.get_stats = kszphy_get_stats,
1565-
.suspend = genphy_suspend,
1566-
.resume = genphy_resume,
1565+
.suspend = kszphy_suspend,
1566+
.resume = kszphy_resume,
15671567
}, {
15681568
.phy_id = PHY_ID_KSZ8031,
15691569
.phy_id_mask = 0x00ffffff,
@@ -1577,8 +1577,8 @@ static struct phy_driver ksphy_driver[] = {
15771577
.get_sset_count = kszphy_get_sset_count,
15781578
.get_strings = kszphy_get_strings,
15791579
.get_stats = kszphy_get_stats,
1580-
.suspend = genphy_suspend,
1581-
.resume = genphy_resume,
1580+
.suspend = kszphy_suspend,
1581+
.resume = kszphy_resume,
15821582
}, {
15831583
.phy_id = PHY_ID_KSZ8041,
15841584
.phy_id_mask = MICREL_PHY_ID_MASK,
@@ -1609,8 +1609,8 @@ static struct phy_driver ksphy_driver[] = {
16091609
.get_sset_count = kszphy_get_sset_count,
16101610
.get_strings = kszphy_get_strings,
16111611
.get_stats = kszphy_get_stats,
1612-
.suspend = genphy_suspend,
1613-
.resume = genphy_resume,
1612+
.suspend = kszphy_suspend,
1613+
.resume = kszphy_resume,
16141614
}, {
16151615
.name = "Micrel KSZ8051",
16161616
/* PHY_BASIC_FEATURES */
@@ -1623,8 +1623,8 @@ static struct phy_driver ksphy_driver[] = {
16231623
.get_strings = kszphy_get_strings,
16241624
.get_stats = kszphy_get_stats,
16251625
.match_phy_device = ksz8051_match_phy_device,
1626-
.suspend = genphy_suspend,
1627-
.resume = genphy_resume,
1626+
.suspend = kszphy_suspend,
1627+
.resume = kszphy_resume,
16281628
}, {
16291629
.phy_id = PHY_ID_KSZ8001,
16301630
.name = "Micrel KSZ8001 or KS8721",
@@ -1638,8 +1638,8 @@ static struct phy_driver ksphy_driver[] = {
16381638
.get_sset_count = kszphy_get_sset_count,
16391639
.get_strings = kszphy_get_strings,
16401640
.get_stats = kszphy_get_stats,
1641-
.suspend = genphy_suspend,
1642-
.resume = genphy_resume,
1641+
.suspend = kszphy_suspend,
1642+
.resume = kszphy_resume,
16431643
}, {
16441644
.phy_id = PHY_ID_KSZ8081,
16451645
.name = "Micrel KSZ8081 or KSZ8091",
@@ -1669,8 +1669,8 @@ static struct phy_driver ksphy_driver[] = {
16691669
.config_init = ksz8061_config_init,
16701670
.config_intr = kszphy_config_intr,
16711671
.handle_interrupt = kszphy_handle_interrupt,
1672-
.suspend = genphy_suspend,
1673-
.resume = genphy_resume,
1672+
.suspend = kszphy_suspend,
1673+
.resume = kszphy_resume,
16741674
}, {
16751675
.phy_id = PHY_ID_KSZ9021,
16761676
.phy_id_mask = 0x000ffffe,
@@ -1685,8 +1685,8 @@ static struct phy_driver ksphy_driver[] = {
16851685
.get_sset_count = kszphy_get_sset_count,
16861686
.get_strings = kszphy_get_strings,
16871687
.get_stats = kszphy_get_stats,
1688-
.suspend = genphy_suspend,
1689-
.resume = genphy_resume,
1688+
.suspend = kszphy_suspend,
1689+
.resume = kszphy_resume,
16901690
.read_mmd = genphy_read_mmd_unsupported,
16911691
.write_mmd = genphy_write_mmd_unsupported,
16921692
}, {
@@ -1704,7 +1704,7 @@ static struct phy_driver ksphy_driver[] = {
17041704
.get_sset_count = kszphy_get_sset_count,
17051705
.get_strings = kszphy_get_strings,
17061706
.get_stats = kszphy_get_stats,
1707-
.suspend = genphy_suspend,
1707+
.suspend = kszphy_suspend,
17081708
.resume = kszphy_resume,
17091709
}, {
17101710
.phy_id = PHY_ID_LAN8814,
@@ -1732,7 +1732,7 @@ static struct phy_driver ksphy_driver[] = {
17321732
.get_sset_count = kszphy_get_sset_count,
17331733
.get_strings = kszphy_get_strings,
17341734
.get_stats = kszphy_get_stats,
1735-
.suspend = genphy_suspend,
1735+
.suspend = kszphy_suspend,
17361736
.resume = kszphy_resume,
17371737
}, {
17381738
.phy_id = PHY_ID_KSZ8873MLL,

0 commit comments

Comments
 (0)