Skip to contentSkip to conversation

net: phy: implement fallback mechanism for negative phy adresses

PATCH New Hannes Schmelzer 4 participants 5 messages Mar 29, 2019 – Apr 8, 2019

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

PATCH v3 1/1 net: phy: implement fallback mechanism for negative phy adresses

Negative phy-addresses can occour if the caller function was not able to determine a valid phy address (from device-tree for example). In this case we catch this here and search for ANY phy device on the given mdio- bus.

---

Changes in v3:
- fix commit message

Changes in v2:
- cosmetic changes

 drivers/net/phy/phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +2 -1
index 0c8b29d..4e8d294 100644
@@ -922,13 +922,14 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 #endif
 {
 	struct phy_device *phydev = NULL;
+	uint mask = (addr > 0) ? (1 << addr) : 0xffffffff;
 
 #ifdef CONFIG_PHY_FIXED
 	phydev = phy_connect_fixed(bus, dev, interface);
 #endif
 
 	if (!phydev)
-		phydev = phy_find_by_mask(bus, 1 << addr, interface);
+		phydev = phy_find_by_mask(bus, mask, interface);
 
 	if (phydev)
 		phy_connect_dev(phydev, dev);
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/1 net: phy: implement fallback mechanism for negative phy adresses

Quoted 29 lines · Hannes Schmelzer

Negative phy-addresses can occour if the caller function was not able to determine a valid phy address (from device-tree for example). In this case we catch this here and search for ANY phy device on the given mdio- bus.

---

Changes in v3:
- fix commit message

Changes in v2:
- cosmetic changes

 drivers/net/phy/phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -0
index 0c8b29d..4e8d294 100644
@@ -922,13 +922,14 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 #endif
 {
 	struct phy_device *phydev = NULL;
+	uint mask = (addr > 0) ? (1 << addr) : 0xffffffff;
 

drivers/net/phy/phy.c struct phy_device *phy_connect(struct mii_dev *bus, int addr, · line 935

Quoted 10 lines
drivers/net/phy/phy.c +1 -1
 #ifdef CONFIG_PHY_FIXED
 	phydev = phy_connect_fixed(bus, dev, interface);
 #endif
 
 	if (!phydev)
-		phydev = phy_find_by_mask(bus, 1 << addr, interface);
+		phydev = phy_find_by_mask(bus, mask, interface);
 
 	if (phydev)
 		phy_connect_dev(phydev, dev);

Thanks,
Michal

#2 lore raw

PATCH v3 1/1 net: phy: implement fallback mechanism for negative phy adresses

In reply to Hannes Schmelzer

Hi Hannes,

Quoted 28 lines

Negative phy-addresses can occour if the caller function was not able to determine a valid phy address (from device-tree for example). In this case we catch this here and search for ANY phy device on the given mdio- bus.

---

Changes in v3:
- fix commit message

Changes in v2:
- cosmetic changes

 drivers/net/phy/phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -0
index 0c8b29d..4e8d294 100644
@@ -922,13 +922,14 @@ struct phy_device *phy_connect(struct mii_dev
 *bus, int addr, #endif
 {
 	struct phy_device *phydev = NULL;
+	uint mask = (addr > 0) ? (1 << addr) : 0xffffffff;
 

drivers/net/phy/phy.c struct phy_device *phy_connect(struct mii_dev · line 935

Quoted 10 lines
drivers/net/phy/phy.c +1 -1
 #ifdef CONFIG_PHY_FIXED
 	phydev = phy_connect_fixed(bus, dev, interface);
 #endif
 
 	if (!phydev)
-		phydev = phy_find_by_mask(bus, 1 << addr, interface);
+		phydev = phy_find_by_mask(bus, mask, interface);
 
 	if (phydev)
 		phy_connect_dev(phydev, dev);

Test HW: imx53 (HSC device).

Could this patch be applied to v2019.04, please ?

(So there is NO need to revert:
"drivers/net/fec: phy_init: remove redundant logic").

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190403/23325b8c/attachment.sig>

#3 lore raw

PATCH v3 1/1 net: phy: implement fallback mechanism for negative phy adresses

Hi Tom,

Quoted 44 lines

Hi Hannes,

Quoted 38 lines

Negative phy-addresses can occour if the caller function was not able to determine a valid phy address (from device-tree for example). In this case we catch this here and search for ANY phy device on the given mdio- bus.

---

Changes in v3:
- fix commit message

Changes in v2:
- cosmetic changes

 drivers/net/phy/phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +2 -1
index 0c8b29d..4e8d294 100644
@@ -922,13 +922,14 @@ struct phy_device *phy_connect(struct mii_dev
 *bus, int addr, #endif
 {
 	struct phy_device *phydev = NULL;
+	uint mask = (addr > 0) ? (1 << addr) : 0xffffffff;
 
 #ifdef CONFIG_PHY_FIXED
 	phydev = phy_connect_fixed(bus, dev, interface);
 #endif
 
 	if (!phydev)
-		phydev = phy_find_by_mask(bus, 1 << addr,
 interface);
+		phydev = phy_find_by_mask(bus, mask, interface);
 
 	if (phydev)
Quoted 1 line

phy_connect_dev(phydev, dev);

Quoted 7 lines

Test HW: imx53 (HSC device).

Could this patch be applied to v2019.04, please ?

(So there is NO need to revert:
"drivers/net/fec: phy_init: remove redundant logic").

Tom, do you plan to add thins commit to v2019.04 ?

Quoted 11 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190407/5f0f1117/attachment.sig>

#4 lore raw

PATCH v3 1/1 net: phy: implement fallback mechanism for negative phy adresses

In reply to Hannes Schmelzer
Quoted 8 lines · Hannes Schmelzer

Negative phy-addresses can occour if the caller function was not able to determine a valid phy address (from device-tree for example). In this case we catch this here and search for ANY phy device on the given mdio- bus.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190408/3bb023ba/attachment.sig>