1 From f78cd93d767cd75969c4661723cfce46071e5b1b Mon Sep 17 00:00:00 2001
2 From: Robert Nelson <robertcnelson@gmail.com>
3 Date: Tue, 11 Dec 2012 06:48:52 -0600
4 Subject: [PATCH 06/10] Beagle: expansion: add wifi
6 build fixes from Pantelis Antoniou <panto@antoniou-consulting.com>
8 Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
10 arch/arm/mach-omap2/board-omap3beagle.c | 119 +++++++++++++++++++++++++++++++
11 1 file changed, 119 insertions(+)
13 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
14 index a8de97e..2322d6c 100644
15 --- a/arch/arm/mach-omap2/board-omap3beagle.c
16 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
17 @@ -221,6 +221,73 @@ static struct {
18 .i2c_settings = EXPANSION_I2C_NONE,
21 +#if IS_ENABLED(CONFIG_WL12XX)
22 +#include <linux/regulator/fixed.h>
23 +#include <linux/ti_wilink_st.h>
24 +#include <linux/wl12xx.h>
26 +#define OMAP_BEAGLE_WLAN_EN_GPIO (139)
27 +#define OMAP_BEAGLE_BT_EN_GPIO (138)
28 +#define OMAP_BEAGLE_WLAN_IRQ_GPIO (137)
29 +#define OMAP_BEAGLE_FM_EN_BT_WU (136)
31 +struct wl12xx_platform_data omap_beagle_wlan_data __initdata = {
32 + .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
35 +static struct ti_st_plat_data wilink_platform_data = {
36 + .nshutdown_gpio = OMAP_BEAGLE_BT_EN_GPIO,
37 + .dev_name = "/dev/ttyO1",
39 + .baud_rate = 3000000,
40 + .chip_enable = NULL,
45 +static struct platform_device wl12xx_device = {
48 + .dev.platform_data = &wilink_platform_data,
51 +static struct platform_device btwilink_device = {
57 +static struct regulator_consumer_supply beagle_vmmc2_supply =
58 + REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
60 +static struct regulator_init_data beagle_vmmc2 = {
62 + .valid_ops_mask = REGULATOR_CHANGE_STATUS,
64 + .num_consumer_supplies = 1,
65 + .consumer_supplies = &beagle_vmmc2_supply,
68 +#if IS_ENABLED(CONFIG_WL12XX)
69 +static struct fixed_voltage_config beagle_vwlan = {
70 + .supply_name = "vwl1271",
71 + .microvolts = 1800000, /* 1.8V */
72 + .gpio = OMAP_BEAGLE_WLAN_EN_GPIO,
73 + .startup_delay = 70000, /* 70ms */
75 + .enabled_at_boot = 0,
76 + .init_data = &beagle_vmmc2,
79 +static struct platform_device omap_vwlan_device = {
80 + .name = "reg-fixed-voltage",
83 + .platform_data = &beagle_vwlan,
88 //rcn-ee: this is just a fake regulator, the zippy hardware provides 3.3/1.8 with jumper..
89 static struct fixed_voltage_config beagle_vzippy = {
90 .supply_name = "vzippy",
91 @@ -459,6 +526,26 @@ static struct omap2_hsmmc_info mmc_zippy[] = {
96 +static struct omap2_hsmmc_info mmcbbt[] = {
99 + .caps = MMC_CAP_4_BIT_DATA,
100 + .gpio_wp = -EINVAL,
106 + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
107 + .gpio_wp = -EINVAL,
108 + .gpio_cd = -EINVAL,
109 + .ocr_mask = MMC_VDD_165_195,
110 + .nonremovable = true,
112 + {} /* Terminator */
115 static struct regulator_consumer_supply beagle_vmmc1_supply[] = {
116 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
118 @@ -490,6 +577,13 @@ static int beagle_twl_gpio_setup(struct device *dev,
121 switch (expansion_config.mmc_settings) {
122 + case EXPANSION_MMC_WIFI:
123 + mmcbbt[0].gpio_wp = beagle_config.mmc1_gpio_wp;
124 + /* gpio + 0 is "mmc0_cd" (input/IRQ) */
125 + mmcbbt[0].gpio_cd = gpio + 0;
127 + omap_hsmmc_late_init(mmcbbt);
129 case EXPANSION_MMC_ZIPPY:
130 mmc_zippy[0].gpio_wp = beagle_config.mmc1_gpio_wp;
131 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
132 @@ -839,6 +933,13 @@ static void __init omap3_beagle_init(void)
133 omap_mux_init_gpio(OMAP3BEAGLE_GPIO_ZIPPY_MMC_CD, OMAP_PIN_INPUT);
136 + if (!strcmp(expansionboard_name, "bbtoys-wifi"))
138 + #if IS_ENABLED(CONFIG_WL12XX)
139 + expansion_config.mmc_settings = EXPANSION_MMC_WIFI;
143 if (!strcmp(expansionboard2_name, "bbtoys-ulcd"))
146 @@ -857,6 +958,10 @@ static void __init omap3_beagle_init(void)
147 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
149 switch (expansion_config.mmc_settings) {
150 + case EXPANSION_MMC_WIFI:
151 + mmcbbt[0].caps = beagle_config.mmc_caps;
152 + omap_hsmmc_init(mmcbbt);
154 case EXPANSION_MMC_ZIPPY:
155 mmc_zippy[0].caps = beagle_config.mmc_caps;
156 omap_hsmmc_init(mmc_zippy);
157 @@ -922,6 +1027,20 @@ static void __init omap3_beagle_init(void)
161 + if (!strcmp(expansionboard_name, "bbtoys-wifi"))
163 + #if IS_ENABLED(CONFIG_WL12XX)
164 + omap_beagle_wlan_data.irq = gpio_to_irq(OMAP_BEAGLE_WLAN_IRQ_GPIO);
165 + if (wl12xx_set_platform_data(&omap_beagle_wlan_data))
166 + pr_err("error setting wl12xx data\n");
167 + pr_info("Beagle expansionboard: registering wl12xx bt platform device\n");
168 + platform_device_register(&wl12xx_device);
169 + platform_device_register(&btwilink_device);
170 + pr_info("Beagle expansionboard: registering wl12xx wifi platform device\n");
171 + platform_device_register(&omap_vwlan_device);
175 if (!strcmp(expansionboard2_name, "bbtoys-ulcd"))
177 #if IS_ENABLED(CONFIG_TOUCHSCREEN_TSC2007)