Skip to content

Commit f1131b9

Browse files
claudiubezneadavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1771afd commit f1131b9

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

drivers/net/phy/micrel.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,8 +1726,8 @@ static struct phy_driver ksphy_driver[] = {
17261726
.config_init = kszphy_config_init,
17271727
.config_intr = kszphy_config_intr,
17281728
.handle_interrupt = kszphy_handle_interrupt,
1729-
.suspend = genphy_suspend,
1730-
.resume = genphy_resume,
1729+
.suspend = kszphy_suspend,
1730+
.resume = kszphy_resume,
17311731
}, {
17321732
.phy_id = PHY_ID_KSZ8021,
17331733
.phy_id_mask = 0x00ffffff,
@@ -1741,8 +1741,8 @@ static struct phy_driver ksphy_driver[] = {
17411741
.get_sset_count = kszphy_get_sset_count,
17421742
.get_strings = kszphy_get_strings,
17431743
.get_stats = kszphy_get_stats,
1744-
.suspend = genphy_suspend,
1745-
.resume = genphy_resume,
1744+
.suspend = kszphy_suspend,
1745+
.resume = kszphy_resume,
17461746
}, {
17471747
.phy_id = PHY_ID_KSZ8031,
17481748
.phy_id_mask = 0x00ffffff,
@@ -1756,8 +1756,8 @@ static struct phy_driver ksphy_driver[] = {
17561756
.get_sset_count = kszphy_get_sset_count,
17571757
.get_strings = kszphy_get_strings,
17581758
.get_stats = kszphy_get_stats,
1759-
.suspend = genphy_suspend,
1760-
.resume = genphy_resume,
1759+
.suspend = kszphy_suspend,
1760+
.resume = kszphy_resume,
17611761
}, {
17621762
.phy_id = PHY_ID_KSZ8041,
17631763
.phy_id_mask = MICREL_PHY_ID_MASK,
@@ -1788,8 +1788,8 @@ static struct phy_driver ksphy_driver[] = {
17881788
.get_sset_count = kszphy_get_sset_count,
17891789
.get_strings = kszphy_get_strings,
17901790
.get_stats = kszphy_get_stats,
1791-
.suspend = genphy_suspend,
1792-
.resume = genphy_resume,
1791+
.suspend = kszphy_suspend,
1792+
.resume = kszphy_resume,
17931793
}, {
17941794
.name = "Micrel KSZ8051",
17951795
/* PHY_BASIC_FEATURES */
@@ -1802,8 +1802,8 @@ static struct phy_driver ksphy_driver[] = {
18021802
.get_strings = kszphy_get_strings,
18031803
.get_stats = kszphy_get_stats,
18041804
.match_phy_device = ksz8051_match_phy_device,
1805-
.suspend = genphy_suspend,
1806-
.resume = genphy_resume,
1805+
.suspend = kszphy_suspend,
1806+
.resume = kszphy_resume,
18071807
}, {
18081808
.phy_id = PHY_ID_KSZ8001,
18091809
.name = "Micrel KSZ8001 or KS8721",
@@ -1817,8 +1817,8 @@ static struct phy_driver ksphy_driver[] = {
18171817
.get_sset_count = kszphy_get_sset_count,
18181818
.get_strings = kszphy_get_strings,
18191819
.get_stats = kszphy_get_stats,
1820-
.suspend = genphy_suspend,
1821-
.resume = genphy_resume,
1820+
.suspend = kszphy_suspend,
1821+
.resume = kszphy_resume,
18221822
}, {
18231823
.phy_id = PHY_ID_KSZ8081,
18241824
.name = "Micrel KSZ8081 or KSZ8091",
@@ -1848,8 +1848,8 @@ static struct phy_driver ksphy_driver[] = {
18481848
.config_init = ksz8061_config_init,
18491849
.config_intr = kszphy_config_intr,
18501850
.handle_interrupt = kszphy_handle_interrupt,
1851-
.suspend = genphy_suspend,
1852-
.resume = genphy_resume,
1851+
.suspend = kszphy_suspend,
1852+
.resume = kszphy_resume,
18531853
}, {
18541854
.phy_id = PHY_ID_KSZ9021,
18551855
.phy_id_mask = 0x000ffffe,
@@ -1864,8 +1864,8 @@ static struct phy_driver ksphy_driver[] = {
18641864
.get_sset_count = kszphy_get_sset_count,
18651865
.get_strings = kszphy_get_strings,
18661866
.get_stats = kszphy_get_stats,
1867-
.suspend = genphy_suspend,
1868-
.resume = genphy_resume,
1867+
.suspend = kszphy_suspend,
1868+
.resume = kszphy_resume,
18691869
.read_mmd = genphy_read_mmd_unsupported,
18701870
.write_mmd = genphy_write_mmd_unsupported,
18711871
}, {
@@ -1883,7 +1883,7 @@ static struct phy_driver ksphy_driver[] = {
18831883
.get_sset_count = kszphy_get_sset_count,
18841884
.get_strings = kszphy_get_strings,
18851885
.get_stats = kszphy_get_stats,
1886-
.suspend = genphy_suspend,
1886+
.suspend = kszphy_suspend,
18871887
.resume = kszphy_resume,
18881888
}, {
18891889
.phy_id = PHY_ID_LAN8814,
@@ -1928,7 +1928,7 @@ static struct phy_driver ksphy_driver[] = {
19281928
.get_sset_count = kszphy_get_sset_count,
19291929
.get_strings = kszphy_get_strings,
19301930
.get_stats = kszphy_get_stats,
1931-
.suspend = genphy_suspend,
1931+
.suspend = kszphy_suspend,
19321932
.resume = kszphy_resume,
19331933
}, {
19341934
.phy_id = PHY_ID_KSZ8873MLL,

0 commit comments

Comments
 (0)