ARM: tegra: enterprise: enable wl18xx wireless module support
Rakesh Goyal [Tue, 28 Aug 2012 16:46:08 +0000 (21:46 +0530)]
Bug 990784
Change-Id: I173df3f7244e7d0b40ae5aad98c72885ff42fdab
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: http://git-master/r/129103
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rakesh Kumar <krakesh@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

arch/arm/mach-tegra/board-enterprise-sdhci.c
arch/arm/mach-tegra/board-enterprise.c
arch/arm/mach-tegra/board-enterprise.h
arch/arm/mach-tegra/board.h

index 8032f81..a003ae9 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/mmc/host.h>
+#include <linux/wl12xx.h>
 
 #include <asm/mach-types.h>
 #include <mach/irqs.h>
@@ -52,6 +53,14 @@ static struct wifi_platform_data enterprise_wifi_control = {
        .set_carddetect = enterprise_wifi_set_carddetect,
 };
 
+static struct wl12xx_platform_data enterprise_wl12xx_wlan_data __initdata = {
+       .irq = TEGRA_GPIO_TO_IRQ(ENTERPRISE_WLAN_WOW),
+       .board_ref_clock = WL12XX_REFCLOCK_26,
+       .board_tcxo_clock = 1,
+       .set_power = enterprise_wifi_power,
+       .set_carddetect = enterprise_wifi_set_carddetect,
+};
+
 static struct resource wifi_resource[] = {
        [0] = {
                .name   = "bcm4329_wlan_irq",
@@ -61,7 +70,7 @@ static struct resource wifi_resource[] = {
        },
 };
 
-static struct platform_device enterprise_wifi_device = {
+static struct platform_device enterprise_brcm_wifi_device = {
        .name           = "bcm4329_wlan",
        .id             = 1,
        .num_resources  = 1,
@@ -238,10 +247,22 @@ static int enterprise_wifi_power(int on)
                tegra_io_dpd_disable(sd_dpd);
                mutex_unlock(&sd_dpd->delay_lock);
        }
-       gpio_set_value(ENTERPRISE_WLAN_PWR, on);
-       mdelay(100);
-       gpio_set_value(ENTERPRISE_WLAN_RST, on);
-       mdelay(200);
+
+       if (on) {
+               gpio_set_value(ENTERPRISE_WLAN_RST, 1);
+               mdelay(100);
+               gpio_set_value(ENTERPRISE_WLAN_RST, 0);
+               mdelay(100);
+               gpio_set_value(ENTERPRISE_WLAN_RST, 1);
+               mdelay(100);
+               gpio_set_value(ENTERPRISE_WLAN_PWR, 1);
+               mdelay(200);
+       } else {
+               gpio_set_value(ENTERPRISE_WLAN_RST, 0);
+               mdelay(100);
+               gpio_set_value(ENTERPRISE_WLAN_PWR, 0);
+       }
+
        if (sd_dpd) {
                mutex_lock(&sd_dpd->delay_lock);
                tegra_io_dpd_enable(sd_dpd);
@@ -295,7 +316,11 @@ static int __init enterprise_wifi_init(void)
        if (rc)
                pr_err("WLAN_WOW gpio direction configuration failed:%d\n", rc);
 
-       platform_device_register(&enterprise_wifi_device);
+       if (tegra_get_commchip_id() == COMMCHIP_TI_WL18XX)
+               wl12xx_set_platform_data(&enterprise_wl12xx_wlan_data);
+       else
+               platform_device_register(&enterprise_brcm_wifi_device);
+
        return 0;
 }
 
@@ -306,6 +331,13 @@ int __init enterprise_sdhci_init(void)
        tegra_sdhci_platform_data2.cd_gpio = ENTERPRISE_SD_CD;
        platform_device_register(&tegra_sdhci_device2);
 
+       /* TI wifi module does not use emdedded sdio */
+       if (tegra_get_commchip_id() == COMMCHIP_TI_WL18XX) {
+#ifdef CONFIG_MMC_EMBEDDED_SDIO
+               tegra_sdhci_platform_data0.mmc_data.embedded_sdio = NULL;
+#endif
+       }
+
        platform_device_register(&tegra_sdhci_device0);
        enterprise_wifi_init();
        return 0;
index 51db725..25f737f 100644 (file)
@@ -42,6 +42,8 @@
 #include <linux/mfd/tlv320aic3262-core.h>
 
 #include <linux/nfc/pn544.h>
+#include <linux/skbuff.h>
+#include <linux/ti_wilink_st.h>
 #include <sound/max98088.h>
 
 #include <mach/clk.h>
@@ -124,6 +126,32 @@ static struct tegra_thermal_data thermal_data = {
 #endif
 };
 
+/* wl128x BT, FM, GPS connectivity chip */
+struct ti_st_plat_data enterprise_wilink_pdata = {
+       .nshutdown_gpio = TEGRA_GPIO_PE6,
+       .dev_name = BLUETOOTH_UART_DEV_NAME,
+       .flow_cntrl = 1,
+       .baud_rate = 3000000,
+};
+
+static struct platform_device wl128x_device = {
+       .name           = "kim",
+       .id             = -1,
+       .dev.platform_data = &enterprise_wilink_pdata,
+};
+
+static struct platform_device btwilink_device = {
+       .name = "btwilink",
+       .id = -1,
+};
+
+static noinline void __init enterprise_bt_st(void)
+{
+       pr_info("enterprise_bt_st");
+
+       platform_device_register(&wl128x_device);
+       platform_device_register(&btwilink_device);
+}
 static struct rfkill_gpio_platform_data enterprise_bt_rfkill_pdata[] = {
        {
                .name           = "bt_rfkill",
@@ -140,8 +168,21 @@ static struct platform_device enterprise_bt_rfkill_device = {
                .platform_data = &enterprise_bt_rfkill_pdata,
        },
 };
-
-static struct resource enterprise_bluesleep_resources[] = {
+static struct resource enterprise_ti_bluesleep_resources[] = {
+       [0] = {
+               .name = "gpio_host_wake",
+                       .start  = TEGRA_GPIO_PS2,
+                       .end    = TEGRA_GPIO_PS2,
+                       .flags  = IORESOURCE_IO,
+       },
+       [1] = {
+               .name = "host_wake",
+                       .start  = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PS2),
+                       .end    = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PS2),
+                       .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
+       },
+};
+static struct resource enterprise_brcm_bluesleep_resources[] = {
        [0] = {
                .name = "gpio_host_wake",
                        .start  = TEGRA_GPIO_PS2,
@@ -162,16 +203,30 @@ static struct resource enterprise_bluesleep_resources[] = {
        },
 };
 
-static struct platform_device enterprise_bluesleep_device = {
+static struct platform_device enterprise_ti_bluesleep_device = {
        .name           = "bluesleep",
        .id             = -1,
-       .num_resources  = ARRAY_SIZE(enterprise_bluesleep_resources),
-       .resource       = enterprise_bluesleep_resources,
+       .num_resources  = ARRAY_SIZE(enterprise_ti_bluesleep_resources),
+       .resource       = enterprise_ti_bluesleep_resources,
 };
 
+static struct platform_device enterprise_brcm_bluesleep_device = {
+       .name           = "bluesleep",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(enterprise_brcm_bluesleep_resources),
+       .resource       = enterprise_brcm_bluesleep_resources,
+};
+static void __init enterprise_bt_rfkill(void)
+{
+       platform_device_register(&enterprise_bt_rfkill_device);
+       return;
+}
 static void __init enterprise_setup_bluesleep(void)
 {
-       platform_device_register(&enterprise_bluesleep_device);
+       if (tegra_get_commchip_id() == COMMCHIP_TI_WL18XX)
+               platform_device_register(&enterprise_ti_bluesleep_device);
+       else
+               platform_device_register(&enterprise_brcm_bluesleep_device);
        return;
 }
 
@@ -634,7 +689,6 @@ static struct platform_device *enterprise_devices[] __initdata = {
        &tegra_avp_device,
 #endif
        &tegra_camera,
-       &enterprise_bt_rfkill_device,
        &tegra_spi_device4,
        &tegra_hda_device,
 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
@@ -1078,7 +1132,6 @@ static void __init tegra_enterprise_init(void)
        enterprise_usb_init();
        if (board_info.board_id == BOARD_E1239)
                enterprise_bt_rfkill_pdata[0].reset_gpio = TEGRA_GPIO_PF4;
-
        platform_add_devices(enterprise_devices, ARRAY_SIZE(enterprise_devices));
        tegra_ram_console_debug_init();
        enterprise_regulator_init();
@@ -1093,6 +1146,10 @@ static void __init tegra_enterprise_init(void)
        enterprise_audio_init();
        enterprise_baseband_init();
        enterprise_panel_init();
+       if (tegra_get_commchip_id() == COMMCHIP_TI_WL18XX)
+               enterprise_bt_st();
+       else
+               enterprise_bt_rfkill();
        enterprise_setup_bluesleep();
        enterprise_emc_init();
        enterprise_sensors_init();
index e9bda70..ae488df 100644 (file)
@@ -121,6 +121,8 @@ void enterprise_bpc_mgmt_init(void);
 #define TEGRA_GPIO_HP_DET      TEGRA_GPIO_PW3
 #define TEGRA_GPIO_CODEC_RST   TEGRA_GPIO_PX0
 
+/* UART port which is used by bluetooth*/
+#define BLUETOOTH_UART_DEV_NAME "/dev/ttyHS2"
 /* Baseband GPIO addresses */
 
 #define GPIO_BB_RESET          TEGRA_GPIO_PE1
index 7c081fa..85d02d5 100644 (file)
@@ -72,9 +72,9 @@
 #define COMMCHIP_UNKNOWN               0
 #define COMMCHIP_NOCHIP                        1
 #define COMMCHIP_BROADCOM_BCM4329      2
-#define COMMCHIP BROADCOM_BCM4330      3
+#define COMMCHIP_BROADCOM_BCM4330      3
 #define COMMCHIP_MARVELL_SD8797                4
-
+#define COMMCHIP_TI_WL18XX             5
 
 struct memory_accessor;