[PATCH v2 031/169] Correct SPL use of ATMEL_PIO4

Eugen Hristev eugen.hristev at collabora.com
Fri Feb 10 13:47:22 CET 2023


On 2/10/23 14:41, Tom Rini wrote:
> On Fri, Feb 10, 2023 at 09:25:22AM +0200, Eugen Hristev wrote:
>> On 2/9/23 19:36, Tom Rini wrote:
>>> On Sun, Feb 05, 2023 at 03:36:17PM -0700, Simon Glass wrote:
>>>
>>>> This converts 1 usage of this option to the non-SPL form, since there is
>>>> no SPL_ATMEL_PIO4 defined in Kconfig
>>>>
>>>> Signed-off-by: Simon Glass <sjg at chromium.org>
>>>> ---
>>>>
>>>> (no changes since v1)
>>>>
>>>>    drivers/pinctrl/pinctrl-at91-pio4.c | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
>>>> index 50e3dd449ab..84b398619c4 100644
>>>> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
>>>> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
>>>> @@ -271,7 +271,7 @@ static int atmel_pinctrl_bind(struct udevice *dev)
>>>>    	ofnode node = dev_ofnode(dev);
>>>>    	struct atmel_pinctrl_data *priv = (struct atmel_pinctrl_data *)dev_get_driver_data(dev);
>>>> -	if (!CONFIG_IS_ENABLED(ATMEL_PIO4))
>>>> +	if (!IS_ENABLED(CONFIG_ATMEL_PIO4))
>>>>    		return 0;
>>>>    	/* Obtain a handle to the GPIO driver */
>>>
>>> This grows SPL in a number of platforms, so adding in Eugen to see if we
>>> really do want to omit this here in SPL on platforms that otherwise set
>>> the symbol.
>>>
>>
>> Hi Simon, Tom,
>>
>> The growth is because the compiler will now include in SPL all the code
>> below the check ? The respective code is not conditionally compiled, so I am
>> trying to see why the growth. The solution would be to guard all the below
>> code in the function (or the whole bind itself) by #ifndef CONFIG_SPL_BUILD
>> ?
> 
> Correct, Simon's change causes it to be included in SPL and not
> optimized out. My question is, are we intentionally omitting the code
> here, in that case? Or should we be including it in SPL and Simon's
> change of macro is correct.
> 


To give a bit of a background: in Linux, the GPIO and Pinctrl driver are 
one and the same. In U-boot, as we have two different Uclasses, there 
are two distinct drivers.
However to keep the bindings match, only one of the drivers is 
instantiated through the devicetree. This driver will instantiate the 
second.
However there is a possible case where the other driver is not selected 
in defconfig, hence this check that Simon is changing.
If we use DT in SPL, and we need the other driver , and not use the 
non-DM variant, then I say that the code is required in SPL.
The problem with most at91 processors is that the SPL is already too 
large to fit in the internal SRAM. So unless there is a lot of 
investment to make it smaller, SPL will no longer work anyway for at91.
But I guess that if we want to have DM and both pinctrl+gpio drivers in 
SPL, Simon's change is correct. Without it, the bind for the gpio driver 
will no longer happen in SPL.

Reviewed-by: Eugen Hristev <eugen.hristev at collabora.com>


More information about the U-Boot mailing list