summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2017-06-07 12:34:21 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-06-07 13:54:49 +0200
commitcd79610404ef65fc77cac3359cb9b9f4c1d87b39 (patch)
treecf36bbddde7121bb2c93aaf2ff59e2a58a6de4ea /drivers
parent83538c10291d0e93de954d2b18887981c72df620 (diff)
downloadbarebox-cd79610404ef65fc77cac3359cb9b9f4c1d87b39.tar.gz
barebox-cd79610404ef65fc77cac3359cb9b9f4c1d87b39.tar.xz
i.MX: fec: add post PHY reset delay DT property
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/fec_imx.c10
1 files changed, 9 insertions, 1 deletions
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. */