How to configure GPIO in LS2085AQDS?

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

How to configure GPIO in LS2085AQDS?

Jump to solution
4,220 Views
naveennvn
Contributor III

Hi all,

    i'm using LS2085AQDS board. i need to configure GPIO & need to test in u-boot and kernel. i changed the RCW settings for GPIO. i'm can't able to access GPIO pin. i dont know how to configure that GPIO pins. can u please help me?

Labels (1)
Tags (1)
1 Solution
2,800 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Naveen,

LS2085 GPIO support is included in drivers/gpio/gpio-mpc8xxx.c, also gpio configuration is added in the device tree. You need to add "CONFIG_GPIO_MPC8XXX" and "CONFIG_GPIO_SYSFS" in Kernel configuration file, then you will find  /sys/class/gpio/.

You could use Yocto rebuild Kernel as the following.

1. bitbake virtual/kernel -c patch -f

2. bitbake virtual/kernel -c configure -f

3. Go to the folder build_ls2085aqds_release/tmp/work/ls2085aqds-fsl-linux/linux-ls2-sdk/3.19-r0/git.

make ARCH=arm64 menuconfig

Add CONFIG_GPIO_MPC8XXX and CONFIG_GPIO_SYSFS.

4. bitbake virtual/kernel -c compile -f

5. bitbake virtual/kernel

If further assistance is needed, please feel free to let me know.


Have a great day,
Yiping

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

View solution in original post

0 Kudos
9 Replies
2,800 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello naveen nvn,

The LS2085A has no dedicated GPIO pins. Instead, GPIO functions are multiplexed internally with other

signals, which must be disabled before using the GPIO functions. Additional set up may be required if pin with GPIO functions is used for board purposes.

To test GPIO, set the DUT to GPIO mode on selected pins, as shown in Table 2-42 and enable the

complimentary function within the FPGA.

GPIO Output:

Set the DUT to GPIO output mode on selected pins, as shown in following table.

Program the FPGA to input mode.

Observe that the DUT can control the FPGA.

GPIO Input:

Set the DUT to GPIO input mode on selected pins, as shown in following table.

Program the FPGA to output mode.

Observe that the FPGA registers can control the DUTpastedImage_1.png

  pastedImage_2.png


Have a great day,
Yiping

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

0 Kudos
2,800 Views
naveennvn
Contributor III

Hi Yiping wang,

          Thanks for your great support.

          Yes. LS2 doesn't have dedicated pins for GPIO. i changed the DUT to GPIO mode using QCVS tool. Before that we need to enable the GPIO command in u-boot and kernel right?

         

For enabling gpio command in u-boot:

1. common/cmd_gpio.c

2. common/Makefile:

       obj-$(CONFIG_CMD_GPIO) += cmd_gpio.o

Note: Step 1 and 2 is already there in u-boot source code.

3.added  include/configs/ls2085aqds.h

             #define CONFIG_CMD_GPIO

4.added ./include/config_cmd_all.h 

             #define CONFIG_CMD_GPIO         /* GPIO configuration           */

5.bitbake -c compile -f u-boot

6.bitbake u-boot

I did like above steps for creating new uboot image. But while compiling (bitbake -c compile -f u-boot) it shows errors. I don't know these steps are correct or wrong. Is there any extra steps for adding gpio command in u-boot?

Thanks,

0 Kudos
2,800 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello naveen nvn,

In u-boot, GPIO driver for LS2085 is not provided, you need to do the porting by yourself.

You could perform your porting based on drivers/gpio/mpc83xx_gpio.c, then add a build option in drivers/gpio/Kconfig and include/configs/ls2085aqds.h.

I checked Linux Kernel source code, GPIO is supported for LS2085, if you only want to do verification, please use Linux Kernel directly.


Have a great day,
Yiping

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

0 Kudos
2,800 Views
naveennvn
Contributor III

