How can I toggle the pin 54 of M.2 connector

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

How can I toggle the pin 54 of M.2 connector

620 Views
pradeep2481
Contributor II

Hi,

I am using i.MX 8QuadMax MEK withLinux 5.4.70. I would like to toggle the BT_DISABLE_B (pin 54 of M.2 connector). From the device tree it looks like  BT_DISABLE_B is connected to the pin IMX8QM_QSPI1A_DQS_LSIO_GPIO4_IO22. So my assumption is that I can use GPIO bank 4  GPIO 22.

Based on the output from /sys/kernel/debug/gpio I calculated the GPIO number to 374 (352+22).

But when I do the export I am getting the Device or resource busy, just like below.

===================================================

root@imx8qmmek:~# echo "374" > /sys/class/gpio/export
-sh: echo: write error: Device or resource busy

====================================================

In the device tree I can see that it is used for modem_reset and it is being used by the node lpuart1.

Do I have to disable the node lpuart1? If I disable lpuart1 what functionality I will lose?

 

Thanks in advance.

 

Best regards,

Pradeep

0 Kudos
2 Replies

574 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @pradeep2481 

I hope you are doing well.

Calculation of GPIO number = (((GPIO bank no.) - 1)*32) + GPIO Pin number = GPIO4_IO22 = ((4-1)*32) + 22 = 118

Please try to export GPIO number 118 to toggle the BT_DISABLE_B pin.

Thanks & Regards

Sanket Parekh

0 Kudos

567 Views
pradeep2481
Contributor II

Hi Sanket,

Thank you so much for your reply.

As you suggested I tried to export 118 and getting the invalid GPIO 118 error.

===============================================================

root@imx8qmmek:~# echo "118" > /sys/class/gpio/export
[ 268.141419] export_store: invalid GPIO 118
-sh: echo: write error: Invalid argument

=============================================================

As I mentioned earlier, based on /sys/kernel/debug/gpio GPIO bank 4 GPIO numbers are from 352-383. Please see the output from cat /sys/kernel/debug/gpio as below.

================================================================

root@imx8qmmek:~# cat /sys/kernel/debug/gpio
gpiochip10: GPIOs 188-191, parent: usb/1-1:1.0, ftdi-cbus, can sleep:

gpiochip9: GPIOs 192-223, parent: platform/58242000.gpio, 58242000.gpio:

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-341 ( |wp ) in lo
gpio-342 ( |cd ) in lo IRQ ACTIVE LOW

gpiochip4: GPIOs 352-383, parent: platform/5d0c0000.gpio, 5d0c0000.gpio:
gpio-353 ( |enable ) out hi ACTIVE LOW
gpio-358 ( |switch ) out hi ACTIVE LOW
gpio-359 ( |usdhc2-vmmc ) out hi
gpio-361 ( |PCIe DIS ) out hi
gpio-371 ( |reset ) out hi
gpio-374 ( |? ) out hi
gpio-379 ( |enable ) out lo ACTIVE LOW
gpio-381 ( |PCIe reset ) out hi
gpio-382 ( |SATA CLKREQ ) out lo

gpiochip3: GPIOs 384-415, parent: platform/5d0b0000.gpio, 5d0b0000.gpio:
gpio-394 ( |fsl_lpspi ) in hi

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

gpiochip1: GPIOs 448-479, parent: platform/5d090000.gpio, 5d090000.gpio:
gpio-461 ( |fixedregulator@100 ) out hi

gpiochip0: GPIOs 480-511, parent: platform/5d080000.gpio, 5d080000.gpio:
gpio-494 ( |scl ) out lo
gpio-495 ( |sda ) in lo
gpio-511 ( |headphone detect ) in lo IRQ

====================================================================

 

Best regards,

Pradeep

 

 

0 Kudos