* [PATCH net-next 1/1] net: phy: fix invalid phy id when probe using C22
@ 2021-03-16 8:57 Wong Vee Khee
2021-03-17 8:15 ` Heiner Kallweit
0 siblings, 1 reply; 3+ messages in thread
From: Wong Vee Khee @ 2021-03-16 8:57 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
Jakub Kicinski
Cc: netdev, linux-kernel, stable, Voon Weifeng, Ong Boon Leong,
Wong Vee Khee
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 <voon.weifeng@intel.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@intel.com>
---
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 a009d1769b08..f1afc00fcba2 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -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;
return 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next 1/1] net: phy: fix invalid phy id when probe using C22
2021-03-16 8:57 [PATCH net-next 1/1] net: phy: fix invalid phy id when probe using C22 Wong Vee Khee
@ 2021-03-17 8:15 ` Heiner Kallweit
2021-03-18 6:54 ` Wong, Vee Khee
0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2021-03-17 8:15 UTC (permalink / raw)
To: Wong Vee Khee, Andrew Lunn, Russell King, David S . Miller,
Jakub Kicinski
Cc: netdev, linux-kernel, stable, Voon Weifeng, Ong Boon Leong
On 16.03.2021 09:57, Wong Vee Khee wrote:
> 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.
> Fixed this by adding a check of PHY ID equals to all zeroes.
>
> Cc: stable@vger.kernel.org
> Reviewed-by: Voon Weifeng <voon.weifeng@intel.com>
> Signed-off-by: Wong Vee Khee <vee.khee.wong@intel.com>
> ---
> 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 a009d1769b08..f1afc00fcba2 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -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;
>
> return 0;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH net-next 1/1] net: phy: fix invalid phy id when probe using C22
2021-03-17 8:15 ` Heiner Kallweit
@ 2021-03-18 6:54 ` Wong, Vee Khee
0 siblings, 0 replies; 3+ messages in thread
From: Wong, Vee Khee @ 2021-03-18 6:54 UTC (permalink / raw)
To: Heiner Kallweit, Andrew Lunn, Russell King, David S . Miller,
Jakub Kicinski
Cc: netdev, linux-kernel, stable, Voon Weifeng, Ong, Boon Leong
> -----Original Message-----
> From: Heiner Kallweit <hkallweit1@gmail.com>
> Sent: Wednesday, March 17, 2021 4:15 PM
> To: Wong, Vee Khee <vee.khee.wong@intel.com>; Andrew Lunn
> <andrew@lunn.ch>; Russell King <linux@armlinux.org.uk>; David S . Miller
> <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> stable@vger.kernel.org; Voon Weifeng <voon.weifeng@intel.com>; Ong,
> Boon Leong <boon.leong.ong@intel.com>
> 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:
> > 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.
> > Fixed this by adding a check of PHY ID equals to all zeroes.
> >
> > Cc: stable@vger.kernel.org
> > Reviewed-by: Voon Weifeng <voon.weifeng@intel.com>
> > Signed-off-by: Wong Vee Khee <vee.khee.wong@intel.com>
> > ---
> > 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 a009d1769b08..f1afc00fcba2 100644
> > --- a/drivers/net/phy/phy_device.c
> > +++ b/drivers/net/phy/phy_device.c
> > @@ -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;
> >
> > return 0;
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-18 6:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 8:57 [PATCH net-next 1/1] net: phy: fix invalid phy id when probe using C22 Wong Vee Khee
2021-03-17 8:15 ` Heiner Kallweit
2021-03-18 6:54 ` Wong, Vee Khee
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).