From: Eddie James <eajames@linux.ibm.com>
To: openbmc@lists.ozlabs.org
Cc: andrew@aj.id.au
Subject: [PATCH u-boot v2019.04-aspeed-openbmc v4 4/6] gpio: Enable hogging support in SPL
Date: Mon, 7 Feb 2022 17:13:32 -0600 [thread overview]
Message-ID: <20220207231334.59845-5-eajames@linux.ibm.com> (raw)
In-Reply-To: <20220207231334.59845-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>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
---
common/spl/spl.c | 4 ++++
drivers/gpio/Kconfig | 10 ++++++++++
drivers/gpio/gpio-uclass.c | 10 +++++-----
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index a1d4514fd3..927e072778 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -12,6 +12,7 @@
#include <dm.h>
#include <handoff.h>
#include <spl.h>
+#include <asm/gpio.h>
#include <asm/sections.h>
#include <asm/u-boot.h>
#include <nand.h>
@@ -652,6 +653,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
timer_init();
#endif
+ if (CONFIG_IS_ENABLED(GPIO_HOG))
+ gpio_hog_probe_all();
+
#if CONFIG_IS_ENABLED(BOARD_INIT)
spl_board_init();
#endif
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index a8dc16ca0e..69ca18c15b 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 in SPL
+ 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..f511a26db0 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,10 @@ 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);
--
2.27.0
next prev parent reply other threads:[~2022-02-07 23:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-07 23:13 [PATCH u-boot v2019.04-aspeed-openbmc v4 0/6] Add GPIO hog support Eddie James
2022-02-07 23:13 ` [PATCH u-boot v2019.04-aspeed-openbmc v4 1/6] dm: Add a No-op uclass Eddie James
2022-02-07 23:13 ` [PATCH u-boot v2019.04-aspeed-openbmc v4 2/6] gpio: add gpio-hog support Eddie James
2022-02-07 23:13 ` [PATCH u-boot v2019.04-aspeed-openbmc v4 3/6] gpio: fixes for " Eddie James
2022-02-07 23:13 ` Eddie James [this message]
2022-02-07 23:13 ` [PATCH u-boot v2019.04-aspeed-openbmc v4 5/6] Add GPIO hogging support for AST2600 openbmc config Eddie James
2022-02-08 3:55 ` Andrew Jeffery
2022-02-07 23:13 ` [PATCH u-boot v2019.04-aspeed-openbmc v4 6/6] ast2600: Add GPIO controller and hog TPM reset pin Eddie James
2022-02-08 3:56 ` Andrew Jeffery
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=20220207231334.59845-5-eajames@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=andrew@aj.id.au \
--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.