From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH v3 3/4] i.MX: fec: add post PHY reset delay DT property
Date: Wed, 7 Jun 2017 12:34:21 +0200 [thread overview]
Message-ID: <20170607103422.4673-4-m.grzeschik@pengutronix.de> (raw)
In-Reply-To: <20170607103422.4673-1-m.grzeschik@pengutronix.de>
Some PHY require to wait for a bit after the reset GPIO has been
toggled. This adds support for the DT property `phy-reset-post-delay`
which gives the delay in milliseconds to wait after reset.
If the DT property is not given, no delay is observed. Post reset
delay greater than 1000ms are invalid.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
drivers/net/fec_imx.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 8cf7c4fbda..d506fd64f1 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -743,7 +743,7 @@ static int fec_probe(struct device_d *dev)
int ret;
enum fec_type type;
int phy_reset;
- u32 msec = 1;
+ u32 msec = 1, phy_post_delay = 0;
u64 start;
ret = dev_get_drvdata(dev, (const void **)&type);
@@ -781,6 +781,11 @@ static int fec_probe(struct device_d *dev)
phy_reset = of_get_named_gpio(dev->device_node, "phy-reset-gpios", 0);
if (gpio_is_valid(phy_reset)) {
of_property_read_u32(dev->device_node, "phy-reset-duration", &msec);
+ of_property_read_u32(dev->device_node, "phy-reset-post-delay",
+ &phy_post_delay);
+ /* valid reset duration should be less than 1s */
+ if (phy_post_delay > 1000)
+ goto release_res;
ret = gpio_request(phy_reset, "phy-reset");
if (ret)
@@ -792,6 +797,9 @@ static int fec_probe(struct device_d *dev)
mdelay(msec);
gpio_set_value(phy_reset, 1);
+
+ if (phy_post_delay)
+ mdelay(phy_post_delay);
}
/* Reset chip. */
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-06-07 10:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 10:34 [PATCH v3 0/4] imx6ul: add Technexion Pico Hobbit support Michael Grzeschik
2017-06-07 10:34 ` [PATCH v3 1/4] ARM: i.MX: setup ENET_TX_CLK_DIR in imx6_init for every imx6ul Michael Grzeschik
2017-06-07 10:34 ` [PATCH v3 2/4] ARM: phytec-som-imx6: remove needles enet refclk setup Michael Grzeschik
2017-06-07 10:34 ` Michael Grzeschik [this message]
2017-06-07 10:34 ` [PATCH v3 4/4] ARM: i.MX6: add Technexion Pico Hobbit support Michael Grzeschik
2017-06-07 11:58 ` [PATCH v3 0/4] imx6ul: " 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=20170607103422.4673-4-m.grzeschik@pengutronix.de \
--to=m.grzeschik@pengutronix.de \
--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