mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Wjatscheslaw Stoljarski <wjatscheslaw.stoljarski@kiwigrid.com>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] net: fec: add simple support for fixed-link
Date: Wed,  4 May 2016 09:28:55 +0200	[thread overview]
Message-ID: <1462346935-31609-1-git-send-email-wjatscheslaw.stoljarski@kiwigrid.com> (raw)

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

             reply	other threads:[~2016-05-04  7:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04  7:28 Wjatscheslaw Stoljarski [this message]
2016-05-04 13:11 ` Sascha Hauer
2016-05-04 14:55   ` Wjatscheslaw Stoljarski
2016-05-09  6:31     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462346935-31609-1-git-send-email-wjatscheslaw.stoljarski@kiwigrid.com \
    --to=wjatscheslaw.stoljarski@kiwigrid.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox