How to export arbitrary GPIOs in i.MX8

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to export arbitrary GPIOs in i.MX8

1,784件の閲覧回数
Hayato
Contributor I

Dear Support,

I'm using i.MX8QXP-CPU (MEK + BB).
I want to use the PIN below as pps input.
============================================
./work-shared/imx8qxpc0mek/kernel-source/include/dt-bindings/pinctrl/pads-imx8qxp.h
#define SC_P_CSI_RESET 149 /* CI_PI.RESET, CI_PI.I2C.SDA, ADMA.I2C3.SDA, ADMA.SPI1.CS0, LSIO.GPIO3.IO03 */
============================================

I disabled the SC_P_CSI_RESET because it is assigned to some other PIN.
The modified file is as attached.

Also, In order to export GPIO, I executed the following command with GPIO=67, but an error occurs.

Is the GPIO corresponding to the above PIN correct at 67?
If GPIO=67 is fine, could you tell me why the error occurs (and how to deal with it)?
============================================
root@imx8qxpc0mek:/proc/device-tree/pps# echo 67 > /sys/class/gpio/export
[ 448.259672] export_store: invalid GPIO 67
-sh: echo: write error: Invalid argument
============================================


Best regards,
Hayato Numata

0 件の賞賛
返信
3 返答(返信)

1,701件の閲覧回数
Hayato
Contributor I

Dear Support,

Sorry for late reply.

Thank you for your support.
I executed the following command.
> cat /sys/kernel/debug/gpio

What do you know from the results?
I kindly ask for your confirmation.

----------
[Result]
root@imx8qxpc0mek:~# cat /sys/kernel/debug/gpio
gpiochip11: GPIOs 192-199, parent: i2c/15-001d, pca9557, can sleep:
gpio-194 ( |usb_otg1_vbus ) out lo
gpio-199 ( |reset ) out hi

gpiochip10: GPIOs 200-207, parent: i2c/15-001a, pca9557, can sleep:
gpio-200 ( |epdev_on ) out hi
gpio-201 ( |? ) out hi
gpio-206 ( |reset ) out hi
gpio-207 ( |reset ) out hi

gpiochip9: GPIOs 208-223, parent: i2c/5-0020, tca6416, can sleep:

gpiochip8: GPIOs 224-255, parent: platform/58222000.gpio, 58222000.gpio:

gpiochip7: GPIOs 256-287, parent: platform/5d0f0000.gpio, 5d0f0000.gpio:

gpiochip6: GPIOs 288-319, parent: platform/5d0e0000.gpio, 5d0e0000.gpio:

gpiochip5: GPIOs 320-351, parent: platform/5d0d0000.gpio, 5d0d0000.gpio:
gpio-329 ( |ss-sel ) out lo

gpiochip4: GPIOs 352-383, parent: platform/5d0c0000.gpio, 5d0c0000.gpio:
gpio-371 ( |SD1_SPWR ) out hi
gpio-373 ( |wp ) in lo
gpio-374 ( |cd ) in lo IRQ

gpiochip3: GPIOs 384-415, parent: platform/5d0b0000.gpio, 5d0b0000.gpio:

gpiochip2: GPIOs 416-447, parent: platform/5d0a0000.gpio, 5d0a0000.gpio:

gpiochip1: GPIOs 448-479, parent: platform/5d090000.gpio, 5d090000.gpio:
gpio-448 ( |headphone detect ) in lo IRQ

gpiochip0: GPIOs 480-511, parent: platform/5d080000.gpio, 5d080000.gpio:
root@imx8qxpc0mek:~#

0 件の賞賛
返信

1,694件の閲覧回数
jimmychan
NXP TechSupport
NXP TechSupport

As your pin is LSIO.GPIO3.IO03, the address of lsio_gpio3 is 0x5d0b0000. ( https://github.com/nxp-imx/linux-imx/blob/imx_5.4.70_2.3.0/arch/arm64/boot/dts/freescale/imx8-ss-lsi...)

 

So, base on your result, the gpio is in the range "gpiochip3: GPIOs 384-415". The number is 384+3 = 387.

0 件の賞賛
返信

1,761件の閲覧回数
jimmychan
NXP TechSupport
NXP TechSupport

Hello,

 

Please type the following command first. Check the pin mapping in the system.

cat /sys/kernel/debug/gpio

 

FYI. Please read this. I have explain how to find out the gpio number.

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/i-MX93EVK-Add-GPIO-control-in-gui-guider...

 

Hope this can help you.

 

Best regards,

Jimmy

0 件の賞賛
返信