Not able to export pins as additional GPIO on VF50

Hi,
I am running Angstrom on VF50.I need to make some pins as GPIOs ,so i added them to additional gpios in
device tree source file(.dts).

The code i added to vf500 dts source file is:-

&iomuxc {
        vf610-colibri{
                        pinctrl_uart3:uart3group {
                               fsl,pins = <
                                               VF610_PAD_PTA20__UART3_TX       0x21a2     
                                               VF610_PAD_PTA31__UART3_RX       0x21a1    
                                          >;
                           };

                         pinctrl_uart4:uart4group {
                               fsl,pins = <
                                             VF610_PAD_PTA28__UART4_TX       0x21a2
                                             VF610_PAD_PTA29__UART4_RX       0x21a1
                                          >;
                           };
                         pinctrl_additionalgpio: additionalgpios {
                                  fsl,pins = <
                                                 VF610_PAD_PTE2__GPIO_107        0x22ed
                                                 VF610_PAD_PTE26__GPIO_131       0x22ed
                                                 VF610_PAD_PTE25__GPIO_130       0x22ed
                                                 VF610_PAD_PTE17__GPIO_122       0x22ed
                                                  VF610_PAD_PTD28__GPIO_66        0x22ed
                                                  VF610_PAD_PTE4__GPIO_109        0x22ed
                                        >;
};

The device tree code is compiling fine but i am not able to export the gpio109(VF610_PAD_PTE4__GPIO_109) .
When i am executing “echo 109 > /sys/class/gpio/export” .The following error status is reported.

[ 1338.079352] vf610-pinctrl 40048000.iomuxc: request() failed for pin 109
[ 1338.097935] vf610-pinctrl 40048000.iomuxc: pin-109 (vf610-gpio:109) status -22
-sh: echo: write error: Invalid argument

Please explain how to rectify this error and how to know the error depending upon the status number returned(say 22).

Thanks
Amit

It is not recommended to change the SOC level dts files vf500.dtsi or vf610.dtsi. Please make any and all changes at the level of carrier board device tree files. The pin you are trying to configure as GPIO is used for display by DCU on Vybrid. See here and hence cannot be used as GPIO. You can look at the additional gpios defined here.

Thanks Sanchayan,

Yes,I have not made any changes to the module level device files . I have made modifications in carrier board level device files(vf500-colibri-eval-v3.dts).

Also the other pins given below

                                         VF610_PAD_PTE2__GPIO_107        0x22ed
                                          VF610_PAD_PTE26__GPIO_131       0x22ed
                                          VF610_PAD_PTE25__GPIO_130       0x22ed
                                          VF610_PAD_PTE17__GPIO_122       0x22ed

are also the part of DCU0 group but i am able to modify them as additional GPIOs
and also able to export them in /sys/class/gpio.

are also the part of DCU0 group but i am able to modify them as additional GPIOs and also able to export them in /sys/class/gpio.

Which image version do you use? What is the output of

uname -a
cat /etc/issue

Those pins you refer to cannnot be used as GPIO unless DCU is disabled. Your setup has something amiss.

root@colibri-vf:/sys/class/gpio# ls
export       gpiochip0    gpiochip128  gpiochip32   gpiochip64   gpiochip96   unexport
root@colibri-vf:/sys/class/gpio# echo 107 > export 
[   39.255917] vf610-pinctrl 40048000.iomuxc: request() failed for pin 107
[   39.262577] vf610-pinctrl 40048000.iomuxc: pin-107 (vf610-gpio:107) status -22
-sh: echo: write error: Invalid argument
root@colibri-vf:/sys/class/gpio# echo 131 > export                                                                                                
[  121.659487] vf610-pinctrl 40048000.iomuxc: request() failed for pin 131
[  121.666143] vf610-pinctrl 40048000.iomuxc: pin-131 (vf610-gpio:131) status -22
-sh: echo: write error: Invalid argument
root@colibri-vf:/sys/class/gpio# echo 130 > export                                                                                                
[  126.129685] vf610-pinctrl 40048000.iomuxc: request() failed for pin 130
[  126.136342] vf610-pinctrl 40048000.iomuxc: pin-130 (vf610-gpio:130) status -22
-sh: echo: write error: Invalid argument
root@colibri-vf:/sys/class/gpio# echo 122 > export                                                                                                
[  129.810155] vf610-pinctrl 40048000.iomuxc: request() failed for pin 122
[  129.816810] vf610-pinctrl 40048000.iomuxc: pin-122 (vf610-gpio:122) status -22
-sh: echo: write error: Invalid argument

Hi Sanchayan,

The output of the following two commands
a) #uname -a
#Linux colibri-vf 4.4.59-2.7.2+g7cfa321 #2 Mon Apr 10 01:16:26 CEST 2017 armv7l GNU/Linux
b) #cat /etc/issue/
#The Angstrom Distribution \n \l
Angstrom v2016.12 - Kernel \r
Colibri-VF_Console-Image 2.7.2 20170410

The gpio109/131/130/122/66 are exported successfully.alt text

Also i have attached the screen shot of the exported pins with the uname -a output.

Hi Sanchayan,

As you told that if we want to use the above requested pins as GPIO we need to disable the DCU .

How to disable the DCU.Is this can be done through device tree modification.

Thanks
Amit

Change the status to disabled here if you do not want to use DCU/display.

Thanks Sanchayan,

I tried disabling the DCU section as i am not using and it is working. I am able to add the pins as additional GPIOs and export.

Amit