From b9acd4bb941790c9e654e031d9818b35e74b0256 Mon Sep 17 00:00:00 2001 From: Preetham Chandru Date: Tue, 29 Nov 2011 17:53:13 +0530 Subject: 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 Reviewed-on: http://git-master/r/67121 Reviewed-by: Mursalin Akon Reviewed-by: Allen Martin --- arch/arm/mach-tegra/board-harmony.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'arch/arm/mach-tegra/board-harmony.c') 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 #include #include +#include #include @@ -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); -- cgit v1.2.3