diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2016-08-31 09:57:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-09-01 02:22:42 -0400 |
commit | dd8d6ec672f9796528a31033084a4947817d6316 (patch) | |
tree | 890a4c45731661723b4a04b4a50c3fc6460f0e68 | |
parent | 70b5b18f716a2d7ab20c2cfaea21919b9fdfb805 (diff) |
x86/platform/intel-mid: Enable WiFi on Intel Edison
Intel Edison board provides built-in WiFi dongle based on Broadcom BCM43340.
Append the essential data to enable WiFi on Intel Edison.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160831135713.79066-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/platform/intel-mid/device_libs/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c | 95 |
2 files changed, 97 insertions, 0 deletions
diff --git a/arch/x86/platform/intel-mid/device_libs/Makefile b/arch/x86/platform/intel-mid/device_libs/Makefile index fc135bf70511..a4711b5e94f3 100644 --- a/arch/x86/platform/intel-mid/device_libs/Makefile +++ b/arch/x86/platform/intel-mid/device_libs/Makefile | |||
@@ -1,5 +1,7 @@ | |||
1 | # Family-Level Interface Shim (FLIS) | 1 | # Family-Level Interface Shim (FLIS) |
2 | obj-$(subst m,y,$(CONFIG_PINCTRL_MERRIFIELD)) += platform_mrfld_pinctrl.o | 2 | obj-$(subst m,y,$(CONFIG_PINCTRL_MERRIFIELD)) += platform_mrfld_pinctrl.o |
3 | # WiFi | ||
4 | obj-$(subst m,y,$(CONFIG_BRCMFMAC_SDIO)) += platform_bcm43xx.o | ||
3 | # IPC Devices | 5 | # IPC Devices |
4 | obj-y += platform_ipc.o | 6 | obj-y += platform_ipc.o |
5 | obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic.o | 7 | obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic.o |
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c b/arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c new file mode 100644 index 000000000000..4392c15ed9e0 --- /dev/null +++ b/arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * platform_bcm43xx.c: bcm43xx platform data initilization file | ||
3 | * | ||
4 | * (C) Copyright 2016 Intel Corporation | ||
5 | * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; version 2 | ||
10 | * of the License. | ||
11 | */ | ||
12 | |||
13 | #include <linux/gpio.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/regulator/machine.h> | ||
16 | #include <linux/regulator/fixed.h> | ||
17 | #include <linux/sfi.h> | ||
18 | |||
19 | #include <asm/intel-mid.h> | ||
20 | |||
21 | #define WLAN_SFI_GPIO_IRQ_NAME "WLAN-interrupt" | ||
22 | #define WLAN_SFI_GPIO_ENABLE_NAME "WLAN-enable" | ||
23 | |||
24 | #define WLAN_DEV_NAME "0000:00:01.3" | ||
25 | |||
26 | static struct regulator_consumer_supply bcm43xx_vmmc_supply = { | ||
27 | .dev_name = WLAN_DEV_NAME, | ||
28 | .supply = "vmmc", | ||
29 | }; | ||
30 | |||
31 | static struct regulator_init_data bcm43xx_vmmc_data = { | ||
32 | .constraints = { | ||
33 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
34 | }, | ||
35 | .num_consumer_supplies = 1, | ||
36 | .consumer_supplies = &bcm43xx_vmmc_supply, | ||
37 | }; | ||
38 | |||
39 | static struct fixed_voltage_config bcm43xx_vmmc = { | ||
40 | .supply_name = "bcm43xx-vmmc-regulator", | ||
41 | /* | ||
42 | * Announce 2.0V here to be compatible with SDIO specification. The | ||
43 | * real voltage and signaling are still 1.8V. | ||
44 | */ | ||
45 | .microvolts = 2000000, /* 1.8V */ | ||
46 | .gpio = -EINVAL, | ||
47 | .startup_delay = 250 * 1000, /* 250ms */ | ||
48 | .enable_high = 1, /* active high */ | ||
49 | .enabled_at_boot = 0, /* disabled at boot */ | ||
50 | .init_data = &bcm43xx_vmmc_data, | ||
51 | }; | ||
52 | |||
53 | static struct platform_device bcm43xx_vmmc_regulator = { | ||
54 | .name = "reg-fixed-voltage", | ||
55 | .id = PLATFORM_DEVID_AUTO, | ||
56 | .dev = { | ||
57 | .platform_data = &bcm43xx_vmmc, | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | static int __init bcm43xx_regulator_register(void) | ||
62 | { | ||
63 | int ret; | ||
64 | |||
65 | bcm43xx_vmmc.gpio = get_gpio_by_name(WLAN_SFI_GPIO_ENABLE_NAME); | ||
66 | ret = platform_device_register(&bcm43xx_vmmc_regulator); | ||
67 | if (ret) { | ||
68 | pr_err("%s: vmmc regulator register failed\n", __func__); | ||
69 | return ret; | ||
70 | } | ||
71 | |||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | static void __init *bcm43xx_platform_data(void *info) | ||
76 | { | ||
77 | int ret; | ||
78 | |||
79 | ret = bcm43xx_regulator_register(); | ||
80 | if (ret) | ||
81 | return NULL; | ||
82 | |||
83 | pr_info("Using generic wifi platform data\n"); | ||
84 | |||
85 | /* For now it's empty */ | ||
86 | return NULL; | ||
87 | } | ||
88 | |||
89 | static const struct devs_id bcm43xx_clk_vmmc_dev_id __initconst = { | ||
90 | .name = "bcm43xx_clk_vmmc", | ||
91 | .type = SFI_DEV_TYPE_SD, | ||
92 | .get_platform_data = &bcm43xx_platform_data, | ||
93 | }; | ||
94 | |||
95 | sfi_device(bcm43xx_clk_vmmc_dev_id); | ||