>From 6646884c2c5c902368238203af2de5db3353a61b Mon Sep 17 00:00:00 2001 From: Sebastien Busson <[email protected]> Date: Fri, 12 Nov 2010 18:56:59 +0100 Subject: [PATCH 4/4] mrst.c: add platform support for wl12xx
Initialized the wl12xx driver with regulator and called the set_platform_data of compat-wireless to set informations to the wl12xx driver. This regulator is only available after scu is initialized. So we need to declare it in the scu initialized callback. Change-Id: Iedff8fa245543e0f7857f463ec103754ceacf9e1 Signed-off-by: Sebastien Busson <[email protected]> Signed-off-by: Gregory Alagnou <[email protected]> --- arch/x86/kernel/mrst.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/mrst.c b/arch/x86/kernel/mrst.c index 6f3327f..7a6d478 100644 --- a/arch/x86/kernel/mrst.c +++ b/arch/x86/kernel/mrst.c @@ -20,10 +20,14 @@ #include <linux/i2c.h> #include <linux/i2c/pca953x.h> #include <linux/gpio_keys.h> +#include <linux/gpio.h> #include <linux/input.h> #include <linux/platform_device.h> #include <linux/irq.h> #include <linux/module.h> +#include <linux/wl12xx.h> +#include <linux/regulator/machine.h> +#include <linux/regulator/fixed.h> #include <asm/setup.h> #include <asm/mpspec_def.h> @@ -535,6 +539,82 @@ struct sd_board_info { void *platform_data; }; +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 wl12xx_vmmc3_supply = { + .supply = "vmmc", + .dev_name = "0000:00:04.1", +}; + +static struct regulator_init_data wl12xx_vmmc3 = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = 1, + .consumer_supplies = &wl12xx_vmmc3_supply, +}; + +static struct fixed_voltage_config wl12xx_vwlan = { + .supply_name = "vwl1271", + .microvolts = 1800000, + .gpio = 75, + .startup_delay = 70000, + .enable_high = 1, + .enabled_at_boot = 0, + .init_data = &wl12xx_vmmc3, +}; + +static struct platform_device wl12xx_vwlan_device = { + .name = "reg-fixed-voltage", + .id = 1, + .dev = { + .platform_data = &wl12xx_vwlan, + }, +}; + +#define WL12XX_SFI_GPIO_IRQ_NAME "WLAN-interrupt" +#define WL12XX_SFI_GPIO_ENABLE_NAME "WLAN-enable" +#define ICDK_BOARD_REF_CLK 26000000 +#define NCDK_BOARD_REF_CLK 38400000 +void *wl12xx_platform_data_init(void *info) +{ + struct sd_board_info *sd_info = info; + + /*Get GPIO numbers from the SFI table*/ + wifi_irq_gpio = get_gpio_by_name(WL12XX_SFI_GPIO_IRQ_NAME); + if (wifi_irq_gpio == -1) { + pr_err("%s: Unable to find WLAN-interrupt GPIO in the SFI table\n", __func__); + return NULL; + } + + wifi_enable_gpio = get_gpio_by_name(WL12XX_SFI_GPIO_ENABLE_NAME); + if (wifi_enable_gpio == -1) { + pr_err("%s: Unable to find WLAN-enable GPIO in the SFI table\n", __func__); + return NULL; + } + + /* Set our board_ref_clock from SFI SD board info */ + if (sd_info->board_ref_clock == ICDK_BOARD_REF_CLK) + /*iCDK board*/ + /*26Mhz TCXO clock ref*/ + mid_wifi_control.board_ref_clock = 1; + else if (sd_info->board_ref_clock == NCDK_BOARD_REF_CLK) + /*nCDK board*/ + /*38,4Mhz TCXO clock ref*/ + mid_wifi_control.board_ref_clock = 2; + + mid_wifi_control.irq = wifi_irq_gpio; + wl12xx_vwlan.gpio = wifi_enable_gpio; + + return &mid_wifi_control; +} + static const struct devs_id __initconst device_ids[] = { {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, {"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data}, @@ -542,6 +622,7 @@ static const struct devs_id __initconst device_ids[] = { {"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, {"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data}, {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, + {"wl12xx_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wl12xx_platform_data_init}, {}, }; @@ -608,10 +689,12 @@ static void __init intel_scu_i2c_device_register(int bus, i2c_devs[i2c_next_dev++] = new_dev; } +extern int sdhci_pci_request_regulators(void); /* Called by IPC driver */ void intel_scu_devices_create(void) { int i; + int retval; for (i = 0; i < ipc_next_dev; i++) platform_device_add(ipc_devs[i]); @@ -632,6 +715,21 @@ void intel_scu_devices_create(void) } else i2c_register_board_info(i2c_bus[i], i2c_devs[i], 1); } + + mid_wifi_control.irq = gpio_to_irq(wifi_irq_gpio); + if (mid_wifi_control.irq < 0) { + pr_err("%s : Error gpio_to_irq : %d\n", __func__,mid_wifi_control.irq); + } + retval = wl12xx_set_platform_data(&mid_wifi_control); + if (retval < 0) { + pr_err("error setting wl12xx data\n"); + } + + retval = platform_device_register(&wl12xx_vwlan_device); + if (retval < 0) { + pr_err("error platform_device_register\n"); + } + sdhci_pci_request_regulators(); } EXPORT_SYMBOL_GPL(intel_scu_devices_create); -- 1.7.2.3 --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
0004-mrst.c-add-platform-support-for-wl12xx.patch
Description: 0004-mrst.c-add-platform-support-for-wl12xx.patch
_______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
