ravb: Add RZ/G2L MII interface support
[platform/kernel/linux-starfive.git] / drivers / net / ethernet / renesas / ravb_main.c
index d013cc1..a550ffe 100644 (file)
@@ -540,7 +540,13 @@ static void ravb_emac_init_gbeth(struct net_device *ndev)
        /* E-MAC interrupt enable register */
        ravb_write(ndev, ECSIPR_ICDIP, ECSIPR);
 
-       ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, CXR31_SEL_LINK0);
+       if (priv->phy_interface == PHY_INTERFACE_MODE_MII) {
+               ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, 0);
+               ravb_write(ndev, (1000 << 16) | CXR35_SEL_XMII_MII, CXR35);
+       } else {
+               ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1,
+                           CXR31_SEL_LINK0);
+       }
 }
 
 static void ravb_emac_init_rcar(struct net_device *ndev)