[U-Boot] [PATCH v3 0/5] Add get_alt_function ops

Patrice CHOTARD patrice.chotard at st.com
Tue Sep 11 11:12:02 UTC 2018


Hi,

On 09/11/2018 12:24 PM, Michal Simek wrote:
> Hi,
> 
> On 11.9.2018 09:31, Patrice CHOTARD wrote:
>> Hi Michal
>>
>> On 09/11/2018 07:51 AM, Michal Simek wrote:
>>> On 10.9.2018 18:11, Patrice Chotard wrote:
>>>>
>>>> This series :
>>>>   - Add new gpio ops get_alt_function
>>>>   - Add get_function and get_alt_function support to stm32 gpio driver
>>>>   - Add get_alt_function test
>>>
>>>
>>> I went quickly over this series and TBH I am not getting what this is
>>> for. It looks like that this is the part of pinmux.
>>>
>>> Can you please elaborate more what this is for?
>>
>> Currently, get_function callback returns the state of a gpio
>> (GPIOF_INPUT, GPIOF_OUTPUT or GPIO_FUNC).
>>
>> If a pin's state is GPIO_FUNC, it's useful to know which alternate
>> function is selected for debug purpose.
>>
>> As example, on STM32 SoCs, a pins can be configured as GPIO or also
>> configured with up to 16 alternate function. Using command "gpio", user
>> can retrieve this information as shown below:
>>
>> STM32MP> gpio state -a
>>
>> Bank GPIOA:
>> GPIOA0: unused: 0 [ ]
>> GPIOA1: unused: 0 [ ]
>> GPIOA2: unused: 0 [ ]
>> GPIOA3: unused: 0 [ ]
>> GPIOA4: unused: 0 [ ]
>> GPIOA5: unused: 0 [ ]
>> GPIOA6: unused: 0 [ ]
>> GPIOA7: unused: 0 [ ]
>> GPIOA8: func: 9
>> GPIOA9: func: 10
>> GPIOA10: unused: 0 [ ]
>> GPIOA11: unused: 0 [ ]
>> GPIOA12: unused: 0 [ ]
>> GPIOA13: output: 1 [x] red.gpios
>> GPIOA14: output: 0 [x] green.gpios
>> GPIOA15: unused: 0 [ ]
>>
>> It shows that pin 8 and 9 of bank A are configured respectively in
>> alternate function 9 and 10.
> 
> Can you list that functionality? Isn't it something what should be shown
> with a name instead of number?

Listing this functionality is possible and printing name instead of
number also, but for each pins, alternate function configuration is
different and need to store all these informations into a table, which
consumes a lot of memory.

> I expect that user has to go to any decode table to find out what 9 or
> 10 means.

Yes, using the SoC's datasheet, user can find the corresponding
alternate function description.

Thanks

Patrice

> 
> Thanks,
> Michal
> 


More information about the U-Boot mailing list