diff mbox series

[U-Boot,4/4] net: dm: fec: Obtain the transceiver type from the DT

Message ID 1538675965-4495-5-git-send-email-martin.fuzzey@flowbird.group
State Accepted
Commit 0126c64
Delegated to: Joe Hershberger
Headers show
Series net: dm: fec: Fixes and improvements | expand

Commit Message

Martin Fuzzey Oct. 4, 2018, 5:59 p.m. UTC
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>
---
 drivers/net/fec_mxc.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

Comments

Joe Hershberger Oct. 22, 2018, 8:56 p.m. UTC | #1
On Thu, Oct 4, 2018 at 1:03 PM Martin Fuzzey
<martin.fuzzey@flowbird.group> wrote:
>
> 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>
Joe Hershberger Oct. 24, 2018, 7:57 p.m. UTC | #2
Hi Martin,

https://patchwork.ozlabs.org/patch/979102/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 4a5555e..e3fc595 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -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;