From: Wong Vee Khee <hidden> Date: 2021-03-16 08:54:43
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.
Cc: stable@vger.kernel.org
Reviewed-by: Voon Weifeng <redacted>
Signed-off-by: Wong Vee Khee <redacted>
---
drivers/net/phy/phy_device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -820,8 +820,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;return0;
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.
The issue occurs with a MAC driver that sets MDIO bus capability
flag MDIOBUS_C22_C45, like stmmac? Or what is the affected MAC
driver?
And if you state it's a fix, a Fixes tag would be needed.
quoted hunk
Fixed this by adding a check of PHY ID equals to all zeroes.
Cc: stable@vger.kernel.org
Reviewed-by: Voon Weifeng <redacted>
Signed-off-by: Wong Vee Khee <redacted>
---
drivers/net/phy/phy_device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -820,8 +820,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;return0;
From: Wong, Vee Khee <hidden> Date: 2021-03-18 06:55:16
-----Original Message-----
From: Heiner Kallweit <hkallweit1@gmail.com>
Sent: Wednesday, March 17, 2021 4:15 PM
To: Wong, Vee Khee <redacted>; Andrew Lunn
[off-list ref]; Russell King [off-list ref]; David S . Miller
[off-list ref]; Jakub Kicinski [off-list ref]
Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
stable@vger.kernel.org; Voon Weifeng [off-list ref]; Ong,
Boon Leong [off-list ref]
Subject: Re: [PATCH net-next 1/1] net: phy: fix invalid phy id when probe
using C22
On 16.03.2021 09:57, Wong Vee Khee wrote:
quoted
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.
The issue occurs with a MAC driver that sets MDIO bus capability
flag MDIOBUS_C22_C45, like stmmac? Or what is the affected MAC
driver?
Yes, you are right. This issue is seen when MarvellE2110 is used with
the STMMAC.
And if you state it's a fix, a Fixes tag would be needed.
Noted. Will send a v2 and marked for net.
quoted
Fixed this by adding a check of PHY ID equals to all zeroes.
Cc: stable@vger.kernel.org
Reviewed-by: Voon Weifeng <redacted>
Signed-off-by: Wong Vee Khee <redacted>
---
drivers/net/phy/phy_device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -820,8 +820,8 @@ static int get_phy_c22_id(struct mii_bus *bus, int
addr, u32 *phy_id)
quoted
*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;