]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: tsec: add option to set device max-speed via dts
authorAleksandar Gerasimovski <aleksandar.gerasimovski@hitachi-powergrids.com>
Fri, 4 Jun 2021 13:40:58 +0000 (13:40 +0000)
committerPriyanka Jain <priyanka.jain@nxp.com>
Thu, 17 Jun 2021 06:16:11 +0000 (11:46 +0530)
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 100Mbps connection, and in
this case setting 1000Mbps 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 100Mbps capable only.
Limiting the rgmii link capabilities provides faster and smoother
link establishment.

Signed-off-by: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachi-powergrids.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
drivers/net/tsec.c

index c68e4b7fb5e7601dee89753dd1b069151287bc00..ee820aae15efd1512de3349e5aabb52ecef47d53 100644 (file)
@@ -828,6 +828,7 @@ int tsec_probe(struct udevice *dev)
        const char *phy_mode;
        ofnode parent, child;
        fdt_addr_t reg;
+       u32 max_speed;
        int ret;
 
        data = (struct tsec_data *)dev_get_driver_data(dev);
@@ -893,8 +894,12 @@ int tsec_probe(struct udevice *dev)
        }
        priv->interface = pdata->phy_interface;
 
+       /* Check for speed limit, 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;