Skip to contentSkip to conversation

net: phy: xilinx-gmii2rgmii: Removed hardcoded phy address 0 for bridge

PATCH Applied Tejas Bhumkar 2 participants 2 messages Sep 15, 2023 – Sep 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: xilinx-gmii2rgmii: Removed hardcoded phy address 0 for bridge

Current code expects bridge phy address at 0 which is not correct expectation because bridge phy address is configurable. That's why update the code to read reg property to figure it out where bridge is and use it in phy creation code.

---
 drivers/net/phy/phy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +4 -1
index ae21acb059..d64a83b83d 100644
@@ -838,7 +838,10 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus,
 	ofnode_for_each_subnode(node, dev_ofnode(dev)) {
 		node = ofnode_by_compatible(node, "xlnx,gmii-to-rgmii-1.0");
 		if (ofnode_valid(node)) {
-			phydev = phy_device_create(bus, 0,
+			int gmiirgmii_phyaddr;
+
+			gmiirgmii_phyaddr = ofnode_read_u32_default(node, "reg", 0);
+			phydev = phy_device_create(bus, gmiirgmii_phyaddr,
 						   PHY_GMII2RGMII_ID, false);
 			if (phydev)
 				phydev->node = node;
Signature · 1 line
2.27.0
Applied
#1 lore raw
Quoted 17 lines · Tejas Bhumkar

Current code expects bridge phy address at 0 which is not correct expectation because bridge phy address is configurable. That's why update the code to read reg property to figure it out where bridge is and use it in phy creation code.

---
  drivers/net/phy/phy.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +0 -0
index ae21acb059..d64a83b83d 100644
@@ -838,7 +838,10 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus,
  	ofnode_for_each_subnode(node, dev_ofnode(dev)) {

drivers/net/phy/phy.c static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus, · line 847

Quoted 10 lines
drivers/net/phy/phy.c +4 -1
  		node = ofnode_by_compatible(node, "xlnx,gmii-to-rgmii-1.0");
  		if (ofnode_valid(node)) {
-			phydev = phy_device_create(bus, 0,
+			int gmiirgmii_phyaddr;
+
+			gmiirgmii_phyaddr = ofnode_read_u32_default(node, "reg", 0);
+			phydev = phy_device_create(bus, gmiirgmii_phyaddr,
  						   PHY_GMII2RGMII_ID, false);
  			if (phydev)
  				phydev->node = node;

Applied.
M