ramips: ethernet: ralink: allow to return EPROBE_DEFER on switch_init
authorAlexander Couzens <lynxis@fe80.eu>
Wed, 2 Jun 2021 00:01:53 +0000 (00:01 +0000)
committerAlexander Couzens <lynxis@fe80.eu>
Fri, 25 Jun 2021 08:52:50 +0000 (10:52 +0200)
For rt3050 the switch needs to be initialized before the ethernet start sending
packets. Allow switch_init to return -EPROBE_DEFER.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c

index 8a088bd5ceaedc95ed6d59df453cd4118a29892d..cf6d4806edabf277169178bd6182d5107869ac08 100644 (file)
@@ -1376,11 +1376,16 @@ static int __init fe_init(struct net_device *dev)
        else
                fe_reset_fe(priv);
 
-       if (priv->soc->switch_init)
-               if (priv->soc->switch_init(priv)) {
+       if (priv->soc->switch_init) {
+               err = priv->soc->switch_init(priv);
+               if (err) {
+                       if (err == -EPROBE_DEFER)
+                               return err;
+
                        netdev_err(dev, "failed to initialize switch core\n");
                        return -ENODEV;
                }
+       }
 
        fe_reset_phy(priv);