>From ddad345999be0d4e5e1bd6a0bca284f500eb8023 Mon Sep 17 00:00:00 2001 From: Pierre Tardy <[email protected]> Date: Thu, 18 Nov 2010 21:33:26 +0100 Subject: [PATCH 5/6] mrst.c: add platform support for wl12xx
Initialized the wl12xx driver with regulator and called the set_platform_data of the wl12xx driver. The gpios used here are only available after scu is initialized. So we need delay the whole initialisation after the scu. Signed-off-by: Sebastien Busson <[email protected]> Signed-off-by: Eric Seibel <[email protected]> Signed-off-by: Pierre Tardy <[email protected]> --- arch/x86/kernel/mrst.c | 131 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 129 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/mrst.c b/arch/x86/kernel/mrst.c index 5697173..75e652b 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> @@ -85,6 +88,7 @@ EXPORT_SYMBOL_GPL(sfi_mrtc_array); int sfi_mrtc_num; static void sfi_handle_ipc_dev(struct platform_device *pdev); +static void intel_delayed_device_register(void*dev, void (*delayed_callback)(void*dev_desc)); static int platformid = MRST_PLATFORM_SHCDK; @@ -1049,6 +1053,126 @@ struct sd_board_info { u32 board_ref_clock; void *platform_data; }; +#ifdef CONFIG_WL12XX_PLATFORM_DATA +static struct wl12xx_platform_data mid_wifi_control = { + .board_ref_clock = 2, + .irq = 2, +}; + +static struct regulator_consumer_supply wl12xx_vmmc3_supply = { + .supply = "vmmc", + .dev_name = "0000:00:00.0", /*default value*/ +}; + +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 + +extern int sdhci_pci_request_regulators(void); +void wl12xx_platform_data_init_post_scu(void *info) +{ + struct sd_board_info *sd_info = info; + int wifi_irq_gpio; + int err; + /*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; + } + err = gpio_request(wifi_irq_gpio, "wl12xx"); + if (err < 0) { + pr_err("%s: Unable to request GPIO \n", __func__); + return; + } + err = gpio_direction_input(wifi_irq_gpio); + if (err < 0) { + pr_err("%s: Unable to set GPIO direction \n", __func__); + return; + } + mid_wifi_control.irq = gpio_to_irq(wifi_irq_gpio); + if (mid_wifi_control.irq < 0) { + pr_err("%s : Error gpio_to_irq : %d->%d\n", __func__, wifi_irq_gpio, + mid_wifi_control.irq); + return; + } + /* 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; + + err= wl12xx_set_platform_data(&mid_wifi_control); + if (err < 0) + pr_err("error setting wl12xx data\n"); + + /* this is the fake regulator that mmc stack use to power of the + wifi sdio card via runtime_pm apis */ + wl12xx_vwlan.gpio = get_gpio_by_name(WL12XX_SFI_GPIO_ENABLE_NAME); + if (wl12xx_vwlan.gpio == -1) { + pr_err("%s: Unable to find WLAN-enable GPIO in the SFI table\n", __func__); + return; + } + /* format vmmc reg address from sfi table */ + sprintf((char *)wl12xx_vmmc3_supply.dev_name, "0000:00:%02x.%01x", + (sd_info->addr)>>8, sd_info->addr&0xFF); + + err = platform_device_register(&wl12xx_vwlan_device); + if (err < 0) + pr_err("error platform_device_register\n"); + + sdhci_pci_request_regulators(); +} +void *wl12xx_platform_data_init(void *info) +{ + struct sd_board_info *sd_info; + + sd_info = kmemdup(info, sizeof(*sd_info), GFP_KERNEL); + if (!sd_info) { + pr_err("MRST: fail to alloc mem for delayed wl12xx dev\n"); + return NULL; + } + intel_delayed_device_register(sd_info, wl12xx_platform_data_init_post_scu); + + return &mid_wifi_control; +} +#else +void *wl12xx_platform_data_init(void *info) +{ + return NULL; +} +#endif static const struct devs_id device_ids[] = { {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, @@ -1075,6 +1199,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}, {}, }; @@ -1377,11 +1502,13 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) strncpy(sd_info.name, pentry->name, 16); sd_info.bus_num = pentry->host_num; sd_info.board_ref_clock = pentry->max_freq; + sd_info.addr = pentry->addr; pr_info("info[%2d]: SDIO bus = %d, name = %16.16s, " - "ref_clock = %d\n", i, + "ref_clock = %d, addr =0x%x\n", i, sd_info.bus_num, sd_info.name, - sd_info.board_ref_clock); + sd_info.board_ref_clock, + sd_info.addr); sfi_handle_sd_dev(&sd_info); case SFI_DEV_TYPE_UART: case SFI_DEV_TYPE_HSI: -- 1.6.2.2 --------------------------------------------------------------------- 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.
0005-mrst.c-add-platform-support-for-wl12xx.patch
Description: 0005-mrst.c-add-platform-support-for-wl12xx.patch
_______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
