diff mbox series

[1/2] net: fec: prevent undesired de-assertion of phy-reset on request

Message ID 20220301201502.28026-2-tharvey@gateworks.com
State Accepted
Commit 4223fb0ee18d11462c55ac94198fdc2055f2c27c
Delegated to: Ramon Fried
Headers show
Series prevent undesired de-assertion of phy-reset | expand

Commit Message

Tim Harvey March 1, 2022, 8:15 p.m. UTC
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(-)

Comments

Joe Hershberger March 1, 2022, 8:38 p.m. UTC | #1
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>
Adam Ford March 2, 2022, 1:58 a.m. UTC | #2
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
Ramon Fried March 3, 2022, 7:55 a.m. UTC | #3
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>
Ramon Fried April 10, 2022, 5:05 a.m. UTC | #4
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
diff mbox series

Patch

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! */