Skip to contentSkip to conversation

net: phy: fix reading fixed phy status

PATCH Applied Heiner Kallweit 3 participants 4 messages Feb 24, 2019 – Feb 25, 2019

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH 1/1 net: phy: fix reading fixed phy status

With the switch to phy_resolve_aneg_linkmode() we don't read from the chip any longer what is advertised but use phydev->advertising directly. For a fixed phy however this bitmap is empty so far, what results in no common mode being found. This breaks DSA. Fix this by advertising everything that is supported. For a normal phy this done by phy_probe().

Fixes 5502b218e001 ("net: phy: use phy_resolve_aneg_linkmode in genphy_read_status")
---
 drivers/net/phy/fixed_phy.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/phy/fixed_phy.c +3 -0
index b0d1368c3..1acd8bfdb 100644
@@ -22,6 +22,7 @@
 #include <linux/seqlock.h>
 #include <linux/idr.h>
 #include <linux/netdevice.h>
+#include <linux/linkmode.h>
 
 #include "swphy.h"
 
@@ -300,6 +301,8 @@ static struct phy_device *__fixed_phy_register(unsigned int irq,
 				 phy->supported);
 	}
 
+	linkmode_copy(phy->advertising, phy->supported);
+
 	ret = phy_device_register(phy);
 	if (ret) {
 		phy_device_free(phy);
Signature · 1 line
2.20.1
maintainer Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · Heiner Kallweit

With the switch to phy_resolve_aneg_linkmode() we don't read from the chip any longer what is advertised but use phydev->advertising directly. For a fixed phy however this bitmap is empty so far, what results in no common mode being found. This breaks DSA. Fix this by advertising everything that is supported. For a normal phy this done by phy_probe().

Fixes 5502b218e001 ("net: phy: use phy_resolve_aneg_linkmode in genphy_read_status")

But i tested on net-next, not net.

Andrew

Quoted 28 lines
---
 drivers/net/phy/fixed_phy.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/phy/fixed_phy.c +3 -0
index b0d1368c3..1acd8bfdb 100644
@@ -22,6 +22,7 @@
 #include <linux/seqlock.h>
 #include <linux/idr.h>
 #include <linux/netdevice.h>
+#include <linux/linkmode.h>
 
 #include "swphy.h"
 
@@ -300,6 +301,8 @@ static struct phy_device *__fixed_phy_register(unsigned int irq,
 				 phy->supported);
 	}
 
+	linkmode_copy(phy->advertising, phy->supported);
+
 	ret = phy_device_register(phy);
 	if (ret) {
 		phy_device_free(phy);
Signature · 1 line
2.20.1
author maintainer
#2 lore raw
Quoted 7 lines · Andrew Lunn
Quoted 6 lines · Heiner Kallweit

With the switch to phy_resolve_aneg_linkmode() we don't read from the chip any longer what is advertised but use phydev->advertising directly. For a fixed phy however this bitmap is empty so far, what results in no common mode being found. This breaks DSA. Fix this by advertising everything that is supported. For a normal phy this done by phy_probe().

Quoted 7 lines
Quoted 2 lines
Fixes 5502b218e001 ("net: phy: use phy_resolve_aneg_linkmode in genphy_read_status")

But i tested on net-next, not net.

You're right, it should be net-next. I just had the wrong automatism fix = net in my mind.

Quoted 3 lines

Andrew

Heiner

maintainer Applied
#3 lore raw
In reply to Heiner Kallweit

From: Heiner Kallweit <[email protected]>
Date: Sun, 24 Feb 2019 18:01:18 +0100

Quoted 8 lines

With the switch to phy_resolve_aneg_linkmode() we don't read from the chip any longer what is advertised but use phydev->advertising directly. For a fixed phy however this bitmap is empty so far, what results in no common mode being found. This breaks DSA. Fix this by advertising everything that is supported. For a normal phy this done by phy_probe().

Fixes 5502b218e001 ("net: phy: use phy_resolve_aneg_linkmode in genphy_read_status")

Applied to net-next.

Let me know if I got this wrong.