From: Andrejs Cainikovs <Andrejs.Cainikovs@netmodule.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] net: dm: fec: Support phy-reset-post-delay property
Date: Fri, 1 Mar 2019 13:27:59 +0000 [thread overview]
Message-ID: <20190301132755.947-2-andrejs.cainikovs@netmodule.com> (raw)
In-Reply-To: <20190301132755.947-1-andrejs.cainikovs@netmodule.com>
As per Linux kernel DT binding doc:
- phy-reset-post-delay : Post reset delay in milliseconds. If present then
a delay of phy-reset-post-delay milliseconds will be observed after the
phy-reset-gpios has been toggled. Can be omitted thus no delay is
observed. Delay is in range of 1ms to 1000ms. Other delays are invalid.
Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@netmodule.com>
---
drivers/net/fec_mxc.c | 11 +++++++++++
drivers/net/fec_mxc.h | 1 +
2 files changed, 12 insertions(+)
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index a14fe43a5b..7fc95fa767 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1315,6 +1315,8 @@ static void fec_gpio_reset(struct fec_priv *priv)
dm_gpio_set_value(&priv->phy_reset_gpio, 1);
mdelay(priv->reset_delay);
dm_gpio_set_value(&priv->phy_reset_gpio, 0);
+ if (priv->reset_post_delay)
+ mdelay(priv->reset_post_delay);
}
}
#endif
@@ -1474,6 +1476,15 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)
/* property value wrong, use default value */
priv->reset_delay = 1;
}
+
+ priv->reset_post_delay = dev_read_u32_default(dev,
+ "phy-reset-post-delay",
+ 0);
+ if (priv->reset_post_delay > 1000) {
+ printf("FEC MXC: phy reset post delay should be <= 1000ms\n");
+ /* property value wrong, use default value */
+ priv->reset_post_delay = 0;
+ }
#endif
return 0;
diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h
index e9a661f0a1..e5f2dd75c5 100644
--- a/drivers/net/fec_mxc.h
+++ b/drivers/net/fec_mxc.h
@@ -258,6 +258,7 @@ struct fec_priv {
#ifdef CONFIG_DM_GPIO
struct gpio_desc phy_reset_gpio;
uint32_t reset_delay;
+ uint32_t reset_post_delay;
#endif
#ifdef CONFIG_DM_ETH
u32 interface;
--
2.11.0
next prev parent reply other threads:[~2019-03-01 13:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 13:27 [U-Boot] [PATCH 0/2] Fix broken ethernet on imx8qxp-mek Andrejs Cainikovs
2019-03-01 13:27 ` Andrejs Cainikovs [this message]
2019-03-01 13:57 ` [U-Boot] [PATCH 1/2] net: dm: fec: Support phy-reset-post-delay property Anatolij Gustschin
2019-03-01 14:07 ` Stefano Babic
2019-03-01 18:49 ` Joe Hershberger
2019-03-03 22:18 ` Lukasz Majewski
2019-03-05 18:05 ` [U-Boot] " Joe Hershberger
2019-03-12 9:10 ` Anatolij Gustschin
2019-03-12 17:22 ` Joe Hershberger
2019-03-01 13:28 ` [U-Boot] [PATCH 2/2] dts: imx8qxp-mek: Add PHY post reset delay Andrejs Cainikovs
2019-03-01 13:58 ` Anatolij Gustschin
2019-03-01 14:07 ` Stefano Babic
2019-03-01 18:49 ` Joe Hershberger
2019-03-05 18:05 ` [U-Boot] " Joe Hershberger
2019-03-12 9:13 ` Anatolij Gustschin
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=20190301132755.947-2-andrejs.cainikovs@netmodule.com \
--to=andrejs.cainikovs@netmodule.com \
--cc=u-boot@lists.denx.de \
/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