Hi Yiping Wang,

     Actually i need to do toggle the particular GPIO pin. I tried in u-boot but am not getting the gpio command in u-boot. So, now i'm trying in linux kernel directly. There also am not getting the GPIO related commands.

     Here i pasted my /sys/class/ directory:

root@ls2085aqds:~# ls /sys/class/                                           

ata_device/   hwmon/        misc/         ptp/          tty/

ata_link/     i2c-adapter/  mmc_host/     regulator/    vc/

ata_port/     i2c-dev/      net/          rtc/          vfio/

bdi/          input/        pci_bus/      scsi_device/  virtio-ports/

block/        iommu/        phy/          scsi_disk/    vtconsole/

cuse/         mdio_bus/     power_supply/ scsi_host/   

graphics/     mem/          pps/          spi_master/  

root@ls2085aqds:~#                        

    

     gpio directory is not here. i don't know how to add here.

     Actually i'm new user for this board. I don't know how to verify in kernel. Can you please help me?

Thanks regards,

Naveen.

0 Kudos
2,801 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Naveen,

LS2085 GPIO support is included in drivers/gpio/gpio-mpc8xxx.c, also gpio configuration is added in the device tree. You need to add "CONFIG_GPIO_MPC8XXX" and "CONFIG_GPIO_SYSFS" in Kernel configuration file, then you will find  /sys/class/gpio/.

You could use Yocto rebuild Kernel as the following.

1. bitbake virtual/kernel -c patch -f

2. bitbake virtual/kernel -c configure -f

3. Go to the folder build_ls2085aqds_release/tmp/work/ls2085aqds-fsl-linux/linux-ls2-sdk/3.19-r0/git.

make ARCH=arm64 menuconfig

Add CONFIG_GPIO_MPC8XXX and CONFIG_GPIO_SYSFS.

4. bitbake virtual/kernel -c compile -f

5. bitbake virtual/kernel

If further assistance is needed, please feel free to let me know.


Have a great day,
Yiping

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

0 Kudos
2,799 Views
naveennvn
Contributor III

Hi Yiping wang,

     Thanks for your great support.

     I done like that changes and i created new kernel image, I need to check with board.

     Thank you very much,

     Naveen.

0 Kudos
2,799 Views
naveennvn
Contributor III

Hi Yiping,

     In kernel i verified like this :

root@ls2085aqds:~# ls /sys/class/gpio/

export  gpiochip384  gpiochip416  gpiochip448  gpiochip480  unexport

root@ls2085aqds:/sys/class/gpio# echo 384 > export

root@ls2085aqds:/sys/class/gpio# ls

export  gpio384  gpiochip384  gpiochip416  gpiochip448  gpiochip480  unexport

root@ls2085aqds:/sys/class/gpio# echo "out" > gpio384/direction

root@ls2085aqds:/sys/class/gpio# echo 1 > gpio384/value                                                                                                                                

root@ls2085aqds:/sys/class/gpio# cat gpio384/value                                                                                                                                     

1

root@ls2085aqds:/sys/class/gpio# echo 0 > gpio384/value                                                                                                                                

root@ls2085aqds:/sys/class/gpio# cat gpio384/value

0

root@ls2085aqds:/sys/class/gpio# echo 384 > unexport'

     Here gpio384 represents GPIO port 1 pin 0 right?   If its wrong means please correct me..

     Actually i'm using LS2085AQDS board i need to verify the gpio toggling in board is there any LED's or any other peripherals there for verify GPIO?

    If its not there means how to verify with board?

Thanks,

-Naveen                                                                                                                          

0 Kudos
2,799 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello naveennvn,

I think you are correct, /sys/class/gpio/gpiochipN, or each gpiochip, #N is its first GPIO.

Except measuring the waveform, I don't have a good method.


Have a great day,
Yiping

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

2,799 Views
naveennvn
Contributor III

Hi Yiping,

   

      I verified GPIO toggling with board.

     Thank you for your valuable responses.

Have a great day,

-Naveen

0 Kudos