[PATCH net-next 1/1] net: phy: probe for C45 PHYs that return PHY ID of zero in C22 space

Subsystems: ethernet phy library, networking drivers, the rest

STALE1885d

3 messages, 3 authors, 2021-06-10 · open the first message on its own page

[PATCH net-next 1/1] net: phy: probe for C45 PHYs that return PHY ID of zero in C22 space

From: Wong Vee Khee <hidden>
Date: 2021-06-07 02:32:09

PHY devices such as the Marvell Alaska 88E2110 does not return a valid
PHY ID when probed using Clause-22. The current implementation treats
PHY ID of zero as a non-error and valid PHY ID, and causing the PHY
device failed to bind to the Marvell driver.

For such devices, we do an additional probe in the Clause-45 space,
if a valid PHY ID is returned, we then proceed to attach the PHY
device to the matching PHY ID driver.

Signed-off-by: Wong Vee Khee <redacted>
---
 drivers/net/phy/phy_device.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 1539ea021ac0..495d86b4af7c 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -870,6 +870,18 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
 	if (r)
 		return ERR_PTR(r);
 
+	/* PHY device such as the Marvell Alaska 88E2110 will return a PHY ID
+	 * of 0 when probed using get_phy_c22_id() with no error. Proceed to
+	 * probe with C45 to see if we're able to get a valid PHY ID in the C45
+	 * space, if successful, create the C45 PHY device.
+	 */
+	if (!is_c45 && phy_id == 0 && bus->probe_capabilities >= MDIOBUS_C45) {
+		r = get_phy_c45_ids(bus, addr, &c45_ids);
+		if (!r)
+			return phy_device_create(bus, addr, phy_id,
+						 true, &c45_ids);
+	}
+
 	return phy_device_create(bus, addr, phy_id, is_c45, &c45_ids);
 }
 EXPORT_SYMBOL(get_phy_device);
-- 
2.25.1

Re: [PATCH net-next 1/1] net: phy: probe for C45 PHYs that return PHY ID of zero in C22 space

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-06-10 04:06:08

On Mon, Jun 07, 2021 at 10:36:45AM +0800, Wong Vee Khee wrote:
PHY devices such as the Marvell Alaska 88E2110 does not return a valid
PHY ID when probed using Clause-22. The current implementation treats
PHY ID of zero as a non-error and valid PHY ID, and causing the PHY
device failed to bind to the Marvell driver.

For such devices, we do an additional probe in the Clause-45 space,
if a valid PHY ID is returned, we then proceed to attach the PHY
device to the matching PHY ID driver.

Signed-off-by: Wong Vee Khee <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

Re: [PATCH net-next 1/1] net: phy: probe for C45 PHYs that return PHY ID of zero in C22 space

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-06-10 20:40:18

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Mon,  7 Jun 2021 10:36:45 +0800 you wrote:
PHY devices such as the Marvell Alaska 88E2110 does not return a valid
PHY ID when probed using Clause-22. The current implementation treats
PHY ID of zero as a non-error and valid PHY ID, and causing the PHY
device failed to bind to the Marvell driver.

For such devices, we do an additional probe in the Clause-45 space,
if a valid PHY ID is returned, we then proceed to attach the PHY
device to the matching PHY ID driver.

[...]
Here is the summary with links:
  - [net-next,1/1] net: phy: probe for C45 PHYs that return PHY ID of zero in C22 space
    https://git.kernel.org/netdev/net-next/c/b040aab76323

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help