[PATCH] fix GENERIC_PHY match nothing

Sascha Hauer s.hauer at pengutronix.de
Sat Dec 8 06:15:03 EST 2012


On Sat, Dec 08, 2012 at 09:58:52AM +0800, 张忠山 wrote:
> According the match logic in function mdio_bus_match
> generic phy driver matchs nothing.

This is done on purpose. The generic phy driver is probed manually
when no other phy matches, see:

> static int phy_register_device(struct phy_device* dev)
> {
>        int ret;
> 
>        ret = register_device(&dev->dev);
>        if (ret)
>                return ret;

register device...

> 
>        if (dev->dev.driver)
>                return 0;

... we have a driver specific to this phy, -> return

> 
>        dev->dev.driver = &genphy_driver.drv;
>        return device_probe(&dev->dev);

No driver, use generic phy driver.

>}

The problem this solves (and that you reintroduce with this patch) is
that if the phy driver matches every device, a more specific phy driver
will not be used if the generic driver is registered first.

Sascha

> 
> If we want it match anything, We must let it's phy_id_mask
> be all zeros
> 
> Signed-off-by: 张忠山 <zzs213 at 126.com>
> ---
>  drivers/net/phy/generic.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/phy/generic.c b/drivers/net/phy/generic.c
> index 3f5f127..c3743b9 100644
> --- a/drivers/net/phy/generic.c
> +++ b/drivers/net/phy/generic.c
> @@ -25,7 +25,7 @@
>  static struct phy_driver generic_phy = {
>  	.drv.name = "Generic PHY",
>  	.phy_id = PHY_ANY_UID,
> -	.phy_id_mask = PHY_ANY_UID,
> +	.phy_id_mask = 0,
>  	.features = 0,
>  };
>  
> -- 
> 1.7.4.4
> 
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list