We want to access gpio14 of p1020. I tried it through sysfs
echo 494 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio494/direction
This reboots/hangs the processor.
Then i tried to access the gpio through driver. Our device tree entry are as follow,
gpio0: gpio-controller@f000 {
#gpio-cells = <0x2>;
compatible = "fsl,pq3-gpio";
reg = <0xf000 0x100>;
interrupt-parent = <&mpic>;
interrupts = <0x2f 0x2 0x0 0x0>;
gpio-controller;
};
NXP SDK supports sysfs possibility for GPIO using from user space.
Check please that the following kernel configuration options are set. These options are necessary
for sysfs GPIO support:
CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB
CONFIG_MPC8XXX_GPIO (Platform Support / MPC8xxx GPIO support)
CONFIG_OF_GPIO
CONFIG_GPIOLIB (-*- GPIO Support ---> )
CONFIG_GPIO_SYSFS (/sys/class/gpio/... (sysfs interface))
CONFIG_GENERIC_GPIO
This option can be checked using the .config file in the kernel source folder.
GPIO controllers should be declared in the Device Tree file.
More information on the device tree GPIO declaration can be found in the kernel source.
See please the following files:
/Documentation/powerpc/dts-bindings/gpio.txt and /Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt
This possibility is available using sysfs from user space.
See the following pages
and
(https://www.kernel.org/doc/Documentation/gpio/sysfs.txt).
and
and
(https://www.kernel.org/doc/Documentation/gpio/sysfs.txt).
Attached file contains .dts file and command dump for GPIO using.
Have a great day,
Pavel Chubakov
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------