[PATCH U-Boot v2019.04-aspeed-openbmc 4/6] gpio: Enable hogging support in SPL

Eddie James eajames at linux.ibm.com
Fri Feb 4 02:47:03 AEDT 2022


On 2/2/22 20:11, Andrew Jeffery wrote:
>
> On Tue, 25 Jan 2022, at 05:45, 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 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)
> Why switch to a CPP conditional here?
>
> I mean, it's not clear why there was a choice for a C conditional
> originally, so I'm curious either way.


Well I just thought it should match the other conditionals for GPIO_HOG, 
and it's obviously more efficient at runtime. Other than that, no reason 
really.


Thanks!

Eddie


>
> Otherwise:
>
> Reviewed-by: Andrew Jeffery <andrew at aj.id.au>


More information about the openbmc mailing list