T1040 setting GPIO's in dtsi

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

T1040 setting GPIO's in dtsi

1,137 Views
lukaszprzeniosl
Contributor II

Hello there,

I am working on a T1040 Linux platform. I need to setup some gpio's as outputs and some as inputs with external interrupt functionality. I am trying to find some reference on how to setup that in the dtsi file and how to code/ decode gpio numbers. Could not find any, thats why I write this.

I would appreciate all help regarding this topic.

Tags (3)
0 Kudos
4 Replies

916 Views
Pavel
NXP Employee
NXP Employee

See the following page:

https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt

 

Use as example the following pages:

 

https://git.sphere.ly/varun.chitre15/thunderzap_sprout/blob/ac7242142b03421c96b0a2f8d99f146d075614c2...

 

https://github.com/andrepuschmann/linux-omap/blob/master/arch/powerpc/boot/dts/mpc8349emitx.dts

Have a great day,
Pavel Chubakov

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

916 Views
Pavel
NXP Employee
NXP Employee

NXP Linux BSP supports sysfs possibility for GPIO using.

 

Look at the following pages:

https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

 

http://falsinsoft.blogspot.ru/2012/11/access-gpio-from-linux-user-space.html

 

https://wiki.openwrt.org/doc/hardware/port.gpio

 

http://linux-sunxi.org/GPIO

 

https://elinux.org/GPIO

 

The sysfs driver has been tested and is working. It has been accepted into the mainline kernel.

The sysfs interface is a very simple way to access the GPIO from user space and has the advantage of requiring very little setup.

 

See also the following pages about using sysfs for GPIO interrupts:

https://elinux.org/EBC_Exercise_11_gpio_Polling_and_Interrupts

 

https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

 

https://stackoverflow.com/questions/48978155/sysfs-gpio-interrupts

 

Have a great day,
Pavel Chubakov

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

916 Views
lukaszprzeniosl
Contributor II

Hello,

Could you only point me some reference on how to set the multiplexing of the pad to a GPIO for the T1040 specific device, in the dts file? I would really appreciate further help.

0 Kudos

916 Views
lukaszprzeniosl
Contributor II

Hello Pavel, Thank you for answer.

But this is all for user space applications. I need to make the GPIO's available through kernel module. Also, I cannot figure out the pins numbering for T1040. In one of the links, there is an equation for that (other cpu):

with XX being the number of the desired pin. To obtain the correct number you have to calculate it from the pin name (like PH18)[1]:

(position of letter in alphabet - 1) * 32 + pin number

I would appreciate your further support.

0 Kudos