summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/gpio-uclass.c7
-rw-r--r--include/asm-generic/gpio.h3
2 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index dbebf3a53eb..c8be5a4d668 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -1171,6 +1171,13 @@ int gpio_request_by_line_name(struct udevice *dev, const char *line_name,
{
int ret;
+ if (!dev) {
+ uclass_foreach_dev_probe(UCLASS_GPIO, dev)
+ if (!gpio_request_by_line_name(dev, line_name, desc, flags))
+ return 0;
+ return -ENOENT;
+ }
+
ret = dev_read_stringlist_search(dev, "gpio-line-names", line_name);
if (ret < 0)
return ret;
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index dd0bdf2315e..c4a7fd28439 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -580,7 +580,8 @@ int gpio_request_by_name(struct udevice *dev, const char *list_name,
* This allows boards to implement common behaviours using GPIOs while not
* requiring specific GPIO offsets be used.
*
- * @dev: An instance of a GPIO controller udevice
+ * @dev: An instance of a GPIO controller udevice, or NULL to search
+ * all GPIO controller devices
* @line_name: The name of the GPIO (e.g. "bmc-secure-boot")
* @desc: A GPIO descriptor that is populated with the requested GPIO
* upon return