* [PATCH] net: ftgmac100: Add reset control
@ 2023-07-27 1:58 Dylan Hung
2023-10-02 9:09 ` Ryan Chen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dylan Hung @ 2023-07-27 1:58 UTC (permalink / raw)
To: ryan_chen, chiawei_wang, BMC-SW, joel, joe.hershberger,
rfried.dev, u-boot
Cc: kobedylan, Dylan Hung
Add optional reset control, especially for the Aspeed SOC. For the
hardware without a reset line, the reset assertion/deassertion will be
skipped.
Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
---
drivers/net/ftgmac100.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index a50cde338a..886b97119d 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -13,6 +13,7 @@
#include <common.h>
#include <clk.h>
+#include <reset.h>
#include <cpu_func.h>
#include <dm.h>
#include <log.h>
@@ -90,6 +91,7 @@ struct ftgmac100_data {
u32 max_speed;
struct clk_bulk clks;
+ struct reset_ctl *reset_ctl;
/* End of RX/TX ring buffer bits. Depend on model */
u32 rxdes0_edorr_mask;
@@ -568,6 +570,8 @@ static int ftgmac100_of_to_plat(struct udevice *dev)
priv->txdes0_edotr_mask = BIT(15);
}
+ priv->reset_ctl = devm_reset_control_get_optional(dev, NULL);
+
return clk_get_bulk(dev, &priv->clks);
}
@@ -593,6 +597,12 @@ static int ftgmac100_probe(struct udevice *dev)
if (ret)
goto out;
+ if (priv->reset_ctl) {
+ ret = reset_deassert(priv->reset_ctl);
+ if (ret)
+ goto out;
+ }
+
/*
* If DM MDIO is enabled, the MDIO bus will be initialized later in
* dm_eth_phy_connect
@@ -628,6 +638,8 @@ static int ftgmac100_remove(struct udevice *dev)
free(priv->phydev);
mdio_unregister(priv->bus);
mdio_free(priv->bus);
+ if (priv->reset_ctl)
+ reset_assert(priv->reset_ctl);
clk_release_bulk(&priv->clks);
return 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] net: ftgmac100: Add reset control
2023-07-27 1:58 [PATCH] net: ftgmac100: Add reset control Dylan Hung
@ 2023-10-02 9:09 ` Ryan Chen
2023-10-06 20:31 ` Ramon Fried
2023-11-06 16:32 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Ryan Chen @ 2023-10-02 9:09 UTC (permalink / raw)
To: Dylan Hung, ChiaWei Wang, BMC-SW, joel, joe.hershberger,
rfried.dev, u-boot
Cc: Dylan Hung
> -----Original Message-----
> From: Dylan Hung <kobedylan@gmail.com>
> Sent: Thursday, July 27, 2023 9:58 AM
> To: Ryan Chen <ryan_chen@aspeedtech.com>; ChiaWei Wang
> <chiawei_wang@aspeedtech.com>; BMC-SW <BMC-SW@aspeedtech.com>;
> joel@jms.id.au; joe.hershberger@ni.com; rfried.dev@gmail.com;
> u-boot@lists.denx.de
> Cc: kobedylan@gmail.com; Dylan Hung <dylan_hung@aspeedtech.com>
> Subject: [PATCH] net: ftgmac100: Add reset control
>
> Add optional reset control, especially for the Aspeed SOC. For the hardware
> without a reset line, the reset assertion/deassertion will be skipped.
>
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
> ---
> drivers/net/ftgmac100.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c index
> a50cde338a..886b97119d 100644
> --- a/drivers/net/ftgmac100.c
> +++ b/drivers/net/ftgmac100.c
> @@ -13,6 +13,7 @@
>
> #include <common.h>
> #include <clk.h>
> +#include <reset.h>
> #include <cpu_func.h>
> #include <dm.h>
> #include <log.h>
> @@ -90,6 +91,7 @@ struct ftgmac100_data {
> u32 max_speed;
>
> struct clk_bulk clks;
> + struct reset_ctl *reset_ctl;
>
> /* End of RX/TX ring buffer bits. Depend on model */
> u32 rxdes0_edorr_mask;
> @@ -568,6 +570,8 @@ static int ftgmac100_of_to_plat(struct udevice *dev)
> priv->txdes0_edotr_mask = BIT(15);
> }
>
> + priv->reset_ctl = devm_reset_control_get_optional(dev, NULL);
> +
> return clk_get_bulk(dev, &priv->clks); }
>
> @@ -593,6 +597,12 @@ static int ftgmac100_probe(struct udevice *dev)
> if (ret)
> goto out;
>
> + if (priv->reset_ctl) {
> + ret = reset_deassert(priv->reset_ctl);
> + if (ret)
> + goto out;
> + }
> +
> /*
> * If DM MDIO is enabled, the MDIO bus will be initialized later in
> * dm_eth_phy_connect
> @@ -628,6 +638,8 @@ static int ftgmac100_remove(struct udevice *dev)
> free(priv->phydev);
> mdio_unregister(priv->bus);
> mdio_free(priv->bus);
> + if (priv->reset_ctl)
> + reset_assert(priv->reset_ctl);
> clk_release_bulk(&priv->clks);
>
> return 0;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: ftgmac100: Add reset control
2023-07-27 1:58 [PATCH] net: ftgmac100: Add reset control Dylan Hung
2023-10-02 9:09 ` Ryan Chen
@ 2023-10-06 20:31 ` Ramon Fried
2023-11-06 16:32 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Ramon Fried @ 2023-10-06 20:31 UTC (permalink / raw)
To: Dylan Hung
Cc: ryan_chen, chiawei_wang, BMC-SW, joel, joe.hershberger, u-boot,
Dylan Hung
On Thu, Jul 27, 2023 at 4:58 AM Dylan Hung <kobedylan@gmail.com> wrote:
>
> Add optional reset control, especially for the Aspeed SOC. For the
> hardware without a reset line, the reset assertion/deassertion will be
> skipped.
>
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
> ---
> drivers/net/ftgmac100.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
> index a50cde338a..886b97119d 100644
> --- a/drivers/net/ftgmac100.c
> +++ b/drivers/net/ftgmac100.c
> @@ -13,6 +13,7 @@
>
> #include <common.h>
> #include <clk.h>
> +#include <reset.h>
> #include <cpu_func.h>
> #include <dm.h>
> #include <log.h>
> @@ -90,6 +91,7 @@ struct ftgmac100_data {
> u32 max_speed;
>
> struct clk_bulk clks;
> + struct reset_ctl *reset_ctl;
>
> /* End of RX/TX ring buffer bits. Depend on model */
> u32 rxdes0_edorr_mask;
> @@ -568,6 +570,8 @@ static int ftgmac100_of_to_plat(struct udevice *dev)
> priv->txdes0_edotr_mask = BIT(15);
> }
>
> + priv->reset_ctl = devm_reset_control_get_optional(dev, NULL);
> +
> return clk_get_bulk(dev, &priv->clks);
> }
>
> @@ -593,6 +597,12 @@ static int ftgmac100_probe(struct udevice *dev)
> if (ret)
> goto out;
>
> + if (priv->reset_ctl) {
> + ret = reset_deassert(priv->reset_ctl);
> + if (ret)
> + goto out;
> + }
> +
> /*
> * If DM MDIO is enabled, the MDIO bus will be initialized later in
> * dm_eth_phy_connect
> @@ -628,6 +638,8 @@ static int ftgmac100_remove(struct udevice *dev)
> free(priv->phydev);
> mdio_unregister(priv->bus);
> mdio_free(priv->bus);
> + if (priv->reset_ctl)
> + reset_assert(priv->reset_ctl);
> clk_release_bulk(&priv->clks);
>
> return 0;
> --
> 2.25.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: ftgmac100: Add reset control
2023-07-27 1:58 [PATCH] net: ftgmac100: Add reset control Dylan Hung
2023-10-02 9:09 ` Ryan Chen
2023-10-06 20:31 ` Ramon Fried
@ 2023-11-06 16:32 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2023-11-06 16:32 UTC (permalink / raw)
To: Dylan Hung
Cc: ryan_chen, chiawei_wang, BMC-SW, joel, joe.hershberger,
rfried.dev, u-boot, Dylan Hung
[-- Attachment #1: Type: text/plain, Size: 433 bytes --]
On Thu, Jul 27, 2023 at 09:58:14AM +0800, Dylan Hung wrote:
> Add optional reset control, especially for the Aspeed SOC. For the
> hardware without a reset line, the reset assertion/deassertion will be
> skipped.
>
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
> Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-06 16:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-27 1:58 [PATCH] net: ftgmac100: Add reset control Dylan Hung
2023-10-02 9:09 ` Ryan Chen
2023-10-06 20:31 ` Ramon Fried
2023-11-06 16:32 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.