NXP BSP 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
(http://elinux.org/GPIO)
and
(https://www.kernel.org/doc/Documentation/gpio/sysfs.txt).
and
(http://www.lindusembedded.com/blog/2011/12/29/gpio-general-purpose-inputoutput-interfaces-in-linux-2...)
and
(https://www.kernel.org/doc/Documentation/gpio/sysfs.txt).
The GPIO0 usually is GPIO224 under Linux (256-32).
2) Look at our dump. It is dump for P2020. Similar command sequence can be used for MPC8309.
// OUTPUT
root@p2020ds:/sys/class/gpio/gpio224# echo out > direction
This command sets direction (input/output)
root@p2020ds:/sys/class/gpio/gpio224# echo 1 > value
This command sets high level on the GPIO.
root@p2020ds:/sys/class/gpio/gpio224# echo 0 > value
This command sets low level on the GPIO.
The second method consist of using mmap command.
It is a POSIX-compliant Linux/Unix system call that maps files or devices into memory.
It is a method of memory-mapped file I/O.
For example, look at the following links (http://en.wikipedia.org/wiki/Mmap) and
(http://beej.us/guide/bgipc/output/html/multipage/mmap.html).
Have a great day,
Pavel Chubakov
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------