[PATCH] net: fec: add simple support for fixed-link

Wjatscheslaw Stoljarski wjatscheslaw.stoljarski at kiwigrid.com
Wed May 4 00:28:55 PDT 2016


Signed-off-by: Wjatscheslaw Stoljarski <wjatscheslaw.stoljarski at kiwigrid.com>
---
 drivers/net/fec_imx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 696483f..31802c2 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -669,6 +669,8 @@ static int fec_probe(struct device_d *dev)
 	enum fec_type type;
 	int phy_reset;
 	u32 msec = 1;
+	struct device_node *fixed_link_node;
+	int speed;
 
 	ret = dev_get_drvdata(dev, (const void **)&type);
 	if (ret)
@@ -716,6 +718,16 @@ static int fec_probe(struct device_d *dev)
 		gpio_set_value(phy_reset, 1);
 	}
 
+	fixed_link_node = of_get_child_by_name(dev->device_node, "fixed-link");
+	if (fixed_link_node) {
+		if (!of_property_read_u32(fixed_link_node, "speed", &speed)) {
+			if (speed == 100)
+				fec->phy_flags |= PHYLIB_FORCE_100;
+			else if (speed == 10)
+				fec->phy_flags |= PHYLIB_FORCE_10;
+		}
+	}
+
 	/* Reset chip. */
 	writel(FEC_ECNTRL_RESET, fec->regs + FEC_ECNTRL);
 	while(readl(fec->regs + FEC_ECNTRL) & 1) {
-- 
1.9.1




More information about the barebox mailing list