[PATCH] gpio: uclass: Introduce gpio-hog-optional property

Simon Glass sjg at chromium.org
Mon Sep 12 20:31:45 CEST 2022


On Mon, 12 Sept 2022 at 11:55, Nate Drude <nate.d at variscite.com> wrote:
>
> gpio_hog_probe_all is invoked by init_sequence_r in board_r.c.
> If device_probe fails for any gpio-hog, boot hangs with the following error:
>
> > initcall sequence 00000000fffc8e18 failed at call 000000004023b320 (err=-121)
> > ### ERROR ### Please RESET the board ###
>
> gpio-hog-optional allows the boot sequence to continue if device_probe
> fails for optional gpio-hog(s).
>
> Signed-off-by: Nate Drude <nate.d at variscite.com>
> ---
>  doc/device-tree-bindings/gpio/gpio.txt | 1 +
>  drivers/gpio/gpio-uclass.c             | 4 +++-
>  2 files changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

nit below

>
> diff --git a/doc/device-tree-bindings/gpio/gpio.txt b/doc/device-tree-bindings/gpio/gpio.txt
> index 1481ed607d..02d296316b 100644
> --- a/doc/device-tree-bindings/gpio/gpio.txt
> +++ b/doc/device-tree-bindings/gpio/gpio.txt
> @@ -189,6 +189,7 @@ gpio-controller's driver probe function.
>  Each GPIO hog definition is represented as a child node of the GPIO controller.
>  Required properties:
>  - gpio-hog:   A property specifying that this child node represents a GPIO hog.
> +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_all
>  - gpios:      Store the GPIO information (id, flags, ...) for each GPIO to
>               affect. Shall contain an integer multiple of the number of cells
>               specified in its parent node (GPIO controller node).
> diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
> index 0ed32b7217..7ef9f4abc8 100644
> --- a/drivers/gpio/gpio-uclass.c
> +++ b/drivers/gpio/gpio-uclass.c
> @@ -329,7 +329,9 @@ int gpio_hog_probe_all(void)
>                         if (ret) {
>                                 printf("Failed to probe device %s err: %d\n",
>                                        dev->name, ret);
> -                               retval = ret;
> +                               if (!dev_read_bool(dev, "gpio-hog-optional")) {
> +                                       retval = ret;
> +                               }

Should not have {} for single-line statements

>                         }
>                 }
>         }
> --
> 2.37.3
>

Regards,
Simon


More information about the U-Boot mailing list