>From 0b67aa40d3523facf6b5ccd52b03edc64027491a Mon Sep 17 00:00:00 2001 From: Sebastien Busson <[email protected]> Date: Fri, 29 Oct 2010 11:44:11 +0200 Subject: [PATCH 6/7] 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. Signed-off-by: Sebastien Busson <[email protected]> Signed-off-by: Gregory Alagnou <[email protected]> --- arch/x86/kernel/mrst.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 107 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/mrst.c b/arch/x86/kernel/mrst.c index f764645..a809de8 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> @@ -1032,6 +1035,91 @@ void *tc35894xbg_n_platform_data(void *info) &tc35894xbg_ncdk_data); } +#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, + }, +}; + +#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) +{ + int retval = 0; + 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; + } + + zoom_vwlan.gpio = wifi_enable_gpio; + + return &mid_wifi_control; +} +#endif + static const struct devs_id device_ids[] = { {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data}, @@ -1057,6 +1145,7 @@ static const struct devs_id device_ids[] = { {"i2c_TC35894-i", SFI_DEV_TYPE_I2C, 0, &tc35894xbg_i_platform_data}, {"bh1770glc", SFI_DEV_TYPE_I2C, 0, &bh1770glc_platform_data_init}, {"lp5523", SFI_DEV_TYPE_I2C, 0, &lp5523_platform_data_init}, + {"wl12xx_clk_vmmc", SFI_DEV_TYPE_SD, 0, &wl12xx_platform_data_init}, {}, }; @@ -1115,10 +1204,12 @@ static void intel_delayed_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]); @@ -1142,6 +1233,22 @@ void intel_scu_devices_create(void) i2c_register_board_info(i2c_bus[i], i2c_devs[i], 1); kfree(i2c_devs[i]); } + + 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"); + return NULL; + } + + retval = platform_device_register(&omap_vwlan_device); + if (retval < 0) { + pr_err("error platform_device_register\n"); + } + sdhci_pci_request_regulators(); } EXPORT_SYMBOL_GPL(intel_scu_devices_create); @@ -1672,5 +1779,3 @@ static int __init setup_hsu_dma_enable_flag(char *p) return 0; } early_param("hsu_dma", setup_hsu_dma_enable_flag); - - -- 1.7.2.3 Claude BROUAT UMG/MIPE/WSIV System Integrator Office: +33 (0)1 72 21 04 54 mailto: mailto:[email protected] Intel Corp. SAS 134, av du Général Eisenhower BP 73586 31100 TOULOUSE France --------------------------------------------------------------------- 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. _______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
