Hi, Siva
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.
Refer to esdhc_platform_data's struct, add "unsigned int cd_gpio;" to spi_imx_master struct, then
195 #define SABRESD_CHARGE_NOW IMX_GPIO_NR(1, 2)
1556 static struct gpio_led imx6q_gpio_leds[] = {
1557 GPIO_LED(SABRESD_CHARGE_NOW, "chg_now_led", 0, 1,
1558 "charger-charging"),
1559 /* For the latest B4 board, this GPIO_1 is connected to POR_B,
1560 which will reset the whole board if this pin's level is changed,
1561 so, for the latest board, we have to avoid using this pin as
1562 GPIO.
1563 GPIO_LED(SABRESD_CHARGE_DONE, "chg_done_led", 0, 1,
1564 "charger-full"),
1565 */
1566 };
diff --git a/arch/arm/mach-mx6/board-mx6q_sabresd.c b/arch/arm/mach-mx6/board-mx6q_sabresd.c
index 3f9a845..fe2eadc 100644
--- a/arch/arm/mach-mx6/board-mx6q_sabresd.c
+++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c
@@ -192,7 +192,6 @@
#define SABRESD_EPDC_PMIC_WAKE IMX_GPIO_NR(3, 20)
#define SABRESD_EPDC_PMIC_INT IMX_GPIO_NR(2, 25)
#define SABRESD_EPDC_VCOM IMX_GPIO_NR(3, 17)
-#define SABRESD_CHARGE_NOW IMX_GPIO_NR(1, 2)
#define SABRESD_CHARGE_DONE IMX_GPIO_NR(1, 1)
#define SABRESD_ELAN_CE IMX_GPIO_NR(2, 18)
#define SABRESD_ELAN_RST IMX_GPIO_NR(3, 8)
@@ -305,6 +304,7 @@ static int mx6q_sabresd_spi_cs[] = {
};
Below is the patch of setting GPIO and passing GPIO into spi driver, you need to add GPIO operation in your spi driver, refer to drivers/mmc/host/sdhci-esdhc-imx.c:
static const struct spi_imx_master mx6q_sabresd_spi_data __initconst = {
+ .wifi_gpio = SABRESD_USR_DEF_RED_LED
.chipselect = mx6q_sabresd_spi_cs,
.num_chipselect = ARRAY_SIZE(mx6q_sabresd_spi_cs),
};
@@ -1554,8 +1554,6 @@ static void gps_power_on(bool on)
* GPIO_LED(SABRESD_CHARGE_DONE, "chg_detect", 0, 1, "ac-online"),
*/
static struct gpio_led imx6q_gpio_leds[] = {
- GPIO_LED(SABRESD_CHARGE_NOW, "chg_now_led", 0, 1,
- "charger-charging"),
diff --git a/arch/arm/plat-mxc/include/mach/spi.h b/arch/arm/plat-mxc/include/mach/spi.h
index 08be445..d61cb09 100644
--- a/arch/arm/plat-mxc/include/mach/spi.h
+++ b/arch/arm/plat-mxc/include/mach/spi.h
@@ -18,6 +18,7 @@
* @num_chipselect: ARRAY_SIZE(chipselect)
*/
struct spi_imx_master {
+ unsigned int wifi_gpio;
int *chipselect;
int num_chipselect;
};