prevent undesired de-assertion of phy-reset
cover prevent undesired de-assertion of phy-reset
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(-)
Signature · 3 lines
[1] https://lore.kernel.org/all/[email protected]/ 2.17.1
PATCH 1/2 net: fec: prevent undesired de-assertion of phy-reset on request
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.
--- drivers/net/fec_mxc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/fec_mxc.c +1 -1
@@ -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! */
Signature · 1 line
2.17.1
Re: [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request
Quoted 7 lines · Tim Harvey
When
gpio_request_by_nameallocates 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 beforefec_gpio_resetis called to assert the reset line it can cause undesired affects if reset timings are not properly met.
Quoted 5 lines
Configure the gpio with
GPIOD_IS_OUT_ACTIVEso that reset is kept active (reset asserted) to avoid this.Cc Sean Anderson <[email protected]>Signed-off-by Tim Harvey <[email protected]>
Adam Ford
Tested-byRe: [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request
Quoted 9 lines · Joe Hershberger
Quoted 7 lines · Tim Harvey
When
gpio_request_by_nameallocates 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 beforefec_gpio_resetis called to assert the reset line it can cause undesired affects if reset timings are not properly met.
Quoted 7 lines
Quoted 5 lines
Configure the gpio with
GPIOD_IS_OUT_ACTIVEso that reset is kept active (reset asserted) to avoid this.Cc Sean Anderson <[email protected]>Signed-off-by Tim Harvey <[email protected]>Acked-by Joe Hershberger <[email protected]>
Ramon Fried
Reviewed-byRe: [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request
Quoted 14 lines · Adam Ford
Quoted 12 lines · Joe Hershberger
Quoted 10 lines · Tim Harvey
When
gpio_request_by_nameallocates 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 beforefec_gpio_resetis 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_ACTIVEso that reset is kept active (reset asserted) to avoid this.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Cc Sean Anderson <[email protected]>Signed-off-by Tim Harvey <[email protected]>Acked-by Joe Hershberger <[email protected]>
Re: [PATCH 1/2] net: fec: prevent undesired de-assertion of phy-reset on request
Quoted 16 lines · Ramon Fried
Quoted 14 lines · Adam Ford
Quoted 12 lines · Joe Hershberger
Quoted 10 lines · Tim Harvey
When
gpio_request_by_nameallocates 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 beforefec_gpio_resetis 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_ACTIVEso that reset is kept active (reset asserted) to avoid this.
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Cc Sean Anderson <[email protected]>Signed-off-by Tim Harvey <[email protected]>Acked-by Joe Hershberger <[email protected]>Reviewed-by Ramon Fried <[email protected]>
Applied to u-boot-net/next
Thanks,
Ramon
PATCH 2/2 net: eth-phy: prevent undesired de-assertion of phy-reset on request
In reply to Tim HarveyWhen 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.
--- drivers/net/eth-phy-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/eth-phy-uclass.c +1 -1
@@ -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;
Signature · 1 line
2.17.1
Re: [PATCH 2/2] net: eth-phy: prevent undesired de-assertion of phy-reset on request
Quoted 7 lines · Tim Harvey
When
gpio_request_by_nameallocates 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 beforeeth_phy_resetis called to assert the reset line it can cause undesired affects if reset timings are not properly met.
Quoted 5 lines
Configure the gpio with
GPIOD_IS_OUT_ACTIVEso that reset is kept active (reset asserted) to avoid this.Cc Sean Anderson <[email protected]>Signed-off-by Tim Harvey <[email protected]>
Ramon Fried
Reviewed-byRe: [PATCH 2/2] net: eth-phy: prevent undesired de-assertion of phy-reset on request
Quoted 9 lines · Joe Hershberger
Quoted 7 lines · Tim Harvey
When
gpio_request_by_nameallocates 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 beforeeth_phy_resetis called to assert the reset line it can cause undesired affects if reset timings are not properly met.
Quoted 7 lines
Quoted 5 lines
Configure the gpio with
GPIOD_IS_OUT_ACTIVEso that reset is kept active (reset asserted) to avoid this.Cc Sean Anderson <[email protected]>Signed-off-by Tim Harvey <[email protected]>Acked-by Joe Hershberger <[email protected]>
Re: [PATCH 2/2] net: eth-phy: prevent undesired de-assertion of phy-reset on request
Quoted 11 lines · Ramon Fried
Quoted 9 lines · Joe Hershberger
Quoted 7 lines · Tim Harvey
When
gpio_request_by_nameallocates 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 beforeeth_phy_resetis called to assert the reset line it can cause undesired affects if reset timings are not properly met.
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Configure the gpio with
GPIOD_IS_OUT_ACTIVEso that reset is kept active (reset asserted) to avoid this.Cc Sean Anderson <[email protected]>Signed-off-by Tim Harvey <[email protected]>Acked-by Joe Hershberger <[email protected]>Reviewed-by Ramon Fried <[email protected]>
Applied to u-boot-net/next
Thanks,
Ramon