mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: fec: add simple support for fixed-link
@ 2016-05-04  7:28 Wjatscheslaw Stoljarski
  2016-05-04 13:11 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Wjatscheslaw Stoljarski @ 2016-05-04  7:28 UTC (permalink / raw)
  To: Barebox List

Signed-off-by: Wjatscheslaw Stoljarski <wjatscheslaw.stoljarski@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-09  6:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-04  7:28 [PATCH] net: fec: add simple support for fixed-link Wjatscheslaw Stoljarski
2016-05-04 13:11 ` Sascha Hauer
2016-05-04 14:55   ` Wjatscheslaw Stoljarski
2016-05-09  6:31     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox