How i can i use and configure GPIO pin on iMX6qSabreSD platfrom

I am using the SPI interface on iMX6qSabreSD platform to integrate WIFI device. I am successfully integrated SPI interface.

Now i want to use one GPIO pin on iMX6 platform to use as an interrupt.But unfortunately i am unable to find the unused GPIO pins on iMX6QSabreSD platform.

I have tried to use one GPIO pin which is being used for volume button but not succeeded.

Can any one please help me how to configure GPIO pin on iMX6qSabreSD platform and which pin can i use for GPIO.And please provide required changes need to be done in the board specific files to configure GPIO pin.

To use a GPIO, first you need to find a pin that is not used on your board, as you said, the pn which is being usedor volume button, it is controller by gpio button driver, so your try failed. I am not sure what do you want for a GPIO, just want to controler this GPIO to output high/low level, or want to use it as an input and enable its interrupt? If you can NOT find an unused GPIO on sabreSD board, maybe you can try using the debug LED pin, as far as I know, this pin is not used by any module.

1. If you want to config a GPIO to output high/low level, you can refer to our v3.0.35 code, take the PCIE power control pin as an example, you need to config this pin as GPIO mode via setting IOMUX, code is as below, set this pin to GPIO mode, then control it to output high/low level via gpio APIs.

Using GPIO as an interrupt pin, what module's interrupt? is it to receive signal from external wifi chip? You did NOT describe your purpose clearly. What is the purpose of GPIO you want, use it as an input or output? to what module?

You can look into the i.MX6Q SabreSD board's schematic, it is in page 21, USR_DEF_RED_LED, but this pin is connected to an LED, so you need to do hardware rework?

in arch/arm/mach-mx6/board-mx6q_sabresd.c, this pin is used as charge LED, you need to remove below code in this file. Then add a gpio into spi_imx_master struct, then pass this pin to spi driver, then you can refer to uSDHC's card detect pin I pasted uppper into your spi driver. Then it should work. And, make sure you do hardware rework first, cut this pin from LED and connect this pin to your wifi card,. You can refer to arch/arm/mach-mx6/board-mx6q_sabresd.c 's SABRESD_SD3_CD, see how it pass to uSDHC driver, and look into drivers/mmc/host/sdhci-esdhc-imx.c: to see how it set this pin to input and enable its interrupt and request irq for this GPIO, then you should see cpu executing the interrupt handle when this pin is triggered.

You provided information is very helpful to me.I have resolved that crash issue by making the GPIO free before converting the GPIO as an IRQ(gpio_to_irq).Now i am able to configure and get the interrupt properly form the configured GPIO.This interrupt status reading when it is "rising-edge" state(We check the rising edge state by using the flag "IRQF_SHARED |IRQF_TRIGGER_RISING").