am335x-evm: wl12xx pin mux detection between rev1.0 and rev1.1
authorEyal Reizer <eyalr@ti.com>
Thu, 17 Nov 2011 15:00:24 +0000 (17:00 +0200)
committerVaibhav Hiremath <hvaibhav@ti.com>
Mon, 23 Jan 2012 19:14:36 +0000 (00:44 +0530)
* WLAN and Bluetooth enable pins are different between alpha(rev1.0) and
  beta (rev1.1a) boards.
  Use the right pin muxing based on the header read from eeprom.

* Add the BT and WLAN enable pins to the wl12xx platform data so they can
  be used by external modules

Signed-off-by: Eyal Reizer <eyalr@ti.com>
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
arch/arm/mach-omap2/board-am335xevm.c
arch/arm/mach-omap2/mux33xx.c
include/linux/wl12xx.h

index 844eccabe717e961b3bd295b3f6341564f7d648e..425a69312868bb58751548a668bc08458082eb19 100644 (file)
@@ -659,7 +659,6 @@ static int backlight_enable;
 
 #define AM335XEVM_WLAN_PMENA_GPIO      GPIO_TO_PIN(1, 30)
 #define AM335XEVM_WLAN_IRQ_GPIO                GPIO_TO_PIN(3, 17)
-#define AM335XEVM_BT_ENABLE_GPIO       GPIO_TO_PIN(1, 31)
 
 struct wl12xx_platform_data am335xevm_wlan_data = {
        .irq = OMAP_GPIO_IRQ(AM335XEVM_WLAN_IRQ_GPIO),
@@ -685,7 +684,14 @@ static struct pinmux_config uart1_wl12xx_pin_mux[] = {
        {NULL, 0},
 };
 
-static struct pinmux_config wl12xx_pin_mux[] = {
+static struct pinmux_config wl12xx_pin_mux_evm_rev1_1a[] = {
+       {"gpmc_a0.gpio1_16", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
+       {"mcasp0_ahclkr.gpio3_17", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
+       {"mcasp0_ahclkx.gpio0_17", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
+       {NULL, 0},
+ };
+
+static struct pinmux_config wl12xx_pin_mux_evm_rev1_0[] = {
        {"gpmc_csn1.gpio1_30", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
        {"mcasp0_ahclkr.gpio3_17", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
        {"gpmc_csn2.gpio1_31", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
@@ -984,20 +990,21 @@ static void uart1_wl12xx_init(int evm_id, int profile)
 
 static void wl12xx_bluetooth_enable(void)
 {
-       int status = gpio_request(AM335XEVM_BT_ENABLE_GPIO, "bt_en\n");
+       int status = gpio_request(am335xevm_wlan_data.bt_enable_gpio,
+               "bt_en\n");
        if (status < 0)
                pr_err("Failed to request gpio for bt_enable");
 
        pr_info("Configure Bluetooth Enable pin...\n");
-       gpio_direction_output(AM335XEVM_BT_ENABLE_GPIO, 0);
+       gpio_direction_output(am335xevm_wlan_data.bt_enable_gpio, 0);
 }
 
 static int wl12xx_set_power(struct device *dev, int slot, int on, int vdd)
 {
        if (on)
-               gpio_set_value(AM335XEVM_WLAN_PMENA_GPIO, 1);
+               gpio_set_value(am335xevm_wlan_data.wlan_enable_gpio, 1);
        else
-               gpio_set_value(AM335XEVM_WLAN_PMENA_GPIO, 0);
+               gpio_set_value(am335xevm_wlan_data.wlan_enable_gpio, 0);
 
        return 0;
 }
@@ -1008,6 +1015,16 @@ static void wl12xx_init(int evm_id, int profile)
        struct omap_mmc_platform_data *pdata;
        int ret;
 
+       /* Register WLAN and BT enable pins based on the evm board revision */
+       if (gp_evm_revision == GP_EVM_REV_IS_1_1A) {
+               am335xevm_wlan_data.wlan_enable_gpio = GPIO_TO_PIN(1, 16);
+               am335xevm_wlan_data.bt_enable_gpio = GPIO_TO_PIN(0, 17);
+       }
+       else {
+               am335xevm_wlan_data.wlan_enable_gpio = GPIO_TO_PIN(1, 30);
+               am335xevm_wlan_data.bt_enable_gpio = GPIO_TO_PIN(1, 31);
+       }
+
        wl12xx_bluetooth_enable();
 
        if (wl12xx_set_platform_data(&am335xevm_wlan_data))
@@ -1025,14 +1042,17 @@ static void wl12xx_init(int evm_id, int profile)
                goto out;
        }
 
-       ret = gpio_request_one(AM335XEVM_WLAN_PMENA_GPIO, GPIOF_OUT_INIT_LOW,
-                              "wlan_en");
+       ret = gpio_request_one(am335xevm_wlan_data.wlan_enable_gpio,
+               GPIOF_OUT_INIT_LOW, "wlan_en");
        if (ret) {
                pr_err("Error requesting wlan enable gpio: %d\n", ret);
                goto out;
        }
 
-       setup_pin_mux(wl12xx_pin_mux);
+       if (gp_evm_revision == GP_EVM_REV_IS_1_1A)
+               setup_pin_mux(wl12xx_pin_mux_evm_rev1_1a);
+       else
+               setup_pin_mux(wl12xx_pin_mux_evm_rev1_0);
 
        pdata->slots[0].set_power = wl12xx_set_power;
 out:
index 8663da56ceff1c8ee0a26e392ad7515944aa4939..ff1151dc5163ceb45a20d5f3a89810afde8cb7a4 100644 (file)
@@ -79,7 +79,7 @@ static struct omap_mux __initdata am33xx_muxmodes[] = {
                NULL, NULL, NULL, NULL),
        _AM33XX_MUXENTRY(GPMC_A0, 0,
                "gpmc_a0", "mii2_txen", "rgmii2_tctl", "rmii2_txen",
-               NULL, NULL, NULL, NULL),
+               NULL, NULL, NULL, "gpio1_16"),
        _AM33XX_MUXENTRY(GPMC_A1, 0,
                "gpmc_a1", "mii2_rxdv", "rgmii2_rctl", "mmc2_dat0",
                NULL, NULL, NULL, NULL),
@@ -355,7 +355,7 @@ static struct omap_mux __initdata am33xx_muxmodes[] = {
                NULL, NULL, NULL, NULL),
        _AM33XX_MUXENTRY(MCASP0_AHCLKX, 0,
                "mcasp0_ahclkx", "mcasp0_axr3", NULL, "mcasp1_axr1",
-               NULL, NULL, NULL, NULL),
+               NULL, NULL, NULL, "gpio0_17"),
        _AM33XX_MUXENTRY(XDMA_EVENT_INTR0, 0,
                "xdma_event_intr0", NULL, NULL, NULL,
                "spi1_cs1", NULL, NULL, NULL),
index 4b697395326eb4e660a099faf352a91c0c8df915..e6911c674a688f275f4ca79234c00ec7f727d073 100644 (file)
@@ -54,6 +54,8 @@ struct wl12xx_platform_data {
        int board_ref_clock;
        int board_tcxo_clock;
        unsigned long platform_quirks;
+       int bt_enable_gpio;
+       int wlan_enable_gpio;
 };
 
 /* Platform does not support level trigger interrupts */