[PATCH] phy: nop-phy: Fix phy reset if no reset-gpio defined

Adam Ford aford173 at gmail.com
Tue Mar 1 11:56:50 CET 2022


On Mon, Feb 28, 2022 at 4:53 PM Tim Harvey <tharvey at gateworks.com> wrote:
>
> Ensure there is a valid reset-gpio defined before using it.
>
> Fixes: f9852acdce02 ("phy: nop-phy: Fix enabling reset")
> Cc: Adam Ford <aford173 at gmail.com>
> Signed-off-by: Tim Harvey <tharvey at gateworks.com>

Reviewed-by: Adam Ford <aford173 at gmail.com>

> ---
>  drivers/phy/nop-phy.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/phy/nop-phy.c b/drivers/phy/nop-phy.c
> index e2ee6e92068e..d0904f4f075b 100644
> --- a/drivers/phy/nop-phy.c
> +++ b/drivers/phy/nop-phy.c
> @@ -45,11 +45,13 @@ static int nop_phy_init(struct phy *phy)
>
>  #if CONFIG_IS_ENABLED(DM_GPIO)
>         /* Take phy out of reset */
> -       ret = dm_gpio_set_value(&priv->reset_gpio, false);
> -       if (ret) {
> -               if (CONFIG_IS_ENABLED(CLK))
> -                       clk_disable_bulk(&priv->bulk);
> -               return ret;
> +       if (dm_gpio_is_valid(&priv->reset_gpio)) {

I didn't realize this was necessary.  Sorry if I broke your board.
Thanks for fixing it.

adam
> +               ret = dm_gpio_set_value(&priv->reset_gpio, false);
> +               if (ret) {
> +                       if (CONFIG_IS_ENABLED(CLK))
> +                               clk_disable_bulk(&priv->bulk);
> +                       return ret;
> +               }
>         }
>  #endif
>         return 0;
> --
> 2.17.1
>


More information about the U-Boot mailing list