Hi Hannes,

> Negative phy-addresses can occour if the caller function was not able
> to determine a valid phy address (from device-tree for example). In
> this case we catch this here and search for ANY phy device on the
> given mdio- bus.
> 
> Signed-off-by: Hannes Schmelzer <hannes.schmel...@br-automation.com>
> 
> ---
> 
> Changes in v3:
> - fix commit message
> 
> Changes in v2:
> - cosmetic changes
> 
>  drivers/net/phy/phy.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 0c8b29d..4e8d294 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -922,13 +922,14 @@ struct phy_device *phy_connect(struct mii_dev
> *bus, int addr, #endif
>  {
>       struct phy_device *phydev = NULL;
> +     uint mask = (addr > 0) ? (1 << addr) : 0xffffffff;
>  
>  #ifdef CONFIG_PHY_FIXED
>       phydev = phy_connect_fixed(bus, dev, interface);
>  #endif
>  
>       if (!phydev)
> -             phydev = phy_find_by_mask(bus, 1 << addr, interface);
> +             phydev = phy_find_by_mask(bus, mask, interface);
>  
>       if (phydev)
>               phy_connect_dev(phydev, dev);

Tested-by: Lukasz Majewski <lu...@denx.de>

Test HW: imx53 (HSC device).

Could this patch be applied to v2019.04, please ?

(So there is NO need to revert:
"drivers/net/fec: phy_init: remove redundant logic").


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lu...@denx.de

Attachment: pgpNvFqMZww7L.pgp
Description: OpenPGP digital signature

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to