All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] prevent undesired de-assertion of phy-reset
@ 2022-03-01 20:15 Tim Harvey
  2022-03-01 20:15 ` [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request Tim Harvey
  2022-03-01 20:15 ` [PATCH 2/2] net: eth-phy: " Tim Harvey
  0 siblings, 2 replies; 10+ messages in thread
From: Tim Harvey @ 2022-03-01 20:15 UTC (permalink / raw)
  To: u-boot, Joe Hershberger, Ramon Fried; +Cc: Tim Harvey

Some PHY's have strict requirements on reset timings which can be
violated if the PHY is taken out of reset before a proper reset pulse is
performed.

When gpio_request_by_name is used for reset gpios without
GPIOD_IS_OUT_ACTIVE the GPIO will be de-asserted when requested taking
the PHY out of reset. Resolve this by adding the GPIOD_IS_OUT_ACTIVE
flag.

There are 42 occurances of gpio_request_by_name in U-Boot for gpio's
with 'reset' in their name yet the only one that uses
GPIOD_IS_OUT_ACTIVE is drivers/net/dwc_eth_qos.c. While I think setting
GPIOD_IS_OUT_ACTIVE is the right thing to do, I'm only changing the ones
that I have run into issues with:
 drivers/net/eth-phy-uclass.c
 drivers/net/fec_mxc.c

Both of these have functions that are called that assert, delay,
de-assert, delay such that I know they will properly be taken out of
reset.

The Linux kernel had a similar issue [1]

Tim Harvey (2):
  net: fec: prevent undesired de-assertion of phy-reset on request
  net: eth-phy: prevent undesired de-assertion of phy-reset on request

 drivers/net/eth-phy-uclass.c | 2 +-
 drivers/net/fec_mxc.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
[1]
https://lore.kernel.org/all/20210202143239.10714-1-mike.looijmans@topic.nl/
2.17.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request
  2022-03-01 20:15 [PATCH 0/2] prevent undesired de-assertion of phy-reset Tim Harvey
