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

Sascha Hauer s.hauer at pengutronix.de
Tue Feb 27 00:41:11 PST 2018


On Thu, Feb 22, 2018 at 11:16:27PM +0100, Andreas Schmidt wrote:
> While cpsw is probe dt, it accepts only slaves nodes with "phy_id" property.
> In case of fixed-link there are no "phy_id" property and probe would be failed.
> This patch avoid the failure due to missing "phy_id" in case of fixed-link.
> 
> Signed-off-by: Andreas Schmidt <mail at schmidt-andreas.de>
> ---
> 
> Changes since v1:
>   - rework after "[PATCH] net: cpsw: remove unnecessary mdiobus_scan()" patch was committed.
> 
> ---
>  drivers/net/cpsw.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
> index 928b97774..3d3939cfa 100644
> --- a/drivers/net/cpsw.c
> +++ b/drivers/net/cpsw.c
> @@ -1089,11 +1089,13 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
>  
>  		if (i < priv->num_slaves && !strncmp(child->name, "slave", 5)) {
>  			struct cpsw_slave *slave = &priv->slaves[i];
> -			uint32_t phy_id[2];
> +			uint32_t phy_id[2] = {-1, -1};
>  
> -			ret = of_property_read_u32_array(child, "phy_id", phy_id, 2);
> -			if (ret)
> -				return ret;
> +			if (!of_find_node_by_name(child, "fixed-link")) {
> +				ret = of_property_read_u32_array(child, "phy_id", phy_id, 2);
> +				if (ret)
> +					return ret;
> +			}
>  
>  			slave->dev.device_node = child;
>  			slave->phy_id = phy_id[1];
> -- 
> 2.14.1
> 
> 
> _______________________________________________
> 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