[PATCH U-Boot v2019.04-aspeed-openbmc 4/6] gpio: Enable hogging support in SPL
Eddie James
eajames at linux.ibm.com
Tue Jan 25 06:15:01 AEDT 2022
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 at 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
More information about the openbmc
mailing list