[U-Boot] [PATCH] phylib: Detect link on 10G devices correctly

Detlev Zundel dzu at denx.de
Thu May 19 10:53:30 CEST 2011


Hi Andy,

> gen10g_startup() had 2 bugs:
>
> 1) It had a boolean logic error in checking the MMD mask, and
> always checked all of them.

Good catch.

> 2) It checked devices which don't actually report link state, which
> meant that it would never believe the link was fully up.
>
> Fix the boolean logic, and then mask the MMD mask so only link-reporting
> devices are checked.
>
> Signed-off-by: Andy Fleming <afleming at freescale.com>
> Reported-by: Ed Swarthout <Ed.Swarthout at freescale.com>
> ---
>
>  drivers/net/phy/generic_10g.c |    8 ++++++--
>  include/linux/mdio.h          |    8 ++++++++
>  2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/phy/generic_10g.c b/drivers/net/phy/generic_10g.c
> index 315c508..1c3e69e 100644
> --- a/drivers/net/phy/generic_10g.c
> +++ b/drivers/net/phy/generic_10g.c
> @@ -36,7 +36,7 @@ int gen10g_shutdown(struct phy_device *phydev)
>  int gen10g_startup(struct phy_device *phydev)
>  {
>  	int devad, reg;
> -	u32 mmd_mask = phydev->mmds;
> +	u32 mmd_mask = phydev->mmds & MDIO_DEVS_LINK;

So we are introducing this new macro, right?  I don't see this in Linux
- how is this handled there?  If we do have to create a new name, can't
we use something more self-documenting, e.g. MDIO_DEVS_REPORT_LINK or
such?

Cheers
  Detlev

-- 
Quantum physicists can either know how fast they do it, or where they
do it, but not both.
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the U-Boot mailing list