linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net V2 1/1] net: phy: fix invalid phy id when probe using C22
@ 2021-03-18  9:09 Wong Vee Khee
  2021-03-18 13:25 ` Heiner Kallweit
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Wong Vee Khee @ 2021-03-18  9:09 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Jakub Kicinski
  Cc: Florian Fainelli, netdev, linux-kernel, stable, Voon Weifeng,
	Ong Boon Leong

When using Clause-22 to probe for PHY devices such as the Marvell
88E2110, PHY ID with value 0 is read from the MII PHYID registers
which caused the PHY framework failed to attach the Marvell PHY
driver.

Fixed this by adding a check of PHY ID equals to all zeroes.

Fixes: ee951005e95e ("net: phy: clean up get_phy_c22_id() invalid ID handling")
Cc: stable@vger.kernel.org
Reviewed-by: Voon Weifeng <voon.weifeng@intel.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@intel.com>
---
v2 changelog:
 - added fixes tag
 - marked for net instead of net-next
---
 drivers/net/phy/phy_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index cc38e326405a..c12c30254c11 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -809,8 +809,8 @@ static int get_phy_c22_id(struct mii_bus *bus, int addr, u32 *phy_id)
 
 	*phy_id |= phy_reg;
 
-	/* If the phy_id is mostly Fs, there is no device there */
-	if ((*phy_id & 0x1fffffff) == 0x1fffffff)
+	/* If the phy_id is mostly Fs or all zeroes, there is no device there */
+	if (((*phy_id & 0x1fffffff) == 0x1fffffff) || (*phy_id == 0))
 		return -ENODEV;
 
 	return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-03-26  2:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18  9:09 [PATCH net V2 1/1] net: phy: fix invalid phy id when probe using C22 Wong Vee Khee
2021-03-18 13:25 ` Heiner Kallweit
2021-03-18 16:02   ` Florian Fainelli
2021-03-18 16:21     ` Russell King - ARM Linux admin
2021-03-18 16:48     ` Heiner Kallweit
2021-03-18 18:14     ` Greg KH
2021-03-18 18:58       ` Florian Fainelli
2021-03-19  7:40 ` Heiner Kallweit
2021-03-19  8:56   ` Russell King - ARM Linux admin
2021-03-22 12:39     ` Wong, Vee Khee
2021-03-26  1:57 ` [net] c0da0048be: WARNING:at_net/core/devlink.c:#devlink_port_type_warn kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).