GPIO enable and disable in ls2088a

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

GPIO enable and disable in ls2088a

1,559 Views
pradeep_t
Contributor III

Hi Team,

We are using LSDK 18.09 for LS2088A custom board,

How we can add gpio in uboot dts and kernel dts to make gpio high and low. can we get example for this

Labels (1)
Tags (1)
0 Kudos
1 Reply

1,220 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello pradeep TG,

LS2088 platform could use GPIO driver for PowerPC architecture. In Linux Kernel, please configure "CONFIG_ARCH_LAYERSCAPE=y" then configure "CONFIG_GPIO_MPC8XXX=y" in Linux Kernel configuration file and rebuild Kernel image.

GPIO has already been defined in Linux Kernel dts file as the following.


                gpio0: gpio@2300000 {
                        compatible = "fsl,ls2080a-gpio", "fsl,qoriq-gpio";
                        reg = <0x0 0x2300000 0x0 0x10000>;
                        interrupts = <0 36 0x4>; /* Level high type */
                        gpio-controller;
                        little-endian;
                        #gpio-cells = <2>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
                };

                gpio1: gpio@2310000 {
                        compatible = "fsl,ls2080a-gpio", "fsl,qoriq-gpio";
                        reg = <0x0 0x2310000 0x0 0x10000>;
                        interrupts = <0 36 0x4>; /* Level high type */
                        gpio-controller;
                        little-endian;
                        #gpio-cells = <2>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
                };

               gpio2: gpio@2320000 {
                        compatible = "fsl,ls2080a-gpio", "fsl,qoriq-gpio";
                        reg = <0x0 0x2320000 0x0 0x10000>;
                        interrupts = <0 37 0x4>; /* Level high type */
                        gpio-controller;
                        little-endian;
                        #gpio-cells = <2>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
                };

                gpio3: gpio@2330000 {
                        compatible = "fsl,ls2080a-gpio", "fsl,qoriq-gpio";
                        reg = <0x0 0x2330000 0x0 0x10000>;
                        interrupts = <0 37 0x4>; /* Level high type */
                        gpio-controller;
                        little-endian;
                        #gpio-cells = <2>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
                };

 

After boot up Linux system, you will get similar information as the following.

root@localhost:~# ls /sys/class/gpio/
export  gpiochip384  gpiochip416  gpiochip448  gpiochip480  unexport

root@localhost:~# cat /sys/kernel/debug/gpio
 GPIOs 384-415, parent: platform/2330000.gpio, 2330000.gpio:

 

GPIOs 416-447, parent: platform/2320000.gpio, 2320000.gpio:

 

GPIOs 448-479, parent: platform/2310000.gpio, 2310000.gpio:

 

GPIOs 480-511, parent: platform/2300000.gpio, 2300000.gpio:

 

pastedImage_5.png

GPIO424(416+8) corresponds with GPIO3_8, GPIO426(416+10) corresponds with GPIO3_10.

 

root@localhost:~# cd /sys/class/gpio/
root@localhost:/sys/class/gpio# echo 424 > export
root@localhost:/sys/class/gpio# echo 426 > export
root@localhost:/sys/class/gpio# ls
export  gpio424  gpio426  gpiochip384  gpiochip416  gpiochip448  gpiochip480  unexport
root@localhost:/sys/class/gpio#

root@localhost:/sys/class/gpio# echo "out" > gpio424/direction
root@localhost:/sys/class/gpio# echo 1 > gpio424/value
root@localhost:/sys/class/gpio# ls gpio424/
active_low  device  direction  edge  subsystem  uevent  value

 

For more detailed information about GPIO on ARMv8 platforms, please refer to LS1043 GPIO support in Linux SDK .

Thanks,

Yiping

0 Kudos