* [PATCH v3] gpio: Enable hogging support in SPL
@ 2022-02-07 23:09 Eddie James
2022-02-11 15:05 ` Simon Glass
2022-04-10 15:20 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Eddie James @ 2022-02-07 23:09 UTC (permalink / raw)
To: u-boot; +Cc: andrew, sjg, Eddie James
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>
---
Changes since v2:
- change #if to if() in gpio_post_bind
Changes since v1:
- remove #if guards around gpio include
- change #if to if() in spl board_init_r
common/spl/spl.c | 4 ++++
drivers/gpio/Kconfig | 10 ++++++++++
drivers/gpio/gpio-uclass.c | 8 ++++----
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 884102bdea..36115e674d 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -20,6 +20,7 @@
#include <serial.h>
#include <spl.h>
#include <asm/global_data.h>
+#include <asm/gpio.h>
#include <asm/u-boot.h>
#include <nand.h>
#include <fat.h>
@@ -739,6 +740,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
}
}
+ 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 305a2dc563..4da2bdc10d 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -57,6 +57,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 DM_GPIO_LOOKUP_LABEL
bool "Enable searching for gpio labelnames"
depends on DM_GPIO
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 125ae53d61..9075c7235d 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -1432,9 +1432,6 @@ void devm_gpiod_put(struct udevice *dev, struct gpio_desc *desc)
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;
@@ -1465,7 +1462,10 @@ static int gpio_post_bind(struct udevice *dev)
}
#endif
- if (CONFIG_IS_ENABLED(OF_REAL) && 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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v3] gpio: Enable hogging support in SPL
2022-02-07 23:09 [PATCH v3] gpio: Enable hogging support in SPL Eddie James
@ 2022-02-11 15:05 ` Simon Glass
2022-04-10 15:20 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2022-02-11 15:05 UTC (permalink / raw)
To: Eddie James; +Cc: U-Boot Mailing List, Andrew Jeffery
On Mon, 7 Feb 2022 at 16:09, Eddie James <eajames@linux.ibm.com> wrote:
>
> 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>
> ---
> Changes since v2:
> - change #if to if() in gpio_post_bind
>
> Changes since v1:
> - remove #if guards around gpio include
> - change #if to if() in spl board_init_r
>
> common/spl/spl.c | 4 ++++
> drivers/gpio/Kconfig | 10 ++++++++++
> drivers/gpio/gpio-uclass.c | 8 ++++----
> 3 files changed, 18 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] gpio: Enable hogging support in SPL
2022-02-07 23:09 [PATCH v3] gpio: Enable hogging support in SPL Eddie James
2022-02-11 15:05 ` Simon Glass
@ 2022-04-10 15:20 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2022-04-10 15:20 UTC (permalink / raw)
To: Eddie James; +Cc: u-boot, andrew, sjg
[-- Attachment #1: Type: text/plain, Size: 516 bytes --]
On Mon, Feb 07, 2022 at 05:09:01PM -0600, Eddie James wrote:
> 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: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-10 15:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-07 23:09 [PATCH v3] gpio: Enable hogging support in SPL Eddie James
2022-02-11 15:05 ` Simon Glass
2022-04-10 15:20 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox