[PATCH] net: tsec: add option to set device max-speed via dts

Vladimir Oltean vladimir.oltean at nxp.com
Fri Jun 4 13:28:46 CEST 2021


On Fri, Jun 04, 2021 at 11:13:36AM +0000, Aleksandar Gerasimovski wrote:
> Current tsec adapter sets adapter gigabit capabilities by default, and in
> reality this must not always be the case.
> It is possible that tsec adapter is used for 100Mbit connection, and in
> this case setting 1000Mbit capabilities can lead to some side effects such
> longer autoneg process.
> 
> In our ls102x designs this problem leads to long autoneg times (> 4 sec)
> in case board rgmii link is 100Mbs capble only.
> Limiting the rgmii link capabilities provides smother and faster
> link establishment.
> 
> Signed-off-by: Aleksandar Gerasimovski <aleksandar.gerasimovski at hitachi-powergrids.com>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean at nxp.com>

Just one comment below:

>  drivers/net/tsec.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
> index c68e4b7..501390f 100644
> --- a/drivers/net/tsec.c
> +++ b/drivers/net/tsec.c
> @@ -824,6 +824,7 @@ int tsec_probe(struct udevice *dev)
>  	struct tsec_private *priv = dev_get_priv(dev);
>  	struct ofnode_phandle_args phandle_args;
>  	u32 tbiaddr = CONFIG_SYS_TBIPA_VALUE;
> +	u32 max_speed;

It would be nice if you could keep the variable sort order, which is in
decreasing order of line length (so-called "reverse Christmas tree
notation").

>  	struct tsec_data *data;
>  	const char *phy_mode;
>  	ofnode parent, child;
> @@ -893,8 +894,12 @@ int tsec_probe(struct udevice *dev)
>  	}
>  	priv->interface = pdata->phy_interface;
>  
> +	/* Check for speed limis, default is 1000Mbps */
> +	max_speed = dev_read_u32_default(dev, "max-speed", 1000);
> +
>  	/* Initialize flags */
> -	priv->flags = TSEC_GIGABIT;
> +	if (max_speed == 1000)
> +		priv->flags = TSEC_GIGABIT;
>  	if (priv->interface == PHY_INTERFACE_MODE_SGMII)
>  		priv->flags |= TSEC_SGMII;
>  
> -- 
> 1.8.3.1

Thanks.


More information about the U-Boot mailing list