@ 2022-03-01 20:15 ` Tim Harvey
  2022-03-01 20:38   ` Joe Hershberger
  2022-03-01 20:15 ` [PATCH 2/2] net: eth-phy: " Tim Harvey
  1 sibling, 1 reply; 10+ messages in thread
From: Tim Harvey @ 2022-03-01 20:15 UTC (permalink / raw)
  To: u-boot, Joe Hershberger, Ramon Fried; +Cc: Tim Harvey, Sean Anderson

When gpio_request_by_name allocates a gpio output it by default will
de-assert the gpio which for phy-reset will take the PHY out of reset.
As this occurs before fec_gpio_reset is called to assert the reset
line it can cause undesired affects if reset timings are not properly
met.

Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active
(reset asserted) to avoid this.

Cc: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/net/fec_mxc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 985b03844739..c1f4930172cf 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1579,7 +1579,7 @@ static int fecmxc_of_to_plat(struct udevice *dev)
 
 #if CONFIG_IS_ENABLED(DM_GPIO)
 	ret = gpio_request_by_name(dev, "phy-reset-gpios", 0,
-				   &priv->phy_reset_gpio, GPIOD_IS_OUT);
+				   &priv->phy_reset_gpio, GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
 	if (ret < 0)
 		return 0; /* property is optional, don't return error! */
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] net: eth-phy: prevent undesired de-assertion of phy-reset on request
  2022-03-01 20:15 [PATCH 0/2] prevent undesired de-assertion of phy-reset Tim Harvey
  2022-03-01 20:15 ` [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request Tim Harvey
@ 2022-03-01 20:15 ` Tim Harvey
  2022-03-01 20:38   ` Joe Hershberger
  1 sibling, 1 reply; 10+ messages in thread
From: Tim Harvey @ 2022-03-01 20:15 UTC (permalink / raw)
  To: u-boot, Joe Hershberger, Ramon Fried; +Cc: Tim Harvey, Sean Anderson

When gpio_request_by_name allocates a gpio output it by default will
de-assert the gpio which for phy-reset will take the PHY out of reset.
As this occurs before eth_phy_reset is called to assert the reset
line it can cause undesired affects if reset timings are not properly
met.

Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active
(reset asserted) to avoid this.

Cc: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/net/eth-phy-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c
index 1f285f7afd20..27b77444a0c5 100644
--- a/drivers/net/eth-phy-uclass.c
+++ b/drivers/net/eth-phy-uclass.c
@@ -137,7 +137,7 @@ static int eth_phy_of_to_plat(struct udevice *dev)
 	/* search "reset-gpios" in phy node */
 	ret = gpio_request_by_name(dev, "reset-gpios", 0,
 				   &uc_priv->reset_gpio,
-				   GPIOD_IS_OUT);
+				   GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
 	if (ret && ret != -ENOENT)
 		return ret;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request
  2022-03-01 20:15 ` [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request Tim Harvey
@ 2022-03-01 20:38   ` Joe Hershberger
  2022-03-02  1:58     ` Adam Ford
  0 siblings, 1 reply; 10+ messages in thread
From: Joe Hershberger @ 2022-03-01 20:38 UTC (permalink / raw)
  To: Tim Harvey; +Cc: u-boot, Joe Hershberger, Ramon Fried, Sean Anderson

On Tue, Mar 1, 2022 at 2:15 PM Tim Harvey <tharvey@gateworks.com> wrote:
>
> When gpio_request_by_name allocates a gpio output it by default will
> de-assert the gpio which for phy-reset will take the PHY out of reset.
> As this occurs before fec_gpio_reset is called to assert the reset
> line it can cause undesired affects if reset timings are not properly
> met.
>
> Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active
> (reset asserted) to avoid this.
>
> Cc: Sean Anderson <sean.anderson@seco.com>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] net: eth-phy: prevent undesired de-assertion of phy-reset on request
  2022-03-01 20:15 ` [PATCH 2/2] net: eth-phy: " Tim Harvey
@ 2022-03-01 20:38   ` Joe Hershberger
  2022-03-03  7:55     ` Ramon Fried
  0 siblings, 1 reply; 10+ messages in thread
From: Joe Hershberger @ 2022-03-01 20:38 UTC (permalink / raw)
  To: Tim Harvey; +Cc: u-boot, Joe Hershberger, Ramon Fried, Sean Anderson

On Tue, Mar 1, 2022 at 2:15 PM Tim Harvey <tharvey@gateworks.com> wrote:
>
> When gpio_request_by_name allocates a gpio output it by default will
> de-assert the gpio which for phy-reset will take the PHY out of reset.
> As this occurs before eth_phy_reset is called to assert the reset
> line it can cause undesired affects if reset timings are not properly
> met.
>
> Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active
> (reset asserted) to avoid this.
>
> Cc: Sean Anderson <sean.anderson@seco.com>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request
  2022-03-01 20:38   ` Joe Hershberger
@ 2022-03-02  1:58     ` Adam Ford
  2022-03-03  7:55       ` Ramon Fried
  0 siblings, 1 reply; 10+ messages in thread
From: Adam Ford @ 2022-03-02  1:58 UTC (permalink / raw)
  To: Joe Hershberger; +Cc: Tim Harvey, u-boot, Ramon Fried, Sean Anderson

On Tue, Mar 1, 2022 at 2:38 PM Joe Hershberger <joe.hershberger@ni.com> wrote:
>
> On Tue, Mar 1, 2022 at 2:15 PM Tim Harvey <tharvey@gateworks.com> wrote:
> >
> > When gpio_request_by_name allocates a gpio output it by default will
> > de-assert the gpio which for phy-reset will take the PHY out of reset.
> > As this occurs before fec_gpio_reset is called to assert the reset
> > line it can cause undesired affects if reset timings are not properly
> > met.
> >
> > Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active
> > (reset asserted) to avoid this.
> >
> > Cc: Sean Anderson <sean.anderson@seco.com>
> > Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>

Tested-by: Adam Ford <aford173@gmail.com> #imx8mm-beacon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request
  2022-03-02  1:58     ` Adam Ford
@ 2022-03-03  7:55       ` Ramon Fried
  2022-04-10  5:05         ` Ramon Fried
  0 siblings, 1 reply; 10+ messages in thread
From: Ramon Fried @ 2022-03-03  7:55 UTC (permalink / raw)
  To: Adam Ford; +Cc: Joe Hershberger, Tim Harvey, u-boot, Sean Anderson

On Wed, Mar 2, 2022 at 3:58 AM Adam Ford <aford173@gmail.com> wrote:
>
> On Tue, Mar 1, 2022 at 2:38 PM Joe Hershberger <joe.hershberger@ni.com> wrote:
> >
> > On Tue, Mar 1, 2022 at 2:15 PM Tim Harvey <tharvey@gateworks.com> wrote:
> > >
> > > When gpio_request_by_name allocates a gpio output it by default will
> > > de-assert the gpio which for phy-reset will take the PHY out of reset.
> > > As this occurs before fec_gpio_reset is called to assert the reset
> > > line it can cause undesired affects if reset timings are not properly
> > > met.
> > >
> > > Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active
> > > (reset asserted) to avoid this.
> > >
> > > Cc: Sean Anderson <sean.anderson@seco.com>
> > > Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> >
> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>
> Tested-by: Adam Ford <aford173@gmail.com> #imx8mm-beacon
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] net: eth-phy: prevent undesired de-assertion of phy-reset on request
  2022-03-01 20:38   ` Joe Hershberger
@ 2022-03-03  7:55     ` Ramon Fried
  2022-04-10  5:05       ` Ramon Fried
  0 siblings, 1 reply; 10+ messages in thread
From: Ramon Fried @ 2022-03-03  7:55 UTC (permalink / raw)
  To: Joe Hershberger; +Cc: Tim Harvey, u-boot, Sean Anderson

On Tue, Mar 1, 2022 at 10:38 PM Joe Hershberger <joe.hershberger@ni.com> wrote:
>
> On Tue, Mar 1, 2022 at 2:15 PM Tim Harvey <tharvey@gateworks.com> wrote:
> >
> > When gpio_request_by_name allocates a gpio output it by default will
> > de-assert the gpio which for phy-reset will take the PHY out of reset.
> > As this occurs before eth_phy_reset is called to assert the reset
> > line it can cause undesired affects if reset timings are not properly
> > met.
> >
> > Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active
> > (reset asserted) to avoid this.
> >
> > Cc: Sean Anderson <sean.anderson@seco.com>
> > Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request
  2022-03-03  7:55       ` Ramon Fried
