ARM: tegra: macallan: enable support for wl8
Nagarjuna Kristam [Tue, 5 Feb 2013 09:42:59 +0000 (14:42 +0530)]
Bug 1179655

Change-Id: I98ced4d3f59127316a138c421b14609e3bdfe86b
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: http://git-master/r/197398
Reviewed-by: Riham Haidar <rhaidar@nvidia.com>
Tested-by: Riham Haidar <rhaidar@nvidia.com>

arch/arm/mach-tegra/board-macallan-power.c
arch/arm/mach-tegra/board-macallan-sdhci.c
arch/arm/mach-tegra/board-macallan.c
arch/arm/mach-tegra/board-macallan.h

index c2f65cc..5341d75 100644 (file)
@@ -565,28 +565,6 @@ static int __init macallan_cl_dvfs_init(void)
 }
 #endif
 
-static struct regulator_bulk_data macallan_gps_regulator_supply[] = {
-       [0] = {
-               .supply = "vdd_gps_3v3",
-       },
-       [1] = {
-               .supply = "vdd_gps_1v8",
-       },
-};
-
-static struct regulator_userspace_consumer_data macallan_gps_regulator_pdata = {
-       .num_supplies   = ARRAY_SIZE(macallan_gps_regulator_supply),
-       .supplies       = macallan_gps_regulator_supply,
-};
-
-static struct platform_device macallan_gps_regulator_device = {
-       .name   = "reg-userspace-consumer",
-       .id     = 2,
-       .dev    = {
-                       .platform_data = &macallan_gps_regulator_pdata,
-       },
-};
-
 static int __init macallan_fixed_regulator_init(void)
 {
        if (!machine_is_macallan())
@@ -606,7 +584,6 @@ int __init macallan_regulator_init(void)
        macallan_palmas_regulator_init();
 
        platform_device_register(&macallan_pda_power_device);
-       platform_device_register(&macallan_gps_regulator_device);
 
        return 0;
 }
index 353bf35..a7ff014 100644 (file)
 #include <mach/sdhci.h>
 #include <mach/gpio-tegra.h>
 #include <mach/io_dpd.h>
+#include <linux/wl12xx.h>
 
 #include "gpio-names.h"
 #include "board.h"
 #include "board-macallan.h"
 
-#define MACALLAN_SD_CD         TEGRA_GPIO_PV2
-
+#define MACALLAN_SD_CD TEGRA_GPIO_PV2
+#define MACALLAN_WLAN_PWR      TEGRA_GPIO_PCC5
+#define MACALLAN_WLAN_RST      TEGRA_GPIO_PX7
+#define MACALLAN_WLAN_WOW      TEGRA_GPIO_PU5
+static void (*wifi_status_cb)(int card_present, void *dev_id);
+static void *wifi_status_cb_devid;
 static int macallan_wifi_status_register(void (*callback)(int , void *), void *);
 
