From: Eddie James <eajames@linux.ibm.com>
To: openbmc@lists.ozlabs.org
Subject: [PATCH U-Boot v2019.04-aspeed-openbmc 4/6] gpio: Enable hogging support in SPL
Date: Mon, 24 Jan 2022 13:15:01 -0600 [thread overview]
Message-ID: <20220124191503.88452-5-eajames@linux.ibm.com> (raw)
In-Reply-To: <20220124191503.88452-1-eajames@linux.ibm.com>
Use the CONFIG macros to conditionally build the GPIO hogging support in
either the SPL or U-Boot, or both, depending on the configuration. Also
call the GPIO hog probe function in the common SPL board initialization
as an equivalent to adding it to the U-Boot init sequence functions.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
common/spl/spl.c | 7 +++++++
drivers/gpio/Kconfig | 10 ++++++++++
drivers/gpio/gpio-uclass.c | 12 +++++++-----
3 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index a1d4514fd3..bbb7578463 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -12,6 +12,9 @@
#include <dm.h>
#include <handoff.h>
#include <spl.h>
+#if defined(CONFIG_SPL_GPIO_HOG)
+#include <asm/gpio.h>
+#endif
#include <asm/sections.h>
#include <asm/u-boot.h>
#include <nand.h>
@@ -652,6 +655,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
timer_init();
#endif
+#if defined(CONFIG_SPL_GPIO_HOG)
+ gpio_hog_probe_all();
+#endif
+
#if CONFIG_IS_ENABLED(BOARD_INIT)
spl_board_init();
#endif
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index a8dc16ca0e..8b8bf6822f 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -24,6 +24,16 @@ config GPIO_HOG
is a mechanism providing automatic GPIO request and config-
uration as part of the gpio-controller's driver probe function.
+config SPL_GPIO_HOG
+ bool "Enable GPIO hog support in SPL"
+ depends on SPL_GPIO_SUPPORT
+ default n
+ help
+ Enable gpio hog support
+ The GPIO chip may contain GPIO hog definitions. GPIO hogging
+ is a mechanism providing automatic GPIO request and config-
+ uration as part of the gpio-controller's driver probe function.
+
config ALTERA_PIO
bool "Altera PIO driver"
depends on DM_GPIO
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 01cfa2f788..219caa651b 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -144,7 +144,7 @@ static int gpio_find_and_xlate(struct gpio_desc *desc,
return gpio_xlate_offs_flags(desc->dev, desc, args);
}
-#if defined(CONFIG_GPIO_HOG)
+#if CONFIG_IS_ENABLED(GPIO_HOG)
struct gpio_hog_priv {
struct gpio_desc gpiod;
@@ -1033,9 +1033,6 @@ int gpio_dev_request_index(struct udevice *dev, const char *nodename,
static int gpio_post_bind(struct udevice *dev)
{
- struct udevice *child;
- ofnode node;
-
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
struct dm_gpio_ops *ops = (struct dm_gpio_ops *)device_get_ops(dev);
static int reloc_done;
@@ -1066,7 +1063,11 @@ static int gpio_post_bind(struct udevice *dev)
}
#endif
- if (IS_ENABLED(CONFIG_GPIO_HOG)) {
+#if CONFIG_IS_ENABLED(GPIO_HOG)
+ {
+ struct udevice *child;
+ ofnode node;
+
dev_for_each_subnode(node, dev) {
if (ofnode_read_bool(node, "gpio-hog")) {
const char *name = ofnode_get_name(node);
@@ -1081,6 +1082,7 @@ static int gpio_post_bind(struct udevice *dev)
}
}
}
+#endif
return 0;
}
--
2.27.0
next prev parent reply other threads:[~2022-01-24 19:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 19:14 [PATCH U-Boot v2019.04-aspeed-openbmc 0/6] Add GPIO hog support Eddie James
2022-01-24 19:14 ` [PATCH U-Boot v2019.04-aspeed-openbmc 1/6] dm: Add a No-op uclass Eddie James
2022-01-31 4:56 ` Andrew Jeffery
2022-01-24 19:14 ` [PATCH U-Boot v2019.04-aspeed-openbmc 2/6] gpio: add gpio-hog support Eddie James
2022-01-31 4:58 ` Andrew Jeffery
2022-01-24 19:15 ` [PATCH U-Boot v2019.04-aspeed-openbmc 3/6] gpio: fixes for " Eddie James
2022-02-03 2:03 ` Andrew Jeffery
2022-01-24 19:15 ` Eddie James [this message]
2022-02-03 2:11 ` [PATCH U-Boot v2019.04-aspeed-openbmc 4/6] gpio: Enable hogging support in SPL Andrew Jeffery
2022-02-03 15:47 ` Eddie James
2022-02-03 21:43 ` Andrew Jeffery
2022-01-24 19:15 ` [PATCH U-Boot v2019.04-aspeed-openbmc 5/6] Add GPIO hogging support for AST2600 openbmc config Eddie James
2022-02-03 2:13 ` Andrew Jeffery
2022-02-03 15:59 ` Eddie James
2022-02-03 21:44 ` Andrew Jeffery
2022-01-24 19:15 ` [PATCH U-Boot v2019.04-aspeed-openbmc 6/6] ast2600: Add GPIO controller and hog TPM reset pin Eddie James
2022-02-03 2:17 ` Andrew Jeffery
2022-02-03 16:01 ` Eddie James
2022-02-03 22:12 ` Andrew Jeffery
2022-02-07 15:27 ` Eddie James
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=20220124191503.88452-5-eajames@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=openbmc@lists.ozlabs.org \
/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.