
On 11.9.2018 15:31, Patrice CHOTARD wrote:
On 09/11/2018 02:17 PM, Michal Simek wrote:
On 11.9.2018 13:12, Patrice CHOTARD wrote:
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.
Can you give some examples of that functionality or link to datasheet and page?
As example, regarding the pin 8 of bank A (GPIOA8 above), alternate function 9 means that pins is currently configured as SDMMC2_DATA4.
For this pins, here are all the possible alternate function :
alternate function description
AF0 MCO0 AF1 TIM1_CH1 AF2 AF3 TIM8_BKIN2 AF4 I2C3_SCL AF5 SPI3_MOSI/SDO AF6 AF7 USART1_CK AF8 SDMMC2 CKIN AF9 SDMMC2 DATA4 AF10 USB_SOF AF11 AF12 SAI4_SD_B AF13 UART7_RX AF14 LCD_R6 AF15 EVENTOUT
ok that means that it is pin mux decoding and you want to use gpio status command to show it. I would expect when you set a value for gpio that nothing is going to change because it is not propagated to output pin.
I can do it for zynq/zynqmp device but I don't think this is something what should be shown via gpio status command. In my case there is even different address range which should be used to get this value.
Anyway I think that it would be better to create regular pinctrl command for this instead of trying to reuse gpio command for that but that's just my opinion.
Thanks, Michal