[PATCH] net: cpsw: fix probe with fixed-link

Sascha Hauer s.hauer at pengutronix.de
Thu Feb 15 23:42:16 PST 2018


Hi Andreas,

On Tue, Feb 13, 2018 at 10:48:16PM +0100, Andreas Schmidt wrote:
> If cpsw slave is set to fixed-link cpsw probe still try to probe and use
> a phy. This patch fix cpsw probe in case of fixed-link.
> 
> Signed-off-by: Andreas Schmidt <mail at schmidt-andreas.de>
> ---
>  drivers/net/cpsw.c | 41 +++++++++++++++++++++++++++--------------
>  1 file changed, 27 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
> index d11ca33f7..37e480248 100644
> --- a/drivers/net/cpsw.c
> +++ b/drivers/net/cpsw.c
> @@ -184,6 +184,7 @@ struct cpsw_slave {
>  	struct eth_device		edev;
>  	struct cpsw_priv		*cpsw;
>  	struct device_d			dev;
> +	int				fixed_link;
>  };
>  
>  struct cpdma_desc {
> @@ -913,18 +914,20 @@ static int cpsw_slave_setup(struct cpsw_slave *slave, int slave_num,
>  	struct eth_device	*edev = &slave->edev;
>  	struct device_d		*dev = &slave->dev;
>  	int ret;
> -	struct phy_device *phy;
> +	struct phy_device *phy = NULL;
>  
> -	phy = mdiobus_scan(&priv->miibus, priv->slaves[slave_num].phy_id);
> -	if (IS_ERR(phy)) {
> -		ret = PTR_ERR(phy);
> -		goto err_out;
> -	}
> +	if (!slave->fixed_link) {
> +		phy = mdiobus_scan(&priv->miibus, priv->slaves[slave_num].phy_id);
> +		if (IS_ERR(phy)) {
> +			ret = PTR_ERR(phy);
> +			goto err_out;
> +		}

Calling mdiobus_scan() here is not only wrong for a fixed phy, it is
wrong for a regular mdiobus phy aswell. I just sent out a patch which
just removes the call to mdiobus_scan(). Tested on a beaglebone which
has a real phy, it should work for you aswell.

Sascha

-- 
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