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.
See the following page:
https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt
Use as example the following pages:
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!
-----------------------------------------------------------------------------------------------------------------------
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
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!
-----------------------------------------------------------------------------------------------------------------------
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.
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.