]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/kernel/omap/beagle/expansion/0006-Beagle-expansion-add-wifi.patch
Merge remote-tracking branch 'alfh/feature_firewalllog_first_last' into next
[people/teissler/ipfire-2.x.git] / src / patches / kernel / omap / beagle / expansion / 0006-Beagle-expansion-add-wifi.patch
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
5
6 build fixes from Pantelis Antoniou <panto@antoniou-consulting.com>
7
8 Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
9 ---
10 arch/arm/mach-omap2/board-omap3beagle.c | 119 +++++++++++++++++++++++++++++++
11 1 file changed, 119 insertions(+)
12
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,
19 };
20
21 +#if IS_ENABLED(CONFIG_WL12XX)
22 +#include <linux/regulator/fixed.h>
23 +#include <linux/ti_wilink_st.h>
24 +#include <linux/wl12xx.h>
25 +
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)
30 +
31 +struct wl12xx_platform_data omap_beagle_wlan_data __initdata = {
32 + .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
33 +};
34 +
35 +static struct ti_st_plat_data wilink_platform_data = {
36 + .nshutdown_gpio = OMAP_BEAGLE_BT_EN_GPIO,
37 + .dev_name = "/dev/ttyO1",
38 + .flow_cntrl = 1,
39 + .baud_rate = 3000000,
40 + .chip_enable = NULL,
41 + .suspend = NULL,
42 + .resume = NULL,
43 +};
44 +
45 +static struct platform_device wl12xx_device = {
46 + .name = "kim",
47 + .id = -1,
48 + .dev.platform_data = &wilink_platform_data,
49 +};
50 +
51 +static struct platform_device btwilink_device = {
52 + .name = "btwilink",
53 + .id = -1,
54 +};
55 +#endif
56 +
57 +static struct regulator_consumer_supply beagle_vmmc2_supply =
58 + REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
59 +
60 +static struct regulator_init_data beagle_vmmc2 = {
61 + .constraints = {
62 + .valid_ops_mask = REGULATOR_CHANGE_STATUS,
63 + },
64 + .num_consumer_supplies = 1,
65 + .consumer_supplies = &beagle_vmmc2_supply,
66 +};
67 +
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 */
74 + .enable_high = 1,
75 + .enabled_at_boot = 0,
76 + .init_data = &beagle_vmmc2,
77 +};
78 +
79 +static struct platform_device omap_vwlan_device = {
80 + .name = "reg-fixed-voltage",
81 + .id = 1,
82 + .dev = {
83 + .platform_data = &beagle_vwlan,
84 + },
85 +};
86 +#endif
87 +
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[] = {
92 },
93 {} /* Terminator */
94 };
95 +
96 +static struct omap2_hsmmc_info mmcbbt[] = {
97 + {
98 + .mmc = 1,
99 + .caps = MMC_CAP_4_BIT_DATA,
100 + .gpio_wp = -EINVAL,
101 + .deferred = true,
102 + },
103 + {
104 + .name = "wl1271",
105 + .mmc = 2,
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,
111 + },
112 + {} /* Terminator */
113 +};
114 +
115 static struct regulator_consumer_supply beagle_vmmc1_supply[] = {
116 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
117 };
118 @@ -490,6 +577,13 @@ static int beagle_twl_gpio_setup(struct device *dev,
119 int r;
120
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;
126 +
127 + omap_hsmmc_late_init(mmcbbt);
128 + break;
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);
134 }
135
136 + if (!strcmp(expansionboard_name, "bbtoys-wifi"))
137 + {
138 + #if IS_ENABLED(CONFIG_WL12XX)
139 + expansion_config.mmc_settings = EXPANSION_MMC_WIFI;
140 + #endif
141 + }
142 +
143 if (!strcmp(expansionboard2_name, "bbtoys-ulcd"))
144 {
145 int r;
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);
148
149 switch (expansion_config.mmc_settings) {
150 + case EXPANSION_MMC_WIFI:
151 + mmcbbt[0].caps = beagle_config.mmc_caps;
152 + omap_hsmmc_init(mmcbbt);
153 + break;
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)
158 gpio_export(162, 1);
159 }
160
161 + if (!strcmp(expansionboard_name, "bbtoys-wifi"))
162 + {
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);
172 + #endif
173 + }
174 +
175 if (!strcmp(expansionboard2_name, "bbtoys-ulcd"))
176 {
177 #if IS_ENABLED(CONFIG_TOUCHSCREEN_TSC2007)
178 --
179 1.7.10.4
180