GPIO is not accssible from sysfs for IMX8

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO is not accssible from sysfs for IMX8

1,414 Views
viswa_kondapall
Contributor III

Hi,

I am working on IMX8dx - Yocto 1.3 or 1.6

I am new to the IMX8dx. We are trying to access the GPIO from userspace/ command line.

1.

export 73 > /sys/class/gpio/export  :
[  115.430117] export_store: invalid GPIO 73
[  184.114083] export_store: invalid GPIO 105
[  342.974089] export_store: invalid GPIO 73
is this error is due to lack of GPIOLIB ???


2. Pinctrl and iomuxc is added in the dts file: correct me if any mistake.

iomuxc: iomuxc {
        compatible = "fsl,imx8qxp-iomuxc, imx8qxp-pinctrl";
    };
3. GPIO Config value for the Register :

for output pin we are givign the value as below , please correct me if i am wrong.
SC_P_ENET0_RGMII_RXD3_LSIO_GPIO5_IO08      0x00000021
SC_P_QSPI0B_SS0_B_LSIO_GPIO3_IO23          0x00000021

4. LSIO_GPIO5_IO08  -- 26-25 bit position which is saying as   0x02000021
   is this value is correct ?? as GPIO OUTPUT configuration ?? or 0x00000021 is correct.

We enabled the DEBUG_GPIO config like all configs. I am not aware about yocto packages setup -- please help any needed to be enable.

No GPIO's we are able access from sysfs. No clue any where... please help in this yocto side or Config side issue.??

regards,

Viswa

Tags (2)
0 Kudos
6 Replies

794 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

How the i.MX8DX is still in pre-production. We still do not have any preliminary information about the software. Unfortunately, we are unable to assist you. 

However, to make work the GPIOs in the i.MX6 family is the same what you did. But instead of exporting the value that you are going to put in the class. Try using echo as below:

echo 73 > /sys/class/gpio/export

Hope this can help you.

Best regards,

Diego.

0 Kudos

794 Views
viswa_kondapall
Contributor III

Thank you for the confirmation.

My first point if see,

export 73 > /sys/class/gpio/export  :
[  115.430117] export_store: invalid GPIO 73
[  184.114083] export_store: invalid GPIO 105
[  342.974089] export_store: invalid GPIO 73

1. exporting is itself failing, which actually no system call interface for GPIO.

2. will GPIO LIB is the issue from the yocto ??

Which i see in the code for imx8 - no GPIO sys interface . Either in drivers/gpio or drivers/pinctrl/freescale/pinctrl-imx8qxp.c

Regards,

Viswanath K

0 Kudos

794 Views
diegoadrian
NXP Employee
NXP Employee

How I said before, I cannot guarantee if the GPIO LIB is the problem since the product is still on pre-production.

However, instead of using export, use echo. This is was the way how it worked for the i.MX6 products. I cannot test on the i.MX8M products, since there are no external GPIOs to test.

Best regards,

Diego.

0 Kudos

794 Views
viswa_kondapall
Contributor III

Hi Diego,

root@imx8dx_dev-cust:/# echo 105 > /sys/class/gpio/export
[  340.871826] export_store: invalid GPIO 105
-sh: echo: write error: Invalid argument

this is the result. I have to question below, to make the gpio to ready to access for the application.

My doubt :

1. DTS file update  : GPIO config we are doing in IOMUXC node, for the GPIO is that need to keep in hoggrp in the iomuxc node??

     --Here one more point is, gpio node in iomuxc, need to call in root node or any where else

2. Linux code : we are configuring the GPIO value in drviers/soc/soc-imx.c -- but its early boot , no access to the application.

3. To access from Application :  If we write a character driver for the GPIO, but it is not a Linux standard one, its equal to legacy interface only before 2.6 Kernel.

Please guide me.

Regards,

Viswa.

0 Kudos

794 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

Like I said before, the product is still in preproduction, we cannot guarantee anything until the product is officially released. I apologize for the inconveniences this could give you.

Best regards,

Diego.

0 Kudos

794 Views
viswa_kondapall
Contributor III

Hi Diego,

echo 73 > /sys/class/gpio/export  -- I saw this but didnt took into mind, now understood, I will test and come back to u.

regards,

Viswa.

0 Kudos