From bdda8b83413234462ab73b47610d60752a9cb78c Mon Sep 17 00:00:00 2001
From: Sebastien Busson <sebastienx.busson@intel.com>
Date: Fri, 29 Oct 2010 11:44:11 +0200
Subject: [PATCH 2/3] wl1271 : initialized the driver

Initialized the wl12xx driver with regulator and
called the set_platform_data of compat-wireless
to set informations to the wl12xx driver.

Signed-off-by: Sebastien Busson <sebastienx.busson@intel.com>
---
 arch/x86/kernel/mrst.c |   85 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/mrst.c b/arch/x86/kernel/mrst.c
index dce79e2..eaebd6a 100644
--- a/arch/x86/kernel/mrst.c
+++ b/arch/x86/kernel/mrst.c
@@ -34,6 +34,9 @@
 #include <linux/i2c/tc35894xbg.h>
 #include <linux/bh1770glc.h>
 #include <linux/leds-lp5523.h>
+#include <linux/wl12xx.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 
 #include <asm/setup.h>
 #include <asm/mpspec_def.h>
@@ -1646,3 +1649,85 @@ static int __init setup_hsu_dma_enable_flag(char *p)
 early_param("hsu_dma", setup_hsu_dma_enable_flag);
 
 
+#if defined(CONFIG_WL1271) || defined(CONFIG_WL1271_MODULE)
+#include <linux/etherdevice.h>
+/*****************************************************************************
+ * Function called by wl1273 driver
+ */
+unsigned int wifi_irq_gpio;
+unsigned int wifi_enable_gpio;
+struct wl12xx_platform_data mid_wifi_control __initdata = {
+	.board_ref_clock = 2,
+	.irq = 2,
+};
+
+static struct regulator_consumer_supply zoom_vmmc3_supply = {
+	.supply		= "vmmc",
+	.dev_name	= "0000:00:04.1",
+};
+
+static struct regulator_init_data zoom_vmmc3 = {
+	.constraints = {
+		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies	= 1,
+	.consumer_supplies = &zoom_vmmc3_supply,
+};
+
+static struct fixed_voltage_config zoom_vwlan = {
+	.supply_name		= "vwl1271",
+	.microvolts		= 1800000,
+	.gpio			= 75,
+	.startup_delay		= 70000,
+	.enable_high		= 1,
+	.enabled_at_boot	= 0,
+	.init_data		= &zoom_vmmc3,
+};
+
+static struct platform_device omap_vwlan_device = {
+	.name		= "reg-fixed-voltage",
+	.id		= 1,
+	.dev = {
+		.platform_data	= &zoom_vwlan,
+	},
+};
+
+
+static int __init mid_wifi_init(void)
+{
+	int retval = 0;
+
+	/*Get GPIO numbers from the SFI table*/
+	wifi_irq_gpio = get_gpio_by_name("WLAN-interrupt");
+	if (wifi_irq_gpio == -1) {
+		pr_err("%s: Unable to find WLAN-interrupt GPIO in the SFI table\n", __func__);
+		retval = -EIO;
+		goto out;
+	}
+
+	wifi_enable_gpio = get_gpio_by_name("WLAN-enable");
+	if (wifi_enable_gpio == -1) {
+		pr_err("%s: Unable to find WLAN-enable GPIO in the SFI table\n", __func__);
+		retval = -EIO;
+		goto out;
+	}
+
+	mid_wifi_control.irq = wifi_irq_gpio;
+	retval = wl12xx_set_platform_data(&mid_wifi_control);
+	if (retval < 0) {
+		pr_err("error setting wl12xx data\n");
+		goto out;
+	}
+
+	zoom_vwlan.gpio = wifi_enable_gpio;
+	retval = platform_device_register(&omap_vwlan_device);
+	if (retval < 0) {
+		pr_err("error platform_device_register\n");
+		goto out;
+	}
+
+out:
+	return retval;
+}
+device_initcall(mid_wifi_init);
+#endif
-- 
1.7.2.3