@ 2022-04-10  5:05         ` Ramon Fried
  0 siblings, 0 replies; 10+ messages in thread
From: Ramon Fried @ 2022-04-10  5:05 UTC (permalink / raw)
  To: Adam Ford; +Cc: Joe Hershberger, Tim Harvey, u-boot, Sean Anderson

On Thu, Mar 3, 2022 at 9:55 AM Ramon Fried <rfried.dev@gmail.com> wrote:
>
> On Wed, Mar 2, 2022 at 3:58 AM Adam Ford <aford173@gmail.com> wrote:
> >
> > On Tue, Mar 1, 2022 at 2:38 PM Joe Hershberger <joe.hershberger@ni.com> wrote:
> > >
> > > On Tue, Mar 1, 2022 at 2:15 PM Tim Harvey <tharvey@gateworks.com> wrote:
> > > >
> > > > When gpio_request_by_name allocates a gpio output it by default will
> > > > de-assert the gpio which for phy-reset will take the PHY out of reset.
> > > > As this occurs before fec_gpio_reset is called to assert the reset
> > > > line it can cause undesired affects if reset timings are not properly
> > > > met.
> > > >
> > > > Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active
> > > > (reset asserted) to avoid this.
> > > >
> > > > Cc: Sean Anderson <sean.anderson@seco.com>
> > > > Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> > >
> > > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> >
> > Tested-by: Adam Ford <aford173@gmail.com> #imx8mm-beacon
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Applied to u-boot-net/next
Thanks,
Ramon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] net: eth-phy: prevent undesired de-assertion of phy-reset on request
  2022-03-03  7:55     ` Ramon Fried
@ 2022-04-10  5:05       ` Ramon Fried
  0 siblings, 0 replies; 10+ messages in thread
From: Ramon Fried @ 2022-04-10  5:05 UTC (permalink / raw)
  To: Joe Hershberger; +Cc: Tim Harvey, u-boot, Sean Anderson

On Thu, Mar 3, 2022 at 9:55 AM Ramon Fried <rfried.dev@gmail.com> wrote:
>
> On Tue, Mar 1, 2022 at 10:38 PM Joe Hershberger <joe.hershberger@ni.com> wrote:
> >
> > On Tue, Mar 1, 2022 at 2:15 PM Tim Harvey <tharvey@gateworks.com> wrote:
> > >
> > > When gpio_request_by_name allocates a gpio output it by default will
> > > de-assert the gpio which for phy-reset will take the PHY out of reset.
> > > As this occurs before eth_phy_reset is called to assert the reset
> > > line it can cause undesired affects if reset timings are not properly
> > > met.
> > >
> > > Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active
> > > (reset asserted) to avoid this.
> > >
> > > Cc: Sean Anderson <sean.anderson@seco.com>
> > > Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> >
> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Applied to u-boot-net/next
Thanks,
Ramon

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-04-10  5:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 20:15 [PATCH 0/2] prevent undesired de-assertion of phy-reset Tim Harvey
2022-03-01 20:15 ` [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request Tim Harvey
2022-03-01 20:38   ` Joe Hershberger
2022-03-02  1:58     ` Adam Ford
2022-03-03  7:55       ` Ramon Fried
2022-04-10  5:05         ` Ramon Fried
2022-03-01 20:15 ` [PATCH 2/2] net: eth-phy: " Tim Harvey
2022-03-01 20:38   ` Joe Hershberger
2022-03-03  7:55     ` Ramon Fried
2022-04-10  5:05       ` Ramon Fried

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.