]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: dm: fec: Obtain the transceiver type from the DT
authorMartin Fuzzey <martin.fuzzey@flowbird.group>
Thu, 4 Oct 2018 17:59:21 +0000 (19:59 +0200)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 24 Oct 2018 19:45:37 +0000 (14:45 -0500)
The DT property "phy-mode" already provides the transceiver type.
Use it so that we do not have to also set CONFIG_FEC_XCV_TYPE

Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/fec_mxc.c

index d3a926dc73731269e14915b8477527cad5b10111..03df92c6c130c02cee0b725834a46f65f5d69b29 100644 (file)
@@ -1312,8 +1312,27 @@ static int fecmxc_probe(struct udevice *dev)
        }
 
        priv->bus = bus;
-       priv->xcv_type = CONFIG_FEC_XCV_TYPE;
        priv->interface = pdata->phy_interface;
+       switch (priv->interface) {
+       case PHY_INTERFACE_MODE_MII:
+               priv->xcv_type = MII100;
+               break;
+       case PHY_INTERFACE_MODE_RMII:
+               priv->xcv_type = RMII;
+               break;
+       case PHY_INTERFACE_MODE_RGMII:
+       case PHY_INTERFACE_MODE_RGMII_ID:
+       case PHY_INTERFACE_MODE_RGMII_RXID:
+       case PHY_INTERFACE_MODE_RGMII_TXID:
+               priv->xcv_type = RGMII;
+               break;
+       default:
+               priv->xcv_type = CONFIG_FEC_XCV_TYPE;
+               printf("Unsupported interface type %d defaulting to %d\n",
+                      priv->interface, priv->xcv_type);
+               break;
+       }
+
        ret = fec_phy_init(priv, dev);
        if (ret)
                goto err_phy;