All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: uclass: Introduce gpio-hog-optional property
@ 2022-09-12 17:55 Nate Drude
  2022-09-12 18:31 ` Simon Glass
  2022-09-12 18:48 ` Fabio Estevam
  0 siblings, 2 replies; 12+ messages in thread
From: Nate Drude @ 2022-09-12 17:55 UTC (permalink / raw)
  To: Simon Glass, Samuel Holland, Heinrich Schuchardt, Andrew Jeffery,
	Eddie James, u-boot
  Cc: eran.m, Nate Drude

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@variscite.com>
---
 doc/device-tree-bindings/gpio/gpio.txt | 1 +
 drivers/gpio/gpio-uclass.c             | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

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;
+				}
 			}
 		}
 	}
-- 
2.37.3


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

end of thread, other threads:[~2022-09-20 11:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-12 17:55 [PATCH] gpio: uclass: Introduce gpio-hog-optional property Nate Drude
2022-09-12 18:31 ` Simon Glass
2022-09-12 18:48 ` Fabio Estevam
2022-09-12 20:16   ` Simon Glass
2022-09-12 20:56     ` Nate Drude
2022-09-14 12:49       ` Simon Glass
2022-09-14 13:59         ` Nate Drude
2022-09-14 14:09           ` Fabio Estevam
2022-09-14 14:16           ` Tom Rini
2022-09-14 14:31             ` Nate Drude
2022-09-14 17:09               ` Simon Glass
2022-09-20 11:43               ` Fabio Estevam

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.