+static int macallan_wifi_power(int on);
+static int macallan_wifi_set_carddetect(int val);
+
+static struct wl12xx_platform_data macallan_wl12xx_wlan_data __initdata = {
+       .board_ref_clock = WL12XX_REFCLOCK_26,
+       .board_tcxo_clock = 1,
+       .set_power = macallan_wifi_power,
+       .set_carddetect = macallan_wifi_set_carddetect,
+};
+
 static struct resource sdhci_resource0[] = {
        [0] = {
                .start  = INT_SDMMC1,
@@ -173,12 +188,70 @@ static int macallan_wifi_status_register(
                void (*callback)(int card_present, void *dev_id),
                void *dev_id)
 {
+       if (wifi_status_cb)
+               return -EAGAIN;
+       wifi_status_cb = callback;
+       wifi_status_cb_devid = dev_id;
+       return 0;
+}
+
+static int macallan_wifi_set_carddetect(int val)
+{
+       pr_debug("%s: %d\n", __func__, val);
+       if (wifi_status_cb)
+               wifi_status_cb(val, wifi_status_cb_devid);
+       else
+               pr_warning("%s: Nobody to notify\n", __func__);
        return 0;
 }
 
+static int macallan_wifi_power(int on)
+{
+       pr_debug("%s: %d\n", __func__, on);
+
+       if (on) {
+               gpio_set_value(MACALLAN_WLAN_RST, 1);
+               mdelay(100);
+               gpio_set_value(MACALLAN_WLAN_RST, 0);
+               mdelay(100);
+               gpio_set_value(MACALLAN_WLAN_RST, 1);
+               mdelay(100);
+               gpio_set_value(MACALLAN_WLAN_PWR, 1);
+               mdelay(200);
+       } else {
+               gpio_set_value(MACALLAN_WLAN_RST, 0);
+               mdelay(100);
+               gpio_set_value(MACALLAN_WLAN_PWR, 0);
+       }
+
+       return 0;
+}
 
 static int __init macallan_wifi_init(void)
 {
+       int rc;
+
+       rc = gpio_request(MACALLAN_WLAN_PWR, "wlan_power");
+       if (rc)
+               pr_err("WLAN_PWR gpio request failed:%d\n", rc);
+       rc = gpio_request(MACALLAN_WLAN_RST, "wlan_rst");
+       if (rc)
+               pr_err("WLAN_RST gpio request failed:%d\n", rc);
+       rc = gpio_request(MACALLAN_WLAN_WOW, "bcmsdh_sdmmc");
+       if (rc)
+               pr_err("WLAN_WOW gpio request failed:%d\n", rc);
+
+       rc = gpio_direction_output(MACALLAN_WLAN_PWR, 0);
+       if (rc)
+               pr_err("WLAN_PWR gpio direction configuration failed:%d\n", rc);
+       rc = gpio_direction_output(MACALLAN_WLAN_RST, 0);
+       if (rc)
+               pr_err("WLAN_RST gpio direction configuration failed:%d\n", rc);
+       rc = gpio_direction_input(MACALLAN_WLAN_WOW);
+       if (rc)
+               pr_err("WLAN_WOW gpio direction configuration failed:%d\n", rc);
+       macallan_wl12xx_wlan_data.irq = gpio_to_irq(MACALLAN_WLAN_WOW);
+               wl12xx_set_platform_data(&macallan_wl12xx_wlan_data);
        return 0;
 }
 
index 0b63e85..19fd595 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/memblock.h>
 #include <linux/spi-tegra.h>
 #include <linux/nfc/pn544.h>
-#include <linux/rfkill-gpio.h>
 #include <linux/skbuff.h>
 #include <linux/ti_wilink_st.h>
 #include <linux/regulator/consumer.h>
 #include "common.h"
 #include "tegra-board-id.h"
 
-#ifdef CONFIG_BT_BLUESLEEP
-static struct rfkill_gpio_platform_data macallan_bt_rfkill_pdata = {
-               .name           = "bt_rfkill",
-               .shutdown_gpio  = TEGRA_GPIO_PQ7,
-               .reset_gpio     = TEGRA_GPIO_PQ6,
-               .type           = RFKILL_TYPE_BLUETOOTH,
+#if defined CONFIG_TI_ST || defined CONFIG_TI_ST_MODULE
+struct ti_st_plat_data macallan_wilink_pdata = {
+       .nshutdown_gpio = TEGRA_GPIO_PQ7,
+       .dev_name = BLUETOOTH_UART_DEV_NAME,
+       .flow_cntrl = 1,
+       .baud_rate = 3000000,
 };
 
-static struct platform_device macallan_bt_rfkill_device = {
-       .name = "rfkill_gpio",
+static struct platform_device wl128x_device = {
+       .name           = "kim",
        .id             = -1,
-       .dev = {
-               .platform_data = &macallan_bt_rfkill_pdata,
-       },
+       .dev.platform_data = &macallan_wilink_pdata,
 };
 
-static struct resource macallan_bluesleep_resources[] = {
-       [0] = {
-               .name = "gpio_host_wake",
-                       .start  = TEGRA_GPIO_PU6,
-                       .end    = TEGRA_GPIO_PU6,
-                       .flags  = IORESOURCE_IO,
-       },
-       [1] = {
-               .name = "gpio_ext_wake",
-                       .start  = TEGRA_GPIO_PEE1,
-                       .end    = TEGRA_GPIO_PEE1,
-                       .flags  = IORESOURCE_IO,
-       },
-       [2] = {
-               .name = "host_wake",
-                       .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
-       },
-};
-
-static struct platform_device macallan_bluesleep_device = {
-       .name           = "bluesleep",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(macallan_bluesleep_resources),
-       .resource       = macallan_bluesleep_resources,
+static struct platform_device btwilink_device = {
+       .name = "btwilink",
+       .id = -1,
 };
 
-static noinline void __init macallan_setup_bt_rfkill(void)
+static noinline void __init macallan_bt_st(void)
 {
-       platform_device_register(&macallan_bt_rfkill_device);
-}
+       pr_info("macallan_bt_st");
 
-static noinline void __init macallan_setup_bluesleep(void)
-{
-       macallan_bluesleep_resources[2].start =
-               macallan_bluesleep_resources[2].end =
-                       gpio_to_irq(TEGRA_GPIO_PU6);
-       platform_device_register(&macallan_bluesleep_device);
-       return;
+       platform_device_register(&wl128x_device);
+       platform_device_register(&btwilink_device);
 }
-#elif defined CONFIG_BLUEDROID_PM
-static struct resource macallan_bluedroid_pm_resources[] = {
+
+static struct resource macallan_st_host_wake_resources[] = {
        [0] = {
-               .name   = "shutdown_gpio",
-               .start  = TEGRA_GPIO_PQ7,
-               .end    = TEGRA_GPIO_PQ7,
-               .flags  = IORESOURCE_IO,
-       },
-       [1] = {
                .name = "host_wake",
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        },
-       [2] = {
-               .name = "gpio_ext_wake",
-               .start  = TEGRA_GPIO_PEE1,
-               .end    = TEGRA_GPIO_PEE1,
-               .flags  = IORESOURCE_IO,
-       },
-       [3] = {
-               .name = "gpio_host_wake",
-               .start  = TEGRA_GPIO_PU6,
-               .end    = TEGRA_GPIO_PU6,
-               .flags  = IORESOURCE_IO,
-       },
-       [4] = {
-               .name = "reset_gpio",
-               .start  = TEGRA_GPIO_PQ6,
-               .end    = TEGRA_GPIO_PQ6,
-               .flags  = IORESOURCE_IO,
-       },
 };
 
-static struct platform_device macallan_bluedroid_pm_device = {
-       .name = "bluedroid_pm",
+static struct platform_device macallan_st_host_wake_device = {
+       .name           = "st_host_wake",
        .id             = 0,
-       .num_resources  = ARRAY_SIZE(macallan_bluedroid_pm_resources),
-       .resource       = macallan_bluedroid_pm_resources,
+       .num_resources  = ARRAY_SIZE(macallan_st_host_wake_resources),
+       .resource       = macallan_st_host_wake_resources,
 };
 
-static noinline void __init macallan_setup_bluedroid_pm(void)
+static noinline void __init macallan_tegra_setup_st_host_wake(void)
 {
-       macallan_bluedroid_pm_resources[1].start =
-               macallan_bluedroid_pm_resources[1].end =
-                               gpio_to_irq(TEGRA_GPIO_PU6);
-       platform_device_register(&macallan_bluedroid_pm_device);
+       macallan_st_host_wake_resources[0].start =
+               macallan_st_host_wake_resources[0].end =
+               gpio_to_irq(TEGRA_GPIO_PU6);
+       platform_device_register(&macallan_st_host_wake_device);
 }
 #endif
 
@@ -764,11 +710,9 @@ static void __init tegra_macallan_init(void)
        macallan_panel_init();
        macallan_kbc_init();
        macallan_pmon_init();
-#ifdef CONFIG_BT_BLUESLEEP
-       macallan_setup_bluesleep();
-       macallan_setup_bt_rfkill();
-#elif defined CONFIG_BLUEDROID_PM
-       macallan_setup_bluedroid_pm();
+#if defined CONFIG_TI_ST || defined CONFIG_TI_ST_MODULE
+       macallan_bt_st();
+       macallan_tegra_setup_st_host_wake();
 #endif
        tegra_release_bootloader_fb();
        macallan_modem_init();
index 670e1a7..6c05446 100644 (file)
@@ -106,6 +106,9 @@ int macallan_kbc_init(void);
 int macallan_pmon_init(void);
 int macallan_soctherm_init(void);
 
+/* UART port which is used by bluetooth*/
+#define BLUETOOTH_UART_DEV_NAME "/dev/ttyHS2"
+
 /* Baseband IDs */
 enum tegra_bb_type {
        TEGRA_BB_NEMO = 1,