All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nate Drude <nate.d@variscite.com>
To: Simon Glass <sjg@chromium.org>,
	Samuel Holland <samuel@sholland.org>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Andrew Jeffery <andrew@aj.id.au>,
	Eddie James <eajames@linux.ibm.com>,
	u-boot@lists.denx.de
Cc: eran.m@variscite.com, Nate Drude <nate.d@variscite.com>
Subject: [PATCH] gpio: uclass: Introduce gpio-hog-optional property
Date: Mon, 12 Sep 2022 12:55:13 -0500	[thread overview]
Message-ID: <20220912175513.4178793-1-nate.d@variscite.com> (raw)

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


             reply	other threads:[~2022-09-12 17:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 17:55 Nate Drude [this message]
2022-09-12 18:31 ` [PATCH] gpio: uclass: Introduce gpio-hog-optional property 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220912175513.4178793-1-nate.d@variscite.com \
    --to=nate.d@variscite.com \
    --cc=andrew@aj.id.au \
    --cc=eajames@linux.ibm.com \
    --cc=eran.m@variscite.com \
    --cc=samuel@sholland.org \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.