From: Heesub Shin <heesub@gmail.com>
To: u-boot@lists.denx.de
Cc: Heesub Shin <heesub@gmail.com>
Subject: [PATCH 4/5] net: dwc_eth_qos: add support for phy-reset-gpios property
Date: Sun, 28 Apr 2024 23:24:05 +0900 [thread overview]
Message-ID: <20240428142406.28445-4-heesub@gmail.com> (raw)
In-Reply-To: <20240428142406.28445-1-heesub@gmail.com>
This commit adds support for a property 'phy-reset-gpios' to reset PHY
chipset.
Signed-off-by: Heesub Shin <heesub@gmail.com>
---
drivers/net/dwc_eth_qos_stm32.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dwc_eth_qos_stm32.c b/drivers/net/dwc_eth_qos_stm32.c
index fbc08bba1d..cffaa10b70 100644
--- a/drivers/net/dwc_eth_qos_stm32.c
+++ b/drivers/net/dwc_eth_qos_stm32.c
@@ -266,6 +266,12 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
if (ret)
dev_warn(dev, "No phy clock provided %d\n", ret);
+ /* Get reset gpio pin (optional) */
+ ret = gpio_request_by_name(dev, "phy-reset-gpios", 0,
+ &eqos->phy_reset_gpio, GPIOD_IS_OUT);
+ if (ret)
+ pr_warn("No phy reset gpio provided: %d\n", ret);
+
dev_dbg(dev, "%s: OK\n", __func__);
return 0;
@@ -277,6 +283,21 @@ err_probe:
return ret;
}
+static int eqos_start_resets_stm32(struct udevice *dev)
+{
+ struct eqos_priv *eqos = dev_get_priv(dev);
+
+ debug("%s(dev=%p):\n", __func__, dev);
+
+ if (dm_gpio_is_valid(&eqos->phy_reset_gpio)) {
+ dm_gpio_set_value(&eqos->phy_reset_gpio, 1);
+ udelay(2);
+ dm_gpio_set_value(&eqos->phy_reset_gpio, 0);
+ }
+
+ return 0;
+}
+
static int eqos_remove_resources_stm32(struct udevice *dev)
{
dev_dbg(dev, "%s:\n", __func__);
@@ -292,7 +313,7 @@ static struct eqos_ops eqos_stm32_ops = {
.eqos_probe_resources = eqos_probe_resources_stm32,
.eqos_remove_resources = eqos_remove_resources_stm32,
.eqos_stop_resets = eqos_null_ops,
- .eqos_start_resets = eqos_null_ops,
+ .eqos_start_resets = eqos_start_resets_stm32,
.eqos_stop_clks = eqos_stop_clks_stm32,
.eqos_start_clks = eqos_start_clks_stm32,
.eqos_calibrate_pads = eqos_null_ops,
--
2.34.1
next prev parent reply other threads:[~2024-04-28 14:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-28 14:24 [PATCH 1/5] dts: stm32mp157c-odyssey: set PLL4_P to 125Mhz for ETH_CLK Heesub Shin
2024-04-28 14:24 ` [PATCH 2/5] dts: stm32mp157c-odyssey: use internal clock for Tx Heesub Shin
2024-06-06 14:37 ` Patrice CHOTARD
2024-06-14 12:08 ` Patrice CHOTARD
2024-04-28 14:24 ` [PATCH 3/5] dts: stm32mp157c-odyssey: fix incorrect PHY address Heesub Shin
2024-06-06 14:37 ` Patrice CHOTARD
2024-06-14 12:08 ` Patrice CHOTARD
2024-06-14 12:10 ` Patrice CHOTARD
2024-04-28 14:24 ` Heesub Shin [this message]
2024-06-06 14:38 ` [PATCH 4/5] net: dwc_eth_qos: add support for phy-reset-gpios property Patrice CHOTARD
2024-06-14 12:08 ` Patrice CHOTARD
2024-04-28 14:24 ` [PATCH 5/5] dts: stm32mp157c-odyssey: add phy-reset-gpios property to ethernet node Heesub Shin
2024-06-06 14:39 ` Patrice CHOTARD
2024-06-14 12:08 ` Patrice CHOTARD
2024-06-06 14:36 ` [PATCH 1/5] dts: stm32mp157c-odyssey: set PLL4_P to 125Mhz for ETH_CLK Patrice CHOTARD
2024-06-14 12:08 ` Patrice CHOTARD
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=20240428142406.28445-4-heesub@gmail.com \
--to=heesub@gmail.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