summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-harmony.c
diff options
context:
space:
mode:
authorPreetham Chandru <pchandru@nvidia.com>2011-11-29 17:53:13 +0530
committerVarun Wadekar <vwadekar@nvidia.com>2011-12-08 16:54:46 +0530
commitb9acd4bb941790c9e654e031d9818b35e74b0256 (patch)
tree3f120570abcb5d73edfca274934892eb4067b715 /arch/arm/mach-tegra/board-harmony.c
parentd6f914ce0a6043b8fcbe642b826eeea3a4d3d4cf (diff)
tegra: harmony: wifi: add board support for WiFi
The SDIO WiFi module requires power from external PMU and 1.2V regulator. The module gets powered on if - (1) all power sources are enabled, and (2) power (down) and reset (down) pins are enabled as per spec. To enable mmc/SDIO driver to detect the WiFi hardware, the WiFi chip has to be powered-up before mmc driver does probing. So, steps should be as following: (1) required regulators are on, (2) power/reset of WiFi are enabled, (3) mmc does probing. Later time, when WiFi driver module is loaded and registers with SDIO, the SDIO driver knows which H/W the driver has to be associated with. Bug: 908534 Change-Id: I6510bced5fa9b8b3314c00180f2694903b23145c Reviewed-on: http://git-master/r/#change,47808,patchset=2 Signed-off-by: Preetham Chandru <pchandru@nvidia.com> Reviewed-on: http://git-master/r/67121 Reviewed-by: Mursalin Akon <makon@nvidia.com> Reviewed-by: Allen Martin <amartin@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/board-harmony.c')
-rw-r--r--arch/arm/mach-tegra/board-harmony.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index ad9c43b0ae9a..9fb1c8fbce0c 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -29,6 +29,7 @@
#include <linux/i2c.h>
#include <linux/i2c-tegra.h>
#include <linux/memblock.h>
+#include <linux/delay.h>
#include <sound/wm8903.h>
@@ -377,6 +378,41 @@ static struct tegra_sdhci_platform_data sdhci_pdata4 = {
.is_8bit = 1,
};
+static int __init harmony_wifi_init(void)
+{
+ int gpio_pwr, gpio_rst;
+
+ if (!machine_is_harmony())
+ return 0;
+
+ /* WLAN - Power up (low) and Reset (low) */
+ gpio_pwr = gpio_request(TEGRA_GPIO_WLAN_PWR_LOW, "wlan_pwr");
+ gpio_rst = gpio_request(TEGRA_GPIO_WLAN_RST_LOW, "wlan_rst");
+ if (gpio_pwr < 0 || gpio_rst < 0)
+ pr_warning("Unable to get gpio for WLAN Power and Reset\n");
+ else {
+
+ tegra_gpio_enable(TEGRA_GPIO_WLAN_PWR_LOW);
+ tegra_gpio_enable(TEGRA_GPIO_WLAN_RST_LOW);
+ /* toggle in this order as per spec */
+ gpio_direction_output(TEGRA_GPIO_WLAN_PWR_LOW, 0);
+ gpio_direction_output(TEGRA_GPIO_WLAN_RST_LOW, 0);
+ udelay(5);
+ gpio_direction_output(TEGRA_GPIO_WLAN_PWR_LOW, 1);
+ gpio_direction_output(TEGRA_GPIO_WLAN_RST_LOW, 1);
+ }
+
+ return 0;
+}
+
+/*
+ * subsys_initcall_sync is good synch point to call harmony_wifi_init
+ * This makes sure that the required regulators (LDO3
+ * supply of external PMU and 1.2V regulator) are properly enabled,
+ * and mmc driver has not yet probed for a device on SDIO bus.
+ */
+subsys_initcall_sync(harmony_wifi_init);
+
static void __init tegra_harmony_init(void)
{
tegra_clk_init_from_table(harmony_clk_init_table);